Last active
December 10, 2015 11:08
-
-
Save Glowin/4425462 to your computer and use it in GitHub Desktop.
百度随心听 http://fm.baidu.com 的核心播放代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(a, b) { | |
| function c(b, c) { | |
| var g = b.nodeName.toLowerCase(); | |
| if ("area" === g) { | |
| var g = b.parentNode, i = g.name; | |
| if (!b.href || !i || "map" !== g.nodeName.toLowerCase()) | |
| return !1; | |
| g = a("img[usemap=#" + i + "]")[0]; | |
| return !!g && d(g) | |
| } | |
| return (/input|select|textarea|button|object/.test(g) ? !b.disabled : "a" == g ? b.href || c : c) && d(b) | |
| } | |
| function d(b) { | |
| return !a(b).parents().andSelf().filter(function() { | |
| return "hidden" === a.curCSS(this, "visibility") || a.expr.filters.hidden(this) | |
| }).length | |
| } | |
| a.ui = a.ui || {}; | |
| a.ui.version || (a.extend(a.ui, {version: "@VERSION", | |
| keyCode: {ALT: 18,BACKSPACE: 8,CAPS_LOCK: 20,COMMA: 188,COMMAND: 91,COMMAND_LEFT: 91,COMMAND_RIGHT: 93,CONTROL: 17,DELETE: 46,DOWN: 40,END: 35,ENTER: 13,ESCAPE: 27,HOME: 36,INSERT: 45,LEFT: 37,MENU: 93,NUMPAD_ADD: 107,NUMPAD_DECIMAL: 110,NUMPAD_DIVIDE: 111,NUMPAD_ENTER: 108,NUMPAD_MULTIPLY: 106,NUMPAD_SUBTRACT: 109,PAGE_DOWN: 34,PAGE_UP: 33,PERIOD: 190,RIGHT: 39,SHIFT: 16,SPACE: 32,TAB: 9,UP: 38,WINDOWS: 91}}), a.fn.extend({propAttr: a.fn.prop || a.fn.attr,_focus: a.fn.focus,focus: function(b, c) { | |
| return "number" === typeof b ? this.each(function() { | |
| var d = | |
| this; | |
| setTimeout(function() { | |
| a(d).focus(); | |
| c && c.call(d) | |
| }, b) | |
| }) : this._focus.apply(this, arguments) | |
| },scrollParent: function() { | |
| var b; | |
| b = a.browser.msie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? this.parents().filter(function() { | |
| return /(relative|absolute|fixed)/.test(a.curCSS(this, "position", 1)) && /(auto|scroll)/.test(a.curCSS(this, "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1)) | |
| }).eq(0) : this.parents().filter(function() { | |
| return /(auto|scroll)/.test(a.curCSS(this, | |
| "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1)) | |
| }).eq(0); | |
| return /fixed/.test(this.css("position")) || !b.length ? a(document) : b | |
| },zIndex: function(c) { | |
| if (c !== b) | |
| return this.css("zIndex", c); | |
| if (this.length) | |
| for (var c = a(this[0]), d; c.length && c[0] !== document; ) { | |
| d = c.css("position"); | |
| if ("absolute" === d || "relative" === d || "fixed" === d) | |
| if (d = parseInt(c.css("zIndex"), 10), !isNaN(d) && 0 !== d) | |
| return d; | |
| c = c.parent() | |
| } | |
| return 0 | |
| },disableSelection: function() { | |
| return this.bind((a.support.selectstart ? "selectstart" : | |
| "mousedown") + ".ui-disableSelection", function(a) { | |
| a.preventDefault() | |
| }) | |
| },enableSelection: function() { | |
| return this.unbind(".ui-disableSelection") | |
| }}), a("<a>").outerWidth(1).jquery || a.each(["Width", "Height"], function(c, d) { | |
| function g(b, c, d, e) { | |
| a.each(i, function() { | |
| c -= parseFloat(a.curCSS(b, "padding" + this, !0)) || 0; | |
| d && (c -= parseFloat(a.curCSS(b, "border" + this + "Width", !0)) || 0); | |
| e && (c -= parseFloat(a.curCSS(b, "margin" + this, !0)) || 0) | |
| }); | |
| return c | |
| } | |
| var i = "Width" === d ? ["Left", "Right"] : ["Top", "Bottom"], j = d.toLowerCase(), n = {innerWidth: a.fn.innerWidth, | |
| innerHeight: a.fn.innerHeight,outerWidth: a.fn.outerWidth,outerHeight: a.fn.outerHeight}; | |
| a.fn["inner" + d] = function(c) { | |
| return c === b ? n["inner" + d].call(this) : this.each(function() { | |
| a(this).css(j, g(this, c) + "px") | |
| }) | |
| }; | |
| a.fn["outer" + d] = function(b, c) { | |
| return "number" !== typeof b ? n["outer" + d].call(this, b) : this.each(function() { | |
| a(this).css(j, g(this, b, !0, c) + "px") | |
| }) | |
| } | |
| }), a.extend(a.expr[":"], {data: a.expr.createPseudo ? a.expr.createPseudo(function(b) { | |
| return function(c) { | |
| return !!a.data(c, b) | |
| } | |
| }) : function(b, c, d) { | |
| return !!a.data(b, | |
| d[3]) | |
| },focusable: function(b) { | |
| return c(b, !isNaN(a.attr(b, "tabindex"))) | |
| },tabbable: function(b) { | |
| var d = a.attr(b, "tabindex"), g = isNaN(d); | |
| return (g || 0 <= d) && c(b, !g) | |
| }}), a(function() { | |
| var b = document.body, c = b.appendChild(c = document.createElement("div")); | |
| c.offsetHeight; | |
| a.extend(c.style, {minHeight: "100px",height: "auto",padding: 0,borderWidth: 0}); | |
| a.support.minHeight = 100 === c.offsetHeight; | |
| a.support.selectstart = "onselectstart" in c; | |
| b.removeChild(c).style.display = "none" | |
| }), a.curCSS || (a.curCSS = a.css), a.extend(a.ui, {plugin: {add: function(b, | |
| c, d) { | |
| var b = a.ui[b].prototype, i; | |
| for (i in d) { | |
| b.plugins[i] = b.plugins[i] || []; | |
| b.plugins[i].push([c, d[i]]) | |
| } | |
| },call: function(a, b, c) { | |
| if ((b = a.plugins[b]) && a.element[0].parentNode) | |
| for (var d = 0; d < b.length; d++) | |
| a.options[b[d][0]] && b[d][1].apply(a.element, c) | |
| }},contains: function(a, b) { | |
| return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b) | |
| },hasScroll: function(b, c) { | |
| if (a(b).css("overflow") === "hidden") | |
| return false; | |
| var d = c && c === "left" ? "scrollLeft" : "scrollTop", i = false; | |
| if (b[d] > 0) | |
| return true; | |
| b[d] = 1; | |
| i = b[d] > 0; | |
| b[d] = 0; | |
| return i | |
| },isOverAxis: function(a, b, c) { | |
| return a > b && a < b + c | |
| },isOver: function(b, c, d, i, j, n) { | |
| return a.ui.isOverAxis(b, d, j) && a.ui.isOverAxis(c, i, n) | |
| }})) | |
| })(jQuery); | |
| (function(a, b) { | |
| if (a.cleanData) { | |
| var c = a.cleanData; | |
| a.cleanData = function(b) { | |
| for (var d = 0, g; null != (g = b[d]); d++) | |
| try { | |
| a(g).triggerHandler("remove") | |
| } catch (i) { | |
| } | |
| c(b) | |
| } | |
| } else { | |
| var d = a.fn.remove; | |
| a.fn.remove = function(b, c) { | |
| return this.each(function() { | |
| c || (!b || a.filter(b, [this]).length) && a("*", this).add([this]).each(function() { | |
| try { | |
| a(this).triggerHandler("remove") | |
| } catch (b) { | |
| } | |
| }); | |
| return d.call(a(this), b, c) | |
| }) | |
| } | |
| } | |
| a.widget = function(b, c, d) { | |
| var i = b.split(".")[0], j, b = b.split(".")[1]; | |
| j = i + "-" + b; | |
| d || (d = c, c = a.Widget); | |
| a.expr[":"][j] = | |
| function(c) { | |
| return !!a.data(c, b) | |
| }; | |
| a[i] = a[i] || {}; | |
| a[i][b] = function(a, b) { | |
| arguments.length && this._createWidget(a, b) | |
| }; | |
| c = new c; | |
| c.options = a.extend(!0, {}, c.options); | |
| a[i][b].prototype = a.extend(!0, c, {namespace: i,widgetName: b,widgetEventPrefix: a[i][b].prototype.widgetEventPrefix || b,widgetBaseClass: j}, d); | |
| a.widget.bridge(b, a[i][b]) | |
| }; | |
| a.widget.bridge = function(c, d) { | |
| a.fn[c] = function(g) { | |
| var i = "string" === typeof g, j = Array.prototype.slice.call(arguments, 1), n = this, g = !i && j.length ? a.extend.apply(null, [!0, g].concat(j)) : g; | |
| if (i && "_" === g.charAt(0)) | |
| return n; | |
| i ? this.each(function() { | |
| var d = a.data(this, c), f = d && a.isFunction(d[g]) ? d[g].apply(d, j) : d; | |
| if (f !== d && f !== b) | |
| return n = f, !1 | |
| }) : this.each(function() { | |
| var b = a.data(this, c); | |
| b ? b.option(g || {})._init() : a.data(this, c, new d(g, this)) | |
| }); | |
| return n | |
| } | |
| }; | |
| a.Widget = function(a, b) { | |
| arguments.length && this._createWidget(a, b) | |
| }; | |
| a.Widget.prototype = {widgetName: "widget",widgetEventPrefix: "",options: {disabled: !1},_createWidget: function(b, c) { | |
| a.data(c, this.widgetName, this); | |
| this.element = a(c); | |
| this.options = a.extend(!0, | |
| {}, this.options, this._getCreateOptions(), b); | |
| var d = this; | |
| this.element.bind("remove." + this.widgetName, function() { | |
| d.destroy() | |
| }); | |
| this._create(); | |
| this._trigger("create"); | |
| this._init() | |
| },_getCreateOptions: function() { | |
| return a.metadata && a.metadata.get(this.element[0])[this.widgetName] | |
| },_create: function() { | |
| },_init: function() { | |
| },destroy: function() { | |
| this.element.unbind("." + this.widgetName).removeData(this.widgetName); | |
| this.widget().unbind("." + this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass + | |
| "-disabled ui-state-disabled") | |
| },widget: function() { | |
| return this.element | |
| },option: function(c, d) { | |
| var g = c; | |
| if (0 === arguments.length) | |
| return a.extend({}, this.options); | |
| if ("string" === typeof c) { | |
| if (d === b) | |
| return this.options[c]; | |
| g = {}; | |
| g[c] = d | |
| } | |
| this._setOptions(g); | |
| return this | |
| },_setOptions: function(b) { | |
| var c = this; | |
| a.each(b, function(a, b) { | |
| c._setOption(a, b) | |
| }); | |
| return this | |
| },_setOption: function(a, b) { | |
| this.options[a] = b; | |
| "disabled" === a && this.widget()[b ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled ui-state-disabled").attr("aria-disabled", | |
| b); | |
| return this | |
| },enable: function() { | |
| return this._setOption("disabled", !1) | |
| },disable: function() { | |
| return this._setOption("disabled", !0) | |
| },_trigger: function(b, c, d) { | |
| var i, j = this.options[b], d = d || {}, c = a.Event(c); | |
| c.type = (b === this.widgetEventPrefix ? b : this.widgetEventPrefix + b).toLowerCase(); | |
| c.target = this.element[0]; | |
| if (b = c.originalEvent) | |
| for (i in b) | |
| i in c || (c[i] = b[i]); | |
| this.element.trigger(c, d); | |
| return !(a.isFunction(j) && !1 === j.call(this.element[0], c, d) || c.isDefaultPrevented()) | |
| }} | |
| })(jQuery); | |
| (function(a) { | |
| var b = !1; | |
| a(document).mouseup(function() { | |
| b = !1 | |
| }); | |
| a.widget("ui.mouse", {options: {cancel: ":input,option",distance: 1,delay: 0},_mouseInit: function() { | |
| var b = this; | |
| this.element.bind("mousedown." + this.widgetName, function(a) { | |
| return b._mouseDown(a) | |
| }).bind("click." + this.widgetName, function(d) { | |
| if (!0 === a.data(d.target, b.widgetName + ".preventClickEvent")) | |
| return a.removeData(d.target, b.widgetName + ".preventClickEvent"), d.stopImmediatePropagation(), !1 | |
| }); | |
| this.started = !1 | |
| },_mouseDestroy: function() { | |
| this.element.unbind("." + | |
| this.widgetName); | |
| this._mouseMoveDelegate && a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate) | |
| },_mouseDown: function(c) { | |
| if (!b) { | |
| this._mouseStarted && this._mouseUp(c); | |
| this._mouseDownEvent = c; | |
| var d = this, e = 1 == c.which, f = "string" == typeof this.options.cancel && c.target.nodeName ? a(c.target).closest(this.options.cancel).length : !1; | |
| if (!e || f || !this._mouseCapture(c)) | |
| return !0; | |
| this.mouseDelayMet = !this.options.delay; | |
| this.mouseDelayMet || (this._mouseDelayTimer = | |
| setTimeout(function() { | |
| d.mouseDelayMet = !0 | |
| }, this.options.delay)); | |
| if (this._mouseDistanceMet(c) && this._mouseDelayMet(c) && (this._mouseStarted = !1 !== this._mouseStart(c), !this._mouseStarted)) | |
| return c.preventDefault(), !0; | |
| !0 === a.data(c.target, this.widgetName + ".preventClickEvent") && a.removeData(c.target, this.widgetName + ".preventClickEvent"); | |
| this._mouseMoveDelegate = function(a) { | |
| return d._mouseMove(a) | |
| }; | |
| this._mouseUpDelegate = function(a) { | |
| return d._mouseUp(a) | |
| }; | |
| a(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + | |
| this.widgetName, this._mouseUpDelegate); | |
| c.preventDefault(); | |
| return b = !0 | |
| } | |
| },_mouseMove: function(b) { | |
| if (a.browser.msie && !(9 <= document.documentMode) && !b.button) | |
| return this._mouseUp(b); | |
| if (this._mouseStarted) | |
| return this._mouseDrag(b), b.preventDefault(); | |
| this._mouseDistanceMet(b) && this._mouseDelayMet(b) && ((this._mouseStarted = !1 !== this._mouseStart(this._mouseDownEvent, b)) ? this._mouseDrag(b) : this._mouseUp(b)); | |
| return !this._mouseStarted | |
| },_mouseUp: function(b) { | |
| a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + | |
| this.widgetName, this._mouseUpDelegate); | |
| this._mouseStarted && (this._mouseStarted = !1, b.target == this._mouseDownEvent.target && a.data(b.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(b)); | |
| return !1 | |
| },_mouseDistanceMet: function(a) { | |
| return Math.max(Math.abs(this._mouseDownEvent.pageX - a.pageX), Math.abs(this._mouseDownEvent.pageY - a.pageY)) >= this.options.distance | |
| },_mouseDelayMet: function() { | |
| return this.mouseDelayMet | |
| },_mouseStart: function() { | |
| },_mouseDrag: function() { | |
| },_mouseStop: function() { | |
| },_mouseCapture: function() { | |
| return !0 | |
| }}) | |
| })(jQuery); | |
| (function(a) { | |
| a.widget("ui.slider", a.ui.mouse, {widgetEventPrefix: "slide",options: {animate: !1,distance: 0,max: 100,min: 0,orientation: "horizontal",range: !1,step: 1,value: 0,values: null},_create: function() { | |
| var b = this, c = this.options, d = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"), e = c.values && c.values.length || 1, f = []; | |
| this._mouseSliding = this._keySliding = !1; | |
| this._animateOff = !0; | |
| this._handleIndex = null; | |
| this._detectOrientation(); | |
| this._mouseInit(); | |
| this.element.addClass("ui-slider ui-slider-" + | |
| this.orientation + " ui-widget ui-widget-content ui-corner-all" + (c.disabled ? " ui-slider-disabled ui-disabled" : "")); | |
| this.range = a([]); | |
| if (c.range) { | |
| if (!0 === c.range && (c.values || (c.values = [this._valueMin(), this._valueMin()]), c.values.length && 2 !== c.values.length)) | |
| c.values = [c.values[0], c.values[0]]; | |
| this.range = a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header" + ("min" === c.range || "max" === c.range ? " ui-slider-range-" + c.range : "")) | |
| } | |
| for (var g = d.length; g < e; g += 1) | |
| f.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>"); | |
| this.handles = d.add(a(f.join("")).appendTo(b.element)); | |
| this.handle = this.handles.eq(0); | |
| this.handles.add(this.range).filter("a").click(function(a) { | |
| a.preventDefault() | |
| }).hover(function() { | |
| c.disabled || a(this).addClass("ui-state-hover") | |
| }, function() { | |
| a(this).removeClass("ui-state-hover") | |
| }).focus(function() { | |
| c.disabled ? a(this).blur() : (a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"), a(this).addClass("ui-state-focus")) | |
| }).blur(function() { | |
| a(this).removeClass("ui-state-focus") | |
| }); | |
| this.handles.each(function(b) { | |
| a(this).data("index.ui-slider-handle", | |
| b) | |
| }); | |
| this.handles.keydown(function(c) { | |
| var d = a(this).data("index.ui-slider-handle"), e, f, g; | |
| if (!b.options.disabled) { | |
| switch (c.keyCode) { | |
| case a.ui.keyCode.HOME: | |
| case a.ui.keyCode.END: | |
| case a.ui.keyCode.PAGE_UP: | |
| case a.ui.keyCode.PAGE_DOWN: | |
| case a.ui.keyCode.UP: | |
| case a.ui.keyCode.RIGHT: | |
| case a.ui.keyCode.DOWN: | |
| case a.ui.keyCode.LEFT: | |
| if (c.preventDefault(), !b._keySliding && (b._keySliding = !0, a(this).addClass("ui-state-active"), e = b._start(c, d), !1 === e)) | |
| return | |
| } | |
| g = b.options.step; | |
| e = b.options.values && b.options.values.length ? | |
| f = b.values(d) : f = b.value(); | |
| switch (c.keyCode) { | |
| case a.ui.keyCode.HOME: | |
| f = b._valueMin(); | |
| break; | |
| case a.ui.keyCode.END: | |
| f = b._valueMax(); | |
| break; | |
| case a.ui.keyCode.PAGE_UP: | |
| f = b._trimAlignValue(e + (b._valueMax() - b._valueMin()) / 5); | |
| break; | |
| case a.ui.keyCode.PAGE_DOWN: | |
| f = b._trimAlignValue(e - (b._valueMax() - b._valueMin()) / 5); | |
| break; | |
| case a.ui.keyCode.UP: | |
| case a.ui.keyCode.RIGHT: | |
| if (e === b._valueMax()) | |
| return; | |
| f = b._trimAlignValue(e + g); | |
| break; | |
| case a.ui.keyCode.DOWN: | |
| case a.ui.keyCode.LEFT: | |
| if (e === b._valueMin()) | |
| return; | |
| f = b._trimAlignValue(e - | |
| g) | |
| } | |
| b._slide(c, d, f) | |
| } | |
| }).keyup(function(c) { | |
| var d = a(this).data("index.ui-slider-handle"); | |
| b._keySliding && (b._keySliding = !1, b._stop(c, d), b._change(c, d), a(this).removeClass("ui-state-active")) | |
| }); | |
| this._refreshValue(); | |
| this._animateOff = !1 | |
| },destroy: function() { | |
| this.handles.remove(); | |
| this.range.remove(); | |
| this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); | |
| this._mouseDestroy(); | |
| return this | |
| }, | |
| _mouseCapture: function(b) { | |
| var c = this.options, d, e, f, g, i; | |
| if (c.disabled) | |
| return !1; | |
| this.elementSize = {width: this.element.outerWidth(),height: this.element.outerHeight()}; | |
| this.elementOffset = this.element.offset(); | |
| d = this._normValueFromMouse({x: b.pageX,y: b.pageY}); | |
| e = this._valueMax() - this._valueMin() + 1; | |
| g = this; | |
| this.handles.each(function(b) { | |
| var c = Math.abs(d - g.values(b)); | |
| e > c && (e = c, f = a(this), i = b) | |
| }); | |
| !0 === c.range && this.values(1) === c.min && (i += 1, f = a(this.handles[i])); | |
| if (!1 === this._start(b, i)) | |
| return !1; | |
| this._mouseSliding = | |
| !0; | |
| g._handleIndex = i; | |
| f.addClass("ui-state-active").focus(); | |
| c = f.offset(); | |
| this._clickOffset = !a(b.target).parents().andSelf().is(".ui-slider-handle") ? {left: 0,top: 0} : {left: b.pageX - c.left - f.width() / 2,top: b.pageY - c.top - f.height() / 2 - (parseInt(f.css("borderTopWidth"), 10) || 0) - (parseInt(f.css("borderBottomWidth"), 10) || 0) + (parseInt(f.css("marginTop"), 10) || 0)}; | |
| this.handles.hasClass("ui-state-hover") || this._slide(b, i, d); | |
| return this._animateOff = !0 | |
| },_mouseStart: function() { | |
| return !0 | |
| },_mouseDrag: function(a) { | |
| var c = this._normValueFromMouse({x: a.pageX, | |
| y: a.pageY}); | |
| this._slide(a, this._handleIndex, c); | |
| return !1 | |
| },_mouseStop: function(a) { | |
| this.handles.removeClass("ui-state-active"); | |
| this._mouseSliding = !1; | |
| this._stop(a, this._handleIndex); | |
| this._change(a, this._handleIndex); | |
| this._clickOffset = this._handleIndex = null; | |
| return this._animateOff = !1 | |
| },_detectOrientation: function() { | |
| this.orientation = "vertical" === this.options.orientation ? "vertical" : "horizontal" | |
| },_normValueFromMouse: function(a) { | |
| var c; | |
| "horizontal" === this.orientation ? (c = this.elementSize.width, a = a.x - this.elementOffset.left - | |
| (this._clickOffset ? this._clickOffset.left : 0)) : (c = this.elementSize.height, a = a.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)); | |
| c = a / c; | |
| 1 < c && (c = 1); | |
| 0 > c && (c = 0); | |
| "vertical" === this.orientation && (c = 1 - c); | |
| a = this._valueMax() - this._valueMin(); | |
| c = this._valueMin() + c * a; | |
| return this._trimAlignValue(c) | |
| },_start: function(a, c) { | |
| var d = {handle: this.handles[c],value: this.value()}; | |
| this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()); | |
| return this._trigger("start", | |
| a, d) | |
| },_slide: function(a, c, d) { | |
| var e; | |
| if (this.options.values && this.options.values.length) { | |
| e = this.values(c ? 0 : 1); | |
| if (2 === this.options.values.length && !0 === this.options.range && (0 === c && d > e || 1 === c && d < e)) | |
| d = e; | |
| d !== this.values(c) && (e = this.values(), e[c] = d, a = this._trigger("slide", a, {handle: this.handles[c],value: d,values: e}), this.values(c ? 0 : 1), !1 !== a && this.values(c, d, !0)) | |
| } else | |
| d !== this.value() && (a = this._trigger("slide", a, {handle: this.handles[c],value: d}), !1 !== a && this.value(d)) | |
| },_stop: function(a, c) { | |
| var d = {handle: this.handles[c], | |
| value: this.value()}; | |
| this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()); | |
| this._trigger("stop", a, d) | |
| },_change: function(a, c) { | |
| if (!this._keySliding && !this._mouseSliding) { | |
| var d = {handle: this.handles[c],value: this.value()}; | |
| this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()); | |
| this._trigger("change", a, d) | |
| } | |
| },value: function(a) { | |
| if (arguments.length) | |
| this.options.value = this._trimAlignValue(a), this._refreshValue(), this._change(null, | |
| 0); | |
| else | |
| return this._value() | |
| },values: function(b, c) { | |
| var d, e, f; | |
| if (1 < arguments.length) | |
| this.options.values[b] = this._trimAlignValue(c), this._refreshValue(), this._change(null, b); | |
| else if (arguments.length) | |
| if (a.isArray(arguments[0])) { | |
| d = this.options.values; | |
| e = arguments[0]; | |
| for (f = 0; f < d.length; f += 1) | |
| d[f] = this._trimAlignValue(e[f]), this._change(null, f); | |
| this._refreshValue() | |
| } else | |
| return this.options.values && this.options.values.length ? this._values(b) : this.value(); | |
| else | |
| return this._values() | |
| },_setOption: function(b, c) { | |
| var d, | |
| e = 0; | |
| a.isArray(this.options.values) && (e = this.options.values.length); | |
| a.Widget.prototype._setOption.apply(this, arguments); | |
| switch (b) { | |
| case "disabled": | |
| c ? (this.handles.filter(".ui-state-focus").blur(), this.handles.removeClass("ui-state-hover"), this.handles.propAttr("disabled", !0), this.element.addClass("ui-disabled")) : (this.handles.propAttr("disabled", !1), this.element.removeClass("ui-disabled")); | |
| break; | |
| case "orientation": | |
| this._detectOrientation(); | |
| this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + | |
| this.orientation); | |
| this._refreshValue(); | |
| break; | |
| case "value": | |
| this._animateOff = !0; | |
| this._refreshValue(); | |
| this._change(null, 0); | |
| this._animateOff = !1; | |
| break; | |
| case "values": | |
| this._animateOff = !0; | |
| this._refreshValue(); | |
| for (d = 0; d < e; d += 1) | |
| this._change(null, d); | |
| this._animateOff = !1 | |
| } | |
| },_value: function() { | |
| var a = this.options.value; | |
| return a = this._trimAlignValue(a) | |
| },_values: function(a) { | |
| var c, d; | |
| if (arguments.length) | |
| return c = this.options.values[a], c = this._trimAlignValue(c); | |
| c = this.options.values.slice(); | |
| for (d = 0; d < c.length; d += 1) | |
| c[d] = | |
| this._trimAlignValue(c[d]); | |
| return c | |
| },_trimAlignValue: function(a) { | |
| if (a <= this._valueMin()) | |
| return this._valueMin(); | |
| if (a >= this._valueMax()) | |
| return this._valueMax(); | |
| var c = 0 < this.options.step ? this.options.step : 1, d = (a - this._valueMin()) % c, a = a - d; | |
| 2 * Math.abs(d) >= c && (a += 0 < d ? c : -c); | |
| return parseFloat(a.toFixed(5)) | |
| },_valueMin: function() { | |
| return this.options.min | |
| },_valueMax: function() { | |
| return this.options.max | |
| },_refreshValue: function() { | |
| var b = this.options.range, c = this.options, d = this, e = !this._animateOff ? c.animate : !1, f, g = | |
| {}, i, j, n, l; | |
| if (this.options.values && this.options.values.length) | |
| this.handles.each(function(b) { | |
| f = 100 * ((d.values(b) - d._valueMin()) / (d._valueMax() - d._valueMin())); | |
| g["horizontal" === d.orientation ? "left" : "bottom"] = f + "%"; | |
| a(this).stop(1, 1)[e ? "animate" : "css"](g, c.animate); | |
| if (!0 === d.options.range) | |
| if ("horizontal" === d.orientation) { | |
| if (0 === b) | |
| d.range.stop(1, 1)[e ? "animate" : "css"]({left: f + "%"}, c.animate); | |
| if (1 === b) | |
| d.range[e ? "animate" : "css"]({width: f - i + "%"}, {queue: !1,duration: c.animate}) | |
| } else { | |
| if (0 === b) | |
| d.range.stop(1, | |
| 1)[e ? "animate" : "css"]({bottom: f + "%"}, c.animate); | |
| if (1 === b) | |
| d.range[e ? "animate" : "css"]({height: f - i + "%"}, {queue: !1,duration: c.animate}) | |
| } | |
| i = f | |
| }); | |
| else { | |
| j = this.value(); | |
| n = this._valueMin(); | |
| l = this._valueMax(); | |
| f = l !== n ? 100 * ((j - n) / (l - n)) : 0; | |
| g["horizontal" === d.orientation ? "left" : "bottom"] = f + "%"; | |
| this.handle.stop(1, 1)[e ? "animate" : "css"](g, c.animate); | |
| if ("min" === b && "horizontal" === this.orientation) | |
| this.range.stop(1, 1)[e ? "animate" : "css"]({width: f + "%"}, c.animate); | |
| if ("max" === b && "horizontal" === this.orientation) | |
| this.range[e ? | |
| "animate" : "css"]({width: 100 - f + "%"}, {queue: !1,duration: c.animate}); | |
| if ("min" === b && "vertical" === this.orientation) | |
| this.range.stop(1, 1)[e ? "animate" : "css"]({height: f + "%"}, c.animate); | |
| if ("max" === b && "vertical" === this.orientation) | |
| this.range[e ? "animate" : "css"]({height: 100 - f + "%"}, {queue: !1,duration: c.animate}) | |
| } | |
| }}); | |
| a.extend(a.ui.slider, {version: "@VERSION"}) | |
| })(jQuery); | |
| (function(a) { | |
| a.widget("ui.tooltip", {_init: function() { | |
| var b = this, c = this._calPosition(this.element); | |
| this.widgetEventPrefix = "tooltip"; | |
| a("#jq-tooltip").remove(); | |
| a("body").append("<div id='jq-tooltip'><table border='0' cellpadding='0' cellspacing='0'><tbody><tr class='top'><td class='jq-tooltip-top-left'></td><td class='jq-tooltip-top'></td><td class='jq-tooltip-top-right'></td></tr><tr class='middle'><td class='jq-tooltip-left'></td><td class='jq-tooltip-center'></td><td class='jq-tooltip-right'></td></tr><tr class='bottom'><td class='jq-tooltip-bottom-left'></td><td class='jq-tooltip-bottom'></td><td class='jq-tooltip-bottom-right'></td></tr></tbody></table></div>"); | |
| this.setPosition(c); | |
| this.setOffset(); | |
| this.setInnerHtml(this.options.innerHtml); | |
| this.options.closeEnable && a(".jq-tooltip-close").bind("click", function() { | |
| b.destroy(); | |
| return !1 | |
| }); | |
| this.options.autoCloseEnable && setTimeout(function() { | |
| a(document).bind("click", function() { | |
| a(document).unbind("click"); | |
| a("#jq-tooltip").remove() | |
| }) | |
| }, 100) | |
| },destroy: function() { | |
| this._trigger("destroyed"); | |
| a("#jq-tooltip").remove() | |
| },setPosition: function(b) { | |
| a("#jq-tooltip").css({position: "absolute",left: b.left + "px",top: b.top + "px"}) | |
| },getPosition: function() { | |
| return a("#jq-tooltip").offset() | |
| }, | |
| setInnerHtml: function(b) { | |
| this.options.innerHtml = b || this.options.innerHtml; | |
| a(".jq-tooltip-center").empty(); | |
| this.options.closeEnable ? a(".jq-tooltip-center").append(this.options.innerHtml).append(this.options._close) : a(".jq-tooltip-center").append(this.options.innerHtml) | |
| },getInnerHtml: function() { | |
| return this.options.innerHtml | |
| },setOffset: function(a) { | |
| var a = a || this.options.offset, c = this.getPosition(); | |
| c.top += a.top; | |
| c.left += a.left; | |
| this.setPosition(c); | |
| this.options.offset = a | |
| },closeEnable: function() { | |
| var b = this; | |
| this.options.closeEnable = !0; | |
| this.setInnerHtml(); | |
| a(".jq-tooltip-close").bind("click", function() { | |
| b.destroy(); | |
| return !1 | |
| }) | |
| },closeDisable: function() { | |
| this.options.closeEnable = !1; | |
| this.setInnerHtml() | |
| },_fixAlphaForIE6: function() { | |
| var b = [], c = []; | |
| b[0] = "-left"; | |
| b[1] = ""; | |
| b[2] = "-right"; | |
| c[0] = "-top"; | |
| c[1] = ""; | |
| c[2] = "-bottom"; | |
| for (var d = 0; 3 > d; ++d) | |
| for (var e = 0; 3 > e; ++e) | |
| if (!(1 == d && 1 == e)) { | |
| var f = ".jq-tooltip" + c[d] + b[e], g = "images/tooltip" + c[d] + b[e] + ".png"; | |
| ".jq-tooltip-top" == f ? a(f).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=crop, src='" + | |
| g + "')") : a(f).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='" + g + "')") | |
| } | |
| },_calPosition: function(a) { | |
| var c = a.offset(), d = c.left, c = c.top, a = a.height(); | |
| return {left: d,top: c + a} | |
| },options: {offset: {top: 0,left: 0},closeEnable: !0,autoCloseEnable: !1,_close: "<a class='jq-tooltip-close' href='#'>   </a>",innerHtml: ""},setMutex: function() { | |
| }}) | |
| })(jQuery); | |
| (function(a) { | |
| a.widget("bradio.pageNavigator", {options: {total: 0,size: 0,start: 0,show_total: 0,focus_neighbor: 0,hash: 0},_init: function() { | |
| this.options.size = this.options.size || 10; | |
| this.options.show_total = this.options.show_total || 10; | |
| this.options.focus_neighbor = this.options.focus_neighbor || 4; | |
| this.options.hash = this.options.hash || 0; | |
| this.widgetEventPrefix = "pagenavigator."; | |
| this._event(this); | |
| this.options.page = this._start2page(this.options.start, this.options.size) | |
| },_start2page: function(a, c) { | |
| return parseInt(a / c) + | |
| 1 | |
| },_event: function(b) { | |
| var c = b.element; | |
| a(".page-navigator-prev", c).click(b._click(b)); | |
| a(".page-navigator-next", c).click(b._click(b)); | |
| a(".page-navigator-number", c).click(b._click(b)) | |
| },_click: function(b) { | |
| return function(c) { | |
| var d; | |
| d = a(this).hasClass("page-navigator-prev") ? b.options.page - 1 : a(this).hasClass("page-navigator-next") ? b.options.page - -1 : parseInt(a(this).text()); | |
| b.setPage(d); | |
| b._trigger("pageChange", c, {size: b.options.size,page: d,start: (d - 1) * b.options.size}); | |
| b.options.hash && (window.location.hash = | |
| "", window.location.hash = b.options.hash); | |
| return !1 | |
| } | |
| },getTotal: function() { | |
| return this.options.total | |
| },setTotal: function(a) { | |
| this.options.total = a; | |
| this._draw() | |
| },getPage: function() { | |
| return this.options.page | |
| },setPage: function(a) { | |
| this.options.page = parseInt(a); | |
| this._draw() | |
| },page_number_width: function(a) { | |
| return 3 > (a + "").length ? "PNNW-S" : "PNNW-D" | |
| },setStart: function(a) { | |
| this.setPage(this._start2page(a, this.options.size)) | |
| },setParam: function(a) { | |
| this.options.total = a.total || this.options.total; | |
| this.options.start = a.start || | |
| this.options.start; | |
| this.options.size = a.size || this.options.size; | |
| this.options.page = a.page || this.options.page; | |
| this._draw() | |
| },getParam: function() { | |
| return {total: this.options.total,start: this.options.start,size: this.options.size,page: this.options.page} | |
| },_draw: function() { | |
| var a = this._page_info(this.options), c = a.total_page, d = a.page, e = a.first, f = a.last, g = a.begin, a = a.end, i = this.element, j = []; | |
| if (2 > c) | |
| return !1; | |
| this.options.total > this.options.size && i.addClass("page-navigator"); | |
| i.text(""); | |
| 1 == d ? j.push('<span class="page-navigator-prev-disable">上一页</span>') : | |
| (this.currentPage = d - 1, j.push('<a class="page-navigator-prev" href="' + this.options.hash + '">上一页</a>')); | |
| e && (this.currentPage = 1, j.push('<a href="' + this.options.hash + '" class="page-navigator-number PNNW-S">1</a>'), j.push('<span class="page-navigator-dots">...</span>')); | |
| for (; g <= a; g++) | |
| e = this.page_number_width(g), g == d ? j.push('<span class="page-navigator-current ' + e + '">' + g + "</span>") : (this.currentPage = g, j.push('<a href="' + this.options.hash + '" class="page-navigator-number ' + e + '">' + g + "</a>")); | |
| f && (this.currentPage = | |
| c, e = this.page_number_width(c), j.push('<span class="page-navigator-dots">...</span>'), j.push('<a href="' + this.options.hash + '" class="page-navigator-number ' + e + '">' + c + "</a>")); | |
| d == c ? j.push('<span class="page-navigator-next-disable">下一页</span>') : (this.currentPage = d + 1, j.push('<a class="page-navigator-next" href="' + this.options.hash + '">下一页</a>')); | |
| i.html(j.join("")); | |
| this._event(this) | |
| },_focusNeighbor: function(a, c) { | |
| var d = (a + c).toString().length - 3, d = c - (0 < d ? d : 0); | |
| return 1 > d ? 1 : d | |
| },_page_info: function(a) { | |
| var c = | |
| a.total, d = a.size || 10, e = a.page, f = a.show_total || 10, a = a.focus_neighbor || 4, g = parseInt(c / d), i, j; | |
| 0 != c % d && (g += 1); | |
| 1 > e && (e = 1); | |
| e > g && (e = g); | |
| a = this._focusNeighbor(e, a); | |
| g <= f ? (c = 1, d = g) : (c = e - a, d = e + a, j = i = !0, 3 > c ? (c = 1, d = f - 1, i = !1) : d > g - 2 && (c = g - 2 * a, d = g, j = !1)); | |
| return {total_page: g,page: e,first: i,last: j,begin: c,end: d} | |
| }}) | |
| })(jQuery); | |
| (function(a) { | |
| a.cookie = function(b, c, d) { | |
| if (1 < arguments.length && (!/Object/.test(Object.prototype.toString.call(c)) || null === c || void 0 === c)) { | |
| d = a.extend({}, d); | |
| if (null === c || void 0 === c) | |
| d.expires = -1; | |
| if ("number" === typeof d.expires) { | |
| var e = d.expires, f = d.expires = new Date; | |
| f.setDate(f.getDate() + e) | |
| } | |
| c = String(c); | |
| return document.cookie = [encodeURIComponent(b), "=", d.raw ? c : encodeURIComponent(c), d.expires ? "; expires=" + d.expires.toUTCString() : "", d.path ? "; path=" + d.path : "", d.domain ? "; domain=" + d.domain : "", d.secure ? "; secure" : | |
| ""].join("") | |
| } | |
| for (var d = c || {}, e = d.raw ? function(a) { | |
| return a | |
| } : decodeURIComponent, f = document.cookie.split("; "), g = 0, i; i = f[g] && f[g].split("="); g++) | |
| if (e(i[0]) === b) | |
| return e(i[1] || ""); | |
| return null | |
| } | |
| })(jQuery); | |
| (function() { | |
| var a = [].slice, b = {}.hasOwnProperty; | |
| var c = function() { | |
| var c, e, f, g, i, j, n, l, m, k, q, u, s, o, r, v, x, y, z, w, A, E, t, D, B; | |
| w = function(a) { | |
| return a.fn.render = function(a, b, c) { | |
| var d, e, f; | |
| e = 0; | |
| for (f = this.length; e < f; e++) | |
| d = this[e], A(d, a, b, c); | |
| return this | |
| } | |
| }; | |
| null != this.jQuery && (c = this.jQuery, w(c)); | |
| l = function(a) { | |
| return a.transparency || (a.transparency = {}) | |
| }; | |
| y = function() { | |
| }; | |
| n = function() { | |
| var b, c, d, e, f; | |
| c = 1 <= arguments.length ? a.call(arguments, 0) : []; | |
| f = []; | |
| d = 0; | |
| for (e = c.length; d < e; d++) { | |
| b = c[d]; | |
| f.push(console.log(b)) | |
| } | |
| return f | |
| }; | |
| v = | |
| y; | |
| A = function(a, c, d, e) { | |
| var f, g, j, k, q, B, s, w, u, t, D, H, N, K, J; | |
| v = e != null && e.debug && typeof console !== "undefined" && console !== null ? n : y; | |
| v("Context:", a, "Models:", c, "Directives:", d, "Config:", e); | |
| if (a) { | |
| c || (c = []); | |
| d || (d = {}); | |
| Array.isArray(c) || (c = [c]); | |
| if (u = a.parentNode) { | |
| t = a.nextSibling; | |
| u.removeChild(a) | |
| } | |
| z(a, c); | |
| g = l(a); | |
| q = D = 0; | |
| for (N = c.length; D < N; q = ++D) { | |
| w = c[q]; | |
| f = []; | |
| B = g.instances[q]; | |
| v("Model:", w, "Template instance for the model:", B); | |
| J = B.elements; | |
| H = 0; | |
| for (K = J.length; H < K; H++) { | |
| j = J[H]; | |
| l(j).model = w | |
| } | |
| if (o(w) && (k = B.elements[0])) | |
| m(k).appendChild(w); | |
| else if (typeof w === "object") | |
| for (s in w) | |
| if (b.call(w, s)) { | |
| j = w[s]; | |
| if (j != null) | |
| if (r(j)) { | |
| J = x(B, s); | |
| H = 0; | |
| for (K = J.length; H < K; H++) { | |
| k = J[H]; | |
| k.nodeName.toLowerCase() === "input" ? i(k, "value", j) : i(k, "text", j) | |
| } | |
| } else | |
| typeof j === "object" && f.push(s) | |
| } | |
| E(B, w, q, d); | |
| q = 0; | |
| for (j = f.length; q < j; q++) { | |
| s = f[q]; | |
| J = x(B, s); | |
| K = 0; | |
| for (H = J.length; K < H; K++) { | |
| k = J[K]; | |
| A(k, w[s], d[s], e) | |
| } | |
| } | |
| } | |
| u && (t ? u.insertBefore(a, t) : u.appendChild(a)); | |
| return a | |
| } | |
| }; | |
| z = function(a, b) { | |
| var c, d, e, g, i, k; | |
| c = l(a); | |
| if (!c.template) { | |
| c.template = j(a); | |
| c.instanceCache = []; | |
| c.instances = [new f(a)] | |
| } | |
| for (v("Template", | |
| c.template); b.length > c.instances.length; ) { | |
| d = c.instanceCache.pop() || new f(j(c.template)); | |
| k = d.childNodes; | |
| g = 0; | |
| for (i = k.length; g < i; g++) { | |
| e = k[g]; | |
| a.appendChild(e) | |
| } | |
| c.instances.push(d) | |
| } | |
| for (g = []; b.length < c.instances.length; ) { | |
| c.instanceCache.push(d = c.instances.pop()); | |
| g.push(function() { | |
| var a, b, c, f; | |
| c = d.childNodes; | |
| f = []; | |
| a = 0; | |
| for (b = c.length; a < b; a++) { | |
| e = c[a]; | |
| f.push(e.parentNode.removeChild(e)) | |
| } | |
| return f | |
| }()) | |
| } | |
| return g | |
| }; | |
| f = function(a) { | |
| this.template = a; | |
| this.queryCache = {}; | |
| this.elements = []; | |
| this.childNodes = []; | |
| q(this.template, | |
| this.elements, this.childNodes) | |
| }; | |
| q = function(a, b, c) { | |
| var d, a = a.firstChild; | |
| for (d = []; a; ) { | |
| c != null && c.push(a); | |
| if (a.nodeType === e) { | |
| b.push(a); | |
| q(a, b) | |
| } | |
| d.push(a = a.nextSibling) | |
| } | |
| return d | |
| }; | |
| E = function(a, c, d, e) { | |
| var f, g, j, l, k, n, q; | |
| if (e) { | |
| c = typeof c === "object" ? c : {value: c}; | |
| q = []; | |
| for (k in e) | |
| if (b.call(e, k)) { | |
| g = e[k]; | |
| if (typeof g !== "object") | |
| throw Error("Directive syntax is directive[element][attribute] = function(params)"); | |
| q.push(function() { | |
| var b, e, q, m; | |
| q = x(a, k); | |
| m = []; | |
| b = 0; | |
| for (e = q.length; b < e; b++) { | |
| l = q[b]; | |
| m.push(function() { | |
| var a; | |
| a = | |
| []; | |
| for (f in g) { | |
| j = g[f]; | |
| if (typeof j === "function") { | |
| n = j.call(c, {element: l,index: d,value: i(l, f)}); | |
| a.push(i(l, f, n)) | |
| } | |
| } | |
| return a | |
| }()) | |
| } | |
| return m | |
| }()) | |
| } | |
| return q | |
| } | |
| }; | |
| t = function(a, b) { | |
| var c, d, f, g, i; | |
| c = l(a); | |
| if (c.html !== b) { | |
| c.html = b; | |
| if (!c.children) { | |
| var j; | |
| i = a.childNodes; | |
| j = []; | |
| f = 0; | |
| for (g = i.length; f < g; f++) { | |
| d = i[f]; | |
| d.nodeType === e && j.push(d) | |
| } | |
| c.children = j | |
| } | |
| m(a); | |
| a.innerHTML = b; | |
| g = c.children; | |
| i = []; | |
| d = 0; | |
| for (f = g.length; d < f; d++) { | |
| c = g[d]; | |
| i.push(a.appendChild(c)) | |
| } | |
| return i | |
| } | |
| }; | |
| D = function(a, b) { | |
| var c; | |
| c = l(a); | |
| if (!(b == null || c.text === b)) { | |
| c.text = b; | |
| return (c = | |
| a.firstChild) ? c.nodeType !== g ? a.insertBefore(a.ownerDocument.createTextNode(b), c) : c.nodeValue = b : a.appendChild(a.ownerDocument.createTextNode(b)) | |
| } | |
| }; | |
| u = function(a) { | |
| var b, c, d, e; | |
| d = a.childNodes; | |
| e = []; | |
| b = 0; | |
| for (c = d.length; b < c; b++) { | |
| a = d[b]; | |
| a.nodeType === g && e.push(a.nodeValue) | |
| } | |
| return e.join("") | |
| }; | |
| i = function(a, b, c) { | |
| var d, e, f, g, i; | |
| c != null && typeof c !== "string" && (c = c.toString()); | |
| d = l(a); | |
| d.originalAttributes || (d.originalAttributes = {}); | |
| switch (b) { | |
| case "text": | |
| (e = d.originalAttributes).text || (e.text = u(a)); | |
| c != null && D(a, c); | |
| break; | |
| case "html": | |
| (f = d.originalAttributes).html || (f.html = a.innerHTML); | |
| c != null && t(a, c); | |
| break; | |
| case "class": | |
| (g = d.originalAttributes)["class"] || (g["class"] = a.className); | |
| if (c != null) | |
| a.className = c; | |
| break; | |
| default: | |
| (i = d.originalAttributes)[b] || (i[b] = a.getAttribute(b)); | |
| c != null && a.setAttribute(b, c) | |
| } | |
| return c != null ? c : d.originalAttributes[b] | |
| }; | |
| x = function(a, b) { | |
| var c, d; | |
| if (!(c = (d = a.queryCache)[b])) { | |
| var e, f, g, i; | |
| g = a.elements; | |
| i = []; | |
| e = 0; | |
| for (f = g.length; e < f; e++) { | |
| c = g[e]; | |
| k.matcher(c, b) && i.push(c) | |
| } | |
| c = d[b] = i | |
| } | |
| d = c; | |
| v("Matching elements for '" + | |
| b + "':", d); | |
| return d | |
| }; | |
| m = function(a) { | |
| for (var c; c = a.firstChild; ) | |
| a.removeChild(c); | |
| return a | |
| }; | |
| e = 1; | |
| g = 3; | |
| j = !("undefined" !== typeof document && null !== document) || function() { | |
| return document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>" | |
| }() ? function(a) { | |
| return a.cloneNode(true) | |
| } : function(a) { | |
| var b, f, g, i, a = c(a).clone()[0]; | |
| if (a.nodeType === e) { | |
| a.removeAttribute("transparency"); | |
| i = a.getElementsByTagName("*"); | |
| f = 0; | |
| for (g = i.length; f < g; f++) { | |
| b = i[f]; | |
| b.removeAttribute("transparency") | |
| } | |
| } | |
| return a | |
| }; | |
| null == Array.isArray && | |
| (Array.isArray = function(a) { | |
| return c.isArray(a) | |
| }); | |
| if (null == (B = Array.prototype).indexOf) | |
| B.indexOf = function(a) { | |
| return c.inArray(a, this) | |
| }; | |
| s = function(a) { | |
| return Object.prototype.toString.call(a) === "[object Date]" | |
| }; | |
| o = function(a) { | |
| return (a != null ? a.nodeType : void 0) === e | |
| }; | |
| r = function(a) { | |
| return s(a) || typeof a !== "object" && typeof a !== "function" | |
| }; | |
| return k = {render: A,register: w,matcher: function(a, c) { | |
| return a.id === c || a.className.split(" ").indexOf(c) > -1 || a.name === c || a.getAttribute("data-bind") === c | |
| }} | |
| }; | |
| "undefined" !== typeof define && | |
| null !== define && define.amd ? define(c) : "undefined" !== typeof module && null !== module && module.exports ? module.exports = c() : this.Transparency = c() | |
| }).call(this); | |
| (function(a) { | |
| a.add2fav = function(a, c) { | |
| if (window.sidebar) | |
| window.sidebar.addPanel(c, a, ""); | |
| else if (document.all) | |
| window.external.AddFavorite(a, c); | |
| else if (window.opera && window.print) | |
| return !0; | |
| return null | |
| } | |
| })(jQuery); | |
| passPortLoadStatus = !1; | |
| var M3 = {PATH: "",id: function() { | |
| var a = arguments.callee; | |
| a.number = ++a.number || 0; | |
| return "_" + a.number | |
| },timeStamp: function() { | |
| return (new Date).getTime() | |
| },log: function(a) { | |
| var b = "log_" + M3.timeStamp(); | |
| (window[b] = new Image).src = a | |
| },nul: function() { | |
| return !1 | |
| },dispatch: function(a, b) { | |
| var c, d, e; | |
| "undefined" == typeof b && (b = []); | |
| c = arguments.callee; | |
| c.map || (c.map = {}); | |
| d = function(a, b, d) { | |
| var e; | |
| (e = c.map[a]) && $.each(e, function(a, c) { | |
| c.apply(d, b) | |
| }) | |
| }; | |
| e = function(a, b) { | |
| var d; | |
| d = c.map; | |
| d[a] || (d[a] = []); | |
| d[a].push(b) | |
| }; | |
| "function" == typeof b ? | |
| e.apply(this, arguments) : b instanceof Array && d.apply(this, arguments) | |
| },registerClassEvent: function() { | |
| this.on = function(a, b) { | |
| M3.dispatch(this.instanceId + a, b) | |
| }; | |
| this.un = function() { | |
| }; | |
| this.fireEvent = function(a, b) { | |
| M3.dispatch(this.instanceId + a, b) | |
| } | |
| },Class: function(a, b, c, d) { | |
| var e, f, a = a || function() { | |
| }, b = b || {}; | |
| e = function() { | |
| this.instanceId = M3.id(); | |
| a.apply(this, arguments) | |
| }; | |
| f = e.prototype; | |
| M3.registerClassEvent.call(f); | |
| $.each(b, function(a, b) { | |
| f[a] = "function" == typeof b ? function() { | |
| var e, f; | |
| e = Array.prototype.slice.call(arguments, | |
| 0); | |
| if (!(c && !1 === c.apply(this, [a].concat(e)))) | |
| return this.fireEvent("before" + a, e), f = b.apply(this, e), d && d.apply(this, [a].concat(e)), this.fireEvent(a, e), f | |
| } : b | |
| }); | |
| return e | |
| },dom: {},boxModule: {pageSize: function() { | |
| var a, b, c, d, e, f, g = document.documentElement, i = document.body; | |
| window.innerWidth ? (a = window.innerWidth, b = window.innerHeight, e = window.pageXOffset, f = window.pageYOffset) : g && g.clientWidth && (a = g.clientWidth, b = g.clientHeight, e = g.scrollLeft, f = g.scrollTop); | |
| g && g.scrollWidth ? (c = g.scrollWidth, d = g.scrollHeight) : | |
| i.scrollWidth && (c = i.scrollWidth, d = i.scrollHeight); | |
| return [c, d, a, b, e, f] | |
| },elementSize: function(a) { | |
| return [a.offsetWidth, a.offsetHeight, a.clientWidth, a.clientHeight, a.scrollWidth, a.scrollHeight, a.scrollLeft, a.scrollTop] | |
| }},mask: {create: function(a, b, c) { | |
| b || $("body"); | |
| (c || $.browser.msie && (6 == $.browser.version || 7 == $.browser.version)) && M3.boxModule.pageSize(); | |
| a = $("#overlay"); | |
| name = "Height"; | |
| h = Math.max(document.documentElement["client" + name], document.body["scroll" + name], document.documentElement["scroll" + name], document.body["offset" + | |
| name], document.documentElement["offset" + name]); | |
| a.css({display: "block",height: h + "px"}); | |
| return a[0] | |
| },show: function(a) { | |
| $(a).css("display", "block") | |
| },hide: function(a, b) { | |
| return b ? $(a).remove() : $(a).css("display", "none") | |
| }},popup: {show: function(a, b, c) { | |
| b = b || {}; | |
| b.z = b.z || 1E3; | |
| var d = M3.boxModule.pageSize(), e, f = [], g = []; | |
| $(a).css("display", "block"); | |
| !b.left && !b.right ? (e = M3.boxModule.elementSize(a), f[0] = "left", f[1] = (d[2] - e[0]) / 2) : f = b.left ? ["left", b.left] : ["right", b.right]; | |
| !b.top && !b.bottom ? (e = e || MV.boxModule.elementSize(a), | |
| g[0] = "top", g[1] = (d[3] - e[1]) / 2) : g = b.top ? ["top", b.top] : ["bottom", b.bottom]; | |
| f[1] += "px"; | |
| g[1] += "px"; | |
| c && (!$.browser.msie || 6 != $.browser.version) && $(a).css("position", "fixed") | |
| },hide: function(a) { | |
| $(a).hide() | |
| }},user: {json: null,sign: function(a) { | |
| a = a || {top: 50,z: 1E3}; | |
| if (M3.user.sign.info) | |
| reSet(), M3.mask.show(M3.user.sign.info.mask), M3.popup.show(M3.user.sign.info.container, a), $("#pass_login_username_0").focus(); | |
| else { | |
| M3.user.sign.info = {poz: a}; | |
| var a = function(a) { | |
| return function() { | |
| var c = {luname: j,lphone: n}, b = {luname: g, | |
| lphone: i}, d; | |
| for (d in c) | |
| if (d == a) { | |
| if (c[d].hasClass("on")) | |
| return !1; | |
| c[d].addClass("on"); | |
| b[d].removeClass("hidden") | |
| } else | |
| c[d].removeClass(), b[d].addClass("hidden") | |
| } | |
| }, b = M3.user.sign.info, c = $("<div />"), d = $("<div />"), e = M3.mask.create(b.poz.z - 1), f = M3.user.statusBar.config; | |
| c.addClass("pop"); | |
| d.addClass("pop-wrapper"); | |
| d.append(c); | |
| d.insertBefore($("#overlay")); | |
| b.mask = e; | |
| b.container = c[0]; | |
| c.html('<div class="pop-header"><ul class="tab clearfix"><li class="on" id="mv_sign_tab_luname"><a href="javascript:;" hidefocus="true">登录<i class="bg"></i></a></li><li id="mv_sign_tab_lphone"><a href="javascript:;" hidefocus="true">手机登录<i class="bg"></i></a></li></ul><a class="pop-close" id="mv_sign_close" title="关闭"><i class="close">关闭</i></a></div><div class="pop-cont"><i class="bg"></i><div class="pop-box-wrapper"><div class="pop-box login-box"><div id="mv_luname" class="via-uname-box"></div><div id="mv_lphone" class="via-phone-box hidden"></div></div><div class="pop-box login-desc"><div id="login-desc-upper" class="login-desc-upper"><ul><li>还没有百度帐号?</li><li><a href="https://passport.baidu.com/v2/?reg®Type=1&tpl=music&u=http://fm.baidu.com/" target="_blank" id="register-text">立即注册</a></li></ul></div><div class="login-desc-bottom"><div class="list-label">登录即可享受</div><ul><li class="item-listen png">忠实记录听歌喜好</li><li class="item-love png">打造自己的红心频道</li><li class="item-private png">私人个性歌曲推荐</li></ul></div></div></div></div>'); | |
| M3.popup.show(c[0], b.poz); | |
| var g = $("#mv_luname"), i = $("#mv_lphone"), j = $("#mv_sign_tab_luname"), n = $("#mv_sign_tab_lphone"), d = $("#mv_sign_close"); | |
| j.click(a("luname")); | |
| n.click(a("lphone")); | |
| d.click(function() { | |
| M3.mask.hide(e); | |
| M3.popup.hide(c[0]); | |
| f && f.close && f.close(); | |
| FM.setLoginInfo({user_name: "",user_id: 0}) | |
| }); | |
| var a = location.href.replace(/(http:\/\/[^\/\\]+)([\/\\].*)/g, "$1") + "/v2Jump.html", l, m; | |
| bdPass.api.login.init({outerDomId: "mv_luname",isPhone: !1,u: null,staticpage: a,onReady: function(a) { | |
| l = createErrHolder($(a)); | |
| $("#pass_login_label_username_0").text("请输入百度帐号"); | |
| $("#pass_login_label_password_0").text("请输入密码"); | |
| labelSwitcher({inputUsername: $("#pass_login_username_0"),inputPassword: $("#pass_login_password_0"),inputVcode: $("#pass_login_verifycode_0")}); | |
| passPortLoadStatus = !0; | |
| $("#pass_login_username_0").focus() | |
| },onInputErr: function(a, c) { | |
| loginErr("uname", l, a, c) | |
| },onLoginSuccess: function() { | |
| b.mask.style.display = "none"; | |
| b.container.style.display = "none"; | |
| M3.user.statusBar(!1, 1) | |
| }}); | |
| bdPass.api.login.init({outerDomId: "mv_lphone", | |
| isPhone: !0,u: null,staticpage: a,onReady: function(a) { | |
| m = createErrHolder($(a)); | |
| $("#pass_login_label_phoneNumber_1").text("请输入手机号"); | |
| $("#pass_login_label_password_1").text("请输入密码"); | |
| labelSwitcher({inputUsername: $("#pass_login_phoneNumber_1"),inputPassword: $("#pass_login_password_1"),inputVcode: $("#pass_login_verifycode_1")}) | |
| },onInputErr: function(a, c) { | |
| loginErr("phone", m, a, c) | |
| },onLoginSuccess: function() { | |
| b.mask.style.display = "none"; | |
| b.container.style.display = "none"; | |
| M3.user.statusBar(!1, 1) | |
| }}); | |
| baidu.phoenix.require(["tsina", | |
| "renren"], {target: "login-desc-upper",tpl: "music",html: {tsina: "tsina",renren: "renren"},u: "http://fm.baidu.com/",memlogin: 1}) | |
| } | |
| },signOut: function() { | |
| M3.log("http://passport.baidu.com/?logout&u=" + encodeURIComponent(location.href) + "&" + M3.timeStamp()); | |
| M3.user.statusBar(!1, 1) | |
| },check: function(a) { | |
| var b = "M3CheckUser" + M3.id(); | |
| window[b] = function(c) { | |
| M3.user.json = c; | |
| a && a(c); | |
| window[b] = null | |
| }; | |
| $.getScript("/dev/api/?tn=checkuser&format=json&callback=" + b + "&rnd=" + M3.timeStamp()) | |
| },statusBar: function(a, b) { | |
| var c = "M3GetUserInfo" + | |
| M3.id(); | |
| window[c] = function(a) { | |
| M3.user.json = a; | |
| FM.setLoginInfo({user_name: a.uName,user_id: a.uId || 0}); | |
| if (M3.user.statusBar.config) { | |
| var e = M3.user.statusBar.config; | |
| b ? (1 == b && e.signIn && e.signIn(a), 2 == b && e.signUp && e.signUp(a)) : e.check && e.check(a) | |
| } | |
| window[c] = null | |
| }; | |
| a && (M3.user.statusBar.config || (M3.user.statusBar.config = a)); | |
| $.getScript("/dev/api/?tn=checkuser&format=json&callback=" + c + "&rnd=" + M3.timeStamp()) | |
| }}}; | |
| function reSet() { | |
| if (passPortLoadStatus) { | |
| var a = $("mv_sign_tab_luname"), b = $("mv_luname"); | |
| a.hasClass("on") || (a.addClass("on"), a.next().removeClass("on"), b.next().addClass("hidden"), b.removeClass("hidden")); | |
| $("pass_login_username_0").attr("value", ""); | |
| $("pass_login_password_0").attr("value", ""); | |
| $("pass_login_phoneNumber_1").attr("value", ""); | |
| $("pass_login_password_1").attr("value", "") | |
| } | |
| } | |
| function loginErr(a, b, c, d) { | |
| var e, f = {"-1": "登录时发生未知错误,请重新输入","-3": "手机号格式错误,请重新输入。(小于或等于11位的数字)","-11": "您尝试使用邮箱登录,但邮箱太长。(不超过60个字节)","-21": "您尝试使用用户名登录,但用户名太长。(不超过7个汉字或14个字节)",4: "登录密码错误,请重新输入",6: "验证码不匹配,请重新输入验证码",5: "今日登录次数过多",16: "对不起,您现在无法登录",20: "此帐号已登录人数过多",257: "请输入验证码",110024: "该用户已注册,但未激活,请激活"}, g = {username: "请输入百度账号",phoneNumber: "请输入手机号",password: "请输入密码",verifycode: "请输入验证码"}; | |
| "uname" == a ? (f[1] = "用户名格式错误,请重新输入", f[2] = "用户不存在") : "phone" == a && (f[1] = "手机号格式错误,请重新输入", f[2] = "手机号不存在"); | |
| if ("-2" == d) | |
| for (var i in g) { | |
| if (c.id.match(RegExp(i))) { | |
| e = | |
| g[i]; | |
| break | |
| } | |
| } | |
| else | |
| e = f[d]; | |
| b.text(e || "") | |
| } | |
| function createErrHolder(a) { | |
| var b = $("<div />"); | |
| b.addClass("login-err-msg"); | |
| b.insertBefore(a.first()); | |
| return b | |
| } | |
| function labelSwitcher(a) { | |
| for (var b in a) | |
| "" == a[b].attr("value") ? a[b].prev().show() : a[b].prev().hide(), a[b].focus(function(c) { | |
| return function() { | |
| a[c].prev().hide() | |
| } | |
| }(b)), a[b].blur(function(c) { | |
| return function() { | |
| "" == a[c].attr("value") && a[c].prev().show() | |
| } | |
| }(b)), a[b].prev().click(function(c) { | |
| return function() { | |
| a[c].prev().hide(); | |
| a[c].focus() | |
| } | |
| }(b)) | |
| } | |
| var bradio = bradio || {}, console = console || {log: function() { | |
| }}; | |
| window._log = function(a, b) { | |
| var c = "log_" + M3.timeStamp(), c = window[c] = new Image, d = "http://nsclick.baidu.com/v.gif?pid=304&ref=radio&url=&type=" + a + "&msg=" + (b || "") + "&source=pcweb&_=" + (new Date).getTime(); | |
| c.src = d | |
| }; | |
| _log("init", ""); | |
| window.onerror = function(a, b, c) { | |
| _log("jserror", a + " line:" + c); | |
| return !1 | |
| }; | |
| bradio.namespace = function() { | |
| var a = arguments, b = null, c, d, e, f; | |
| c = 0; | |
| for (f = a.length; c < f; c++) { | |
| e = ("" + a[c]).split("."); | |
| b = bradio; | |
| for (d = "bradio" == e[0] ? 1 : 0; d < e.length; d += 1) | |
| b[e[d]] = b[e[d]] || {}, b = b[e[d]] | |
| } | |
| return b | |
| }; | |
| bradio.addPath = function(a) { | |
| /^.+\/$/g.test(a) && (a += "__init__"); | |
| document.write(unescape("%3Cscript src='" + ("/static/js/" + a + ".js") + "' type='text/javascript'%3E%3C/script%3E")) | |
| }; | |
| if ($.browser.msie && 7 > $.browser.version) { | |
| var bgHide = $("#body-bg-hide"); | |
| window.onscroll = function() { | |
| bgHide && bgHide.html("") | |
| } | |
| } | |
| var T, baidu = T = baidu || {version: "1.5.2.2"}; | |
| baidu.guid = "$BAIDU$"; | |
| baidu.$$ = window[baidu.guid] = window[baidu.guid] || {global: {}}; | |
| baidu.ajax = baidu.ajax || {}; | |
| baidu.fn = baidu.fn || {}; | |
| baidu.fn.blank = function() { | |
| }; | |
| baidu.ajax.request = function(a, b) { | |
| function c() { | |
| if (4 == o.readyState) { | |
| try { | |
| var a = o.status | |
| } catch (c) { | |
| e("failure"); | |
| return | |
| } | |
| e(a); | |
| 200 <= a && 300 > a || 304 == a || 1223 == a ? e("success") : e("failure"); | |
| window.setTimeout(function() { | |
| o.onreadystatechange = baidu.fn.blank; | |
| i && (o = null) | |
| }, 0) | |
| } | |
| } | |
| function d() { | |
| if (window.ActiveXObject) | |
| try { | |
| return new ActiveXObject("Msxml2.XMLHTTP") | |
| } catch (a) { | |
| try { | |
| return new ActiveXObject("Microsoft.XMLHTTP") | |
| } catch (c) { | |
| } | |
| } | |
| if (window.XMLHttpRequest) | |
| return new XMLHttpRequest | |
| } | |
| function e(a) { | |
| var a = "on" + a, c = q[a], b = baidu.ajax[a]; | |
| if (c) | |
| if (u && clearTimeout(u), "onsuccess" != a) | |
| c(o); | |
| else { | |
| try { | |
| o.responseText | |
| } catch (d) { | |
| return c(o) | |
| } | |
| c(o, o.responseText) | |
| } | |
| else | |
| b && "onsuccess" != a && b(o) | |
| } | |
| var f = b || {}, g = f.data || "", i = !1 !== f.async, j = f.username || "", n = f.password || "", l = (f.method || "GET").toUpperCase(), m = f.headers || {}, k = f.timeout || 0, q = {}, u, s, o; | |
| for (s in f) | |
| q[s] = f[s]; | |
| m["X-Requested-With"] = "XMLHttpRequest"; | |
| try { | |
| o = d(); | |
| "GET" == l && (g && (a += (0 <= a.indexOf("?") ? "&" : "?") + g, g = null), f.noCache && (a += (0 <= a.indexOf("?") ? "&" : "?") + "b" + +new Date + "=1")); | |
| j ? o.open(l, a, i, j, n) : | |
| o.open(l, a, i); | |
| i && (o.onreadystatechange = c); | |
| "POST" == l && o.setRequestHeader("Content-Type", m["Content-Type"] || "application/x-www-form-urlencoded"); | |
| for (s in m) | |
| m.hasOwnProperty(s) && o.setRequestHeader(s, m[s]); | |
| e("beforerequest"); | |
| k && (u = setTimeout(function() { | |
| o.onreadystatechange = baidu.fn.blank; | |
| o.abort(); | |
| e("timeout") | |
| }, k)); | |
| o.send(g); | |
| i || c() | |
| } catch (r) { | |
| e("failure") | |
| } | |
| return o | |
| }; | |
| baidu.string = baidu.string || {}; | |
| baidu.string.format = function(a, b) { | |
| var a = String(a), c = Array.prototype.slice.call(arguments, 1), d = Object.prototype.toString; | |
| return c.length ? (c = 1 == c.length ? null !== b && /\[object Array\]|\[object Object\]/.test(d.call(b)) ? b : c : c, a.replace(/#\{(.+?)\}/g, function(a, b) { | |
| var g = c[b]; | |
| "[object Function]" == d.call(g) && (g = g(b)); | |
| return "undefined" == typeof g ? "" : g | |
| })) : a | |
| }; | |
| baidu.format = baidu.string.format; | |
| baidu.object = baidu.object || {}; | |
| baidu.object.each = function(a, b) { | |
| var c, d; | |
| if ("function" == typeof b) | |
| for (d in a) | |
| if (a.hasOwnProperty(d) && (c = a[d], c = b.call(a, c, d), !1 === c)) | |
| break; | |
| return a | |
| }; | |
| baidu.extend = baidu.object.extend = function(a, b) { | |
| for (var c in b) | |
| b.hasOwnProperty(c) && (a[c] = b[c]); | |
| return a | |
| }; | |
| baidu.number = baidu.number || {}; | |
| baidu.number.pad = function(a, b) { | |
| var c = "", d = 0 > a, e = String(Math.abs(a)); | |
| e.length < b && (c = Array(b - e.length + 1).join("0")); | |
| return (d ? "-" : "") + c + e | |
| }; | |
| baidu.platform = baidu.platform || {}; | |
| baidu.platform.isAndroid = /android/i.test(navigator.userAgent); | |
| baidu.platform.isIpad = /ipad/i.test(navigator.userAgent); | |
| baidu.platform.isIphone = /iphone/i.test(navigator.userAgent); | |
| baidu.swf = baidu.swf || {}; | |
| baidu.browser = baidu.browser || {}; | |
| baidu.browser.ie = baidu.ie = /msie (\d+\.\d+)/i.test(navigator.userAgent) ? document.documentMode || +RegExp.$1 : void 0; | |
| baidu.array = baidu.array || {}; | |
| baidu.array.remove = function(a, b) { | |
| for (var c = a.length; c--; ) | |
| c in a && a[c] === b && a.splice(c, 1); | |
| return a | |
| }; | |
| baidu.lang = baidu.lang || {}; | |
| baidu.lang.isArray = function(a) { | |
| return "[object Array]" == Object.prototype.toString.call(a) | |
| }; | |
| baidu.lang.isFunction = function(a) { | |
| return "[object Function]" == Object.prototype.toString.call(a) | |
| }; | |
| baidu.lang.toArray = function(a) { | |
| if (null === a || void 0 === a) | |
| return []; | |
| if (baidu.lang.isArray(a)) | |
| return a; | |
| if ("number" !== typeof a.length || "string" === typeof a || baidu.lang.isFunction(a)) | |
| return [a]; | |
| if (a.item) { | |
| for (var b = a.length, c = Array(b); b--; ) | |
| c[b] = a[b]; | |
| return c | |
| } | |
| return [].slice.call(a) | |
| }; | |
| baidu.swf.getMovie = function(a) { | |
| var b = document[a], c; | |
| return 9 == baidu.browser.ie ? b && b.length ? 1 == (c = baidu.array.remove(baidu.lang.toArray(b), function(a) { | |
| return "embed" != a.tagName.toLowerCase() | |
| })).length ? c[0] : c : b : b || window[a] | |
| }; | |
| baidu.swf.version = function() { | |
| var a = navigator; | |
| if (a.plugins && a.mimeTypes.length) { | |
| var b = a.plugins["Shockwave Flash"]; | |
| if (b && b.description) | |
| return b.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s)+r/, ".") + ".0" | |
| } else if (window.ActiveXObject && !window.opera) | |
| for (a = 12; 2 <= a; a--) | |
| try { | |
| if (b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + a)) | |
| return b.GetVariable("$version").replace(/WIN/g, "").replace(/,/g, ".") | |
| } catch (c) { | |
| } | |
| }(); | |
| baidu.dom = baidu.dom || {}; | |
| baidu.dom.g = function(a) { | |
| return !a ? null : "string" == typeof a || a instanceof String ? document.getElementById(a) : a.nodeName && (1 == a.nodeType || 9 == a.nodeType) ? a : null | |
| }; | |
| baidu.g = baidu.G = baidu.dom.g; | |
| baidu.browser.opera = /opera(\/| )(\d+(\.\d+)?)(.+?(version\/(\d+(\.\d+)?)))?/i.test(navigator.userAgent) ? +(RegExp.$6 || RegExp.$2) : void 0; | |
| baidu.dom.insertHTML = function(a, b, c) { | |
| var a = baidu.dom.g(a), d; | |
| a.insertAdjacentHTML && !baidu.browser.opera ? a.insertAdjacentHTML(b, c) : (d = a.ownerDocument.createRange(), b = b.toUpperCase(), "AFTERBEGIN" == b || "BEFOREEND" == b ? (d.selectNodeContents(a), d.collapse("AFTERBEGIN" == b)) : (b = "BEFOREBEGIN" == b, d[b ? "setStartBefore" : "setEndAfter"](a), d.collapse(b)), d.insertNode(d.createContextualFragment(c))); | |
| return a | |
| }; | |
| baidu.insertHTML = baidu.dom.insertHTML; | |
| baidu.string.encodeHTML = function(a) { | |
| return String(a).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'") | |
| }; | |
| baidu.encodeHTML = baidu.string.encodeHTML; | |
| baidu.swf.createHTML = function(a) { | |
| var a = a || {}, b = baidu.swf.version, c = a.ver || "6.0.0", d, e, f, g; | |
| f = {}; | |
| var i = baidu.string.encodeHTML; | |
| for (g in a) | |
| f[g] = a[g]; | |
| a = f; | |
| if (b) { | |
| b = b.split("."); | |
| c = c.split("."); | |
| for (f = 0; 3 > f && !(d = parseInt(b[f], 10), e = parseInt(c[f], 10), e < d); f++) | |
| if (e > d) | |
| return "" | |
| } else | |
| return ""; | |
| f = a.vars; | |
| c = "classid codebase id width height align".split(" "); | |
| a.align = a.align || "middle"; | |
| a.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"; | |
| a.codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"; | |
| a.movie = a.url || ""; | |
| delete a.vars; | |
| delete a.url; | |
| if ("string" == typeof f) | |
| a.flashvars = f; | |
| else { | |
| d = []; | |
| for (g in f) | |
| b = f[g], d.push(g + "=" + encodeURIComponent(b)); | |
| a.flashvars = d.join("&") | |
| } | |
| d = ["<object "]; | |
| f = 0; | |
| for (e = c.length; f < e; f++) | |
| b = c[f], d.push(" ", b, '="', i(a[b]), '"'); | |
| d.push(">"); | |
| f = {wmode: 1,scale: 1,quality: 1,play: 1,loop: 1,menu: 1,salign: 1,bgcolor: 1,base: 1,allowscriptaccess: 1,allownetworking: 1,allowfullscreen: 1,seamlesstabbing: 1,devicefont: 1,swliveconnect: 1,flashvars: 1,movie: 1}; | |
| for (g in a) | |
| b = a[g], g = g.toLowerCase(), f[g] && | |
| (b || !1 === b || 0 === b) && d.push('<param name="' + g + '" value="' + i(b) + '" />'); | |
| a.src = a.movie; | |
| a.name = a.id; | |
| delete a.id; | |
| delete a.movie; | |
| delete a.classid; | |
| delete a.codebase; | |
| a.type = "application/x-shockwave-flash"; | |
| a.pluginspage = "http://www.macromedia.com/go/getflashplayer"; | |
| d.push("<embed"); | |
| var j; | |
| for (g in a) | |
| if ((b = a[g]) || !1 === b || 0 === b) | |
| / /^salign$/i . | |
| test(g) ? j = b : d.push(" ", g, '="', i(b), '"'); | |
| j && d.push(' salign="', i(j), '"'); | |
| d.push("></embed></object>"); | |
| return d.join("") | |
| }; | |
| baidu.swf.create = function(a, b) { | |
| var a = a || {}, c = baidu.swf.createHTML(a) || a.errorMessage || ""; | |
| b && "string" == typeof b && (b = document.getElementById(b)); | |
| baidu.dom.insertHTML(b || document.body, "beforeEnd", c) | |
| }; | |
| baidu.lang.guid = function() { | |
| return "TANGRAM$" + baidu.$$._counter++ | |
| }; | |
| baidu.$$._counter = baidu.$$._counter || 1; | |
| baidu.lang.Class = function() { | |
| this.guid = baidu.lang.guid(); | |
| !this.__decontrolled && (baidu.$$._instances[this.guid] = this) | |
| }; | |
| baidu.$$._instances = baidu.$$._instances || {}; | |
| baidu.lang.Class.prototype.dispose = function() { | |
| delete baidu.$$._instances[this.guid]; | |
| for (var a in this) | |
| "function" != typeof this[a] && delete this[a]; | |
| this.disposed = !0 | |
| }; | |
| baidu.lang.Class.prototype.toString = function() { | |
| return "[object " + (this.__type || this._className || "Object") + "]" | |
| }; | |
| window.baiduInstance = function(a) { | |
| return baidu.$$._instances[a] | |
| }; | |
| baidu.lang.isString = function(a) { | |
| return "[object String]" == Object.prototype.toString.call(a) | |
| }; | |
| baidu.isString = baidu.lang.isString; | |
| baidu.lang.Event = function(a, b) { | |
| this.type = a; | |
| this.returnValue = !0; | |
| this.target = b || null; | |
| this.currentTarget = null | |
| }; | |
| baidu.lang.Class.prototype.fire = baidu.lang.Class.prototype.dispatchEvent = function(a, b) { | |
| baidu.lang.isString(a) && (a = new baidu.lang.Event(a)); | |
| !this.__listeners && (this.__listeners = {}); | |
| var b = b || {}, c; | |
| for (c in b) | |
| a[c] = b[c]; | |
| var d, e = this.__listeners, f = a.type; | |
| a.target = a.target || (a.currentTarget = this); | |
| f.indexOf("on") && (f = "on" + f); | |
| "function" == typeof this[f] && this[f].apply(this, arguments); | |
| if ("object" == typeof e[f]) { | |
| c = 0; | |
| for (d = e[f].length; c < d; c++) | |
| e[f][c] && e[f][c].apply(this, arguments) | |
| } | |
| return a.returnValue | |
| }; | |
| baidu.lang.Class.prototype.on = baidu.lang.Class.prototype.addEventListener = function(a, b, c) { | |
| if ("function" == typeof b) { | |
| !this.__listeners && (this.__listeners = {}); | |
| var d, e = this.__listeners; | |
| a.indexOf("on") && (a = "on" + a); | |
| "object" != typeof e[a] && (e[a] = []); | |
| for (d = e[a].length - 1; 0 <= d; d--) | |
| if (e[a][d] === b) | |
| return b; | |
| e[a].push(b); | |
| c && "string" == typeof c && (e[a][c] = b); | |
| return b | |
| } | |
| }; | |
| baidu.lang.createClass = function(a, b) { | |
| var b = b || {}, c = b.superClass || baidu.lang.Class, d = function() { | |
| b.decontrolled && (this.__decontrolled = !0); | |
| c.apply(this, arguments); | |
| for (e in d.options) | |
| this[e] = d.options[e]; | |
| a.apply(this, arguments); | |
| for (var e = 0, f = d["r"]; f && e < f.length; e++) | |
| f[e].apply(this, arguments) | |
| }; | |
| d.options = b.options || {}; | |
| var e = function() { | |
| }, f = a.prototype; | |
| e.prototype = c.prototype; | |
| var e = d.prototype = new e, g; | |
| for (g in f) | |
| e[g] = f[g]; | |
| g = b.className || b.type; | |
| "string" == typeof g && (e.__type = g); | |
| e.constructor = f.constructor; | |
| d.extend = function(a) { | |
| for (var c in a) | |
| d.prototype[c] = a[c]; | |
| return d | |
| }; | |
| return d | |
| }; | |
| baidu.lang.inherits = function(a, b, c) { | |
| var d, e, f = a.prototype, g = new Function; | |
| g.prototype = b.prototype; | |
| e = a.prototype = new g; | |
| for (d in f) | |
| e[d] = f[d]; | |
| a.prototype.constructor = a; | |
| a.superClass = b.prototype; | |
| "string" == typeof c && (e.__type = c); | |
| a.extend = function(c) { | |
| for (var b in c) | |
| e[b] = c[b]; | |
| return a | |
| }; | |
| return a | |
| }; | |
| baidu.inherits = baidu.lang.inherits; | |
| baidu.lang.isBoolean = function(a) { | |
| return "boolean" === typeof a | |
| }; | |
| baidu.lang.isElement = function(a) { | |
| return !(!a || !(a.nodeName && 1 == a.nodeType)) | |
| }; | |
| baidu.lang.isNumber = function(a) { | |
| return "[object Number]" == Object.prototype.toString.call(a) && isFinite(a) | |
| }; | |
| baidu.lang.isObject = function(a) { | |
| return "function" == typeof a || !!(a && "object" == typeof a) | |
| }; | |
| baidu.isObject = baidu.lang.isObject; | |
| baidu.fn.bind = function(a, b) { | |
| var c = 2 < arguments.length ? [].slice.call(arguments, 2) : null; | |
| return function() { | |
| var d = baidu.lang.isString(a) ? b[a] : a, e = c ? c.concat([].slice.call(arguments, 0)) : arguments; | |
| return d.apply(b || d, e) | |
| } | |
| }; | |
| baidu.each = baidu.array.forEach = baidu.array.each = function(a, b, c) { | |
| var d, e, f = a.length; | |
| if ("function" == typeof b) | |
| for (e = 0; e < f && !(d = a[e], d = b.call(c || a, d, e), !1 === d); e++) | |
| ; | |
| return a | |
| }; | |
| baidu.array.some = function(a, b, c) { | |
| for (var d = 0, e = a.length; d < e; d++) | |
| if (d in a && b.call(c || a, a[d], d)) | |
| return !0; | |
| return !1 | |
| }; | |
| baidu.browser.chrome = /chrome\/(\d+\.\d+)/i.test(navigator.userAgent) ? +RegExp.$1 : void 0; | |
| baidu.browser.firefox = /firefox\/(\d+\.\d+)/i.test(navigator.userAgent) ? +RegExp.$1 : void 0; | |
| baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent); | |
| try { | |
| /(\d+\.\d+)/.test(external.max_version) && (baidu.browser.maxthon = +RegExp.$1) | |
| } catch (e$$22) { | |
| } | |
| (function() { | |
| var a = navigator.userAgent; | |
| baidu.browser.safari = /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a) && !/chrome/i.test(a) ? +(RegExp.$1 || RegExp.$2) : void 0 | |
| })(); | |
| baidu.dom._styleFixer = baidu.dom._styleFixer || {}; | |
| baidu.dom._styleFilter = baidu.dom._styleFilter || []; | |
| baidu.dom._styleFilter.filter = function(a, b, c) { | |
| for (var d = 0, e = baidu.dom._styleFilter, f; f = e[d]; d++) | |
| if (f = f[c]) | |
| b = f(a, b); | |
| return b | |
| }; | |
| baidu.string.toCamelCase = function(a) { | |
| return 0 > a.indexOf("-") && 0 > a.indexOf("_") ? a : a.replace(/[-_][^-_]/g, function(a) { | |
| return a.charAt(1).toUpperCase() | |
| }) | |
| }; | |
| baidu.dom.setStyle = function(a, b, c) { | |
| var d = baidu.dom, e, a = d.g(a), b = baidu.string.toCamelCase(b); | |
| if (e = d._styleFilter) | |
| c = e.filter(b, c, "set"); | |
| (e = d._styleFixer[b]) && e.set ? e.set(a, c, b) : a.style[e || b] = c; | |
| return a | |
| }; | |
| baidu.setStyle = baidu.dom.setStyle; | |
| baidu.dom.setStyles = function(a, b) { | |
| var a = baidu.dom.g(a), c; | |
| for (c in b) | |
| baidu.dom.setStyle(a, c, b[c]); | |
| return a | |
| }; | |
| baidu.setStyles = baidu.dom.setStyles; | |
| baidu.dom._NAME_ATTRS = function() { | |
| var a = {cellpadding: "cellPadding",cellspacing: "cellSpacing",colspan: "colSpan",rowspan: "rowSpan",valign: "vAlign",usemap: "useMap",frameborder: "frameBorder"}; | |
| 8 > baidu.browser.ie ? (a["for"] = "htmlFor", a["class"] = "className") : (a.htmlFor = "for", a.className = "class"); | |
| return a | |
| }(); | |
| baidu.dom.setAttr = function(a, b, c) { | |
| a = baidu.dom.g(a); | |
| "style" == b ? a.style.cssText = c : (b = baidu.dom._NAME_ATTRS[b] || b, a.setAttribute(b, c)); | |
| return a | |
| }; | |
| baidu.setAttr = baidu.dom.setAttr; | |
| baidu.dom.setAttrs = function(a, b) { | |
| var a = baidu.dom.g(a), c; | |
| for (c in b) | |
| baidu.dom.setAttr(a, c, b[c]); | |
| return a | |
| }; | |
| baidu.setAttrs = baidu.dom.setAttrs; | |
| baidu.dom.create = function(a, b) { | |
| var c = document.createElement(a); | |
| return baidu.dom.setAttrs(c, b || {}) | |
| }; | |
| baidu.sio = baidu.sio || {}; | |
| baidu.sio._createScriptTag = function(a, b, c) { | |
| a.setAttribute("type", "text/javascript"); | |
| c && a.setAttribute("charset", c); | |
| a.setAttribute("src", b); | |
| document.getElementsByTagName("head")[0].appendChild(a) | |
| }; | |
| baidu.sio._removeScriptTag = function(a) { | |
| if (a.clearAttributes) | |
| a.clearAttributes(); | |
| else | |
| for (var b in a) | |
| a.hasOwnProperty(b) && delete a[b]; | |
| a && a.parentNode && a.parentNode.removeChild(a) | |
| }; | |
| baidu.sio.callByServer = function(a, b, c) { | |
| function d(a) { | |
| return function() { | |
| try { | |
| a ? g.onfailure && g.onfailure() : (b.apply(window, arguments), clearTimeout(n)), window[f] = null, delete window[f] | |
| } catch (c) { | |
| }finally { | |
| baidu.sio._removeScriptTag(e) | |
| } | |
| } | |
| } | |
| var e = document.createElement("SCRIPT"), f, g = c || {}, c = g.charset, i = g.queryField || "callback", j = g.timeOut || 0, n, l = RegExp("(\\?|&)" + i + "=([^&]*)"), m; | |
| if (baidu.lang.isFunction(b)) | |
| f = "bd__cbs__" + Math.floor(2147483648 * Math.random()).toString(36), window[f] = d(0); | |
| else if (baidu.lang.isString(b)) | |
| f = | |
| b; | |
| else if (m = l.exec(a)) | |
| f = m[2]; | |
| j && (n = setTimeout(d(1), j)); | |
| a = a.replace(l, "$1" + i + "=" + f); | |
| 0 > a.search(l) && (a += (0 > a.indexOf("?") ? "?" : "&") + i + "=" + f); | |
| baidu.sio._createScriptTag(e, a, c) | |
| }; | |
| baidu.dom._g = function(a) { | |
| return baidu.lang.isString(a) ? document.getElementById(a) : a | |
| }; | |
| baidu._g = baidu.dom._g; | |
| baidu.dom.getDocument = function(a) { | |
| a = baidu.dom.g(a); | |
| return 9 == a.nodeType ? a : a.ownerDocument || a.document | |
| }; | |
| baidu.dom.getComputedStyle = function(a, b) { | |
| var a = baidu.dom._g(a), c = baidu.dom.getDocument(a); | |
| return c.defaultView && c.defaultView.getComputedStyle && (c = c.defaultView.getComputedStyle(a, null)) ? c[b] || c.getPropertyValue(b) : "" | |
| }; | |
| baidu.event = baidu.event || {}; | |
| baidu.event._listeners = baidu.event._listeners || []; | |
| baidu.event.on = function(a, b, c) { | |
| var b = b.replace(/^on/i, ""), a = baidu.dom._g(a), d = function(b) { | |
| c.call(a, b) | |
| }, e = baidu.event._listeners, f = baidu.event._eventFilter, g = b, b = b.toLowerCase(); | |
| f && f[b] && (d = f[b](a, b, d), g = d.type, d = d.listener); | |
| a.addEventListener ? a.addEventListener(g, d, !1) : a.attachEvent && a.attachEvent("on" + g, d); | |
| e[e.length] = [a, b, c, d, g]; | |
| return a | |
| }; | |
| baidu.on = baidu.event.on; | |
| baidu.page = baidu.page || {}; | |
| baidu.page.getScrollTop = function() { | |
| var a = document; | |
| return window.pageYOffset || a.documentElement.scrollTop || a.body.scrollTop | |
| }; | |
| baidu.page.getScrollLeft = function() { | |
| var a = document; | |
| return window.pageXOffset || a.documentElement.scrollLeft || a.body.scrollLeft | |
| }; | |
| (function() { | |
| baidu.page.getMousePosition = function() { | |
| return {x: baidu.page.getScrollLeft() + a.x,y: baidu.page.getScrollTop() + a.y} | |
| }; | |
| var a = {x: 0,y: 0}; | |
| baidu.event.on(document, "onmousemove", function(b) { | |
| b = window.event || b; | |
| a.x = b.clientX; | |
| a.y = b.clientY | |
| }) | |
| })(); | |
| baidu.dom.getStyle = function(a, b) { | |
| var c = baidu.dom, a = c.g(a), b = baidu.string.toCamelCase(b), d = a.style[b] || (a.currentStyle ? a.currentStyle[b] : "") || c.getComputedStyle(a, b); | |
| if (!d || "auto" == d) { | |
| var e = c._styleFixer[b]; | |
| e && (d = e.get ? e.get(a, b, d) : baidu.dom.getStyle(a, e)) | |
| } | |
| if (e = c._styleFilter) | |
| d = e.filter(b, d, "get"); | |
| return d | |
| }; | |
| baidu.getStyle = baidu.dom.getStyle; | |
| baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent); | |
| baidu.browser.isStrict = "CSS1Compat" == document.compatMode; | |
| baidu.dom.getPosition = function(a) { | |
| var a = baidu.dom.g(a), b = baidu.dom.getDocument(a), c = baidu.browser, d = baidu.dom.getStyle; | |
| 0 < c.isGecko && b.getBoxObjectFor && d(a, "position"); | |
| var e = {left: 0,top: 0}, f; | |
| if (a == (c.ie && !c.isStrict ? b.body : b.documentElement)) | |
| return e; | |
| if (a.getBoundingClientRect) | |
| a = a.getBoundingClientRect(), e.left = Math.floor(a.left) + Math.max(b.documentElement.scrollLeft, b.body.scrollLeft), e.top = Math.floor(a.top) + Math.max(b.documentElement.scrollTop, b.body.scrollTop), e.left -= b.documentElement.clientLeft, | |
| e.top -= b.documentElement.clientTop, a = b.body, b = parseInt(d(a, "borderLeftWidth")), d = parseInt(d(a, "borderTopWidth")), c.ie && !c.isStrict && (e.left -= isNaN(b) ? 2 : b, e.top -= isNaN(d) ? 2 : d); | |
| else { | |
| f = a; | |
| do { | |
| e.left += f.offsetLeft; | |
| e.top += f.offsetTop; | |
| if (0 < c.isWebkit && "fixed" == d(f, "position")) { | |
| e.left += b.body.scrollLeft; | |
| e.top += b.body.scrollTop; | |
| break | |
| } | |
| f = f.offsetParent | |
| } while (f && f != a); | |
| if (0 < c.opera || 0 < c.isWebkit && "absolute" == d(a, "position")) | |
| e.top -= b.body.offsetTop; | |
| for (f = a.offsetParent; f && f != b.body; ) { | |
| e.left -= f.scrollLeft; | |
| if (!c.opera || | |
| "TR" != f.tagName) | |
| e.top -= f.scrollTop; | |
| f = f.offsetParent | |
| } | |
| } | |
| return e | |
| }; | |
| baidu.array.indexOf = function(a, b, c) { | |
| var d = a.length, c = c | 0; | |
| for (0 > c && (c = Math.max(0, d + c)); c < d; c++) | |
| if (c in a && a[c] === b) | |
| return c; | |
| return -1 | |
| }; | |
| baidu.array.contains = function(a, b) { | |
| return 0 <= baidu.array.indexOf(a, b) | |
| }; | |
| baidu.event.getKeyCode = function(a) { | |
| return a.which || a.keyCode | |
| }; | |
| baidu.object.values = function(a) { | |
| var b = [], c = 0, d; | |
| for (d in a) | |
| a.hasOwnProperty(d) && (b[c++] = a[d]); | |
| return b | |
| }; | |
| (function() { | |
| function a(a, c) { | |
| for (var b = 0, d = a.length, e = {}; b < d; b++) | |
| e[a[b]] = c[a[b]], delete c[a[b]]; | |
| return e | |
| } | |
| function b(c, b, d) { | |
| var d = baidu.object.extend({}, d), e = baidu.object.values(a(j[b], d)), f = document.createEvent(b); | |
| e.unshift(c); | |
| "KeyEvents" == b ? f.initKeyEvent.apply(f, e) : "MouseEvents" == b ? f.initMouseEvent.apply(f, e) : "UIEvents" == b ? f.initUIEvent.apply(f, e) : f.initEvent.apply(f, e); | |
| baidu.object.extend(f, d); | |
| return f | |
| } | |
| function c(a) { | |
| var c; | |
| document.createEventObject && (c = document.createEventObject(), baidu.object.extend(c, | |
| a)); | |
| return c | |
| } | |
| var d = baidu.browser, e = {keydown: 1,keyup: 1,keypress: 1}, f = {click: 1,dblclick: 1,mousedown: 1,mousemove: 1,mouseup: 1,mouseover: 1,mouseout: 1}, g = {abort: 1,blur: 1,change: 1,error: 1,focus: 1,load: d.ie ? 0 : 1,reset: 1,resize: 1,scroll: 1,select: 1,submit: 1,unload: d.ie ? 0 : 1}, i = {scroll: 1,resize: 1,reset: 1,submit: 1,change: 1,select: 1,error: 1,abort: 1}, j = {KeyEvents: "bubbles cancelable view ctrlKey altKey shiftKey metaKey keyCode charCode".split(" "),MouseEvents: "bubbles cancelable view detail screenX screenY clientX clientY ctrlKey altKey shiftKey metaKey button relatedTarget".split(" "), | |
| HTMLEvents: ["bubbles", "cancelable"],UIEvents: ["bubbles", "cancelable", "view", "detail"],Events: ["bubbles", "cancelable"]}; | |
| baidu.object.extend(i, e); | |
| baidu.object.extend(i, f); | |
| baidu.event.fire = function(d, l, m) { | |
| l = l.replace(/^on/i, ""); | |
| d = baidu.dom._g(d); | |
| m = baidu.object.extend({bubbles: !0,cancelable: !0,view: window,detail: 1,screenX: 0,screenY: 0,clientX: 0,clientY: 0,ctrlKey: !1,altKey: !1,shiftKey: !1,metaKey: !1,keyCode: 0,charCode: 0,button: 0,relatedTarget: null}, m); | |
| if (e[l]) { | |
| var k = l, m = a(j.KeyEvents, m), q; | |
| if (document.createEvent) | |
| try { | |
| q = | |
| b(k, "KeyEvents", m) | |
| } catch (u) { | |
| try { | |
| q = b(k, "Events", m) | |
| } catch (s) { | |
| q = b(k, "UIEvents", m) | |
| } | |
| } | |
| else | |
| m.keyCode = 0 < m.charCode ? m.charCode : m.keyCode, q = c(m); | |
| m = q | |
| } else if (f[l]) | |
| q = l, m = a(j.MouseEvents, m), document.createEvent ? (k = b(q, "MouseEvents", m), m.relatedTarget && !k.relatedTarget && ("mouseout" == q.toLowerCase() ? k.toElement = m.relatedTarget : "mouseover" == q.toLowerCase() && (k.fromElement = m.relatedTarget))) : (m.button = 0 == m.button ? 1 : 1 == m.button ? 4 : baidu.lang.isNumber(m.button) ? m.button : 0, k = c(m)), m = k; | |
| else if (g[l]) { | |
| q = l; | |
| m.bubbles = i.hasOwnProperty(q); | |
| m = a(j.HTMLEvents, m); | |
| if (document.createEvent) | |
| try { | |
| k = b(q, "HTMLEvents", m) | |
| } catch (o) { | |
| try { | |
| k = b(q, "UIEvents", m) | |
| } catch (r) { | |
| k = b(q, "Events", m) | |
| } | |
| } | |
| else | |
| k = c(m); | |
| m = k | |
| } else | |
| throw Error(l + " is not support!"); | |
| m && (d.dispatchEvent ? d.dispatchEvent(m) : d.fireEvent && d.fireEvent("on" + l, m)) | |
| } | |
| })(); | |
| baidu.event.getTarget = function(a) { | |
| return a.target || a.srcElement | |
| }; | |
| baidu.dom.show = function(a) { | |
| a = baidu.dom.g(a); | |
| a.style.display = ""; | |
| return a | |
| }; | |
| baidu.show = baidu.dom.show; | |
| T.undope = !0; | |
| var mbox = mbox || {}; | |
| mbox.namespace = function() { | |
| var a = arguments, b = null, c, d, e; | |
| c = 0; | |
| for (len = a.length; c < len; c++) { | |
| e = ("" + a[c]).split("."); | |
| b = mbox; | |
| for (d = "mbox" == e[0] ? 1 : 0; d < e.length; d += 1) | |
| b[e[d]] = b[e[d]] || {}, b = b[e[d]] | |
| } | |
| return b | |
| }; | |
| T.extend(mbox, {Fuze: function() { | |
| var a, b, c; | |
| a = []; | |
| b = function(b) { | |
| c ? b() : a.push(b) | |
| }; | |
| b.fire = function() { | |
| for (; a.length; ) | |
| a.shift()(); | |
| c = !0 | |
| }; | |
| b.extinguish = function() { | |
| c = !1 | |
| }; | |
| b.wettish = function() { | |
| this.fire(); | |
| this.extinguish() | |
| }; | |
| return b | |
| },convertTime: function(a) { | |
| var b, a = Math.round(a / 1E3); | |
| b = Math.floor(a / 60); | |
| a %= 60; | |
| return T.number.pad(b, 2) + ":" + T.number.pad(a, 2) | |
| },Timer: function(a) { | |
| var b = function(a, b) { | |
| this._timer = function() { | |
| }; | |
| this._listener = function() { | |
| }; | |
| this._timerComplete = function() { | |
| }; | |
| this._timerID = null; | |
| this._delay = this._remain = | |
| a; | |
| this._repeatCount = b || 0; | |
| this._currentCount = 0; | |
| this._isRunning = !1; | |
| this._startTime = this._endTime = 0; | |
| this.EVENTS = {TIMER: "timer",COMPLETE: "timerComplete"} | |
| }; | |
| b.prototype = {_createTimer: function(c, b) { | |
| var e = this; | |
| return 1 == b ? function() { | |
| return a.setTimeout(function() { | |
| e.reset(); | |
| e._listener(e._delay, b); | |
| e._timerComplete() | |
| }, c) | |
| } : function() { | |
| return a.setInterval(function() { | |
| 0 != b && e._currentCount >= b ? (e.reset(), e._timerComplete()) : (e._currentCount++, e._listener(c, e._currentCount)) | |
| }, c) | |
| } | |
| },addEventListener: function(a, b) { | |
| "timer" == | |
| a ? (this._listener = b, this._timer = this._createTimer(this._delay, this._repeatCount)) : "timerComplete" == a && (this._timerComplete = b) | |
| },reset: function() { | |
| this.stop(); | |
| 1 == this._repeatCount && (this._timer = this._createTimer(this._delay, this._repeatCount)); | |
| this._currentCount = 0; | |
| this._remain = this._delay; | |
| this._startTime = this._endTime = 0 | |
| },start: function() { | |
| this._timerID || (this._timerID = this._timer(), 1 == this._repeatCount && (this._startTime = (new Date).getTime()), this._isRunning = !0) | |
| },stop: function() { | |
| this._timerID && (1 == this._repeatCount ? | |
| a.clearTimeout(this._timerID) : a.clearInterval(this._timerID), this._timerID = null, this._isRunning = !1) | |
| },pause: function() { | |
| 1 == this._repeatCount ? this._timerID && (this.stop(), this._endTime = (new Date).getTime(), this._remain -= this._endTime - this._startTime, 0 < this._remain ? this._timer = this._createTimer(this._remain, 1) : this.reset()) : this.stop() | |
| },getCurrentCount: function() { | |
| return this._currentCount | |
| },isRunning: function() { | |
| return this._isRunning | |
| }}; | |
| return b | |
| }(window),StopWatch: function() { | |
| var a = 0, b = function() { | |
| this.startTime = | |
| 0; | |
| this.isRunning = !1; | |
| this.isReset = !0; | |
| this.passedTime = 0; | |
| a++ | |
| }; | |
| b.prototype = {reset: function() { | |
| this.passedTime = this.pauseTime = this.startTime = 0; | |
| this.isRunning = !1; | |
| this.isReset = !0 | |
| },start: function() { | |
| this.isReset ? (this.reset(), this.startTime = (new Date).getTime()) : this.isRunning || (this.startTime = (new Date).getTime()); | |
| this.isRunning = !0; | |
| this.isReset = !1 | |
| },pause: function() { | |
| !this.isReset && this.isRunning && (this.pauseTime = (new Date).getTime(), this.passedTime += this.pauseTime - this.startTime, this.isRunning = !1) | |
| },isRunning: function() { | |
| return this.isRunning | |
| }, | |
| isReset: function() { | |
| return this.isReset | |
| },getTime: function() { | |
| return this.isReset ? 0 : this.isRunning ? (new Date).getTime() - this.startTime + this.passedTime : this.passedTime | |
| },getCounts: function() { | |
| return a | |
| }}; | |
| return b | |
| }(window)}); | |
| mbox.namespace("mbox.lang"); | |
| T.extend(mbox.lang, {createClass: function(a, b) { | |
| var c = T.lang.createClass(a, b); | |
| c.extend = function(a) { | |
| for (var b in a) | |
| c.prototype[b] = function(a, b) { | |
| return T.lang.isFunction(a) ? function() { | |
| this.dispatchEvent(b, {name: b,arguments: arguments}); | |
| return a.apply(this, arguments) | |
| } : a | |
| }(a[b], b); | |
| return c | |
| }; | |
| return c | |
| }}); | |
| var PlayEngine_Interface = mbox.lang.createClass(function() { | |
| var a = 0, b = function(a) { | |
| this.STATES = {INIT: "init",READY: "ready",STOP: "stop",PLAY: "play",PAUSE: "pause",END: "end",BUFFERING: "buffering",PREBUFFER: "pre-buffer",ERROR: "error"}; | |
| this.EVENTS = {STATECHANGE: "player_playStateChange",POSITIONCHANGE: "player_positionChange",PROGRESS: "player_progress",ERROR: "player_error",INIT: "player_initSuccess",INITFAIL: "player_initFail"}; | |
| a = a || {}; | |
| this.mute = "undefined" == typeof a.mute ? !1 : !!a.mute; | |
| this.volume = "undefined" == typeof a.volume ? | |
| 50 : a.volume; | |
| this.ready = !1; | |
| this.url = ""; | |
| this.state = this.STATES.INIT; | |
| this.engineType = ""; | |
| this.stateStack = [this.STATES.INIT]; | |
| this.supportMimeType = [] | |
| }; | |
| b.prototype = {newId: function() { | |
| return "_m3_" + a++ | |
| },init: function() { | |
| },reset: function() { | |
| },setUrl: function() { | |
| },getUrl: function() { | |
| return this.url | |
| },play: function() { | |
| },pause: function() { | |
| },stop: function() { | |
| },setMute: function() { | |
| },getMute: function() { | |
| return this.mute | |
| },setVolume: function() { | |
| },getVolume: function() { | |
| return this.volume | |
| },getState: function() { | |
| return "" | |
| },setCurrentPosition: function() { | |
| }, | |
| getCurrentPosition: function() { | |
| return 0 | |
| },getLoadedPercent: function() { | |
| return 0 | |
| },getLoadedBytes: function() { | |
| return 0 | |
| },getTotalBytes: function() { | |
| return 0 | |
| },getTotalTime: function() { | |
| return 0 | |
| },getVersion: function() { | |
| return "" | |
| },getEngineType: function() { | |
| return this.engineType | |
| },canPlayType: function(a) { | |
| var b = this.getSupportMimeTypeList(); | |
| return T.array.some(b, function(b) { | |
| return a == b | |
| }) | |
| },getSupportMimeTypeList: function() { | |
| return this.supportMimeType | |
| },setEventListener: function(a, b) { | |
| var e = T.fn.bind(function() { | |
| return b.apply(this, | |
| arguments) | |
| }, this); | |
| this.addEventListener(a, e) | |
| }}; | |
| return b | |
| }(window), {superClass: T.lang.Class,className: "PlayEngine_Interface"}), PlayEngine = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| this.subEnginesConf = []; | |
| this.subEnginesInitArgs = {}; | |
| this.curEngine = null; | |
| this.curEngineType = ""; | |
| this.unInitEngineList = []; | |
| this.engineList = []; | |
| this.engineTypeList = []; | |
| this.ready = !1; | |
| this.defaultExt = ".mp3"; | |
| this.coreContainer = null; | |
| this.EVENTS = {STATECHANGE: "player_playStateChange",POSITIONCHANGE: "player_positionChange",PROGRESS: "player_progress", | |
| ERROR: "player_error",INIT: "player_initSuccess",INITFAIL: "player_initFail"}; | |
| this.STATES = {INIT: "init",READY: "ready",STOP: "stop",PLAY: "play",PAUSE: "pause",END: "end",BUFFERING: "buffering",PREBUFFER: "pre-buffer",ERROR: "error"}; | |
| this.progressTimer = new mbox.Timer(200, 0); | |
| this.positionTimer = new mbox.Timer(100, 0); | |
| this._initEngines(a) | |
| }, {className: "PlayEngine"}).extend({_error: function(a) { | |
| throw Error(a); | |
| },_initEngines: function(a) { | |
| this.coreContainer = a.el || null; | |
| this.subEnginesConf = a.subEngines || []; | |
| T.array.each(this.subEnginesConf, | |
| T.fn.bind(function(a) { | |
| var c = a.constructorName, a = a.args || {}, d; | |
| this.subEnginesInitArgs[c] = a; | |
| try { | |
| if (d = eval(c), !T.lang.isFunction(d)) | |
| return | |
| } catch (e) { | |
| return | |
| } | |
| c = new d(a); | |
| this.unInitEngineList.push(c) | |
| }, this)); | |
| this.curEngine = this.unInitEngineList[0] | |
| },init: function(a) { | |
| if (this.ready) | |
| return this._error(""); | |
| a = a || {}; | |
| this.subEnginesInitArgs = a.subEngines ? a.subEngines : this.subEnginesInitArgs; | |
| this.coreContainer = a.el ? a.el : this.coreContainer; | |
| if (!this.coreContainer) { | |
| var b = T.dom.create("div", {id: "_player_container_" + T.lang.guid()}); | |
| T.dom.setStyles(b, {width: "1px",height: "1px",overflow: "hidden"}); | |
| document.body.appendChild(b); | |
| this.coreContainer = a.el = b | |
| } | |
| T.array.each(this.unInitEngineList, T.fn.bind(function(a) { | |
| var b = ""; | |
| /^\[object (.*)\]$/i.test(a.toString()) && (b = RegExp.$1); | |
| b = this.subEnginesInitArgs[b] || {}; | |
| a.test(!0) && (b.instanceName = b.instanceName + ".engineList[" + this.engineList.length + "]", b.el = b.el || this.coreContainer, this.engineList.push(a), a.init.apply(a, [b])) | |
| }, this)); | |
| this.switchEngineByUrl(this.defaultExt); | |
| this.ready = !0; | |
| this._initProgressEvent(); | |
| this._initPositionChangeEvent() | |
| },canPlayType: function(a) { | |
| return T.array.some(this.engineList, function(b) { | |
| return b.canPlayType(a) | |
| }) | |
| },getSupportMimeTypeList: function() { | |
| var a = []; | |
| T.array.each(this.engineList, T.fn.bind(function(b) { | |
| a = a.concat(b.getSupportMimeTypeList()) | |
| }, this)); | |
| return a | |
| },switchEngineByUrl: function(a) { | |
| var b = T.array.some(this.engineList, T.fn.bind(function(b) { | |
| var c = b.getSupportMimeTypeList().join("|"); | |
| if (RegExp("\\.(" + c + ")(\\?|$)", "ig").test(a)) | |
| return this.curEngine = b, this.curEngineType = b.getEngineType(), | |
| !0 | |
| }, this)), c = arguments[1]; | |
| !b && !c && arguments.callee.apply(this, [this.defaultExt, !0]) | |
| },switchEngineByMimeType: function(a) { | |
| T.array.some(this.engineList, T.fn.bind(function(b) { | |
| if (b.canPlayType(a)) | |
| return this.curEngine = b, this.curEngineType = b.getEngineType(), !0 | |
| }, this)) | |
| },reset: function() { | |
| this.curEngine.reset.apply(this.curEngine, arguments) | |
| },setUrl: function(a) { | |
| var b = this.curEngine; | |
| this.switchEngineByUrl(a); | |
| b && b != this.curEngine && b.stop(); | |
| this.curEngine && this.curEngine.setUrl.apply(this.curEngine, arguments) | |
| }, | |
| getUrl: function() { | |
| return this.curEngine.getUrl.apply(this.curEngine, arguments) | |
| },play: function(a) { | |
| if ("undefined" == typeof a) { | |
| if (this.curEngine) | |
| return this.curEngine.play.apply(this.curEngine, arguments) | |
| } else | |
| return this.setCurrentPosition(a) | |
| },pause: function() { | |
| if (this.curEngine) | |
| return this.curEngine.pause.apply(this.curEngine, arguments) | |
| },stop: function() { | |
| if (this.curEngine) | |
| return this.curEngine.stop.apply(this.curEngine, arguments) | |
| },setMute: function(a) { | |
| var b = arguments; | |
| T.array.each(this.engineList, function(a) { | |
| a.setMute.apply(a, | |
| b) | |
| }) | |
| },getMute: function() { | |
| return this.curEngine ? this.curEngine.getMute.apply(this.curEngine, arguments) : !1 | |
| },setVolume: function(a) { | |
| var b = arguments; | |
| T.array.each(this.engineList, function(a) { | |
| a.setVolume.apply(a, b) | |
| }) | |
| },getVolume: function() { | |
| return this.curEngine ? this.curEngine.getVolume.apply(this.curEngine, arguments) : 0 | |
| },setCurrentPosition: function(a) { | |
| if (this.curEngine) | |
| return this.curEngine.setCurrentPosition.apply(this.curEngine, arguments) | |
| },getCurrentPosition: function() { | |
| return this.curEngine ? this.curEngine.getCurrentPosition.apply(this.curEngine, | |
| arguments) : 0 | |
| },getCurrentPositionString: function() { | |
| return mbox.convertTime(this.getCurrentPosition()) | |
| },getLoadedPercent: function() { | |
| return this.curEngine ? this.curEngine.getLoadedPercent.apply(this.curEngine, arguments) : 0 | |
| },getLoadedBytes: function() { | |
| if (this.curEngine) | |
| return this.curEngine.getLoadedBytes.apply(this.curEngine, arguments) | |
| },getTotalBytes: function() { | |
| return this.curEngine ? this.curEngine.getTotalBytes.apply(this.curEngine, arguments) : 0 | |
| },getTotalTime: function() { | |
| return this.curEngine ? this.curEngine.getTotalTime.apply(this.curEngine, | |
| arguments) : 0 | |
| },getTotalTimeString: function() { | |
| return mbox.convertTime(this.getTotalTime()) | |
| },getCurEngine: function() { | |
| return this.curEngine | |
| },getEngineType: function() { | |
| return this.getCurEngine().getEngineType() | |
| },getVersion: function() { | |
| var a = {}; | |
| T.array.each(this.engineList, function(b) { | |
| a[b.getEngineType()] = b.getVersion() | |
| }); | |
| return a | |
| },getState: function() { | |
| return this.curEngine ? this.curEngine.getState.apply(this.curEngine, arguments) : null | |
| },setEventListener: function(a, b) { | |
| var c; | |
| c = a == this.EVENTS.INITFAIL || a == this.EVENTS.INIT ? | |
| T.fn.bind(function(a) { | |
| b.apply(this, arguments) | |
| }, this) : T.fn.bind(function(a) { | |
| a.target && a.target.getEngineType() == this.curEngineType && b.apply(this, arguments) | |
| }, this); | |
| T.array.each(this.unInitEngineList, function(b) { | |
| b.setEventListener(a, c) | |
| }) | |
| },_initProgressEvent: function() { | |
| this.progressTimer.addEventListener("timer", T.fn.bind(function() { | |
| var a = this.getLoadedPercent(); | |
| this.curEngine.dispatchEvent(this.EVENTS.PROGRESS, {progress: a,totalBytes: this.getTotalBytes(),loadedBytes: this.getLoadedBytes(),totalTime: this.getTotalTime()}); | |
| 1 == a && this.progressTimer.stop() | |
| }, this)); | |
| this.setEventListener(this.EVENTS.STATECHANGE, T.fn.bind(function(a) { | |
| switch (a.newState) { | |
| case this.STATES.PREBUFFER: | |
| case this.STATES.PLAY: | |
| 1 > this.getLoadedPercent() && this.progressTimer.start(); | |
| break; | |
| case this.STATES.STOP: | |
| case this.STATES.READY: | |
| case this.STATES.END: | |
| this.progressTimer.reset() | |
| } | |
| }, this)); | |
| this.setEventListener("setUrl", T.fn.bind(function() { | |
| this.progressTimer.reset(); | |
| this.progressTimer.start() | |
| }, this)) | |
| },_initPositionChangeEvent: function() { | |
| this.positionTimer.addEventListener("timer", | |
| T.fn.bind(function() { | |
| var a = this.getCurrentPosition(); | |
| this.curEngine.dispatchEvent(this.EVENTS.POSITIONCHANGE, {position: a}) | |
| }, this)); | |
| this.setEventListener(this.EVENTS.STATECHANGE, T.fn.bind(function(a) { | |
| switch (a.newState) { | |
| case this.STATES.PLAY: | |
| this.positionTimer.start(); | |
| break; | |
| case this.STATES.STOP: | |
| case this.STATES.PAUSE: | |
| this.positionTimer.pause(); | |
| this.curEngine.dispatchEvent(this.EVENTS.POSITIONCHANGE, {position: this.getCurrentPosition()}); | |
| break; | |
| case this.STATES.READY: | |
| case this.STATES.END: | |
| this.positionTimer.reset() | |
| } | |
| }, | |
| this)); | |
| this.setEventListener("setUrl", T.fn.bind(function() { | |
| this.positionTimer.reset() | |
| }, this)) | |
| }}), PlayEngine_Audio = mbox.lang.createClass(function() { | |
| this.engineType = "audio"; | |
| this.contentType = {mp3: ["audio/mpeg", "audio/mp3"],mp4: ["audio/mp4", "audio/MP4A-LATM", "video/mpeg4", "audio/mpeg4-generic"],m4a: ["audio/mp4", "audio/MP4A-LATM", "video/mpeg4", "audio/mpeg4-generic"],aac: ["audio/aac", "audio/aacp"],"3gp": ["audio/3gpp", "audio/3gpp2"],ogg: ["audio/ogg", "video/ogg", "application/ogg", "audio/vorbis"],oga: ["audio/ogg", | |
| "application/ogg", "audio/vorbis"],wma: ["audio/x-ms-wma"]}; | |
| this.supportAudio = "undefined" != typeof Audio; | |
| this.supportMimeType = []; | |
| this.supportAudio && (this.audio = new Audio, "function" == typeof this.audio.canPlayType && T.object.each(this.contentType, T.fn.bind(function(a, b) { | |
| for (var c = 0; c < a.length; c++) { | |
| var d = this.audio.canPlayType(a[c]); | |
| if ("probably" == d || "maybe" == d) { | |
| this.supportMimeType.push(b); | |
| break | |
| } | |
| } | |
| }, this)), this.supportMimeType.length || (this.supportAudio = !1)); | |
| this.supportVolume = T.fn.bind(function() { | |
| if (this.supportAudio) { | |
| this.audio.volume = | |
| 0.5; | |
| return this.audio.volume < 1 | |
| } | |
| return false | |
| }, this)() | |
| }, {superClass: PlayEngine_Interface,className: "PlayEngine_Audio"}).extend({test: function(a) { | |
| !this.supportAudio && a && this.dispatchEvent(this.EVENTS.INITFAIL, {engineType: this.engineType}); | |
| return this.supportAudio | |
| },init: function() { | |
| this.lastState = this.STATES.INIT; | |
| this.muted = this.audio.muted = !1; | |
| this.volume = 50; | |
| this.audio.volume = 0.5; | |
| this.url = ""; | |
| this._definedEvents(); | |
| this.state = this.STATES.READY; | |
| this.dispatchEvent(this.EVENTS.INIT, {engineType: this.engineType, | |
| engine: this.audio}) | |
| },reset: function() { | |
| this.supportAudio && (this.url = "", this.audio.pause(), this.lastState = this.state = "ready") | |
| },setUrl: function(a) { | |
| this.supportAudio && (this.url = a, this.audio.src = a, this.audio.load(), this._firePlayStateChange(this.STATES.PREBUFFER)) | |
| },play: function() { | |
| if (this.supportAudio && "ready" != this.state) | |
| if (T.platform.isAndroid && T.browser.isWebkit && 3 > this.audio.readyState) { | |
| var a = T.fn.bind(function() { | |
| this.audio.play(); | |
| this.audio.removeEventListener("canplay", a, !1) | |
| }, this); | |
| this.audio.addEventListener("canplay", | |
| a, !1) | |
| } else | |
| this.audio.play() | |
| },pause: function() { | |
| this.supportAudio && (this.state != this.STATES.STOP && this.state != this.STATES.READY && this.state != this.STATES.END) && (this.audio.pause(), this._firePlayStateChange(this.STATES.PAUSE)) | |
| },stop: function() { | |
| this.supportAudio && this.state != this.STATES.READY && (0 != this.audio.currentTime && (this.audio.currentTime = 0), this.audio.pause(), this._firePlayStateChange(this.STATES.STOP)) | |
| },setMute: function(a) { | |
| this.supportAudio && (this.audio.muted = this.mute = a) | |
| },setVolume: function(a) { | |
| this.supportAudio && | |
| (a = T.lang.isNumber(a) ? a : 50, this.volume = a = Math.max(Math.min(a, 100), 0), this.audio.volume = a / 100) | |
| },setCurrentPosition: function(a) { | |
| if (this.supportAudio) | |
| if (T.platform.isAndroid && 3 > this.audio.readyState) { | |
| var b = T.fn.bind(function() { | |
| this.audio.currentTime = a / 1E3; | |
| this.audio.play(); | |
| this.audio.removeEventListener("canplay", b, !1) | |
| }, this); | |
| this.audio.addEventListener("canplay", b, !1) | |
| } else | |
| this.audio.currentTime = a / 1E3, this.audio.play() | |
| },getCurrentPosition: function() { | |
| return !this.supportAudio ? 0 : Math.round(1E3 * this.audio.currentTime) | |
| }, | |
| getLoadedPercent: function() { | |
| try { | |
| var a = this.audio.buffered.end(0), b = this.audio.duration, b = isNaN(b) ? 0 : b; | |
| return Math.round(100 * (a / b)) / 100 | |
| } catch (c) { | |
| return 0 | |
| } | |
| },getTotalTime: function() { | |
| if (!this.supportAudio) | |
| return 0; | |
| var a = this.audio.duration, a = isNaN(a) ? 0 : a; | |
| return Math.round(1E3 * a) | |
| },getState: function() { | |
| return this.state | |
| },_firePlayStateChange: function(a) { | |
| this.state != a && (this.lastState = this.state, this.state = a, this.dispatchEvent(this.EVENTS.STATECHANGE, {newState: a,oldState: this.lastState,engineType: this.engineType})) | |
| }, | |
| _definedEvents: function() { | |
| this.audio.addEventListener("error", T.fn.bind(function() { | |
| this._firePlayStateChange(this.STATES.ERROR); | |
| this.dispatchEvent(this.EVENTS.ERROR, {engineType: this.engineType}) | |
| }, this), !1); | |
| this.audio.addEventListener("ended", T.fn.bind(function() { | |
| this._firePlayStateChange(this.STATES.END) | |
| }, this), !1); | |
| this.audio.addEventListener("playing", T.fn.bind(function() { | |
| this._firePlayStateChange(this.STATES.PLAY) | |
| }, this), !1); | |
| this.audio.addEventListener("pause", T.fn.bind(function() { | |
| this.getState() == | |
| this.STATES.PLAY && this._firePlayStateChange(this.getCurrentPosition() ? this.STATES.PAUSE : this.STATES.STOP) | |
| }, this), !1); | |
| this.audio.addEventListener("waiting", T.fn.bind(function() { | |
| this._firePlayStateChange(this.getCurrentPosition() ? this.STATES.BUFFERING : this.STATES.PREBUFFER) | |
| }, this), !1) | |
| }}), PlayEngine_FMP_MP3 = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| this.supportMimeType = ["mp3"]; | |
| this.engineType = "fmp_mp3"; | |
| this.swfPath = "fmp_mp3.swf"; | |
| this.flashVersionRequire = a.flashVersionRequire || "9.0.0"; | |
| this.versionErrorMessage = | |
| a.versionErrorMessage || ""; | |
| this.stateCode = {"-2": this.STATES.INIT,"-1": this.STATES.READY,"0": this.STATES.STOP,1: this.STATES.PLAY,2: this.STATES.PAUSE,3: this.STATES.END,4: this.STATES.BUFFERING,5: this.STATES.PREBUFFER,6: this.STATES.ERROR}; | |
| this.flashLoaded = !1; | |
| this.flashReady = new mbox.Fuze | |
| }, {superClass: PlayEngine_Interface,className: "PlayEngine_FMP_MP3"}).extend({test: function(a) { | |
| return this._checkPlayer(a) | |
| },init: function(a) { | |
| var a = a || {}, b = a.el; | |
| this.instanceName = a.instanceName; | |
| this.swfPath = a.swfPath || this.swfPath; | |
| var c = this.newId(); | |
| T.lang.isString(b) && (b = T.g(b)); | |
| b || (b = T.dom.create("div"), document.body.appendChild(b)); | |
| a = T.dom.create("div"); | |
| b.appendChild(a); | |
| if (T.browser.maxthon || T.browser.ie) | |
| this.swfPath += "?" + c + "_" + Math.random(); | |
| T.swf.create({id: this.flashObjectId = c,width: "1px",height: "1px",ver: this.flashVersionRequire,errorMessage: this.versionErrorMessage,allowscriptaccess: "always",url: this.swfPath,bgcolor: "#ffffff",wmode: "window",scale: "noscale",vars: {_instanceName: this.instanceName + "",_buffertime: 2E3}}, a); | |
| this.flashObject = T.swf.getMovie(this.flashObjectId) | |
| },reset: function() { | |
| this.stop(); | |
| this.state != this.STATES.INIT && (this.url = "", this.state = this.STATES.READY, this.stateStack = [this.STATES.READY]) | |
| },setUrl: function(a) { | |
| this.flashReady(T.fn.bind(function() { | |
| this.url = a; | |
| this.flashObject.f_load(a) | |
| }, this)) | |
| },play: function() { | |
| this.flashReady(T.fn.bind(function() { | |
| this.state != this.STATES.PLAY && this.flashObject.f_play() | |
| }, this)) | |
| },pause: function() { | |
| this.flashReady(T.fn.bind(function() { | |
| this.state == this.STATES.PAUSE || (this.state == | |
| this.STATES.STOP || this.state == this.STATES.END) || this.flashObject.f_pause() | |
| }, this)) | |
| },stop: function() { | |
| this.flashReady(T.fn.bind(function() { | |
| this.state != this.STATES.STOP && this.flashObject.f_stop() | |
| }, this)) | |
| },setMute: function(a) { | |
| this.flashReady(T.fn.bind(function() { | |
| this.mute = a; | |
| this.flashObject.setData("mute", a) | |
| }, this)) | |
| },setVolume: function(a) { | |
| this.flashReady(T.fn.bind(function() { | |
| this.volume = a; | |
| this.flashObject.setData("volume", a) | |
| }, this)) | |
| },setCurrentPosition: function(a) { | |
| this.flashReady(T.fn.bind(function() { | |
| this.flashObject.f_play(a) | |
| }, | |
| this)) | |
| },getCurrentPosition: function() { | |
| return this.flashLoaded ? this.flashObject.getData("currentPosition") : 0 | |
| },getLoadedPercent: function() { | |
| return this.flashLoaded ? this.flashObject.getData("loadedPct") : 0 | |
| },getTotalTime: function() { | |
| return this.flashLoaded ? this.flashObject.getData("length") : 0 | |
| },getState: function(a) { | |
| return T.lang.isNumber(a) ? this.stateCode[a] : this.state | |
| },getVersion: function() { | |
| return T.swf.version | |
| },_firePlayStateChange: function(a) { | |
| if (this.state != a) { | |
| this.state = a; | |
| this.stateStack.push(a); | |
| var b = | |
| this.stateStack.shift(); | |
| this.dispatchEvent(this.EVENTS.STATECHANGE, {newState: a,oldState: b,engineType: this.engineType}) | |
| } | |
| },_onLoad: function() { | |
| this.state = this.STATES.READY; | |
| this.stateStack = [this.state]; | |
| this.dispatchEvent(this.EVENTS.INIT, {engineType: this.engineType,engine: this.flashObject}); | |
| setTimeout(T.fn.bind(function() { | |
| this.flashReady.fire(); | |
| this.flashLoaded = !0 | |
| }, this), 0) | |
| },_onPlayStateChange: function(a) { | |
| this._firePlayStateChange(this.getState(a)) | |
| },_checkPlayer: function(a) { | |
| var a = !!a, b = T.swf.version, | |
| c = this.flashVersionRequire; | |
| if (b) { | |
| b = b.split("."); | |
| c = c.split("."); | |
| if (0 <= b[0] - c[0] && 0 <= b[1] - c[1]) | |
| return !0; | |
| a && this.dispatchEvent(this.EVENTS.INITFAIL, {engineType: this.engineType}); | |
| return !1 | |
| } | |
| a && this.dispatchEvent(this.EVENTS.INITFAIL, {engineType: this.engineType}); | |
| return !1 | |
| }}), PlayEngine_FMP_AAC = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| this.supportMimeType = ["mp4", "m4a"]; | |
| this.engineType = "fmp_aac"; | |
| this.swfPath = "fmp_aac.swf"; | |
| this.flashVersionRequire = a.flashVersionRequire || "10.0.0" | |
| }, {superClass: PlayEngine_FMP_MP3, | |
| className: "PlayEngine_FMP_AAC"}), PlayEngineRuleModel = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| this.name = a.name || ""; | |
| this.delayTime = a.delayTime; | |
| this.timer = null; | |
| this.playEngine = a.playEngine || null; | |
| this.listener = a.listener || {}; | |
| this.handler = a.handler || function() { | |
| }; | |
| this.EVENTS = {TIMER: "timer"}; | |
| this.init() | |
| }, {className: "PlayEngineRuleModel"}).extend({init: function() { | |
| !this.timer && null != this.delayTime && (this.timer = new mbox.Timer(this.delayTime, 1), this.addHandler(this.handler), this.timer.addEventListener(this.timer.EVENTS.TIMER, | |
| T.fn.bind(function() { | |
| this.dispatchEvent(this.EVENTS.TIMER, {timer: this.timer,playEngine: this.playEngine}) | |
| }, this))) | |
| },setPlayEngine: function(a) { | |
| this.playEngine = a | |
| },getName: function() { | |
| return this.name | |
| },getListener: function() { | |
| return this.listener | |
| },getTimer: function() { | |
| return this.timer | |
| },addHandler: function(a) { | |
| this.addEventListener(this.EVENTS.TIMER, T.fn.bind(function() { | |
| a.apply(this, arguments) | |
| }, this)) | |
| }}), PlayEngineRulesController = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| this.playEngine = a.playEngine; | |
| this.rules = | |
| []; | |
| this.isBlock = !1 | |
| }, {className: "PlayEngineRulesController"}).extend({addRule: function(a) { | |
| var b = a.getRule(); | |
| b.setPlayEngine(this.playEngine); | |
| this.rules.push(b); | |
| a = b.getListener(); | |
| T.object.each(a, T.fn.bind(function(a, d) { | |
| var e = T.fn.bind(function() { | |
| this.isBlock || a.apply(b, arguments) | |
| }, this, b); | |
| switch (d.toLowerCase()) { | |
| case "playstatechange": | |
| d = this.playEngine.EVENTS.STATECHANGE | |
| } | |
| this.playEngine.setEventListener(d, e) | |
| }, this)) | |
| },getRulesCount: function() { | |
| return this.rules.length | |
| },getRules: function() { | |
| return this.rules | |
| }, | |
| reset: function(a) { | |
| if (a) | |
| for (var b = 0, c = this.rules.length; b < c; b++) | |
| this.rules[b].getName() == a && this.rules[b].getTimer().reset(); | |
| else { | |
| b = 0; | |
| for (c = this.rules.length; b < c; b++) | |
| this.rules[b].getTimer().reset() | |
| } | |
| },blockListen: function() { | |
| this.isBlock = !0 | |
| },resetListen: function() { | |
| this.isBlock = !1 | |
| },getBlockState: function() { | |
| return this.isBlock | |
| }}), PlayEngineRules = PlayEngineRules || {}; | |
| PlayEngineRules.Prebuffer = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 10; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "preBuffer",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| c.newState == c.target.STATES.PREBUFFER ? a.getTimer().start() : a.getTimer().reset() | |
| }}}); | |
| this.rule.addHandler(a.handler) | |
| }, {className: "PlayEngineRules.Prebuffer"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| PlayEngineRules.FirstBuffer = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 10; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "firstBuffer",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| var d = c.oldState, e = c.target.STATES; | |
| c.newState == e.BUFFERING ? (d == e.READY || d == e.PREBUFFER) && a.getTimer().start() : a.getTimer().reset() | |
| }}}); | |
| this.rule.addHandler(a.handler) | |
| }, {className: "PlayEngineRules.FirstBuffer"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| PlayEngineRules.Buffer = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 20; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "buffer",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.startRecord = !0; | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| var d = c.newState, e = c.oldState, f = c.target.STATES; | |
| if (a.startRecord) | |
| if (d == f.BUFFERING) | |
| e == f.PLAY && a.getTimer().start(); | |
| else if (d == f.PLAY || d == f.PAUSE) | |
| e == f.BUFFERING && a.getTimer().pause(); | |
| else if (d == f.END || d == f.READY) | |
| a.getTimer().reset(), | |
| a.startRecord = !1 | |
| }},handler: function(a) { | |
| a.target.startRecord = !1 | |
| }}); | |
| this.rule.addHandler(a.handler) | |
| }, {className: "PlayEngineRules.Buffer"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| PlayEngineRules.Exception = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 1; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "exception",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.startRecord = !0; | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| var d = c.newState, e = c.oldState, f = c.target.STATES; | |
| a.startRecord && (d == f.READY ? (e == f.PLAY || e == f.PREBUFFER) && a.getTimer().start() : a.getTimer().reset()) | |
| }},handler: function(a) { | |
| a.target.startRecord = !1 | |
| }}); | |
| this.rule.addHandler(a.handler) | |
| }, | |
| {className: "PlayEngineRules.Exception"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| PlayEngineRules.Play60s = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 60; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "savelink",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.startRecord = !0; | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| var d = c.newState, e = c.oldState, f = c.target.STATES; | |
| a.startRecord && (d == f.PLAY ? a.getTimer().start() : d == f.PAUSE || d == f.BUFFERING ? e == f.PLAY && a.getTimer().pause() : a.getTimer().reset()) | |
| }},handler: function(a) { | |
| a.target.startRecord = | |
| !1 | |
| }}); | |
| this.rule.addHandler(a.handler) | |
| }, {className: "PlayEngineRules.Play60s"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| PlayEngineRules.Play100ms = mbox.lang.createClass(function(a) { | |
| a = a || {}; | |
| a.time = a.time || 0.1; | |
| a.handler = a.handler || function() { | |
| }; | |
| this.rule = new PlayEngineRuleModel({name: "play100ms",delayTime: 1E3 * a.time,listener: {setUrl: function(a) { | |
| a.startRecord = !0; | |
| a.getTimer().reset() | |
| },playStateChange: function(a, c) { | |
| var d = c.newState, e = c.target.STATES; | |
| a.startRecord && (d == e.PLAY ? a.getTimer().start() : a.getTimer().reset()) | |
| }},handler: function(a) { | |
| a.target.startRecord = !1 | |
| }}); | |
| this.rule.addHandler(a.handler) | |
| }, {className: "PlayEngineRules.Play100ms"}).extend({getRule: function() { | |
| return this.rule | |
| }}); | |
| bradio.namespace("bradio.lang.array"); | |
| Array.prototype.getUniq = function() { | |
| for (var a = {}, b = [], c = 0, d = this.length; c < d; ++c) | |
| a.hasOwnProperty(this[c]) || (b.push(this[c]), a[this[c]] = 1); | |
| return b | |
| }; | |
| bradio.namespace("bradio.lang.string"); | |
| bradio.lang.string.ucFirst = function(a) { | |
| return a.charAt(0).toUpperCase() + a.slice(1) | |
| }; | |
| bradio.lang.string.ellipsis = function(a, b, c, d, e, f) { | |
| b.text(a); | |
| for (var g = a, i; b.outerWidth() > c; ) | |
| "center" === f ? (i = Math.floor(bradio.lang.string.getByteLength(g) / 2), g = g.substring(0, i) + g.substring(i + 1)) : g = bradio.lang.string.subByte(g, bradio.lang.string.getByteLength(g) - 1), b.text(g); | |
| bradio.lang.string.getByteLength(g) < bradio.lang.string.getByteLength(a) && ("center" === f ? (a = Math.floor(bradio.lang.string.getByteLength(g) / 2), b.text(g.substring(0, a) + "..." + g.substring(a))) : b.text(b.text() + "...")); | |
| d && b.text(d + b.text()); | |
| e && b.text(b.text() + e) | |
| }; | |
| bradio.lang.string.encodeHTML = function(a) { | |
| return String(a).replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">") | |
| }; | |
| bradio.lang.string.format = function(a, b) { | |
| var a = String(a), c = Array.prototype.slice.call(arguments, 1), d = Object.prototype.toString; | |
| return c.length ? (c = 1 == c.length ? null !== b && /\[object Array\]|\[object Object\]/.test(d.call(b)) ? b : c : c, a.replace(/#\{(.+?)\}/g, function(a, b) { | |
| var g = c[b]; | |
| "[object Function]" == d.call(g) && (g = g(b)); | |
| return "undefined" == typeof g ? "" : g | |
| })) : a | |
| }; | |
| bradio.lang.string.getByteLength = function(a) { | |
| return String(a).replace(/[^\x00-\xff]/g, "ci").length | |
| }; | |
| bradio.lang.string.subByte = function(a, b, c) { | |
| a = String(a); | |
| c = c || ""; | |
| if (0 > b || bradio.lang.string.getByteLength(a) <= b) | |
| return a + c; | |
| a = a.substr(0, b).replace(/([^\x00-\xff])/g, "$1 ").substr(0, b).replace(/[^\x00-\xff]$/, "").replace(/([^\x00-\xff]) /g, "$1"); | |
| return a + c | |
| }; | |
| bradio.lang.string.convertTime = function(a) { | |
| var b, a = Math.round(a / 1E3); | |
| b = Math.floor(a / 60); | |
| a %= 60; | |
| return T.number.pad(b, 2) + ":" + T.number.pad(a, 2) | |
| }; | |
| bradio.namespace("bradio.lang"); | |
| bradio.lang.Class = function() { | |
| var a = {extend: function(b) { | |
| $.extend(a, b) | |
| }}; | |
| return a | |
| }; | |
| bradio.namespace("bradio.lang"); | |
| bradio.lang.Enumerable = function(a) { | |
| var b = bradio.lang.Class(), c = bradio.lang.string.ucFirst, d = {raw: function() { | |
| return a | |
| },loadRaw: function(b, c) { | |
| var d; | |
| if (c) { | |
| d = {}; | |
| for (var i in c) | |
| d[c[i]] = a[c[i]] | |
| } | |
| a = $.extend(!0, a, b); | |
| d && (a = $.extend(!0, a, d)) | |
| },clone: function() { | |
| return $.extend(!0, {}, b) | |
| }}; | |
| for (p in a) | |
| d["set" + c(p)] = function(b) { | |
| return function(c) { | |
| "undefined" != a[b] && a[b] != c && (a[b] = c) | |
| } | |
| }(p), d["get" + c(p)] = function(b) { | |
| return function() { | |
| return a[b] | |
| } | |
| }(p); | |
| b.extend(d); | |
| return b | |
| }; | |
| bradio.namespace("bradio.lang"); | |
| bradio.lang.Iterable = function() { | |
| var a = bradio.lang.Class(), b = 0, c = []; | |
| a.extend({getData: function() { | |
| return c | |
| },load: function(a) { | |
| c = a | |
| },getLength: function() { | |
| return c.length | |
| },getIndex: function() { | |
| return b | |
| },setIndex: function(a) { | |
| b = a | |
| },next: function() { | |
| b = b + 1 > c.length - 1 ? c.length - 1 : b + 1; | |
| return c[b] | |
| },prev: function() { | |
| b = 0 > b - 1 ? 0 : b + 1; | |
| return c[b] | |
| },get: function(a) { | |
| return c[a] | |
| },set: function(a, b) { | |
| c[a] = b | |
| },push: function(a) { | |
| return c.push(a) | |
| },unshift: function(a) { | |
| return c.unshift(a) | |
| },pop: function() { | |
| return c.pop() | |
| },shift: function() { | |
| return c.shift() | |
| }, | |
| slice: function(a, b) { | |
| return c.slice(a, b) | |
| },splice: function(a, b) { | |
| return c.splice(a, b) | |
| },page: function(a, b) { | |
| return c.slice(a * b, Math.min(c.length, (a + 1) * b)) | |
| },clear: function() { | |
| c.splice(0, c.length) | |
| },sort: function(a) { | |
| c.sort(a) | |
| },remove: function(a) { | |
| a = $.inArray(a, c); | |
| -1 != a && c.splice(a, 1) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.lang"); | |
| bradio.lang.Bindable = function() { | |
| var a = bradio.lang.Class(), b = $(a); | |
| a.extend({bind: function(a, d) { | |
| b.bind(a, d) | |
| },unbind: function(a, d) { | |
| try { | |
| b.unbind(a, d) | |
| } catch (e) { | |
| } | |
| },trigger: function(a, d) { | |
| b.trigger(a, d) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.Constant = {Path: {LS_PATH: "http://music.baidu.com/data/music/fmlink",LRC_PATH: "",ARTIST_PATH: "http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.artist.getInfo&format=json",SUGGEST_PATH: "http://openapi.baidu.com/public/2.0/mp3/info/suggestion?format=json",LOG_PATH: "http://static.mp3.baidu.com/wd/radiostat.gif",LOG_PATH_NS: "http://nsclick.baidu.com/v.gif",DATA_BASE: "/dev/api/"},PlayStatus: {INIT: "init",READY: "ready",STOP: "stop",PLAY: "play",PAUSE: "pause",END: "end",ERROR: "error", | |
| BUFFERING: "buffering",PREBUFFER: "pre-buffer"},Behaviour: {SONG: {PREV: "1|3|1",SKIP: "1|4|1",LOVE: "1|1|1",DELOVE: "2|1|1",HATE: "1|2|1",DEHATE: "2|2|1",COMPLETE: "1|5|1"},ARTIST: {LOVE: "1|1|2",DELOVE: "2|1|2",HATE: "1|2|2",DEHATE: "2|2|2"}},FavStatus: {LIKE: "status_like",DISLIKE: "status_dislike",NORMAL: "status_normal",NONE: "status_none"},ChannelDescriptions: [{channel: "lovesongs",content: "红心歌曲越多,私人频道越懂你~"}, {channel: "private",content: "打开就有好音乐 遇见未知的精彩"}, {channel: "public_tuijian_suibiantingting",content: "去私人频道~ 推荐歌曲更符合口味~", | |
| onclick: function() { | |
| FM.loadChannel("private") | |
| }}, {channel: "public_tuijian_rege",content: "近期最热门的歌就在这里了!"}, {channel: "public_tuijian_billboard",content: "Billboard金曲全收录 最Hot欧美大流行"}, {channel: "public_tuijian_ktv",content: "网罗百听不厌的K歌金曲"}, {channel: "public_tuijian_wangluo",content: "你不能错过的 最红网络流行曲!"}, {channel: "public_tuijian_chengmingqu",content: "还记得你与他们/她们相遇的第一首歌吗?"}, {channel: "public_tuijian_yingshi",content: "熟悉的旋律 唤醒散落在影视剧里的回忆"}, {channel: "public_tuijian_kaiche",content: "那些适合开车时听的歌 "}, {channel: "public_shiguang_jingdianlaoge", | |
| content: "让我们聆听经典,回味青春。"}, {channel: "public_shiguang_70hou",content: "往日的流行 今日的经典 那是属于我们的美好年代"}, {channel: "public_shiguang_80hou",content: "一起听 那些陪伴80后成长的歌~"}, {channel: "public_shiguang_90hou",content: "“年轻”没有定义,心与音乐共鸣!"}, {channel: "public_shiguang_xinge",content: "第一时间收听潮流新曲 让耳朵新鲜每一天!"}, {channel: "public_shiguang_erge",content: "陪宝贝唱一首童真的歌"}, {channel: "public_shiguang_lvxing",content: "音乐是旅途里的回忆 也是梦想中的目的地"}, {channel: "public_shiguang_yedian",content: "跟着节奏一起舞动,点燃你的激情!"}, {channel: "public_fengge_minyao",content: "放慢脚步 任时光流淌成一首温暖的歌"}, | |
| {channel: "public_fengge_liuxing",content: "全球流行音乐全搜罗"}, {channel: "public_fengge_dj",content: "国内外嗨爆DJ舞曲大集结!"}, {channel: "public_fengge_qingyinyue",content: "抛开尘世的喧嚣 直抵心灵的避风港"}, {channel: "public_fengge_xiaoqingxin",content: "只属于你的清新小世界"}, {channel: "public_fengge_zhongguofeng",content: "在悠扬的旋律中感受流行音乐里的东方味道"}, {channel: "public_fengge_yaogun",content: "就是爱听摇滚乐!"}, {channel: "public_fengge_dianyingyuansheng",content: "经典的故事 流转的旋律"}, {channel: "public_xinqing_huankuai",content: "快乐的时候就要听快乐的歌"}, {channel: "public_xinqing_jimo", | |
| content: "一个人的时光 我只想静静听一首歌"}, {channel: "public_xinqing_shanggan",content: "心情不好的时候 情感共鸣是最好的安慰"}, {channel: "public_xinqing_tianmi",content: "绽放在心里的小甜蜜 忍不住地嘴角上扬"}, {channel: "public_xinqing_qingge",content: "总有一首歌 陪你走过爱情旅程"}, {channel: "public_xinqing_shuhuan",content: "舒缓的节奏 安静地陪伴"}, {channel: "public_xinqing_yonglanwuhou",content: "用音乐 冲泡一杯清香惬意的下午茶"}, {channel: "public_xinqing_qingsongjiari",content: "抛开烦恼,尽享假日的轻松自在!"}, {channel: "public_yuzhong_huayu",content: "经典之外 让好音乐不再错过"}, {channel: "public_yuzhong_oumei",content: "那些你听过的、没听过的、最动听的英文歌"}, | |
| {channel: "public_yuzhong_riyu",content: "网罗最In流行曲 聆听最正日本范儿"}, {channel: "public_yuzhong_hanyu",content: "K-pop正流行!"}, {channel: "public_yuzhong_yueyu",content: "聆听粤语里的百转千回"}, {channel: "public_tuijian_winter",content: "这个冬天,你需要一首暖心的歌"}],Etc: {PRIVATE_CHANNEL_ID: "private",LOVE_CHANNEL_ID: "lovesongs",DEFAULT_CHANNEL_ID: "public_yuzhong_huayu"}}; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.Event = {Base: {DATA_LOADED: "event_core_data_loaded",DATA_FAILED: "event_core_data_failed"},View: {PLAY: "event_view_play",PAUSE: "event_view_pause",SKIP: "event_view_skip",PREV: "event_view_prev",VOLUME: "event_view_volume",VOLUME_SHOW: "event_view_volume_show",MUTE: "event_view_mute",UNMUTE: "event_view_unmute",DOWNLOAD: "event_view_download",COVER_CLICK: "event_view_cover_click",ARTIST_LOVE: "event_view_ARTIST_love",ARTIST_DELOVE: "event_view_ARTIST_delove",ARTIST_HATE: "event_view_ARTIST_hate",ARTIST_DEHATE: "event_view_ARTIST_dehate", | |
| SONG_PLAY: "event_view_song_play",SONG_LOVE: "event_view_song_love",SONG_DELOVE: "sevent_view_song_delove",SONG_HATE: "event_view_song_hate",SONG_DEHATE: "event_view_song_dehate",FAVLIST_SONG_DELOVE: "event_view_fav_list_song_delove",FAVLIST_SONG_PLAY: "event_view_fav_list_song_play",FAVLIST_ARTIST_DELOVE: "event_view_fav_list_artist_delove",CHANNEL_SWITCH: "event_view_channel_list_channel_switch",CHANNEL_SELECTOR: "event_view_channel_list_show",PROMOTIONBAR_SHOW: "event_view_pb_show",PROMOTIONBAR_HIDE: "event_view_pb_hide", | |
| PROMOTIONBAR_CLICK: "event_view_pb_click",USER_NAME_CLICK: "event_view_user_bar_username_click",LISTEN_COUNT_CLICK: "event_view_user_bar_listen_count_click",LOVE_COUNT_CLICK: "event_view_user_bar_love_count_click",HATE_COUNT_CLICK: "event_view_user_bar_hate_count_click",USER_CENTER_CLICK: "event_view_user_bar_usercenter_click",LOGOUT_CLICK: "event_ui_userbar_logout_click",SHARE: "event_view_sharebar_share",CHANNELBAR_TIPS_CLICK: "event_view_channelbar_tips_click",CHANNELBAR_TIPS_SHOW: "event_view_channelbar_tips_show", | |
| CHANNELBAR_TIPS_CLOSE: "event_view_channelbar_tips_close",ARTIST_CLICK: "event_view_player_artist_click",SONG_CLICK: "event_view_player_song_click",ALBUM_CLICK: "event_view_player_album_click"},Model: {DEFAULT_CHANNEL: "event_model_default_channel",CHANNEL_LOADED: "event_model_channel_loaded",CHANNEL_SWITCHED: "event_model_channel_switched",PLAY_STATUS: "event_model_play_status",TIME_INFO: "event_model_time_info",USER_INFO: "event_model_user_info",CHANNEL_LIST: "event_model_channel_list",PLAY_LIST: "event_model_play_list", | |
| FAV_DATA_UPDATED: "event_model_fav_data_updated",SONG_INFO: "event_model_song_info",SONG_INFO_ITEM_ERROR: "event_model_song_info_item_error",SONG_LINK: "event_model_song_link",SONG_READY: "event_model_song_ready",SONG_INFO_LOADED: "event_model_song_info_loaded",SONG_INFO_FAILED: "event_model_song_info_failed",SONG_INFO_ALL_FAILED: "event_model_song_info_all_failed",LINK_ERROR: "event_model_link_error",LRC: "event_model_lrc",LOAD_PROGRESS: "event_model_load_progress",PLAY_COMPLETE: "event_model_play_complete", | |
| PLAY_ERROR: "event_model_play_error",LOAD_ERROR: "event_model_load_error",PLAY_ERROR_RECOVERED: "event_model_play_error_recovered",PLAYLIST_INITED: "event_model_playlist_inited",FAV_COUNT_UPDATED: "event_model_fav_count_update",FAV_ARTIST_UPDATED: "event_model_fav_artists_update",FAV_SONG_UPDATED: "event_model_fav_song_updated",LISTEN_RECORD_UPDATED: "event_model_listen_record_updated",LOVE_RECORD_UPDATED: "event_model_love_record_updated",HATE_RECORD_UPDATED: "event_model_hate_record_updated",VOLUME: "event_model_volume", | |
| ENV_UPDATED: "event_model_env_updated"},UI: {SceneMgr: {PAGE_SWITCH: "event_ui_scene_mgr_page_switch"},GuideScene: {CLICK: "event_ui_guideScene_click"},Player: {SONG_LOVE: "event_ui_player_song_love",SONG_DELOVE: "event_ui_player_song_delove",SONG_HATE: "event_ui_player_song_hate",SONG_DEHATE: "event_ui_player_song_dehate",DOWNLOAD: "event_ui_player_song_download",COVER_CLICK: "event_ui_player_cover_click",ARTISTCHANNELDOOR_CLICK: "event_ui_player_artistChannelDoor_click",ARTIST_CLICK: "event_ui_player_artist_click", | |
| SONG_CLICK: "event_ui_player_song_click",ALBUM_CLICK: "event_ui_player_album_click",PLAY: "event_ui_player_song_play",PAUSE: "event_ui_player_song_pause",SKIP: "event_ui_player_song_skip",PREV: "event_ui_player_song_prev",VOLUME_SHOW: "event_ui_player_volume_show",VOLUME_CHANGE: "event_ui_player_volume_change",MUTE: "event_ui_player_mute",UNMUTE: "event_ui_player_unmute"},FavList: {BACK_PLAYER: "event_ui_song_list_back_player",SONG_PLAY: "event_ui_fav_list_song_play",SONG_LOVE: "event_ui_fav_list_song_love",SONG_DELOVE: "event_ui_fav_list_song_delove", | |
| SONG_DEHATE: "event_ui_fav_list_song_dehate",BACK_PLAYER: "event_ui_fav_list_back_player",TAB_SWITCH: "event_ui_fav_list_tab_switch"},ChannelList: {SWITCH: "event_ui_channel_list_switch"},UserBar: {USER_NAME: "event_ui_userbar_username",USER_CENTER: "event_ui_userbar_username",LISTEN_COUNT: "event_ui_userbar_listen_count",LOVE_COUNT: "event_ui_userbar_love_count",HATE_COUNT: "event_ui_userbar_hate_count",LOGOUT: "event_ui_userbar_logout"},ShareBar: {SHARE: "event_ui_sharebar_share"},ChannelBar: {SWITCH_CHANNEL: "event_ui_channelbar_switch_channel", | |
| BACK_PLAYER: "event_ui_channel_list_back_player",TIPS_CLICK: "event_ui_channelbar_tips_click",TIPS_SHOW: "event_ui_channelbar_tips_show",TIPS_CLOSE: "event_ui_channelbar_tips_close"},ChannelBtn: {CLICK: "event_ui_channelbtn_click"},PromotionBar: {SHOW: "event_ui_promotionbar_show",HIDE: "event_ui_promotionbar_hide",CLICK: "event_ui_promotionbar_click"},Tooltip: {CLOSE: "event_ui_tooltip_close"},Slider: {UPDATE: "event_ui_slider_update"},ScrollBar: {UPDATE: "event_ui_scrollbar_update"},ColdStart: {SINGERLIST_RENDER: "event_ui_coldStart_singerList_render", | |
| SEARCHLIST_RENDER: "event_ui_coldStart_searchList_render",SKIP: "event_ui_coldStart_skip",POST_SINGERLIST: "event_ui_coldStart_singerList_post",COMPLETE_CHANGE: "event_ui_coldStart_autoComplete_change"}},Providable: {Behaviour: {FAV_COUNT_UPDATED: "event_behaviour_count_update",FAV_SONG_UPDATED: "event_behaviour_song_updated",FAV_DATA_UPDATED: "event_behaviour_data_updated",LISTEN_RECORD_UPDATED: "event_behaviour_listen_record_updated",LOVE_RECORD_UPDATED: "event_behaviour_love_record_updated",HATE_RECORD_UPDATED: "event_behaviour_hate_record_updated"}, | |
| Song: {SONG_INFO: "event_song_song_info",SONG_INFO_ERROR: "event_song_song_info_error",ALL_FAILED: "event_song_song_all_failed"},Artist: {ARTIST_INFO: "event_artist_artist_info"},Coldstart: {SINGER_LIST: "event_providable_coldstart_singer_list",SUBMITTED: "event_providable_coldstart_submitted"}},Playlist: {INITED: "event_playlist_init",SONG: "event_playlist_song"},PlayStrategy: {LOAD_CHANNEL: "event_play_strategy_load_channel"},AudioKernel: {INITED: "event_audiokernel_inited",INIT_FAILED: "event_audiokernel_init_failed", | |
| PLAY_STATUS: "event_audiokernel_play_status",PLAY_PROGRESS: "event_audiokernel_play_progress",LOAD_PROGRESS: "event_audiokernel_load_progress",ERROR: "event_audiokernel_error"},Log: {FIRST_SONG: "event_log_firstsong",SONG_LOVE: "event_log_songlove",SONG_DELOVE: "event_log_songcancellove",SONG_HATE: "event_log_songhate",SONG_DEHATE: "event_log_songdehate",SONG_SKIP: "event_log_songpass",SONG_PREV: "event_log_btnPrevClick",SONG_INFO_ITEM_ERROR: "event_log_songinfoitemerror",SONG_INFO_LOADED: "event_log_songinfoloaded", | |
| SONG_INFO_FAILED: "event_log_songinfofailed",SONG_INFO_ALL_FAILED: "event_log_songinfoallfailed",PLAY_TIMEOUT: "event_log_playtimeout",PLAY_SONG: "event_log_songplay",PLAY_END: "event_log_playend",PLAY_COMPLETE: "event_log_songcomplete",PLAY_RESULT: "event_log_playresult",PLAY_ERROR: "event_log_playerr",PLAY_NOLINK: "event_log_nolink",PLAY_60S: "event_log_playcomplete",PLAY_100MS: "event_log_playsong100ms",PLAY_LOAD_ERROR: "event_log_loadfileerr",BTN_LOVE: "event_log_btn_love",BTN_SOUND_ON: "event_log_btnSoundOnClick", | |
| BTN_SOUND_OFF: "event_log_btnSoundOffClick",BTN_COPY_LYRICS: "event_log_btnCopyLyrics",BTN_SHOW_VOLUNE: "event_log_btnShowVolume",BTN_PLAY_PAUSE: "event_log_btnPlayPause",BTN_DOWNLOAD: "event_log_btnDownload",CHANNEL_SELECTOR: "event_log_channel_selector",CHANNEL_DEFAULT: "event_log_defaultchannel",CHANEL_CHANGE: "event_log_channelchange",CHANNEL_DURATION: "event_log_channelduration",COVER_CLICK: "event_log_coverclick",CHANGE_VOLUNE: "event_log_changeVolume",SHARE: "event_log_share",PROMOTIONBAR_SHOW: "event_log_promotionbar_show", | |
| PROMOTIONBAR_HIDE: "event_log_promotionbar_hide",PROMOTIONBAR_CLICK: "event_log_promotionbar_click",CHANNELBAR_TIPS_CLICK: "event_log_channel_bar_tips_click",CHANNELBAR_TIPS_SHOW: "event_log_channel_bar_tips_show",CHANNELBAR_TIPS_CLOSE: "event_log_channel_bar_tips_close"},NSLog: {FIRST_SONG: "event_nslog_firstsong",SONG_LOVE: "event_nslog_click_singleFavor",SONG_DELOVE: "event_nslog_click_cancelFavor",SONG_HATE: "event_nslog_click_singleDel",SONG_DEHATE: "event_nslog_click_cancelDel",SONG_SKIP: "event_nslog_click_passsong", | |
| SONG_PREV: "event_nslog_click_prevsong",SONG_INFO_LOADED: "event_nslog_load",SONG_INFO_FAILED: "event_nslog_linkfail",PLAY_START: "event_nslog_playstart",PLAY_END: "event_nslog_playend",PLAY_COMPLETE: "event_nslog_playcomplete",PLAY_100MS: "event_nslog_playsong100ms",PLAY_ERROR: "event_nslog_playerr",PLAY_60S: "event_nslog_60play",PLAY_LOAD_ERROR: "event_nslog_loadfileerr",CHANNEL_SELECTOR: "event_nslog_click_channel",CHANEL_CHANGE: "event_nslog_click_changechannel",BTN_PLAY_PAUSE: "event_nslog_click_playpausebtn", | |
| BTN_DOWNLOAD: "event_nslog_click_download",COVER_CLICK: "event_nslog_click_cover",SHARE: "event_nslog_click_share",CLICK: "event_nslog_click"}}; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.Model = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event, c = bradio.core.Event.Model, d = b.Providable, e = bradio.core.Constant, f = bradio.core.Constant.Behaviour, g = [], i = bradio.data.enumerable.User(), j = bradio.core.AudioKernel(), n = bradio.data.providable.Cookie(), l = bradio.data.providable.Behaviour(), m = bradio.data.providable.Channel(), k = bradio.data.providable.ChannelList(), q = bradio.data.providable.Song(), u = bradio.data.providable.Lyrics(), s = bradio.lang.Iterable(), o = bradio.data.iterable.Playlist(); | |
| bradio.data.enumerable.Song(); | |
| var r = bradio.data.enumerable.Channel(), v = "", x = {}, y = !1, z = !0, w = !1, A = {user: i,operation: "",currentChannel: null,kv: x}, E = "lovesongs public_fengge_qingyinyue public_tuijian_billboard public_yuzhong_oumei public_yuzhong_riyu public_yuzhong_hanyu public_yuzhong_yueyu public_shiguang_erge".split(" "), t = {}, D = function() { | |
| return j.getVolume() | |
| }, B = function() { | |
| y = !1; | |
| o.next() | |
| }, C = function() { | |
| return o.getCurrentSong() || bradio.data.enumerable.Song() | |
| }, I = function(a) { | |
| return o.getPrevSong(a) | |
| }, F = | |
| function(b, d) { | |
| A[b] = d; | |
| a.trigger(c.ENV_UPDATED, {field: b}) | |
| }; | |
| a.extend({getStatus: function() { | |
| return j.getStatus() | |
| },getSongBytesTotal: function() { | |
| return j.getBytesTotal() | |
| },setCurrentPosition: function(a) { | |
| j.setCurrentPosition(a) | |
| },getCurrentPosition: function() { | |
| return j.getCurrentPosition() | |
| },getCurrentPositionString: function() { | |
| return "-" + bradio.lang.string.convertTime(C().getDuration() - j.getCurrentPosition()) | |
| },getTotalTime: function() { | |
| return j.getTotalTime() | |
| },getTotalTimeString: function() { | |
| return j.getTotalTimeString() | |
| }, | |
| getLoadedPercent: function() { | |
| return j.getLoadedPercent() | |
| },mute: function() { | |
| return j.setMute(!0) | |
| },unmute: function() { | |
| return j.setMute(!1) | |
| },getMute: function() { | |
| return j.getMute() | |
| },setVolume: function(b) { | |
| if (b != D()) | |
| return a.trigger(c.VOLUME, {volume: b}), j.setVolume(b) | |
| },getVolume: D,getDefaultViewPath: function() { | |
| return n.getDefaultViewPath() | |
| },getViewPath: function() { | |
| return n.getViewPath() | |
| },getUserInfo: function() { | |
| return i | |
| },setChannelList: function(a) { | |
| s.load(a) | |
| },getChannelList: function() { | |
| return s | |
| },getSongList: function() { | |
| return l.favSongList() | |
| }, | |
| play: function() { | |
| j.play() | |
| },pause: function() { | |
| j.pause() | |
| },stop: function() { | |
| j.stop() | |
| },setAudioUrl: function(a) { | |
| j.setUrl(a) | |
| },getAudioUrl: function() { | |
| return j.getUrl() | |
| },getBehaviourPrvdr: function() { | |
| return l | |
| },getChannelListPrvdr: function() { | |
| return k | |
| },getCurrentSong: C,getPrevSong: I,next: B,prev: function() { | |
| F("operation", "prev"); | |
| y = !0; | |
| l.log(f.SONG.PREV, C(), r); | |
| o.prev() | |
| },skip: function() { | |
| F("operation", "skip"); | |
| y = !1; | |
| l.log(f.SONG.SKIP, C(), r); | |
| o.skip() | |
| },queueSong: function(a) { | |
| o.queue(a) | |
| },loveSong: function(b) { | |
| F("operation", | |
| "love"); | |
| l.log(f.SONG.LOVE, b, r); | |
| a.trigger(c.SONG_INFO, {status: "update",currentSong: C(),prevSong: y ? bradio.data.enumerable.Song() : I()}) | |
| },deloveSong: function(b) { | |
| F("operation", "delove"); | |
| l.log(f.SONG.DELOVE, b, r); | |
| a.trigger(c.SONG_INFO, {status: "update",currentSong: C(),prevSong: y ? bradio.data.enumerable.Song() : I()}) | |
| },hateSong: function(b) { | |
| F("operation", "hate"); | |
| l.log(f.SONG.HATE, b, r); | |
| a.trigger(c.SONG_INFO, {status: "update",currentSong: C(),prevSong: y ? bradio.data.enumerable.Song() : I()}); | |
| b.toKeyString() == C().toKeyString() && | |
| (o.hate(b), o.remove(b)) | |
| },dehateSong: function(b) { | |
| F("operation", "dehate"); | |
| l.log(f.SONG.DEHATE, b, r); | |
| a.trigger(c.SONG_INFO, {status: "update",currentSong: C(),prevSong: y ? bradio.data.enumerable.Song() : I()}) | |
| },complete: function() { | |
| l.log(f.SONG.COMPLETE, C(), r); | |
| o.complete() | |
| },error: function() { | |
| y = !1; | |
| o.error() | |
| },setCurrentChannel: function(b) { | |
| if (r.getId() != b.getId() || r.getName() != b.getName()) | |
| "" != r.getName() && (z = !1), r = b, F("currentChannel", b), x.channelTimestamp = (new Date).getTime(), o.setAdable(-1 == $.inArray(r.getId(), | |
| E) && !/artist|tag/.test(r.getId())), a.trigger(c.CHANNEL_SWITCHED) | |
| },getCurrentChannel: function() { | |
| return r | |
| },getChannelList: function() { | |
| return s | |
| },loadChannel: function(a, b) { | |
| x.firstChannelLoaded || (x.firstChannelLoaded = !0, x.user_source = n.getShareSource(), "" != n.getDefaultSongId() && (b = +n.getDefaultSongId())); | |
| m.load(a, b) | |
| },loadPlayList: function(a, b) { | |
| o.load(a, b); | |
| q.load(a.slice(0, 30)) | |
| },getKV: function() { | |
| return x | |
| },getEnvObj: function() { | |
| return A | |
| },getEnv: function(a) { | |
| a = a ? a : C() ? C() : bradio.data.enumerable.Song(); | |
| t.song_id = | |
| a.getId(); | |
| t.song_title = a.getName(); | |
| t.song_version = a.getVersion(); | |
| t.singer_id = a.getPlainArtistIds(); | |
| t.singer_name = a.getPlainArtists(); | |
| t.album_id = a.getAlbumId(); | |
| t.album_name = a.getAlbum(); | |
| t.copyType = a.getCopyType(); | |
| t.format = a.getFormat(); | |
| t.rate = a.getRate(); | |
| t.relateStatus = a.getRelateStatus(); | |
| t.resourceType = a.getResourceType(); | |
| t.songSize = j.getBytesTotal(); | |
| t.loadSize = j.getBytesLoaded(); | |
| t.title = a.toTitleString(); | |
| t.channel = r.getId(); | |
| t.link = j.getUrl() || ""; | |
| t.position = j.getCurrentPosition(); | |
| t.isAd = a.getIsAd() + | |
| ""; | |
| t.songPlayedCount = o.getSongPlayedCount(); | |
| t.channelduration = ((new Date).getTime() - x.channelTimestamp) / 1E3; | |
| t.bufferCount = j.getBufferCount(); | |
| t.bufferLength = j.getBufferLength(); | |
| t.playStatus = j.getStatus(); | |
| t.bytesTotal = j.getBytesTotal(); | |
| t.bytesLoaded = j.getBytesLoaded(); | |
| t.startTimestamp = j.getStartTimestamp(); | |
| t.connectTimestamp = j.getConnectTimestamp(); | |
| t.fromstart = j.getTimeFromStart(); | |
| t.start2play = j.getStart2Play(); | |
| t.user = i.getUserName() || ""; | |
| t.duration = j.getTotalTime(); | |
| t.durationRaw = a.getDuration(); | |
| t.playengine = | |
| j.getCurEngine(); | |
| t.lrc = a.getLrcLink(); | |
| t.cover = a.getCover(); | |
| t.user_source = x.user_source || ""; | |
| t.referrer = document.referrer; | |
| t.method_commend = a.getRecommendMethod(); | |
| t.result = 100 < j.getCurrentPosition() ? "success" : "fail"; | |
| t.source = "pcweb"; | |
| return t | |
| },getNextAvailLink: function() { | |
| var a = ""; | |
| g.length && (a = g.splice(0, 1)[0], a += (-1 != a.indexOf("?") ? "&" : "?") + "_=" + +new Date); | |
| return a | |
| },getPendingLink: function() { | |
| return v | |
| },setPendingLink: function(a) { | |
| v = a | |
| },getCurrentLink: function() { | |
| return j.getUrl() | |
| },loadSongLink: function(a) { | |
| j.setUrl(a) | |
| }, | |
| logChannelHistory: function(a) { | |
| n.setDefaultChannelId(a.getId()) | |
| },setLoginInfo: function(b) { | |
| var d = i.getLogined(); | |
| i.setUserId(+b.user_id); | |
| i.setUserName(b.user_name); | |
| i.setLogined("" != i.getUserName()); | |
| l.setUserInfo(i); | |
| !d && i.getLogined && l.refresh(!0); | |
| l.updateFavCount(); | |
| a.trigger(c.USER_INFO) | |
| },isLogined: function() { | |
| return i.getLogined() | |
| }}); | |
| var G = b.Base, L = b.Providable.Behaviour, M = b.Playlist, b = b.AudioKernel; | |
| l.bind(G.DATA_LOADED, function(b, d) { | |
| var e = $.map(o.getAllHistory().slice(-10), function(a) { | |
| return a.getId() | |
| }), | |
| f = $.grep(d.rawData, function(a) { | |
| return -1 == $.inArray(a.id, e) | |
| }); | |
| a.trigger(c.CHANNEL_LOADED, {id: d.id,name: d.name,rawData: f,force: !1}) | |
| }); | |
| l.bind(L.FAV_SONG_UPDATED, function() { | |
| a.trigger(c.FAV_SONG_UPDATED) | |
| }); | |
| l.bind(L.FAV_COUNT_UPDATED, function(b, d) { | |
| i.setUserId(+d.user_id); | |
| i.setUserName(d.user_name); | |
| i.setLogined("" != i.getUserName()); | |
| F("userInfo", i); | |
| a.trigger(c.USER_INFO); | |
| a.trigger(c.FAV_COUNT_UPDATED); | |
| l.setUserInfo(i); | |
| if (!w) { | |
| w = !0; | |
| var e = n.getDefaultChannelId(); | |
| "public_tuijian_suibiantingting" == e && (e = s.get(Math.floor(Math.random() * | |
| s.getLength() - 3) + 3).getId(), i.getLogined() && (e = "private")); | |
| "" != n.getShareSource() && i.getLogined() && (e = "private"); | |
| a.trigger(c.DEFAULT_CHANNEL, {id: e}) | |
| } | |
| }); | |
| l.bind(L.LISTEN_RECORD_UPDATED, function(b, d) { | |
| a.trigger(c.LISTEN_RECORD_UPDATED, d) | |
| }); | |
| l.bind(L.LOVE_RECORD_UPDATED, function(b, d) { | |
| a.trigger(c.LOVE_RECORD_UPDATED, d) | |
| }); | |
| l.bind(L.HATE_RECORD_UPDATED, function(b, d) { | |
| a.trigger(c.HATE_RECORD_UPDATED, d) | |
| }); | |
| m.bind(G.DATA_LOADED, function(b, d) { | |
| a.trigger(c.CHANNEL_LOADED, {id: d.id,name: d.name,rawData: d.rawData,force: !0}) | |
| }); | |
| m.bind(G.DATA_FAILED, function() { | |
| }); | |
| k.bind(G.DATA_LOADED, function(b, d) { | |
| for (var e, f, g = 0, i = d.channel_list.length; g < i; g++) | |
| f = d.channel_list[g], e = bradio.data.enumerable.Channel(), e.setName(f.channel_name), e.setId(f.channel_id), e.setCateName(f.cate), e.setCateId(f.cate_id), e.setPos(f.channel_order + 0), s.push(e); | |
| e = bradio.data.enumerable.Channel(); | |
| e.setName("私人频道"); | |
| e.setId("private"); | |
| e.setCateName("private"); | |
| e.setCateId("private"); | |
| e.setPos(0); | |
| s.push(e); | |
| e = bradio.data.enumerable.Channel(); | |
| e.setName("红心频道"); | |
| e.setId("lovesongs"); | |
| e.setCateName("love"); | |
| e.setCateId("love"); | |
| e.setPos(1); | |
| s.push(e); | |
| s.sort(function(a, b) { | |
| return a.getPos() == b.getPos() ? 0 : a.getPos() > b.getPos() ? 1 : -1 | |
| }); | |
| a.trigger(c.CHANNEL_LIST) | |
| }); | |
| k.bind(G.DATA_FAILED, function() { | |
| }); | |
| q.bind(G.DATA_LOADED, function(b, d) { | |
| a.trigger(c.SONG_INFO_LOADED, d) | |
| }); | |
| q.bind(G.DATA_FAILED, function(b, d) { | |
| a.trigger(c.SONG_INFO_FAILED, d); | |
| o.stage() | |
| }); | |
| q.bind(d.Song.ALL_FAILED, function(b, d) { | |
| a.trigger(c.SONG_INFO_ALL_FAILED, d) | |
| }); | |
| q.bind(d.Song.SONG_INFO, function(a, b) { | |
| 2 < b.song.getResourceType() && r.getId() != | |
| e.Etc.LOVE_CHANNEL_ID || o.updateSong(b.song) | |
| }); | |
| q.bind(d.Song.SONG_INFO_ERROR, function(b, d) { | |
| a.trigger(c.SONG_INFO_ITEM_ERROR, d) | |
| }); | |
| u.bind(G.DATA_LOADED, function(b, d) { | |
| d.song.getId() == C().getId() && a.trigger(c.LRC, {data: d.data}) | |
| }); | |
| o.bind(M.SONG, function(b, d) { | |
| g = []; | |
| C().getHated() ? 1 < o.getLength() && B() : (a.trigger(c.SONG_INFO, {status: d.status,auto: d.auto,currentSong: C(),prevSong: y || !z ? bradio.data.enumerable.Song() : I()}), "update" == d.status && F("operation", "next"), u.load(C()), z = !0, g.push(C().getLink()), a.trigger(c.SONG_READY), | |
| 0 < o.getRawLength() - o.getLength() && 5 > o.getLength() - o.getIndex() && q.load(o.getRawData().slice(o.getLength(), Math.min(o.getRawLength(), o.getLength() + 10)))) | |
| }); | |
| o.bind(M.INITED, function() { | |
| a.trigger(c.PLAYLIST_INITED) | |
| }); | |
| j.bind(b.INITED, function() { | |
| }); | |
| j.bind(b.INIT_FAILED, function() { | |
| }); | |
| j.bind(b.PLAY_STATUS, function(b, d) { | |
| a.trigger(c.PLAY_STATUS, d) | |
| }); | |
| j.bind(b.PLAY_PROGRESS, function(b, d) { | |
| a.trigger(c.TIME_INFO, d) | |
| }); | |
| j.bind(b.LOAD_PROGRESS, function() { | |
| }); | |
| j.bind(b.ERROR, function() { | |
| a.trigger(c.PLAY_ERROR) | |
| }); | |
| return a | |
| }; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.View = function(a) { | |
| var b = bradio.lang.Bindable(), c = bradio.core.Event, d = c.Model, e = c.View, c = c.UI, f = c.FavList, g = c.Player, i = bradio.ui.SceneMgr(), j = bradio.ui.Background(), n = bradio.ui.UserBar(), l = bradio.ui.ShareBar(), m = bradio.ui.PromotionBar(), k = bradio.ui.PlayerPanel(), q = bradio.ui.Lyrics(), u = bradio.ui.ChannelList(), s = bradio.ui.ChannelBar(), o = bradio.ui.FavList(), r = $(".radio-logo a:first"), v = function(a, b) { | |
| "undefined" == typeof b && (b = 0); | |
| $("#jq-tooltip").remove(); | |
| _hmt.push(["_trackPageview", "/scene/" + | |
| a + "/" + b]); | |
| i.switchScene(a); | |
| 2 == a ? j.hide() : j.show(); | |
| 2 == a && o.showTab(b); | |
| 1 == a && q.refresh(); | |
| 1 != a ? $("#weibo-activity").addClass("hidden") : $("#weibo-activity").removeClass("hidden") | |
| }; | |
| b.extend({switchScene: function(a, b) { | |
| v(a, b) | |
| },hideTooltip: function() { | |
| $("#jq-tooltip").remove() | |
| },showMobileInit: function() { | |
| k.showMobileInit() | |
| }}); | |
| a.bind(d.ENV_UPDATED, function(b, c) { | |
| m.test(a.getEnvObj(), c.field) | |
| }); | |
| a.bind(d.USER_INFO, function() { | |
| n.setUserInfo(a.getUserInfo()); | |
| k.setUserInfo(a.getUserInfo()); | |
| u.setUserInfo(a.getUserInfo()); | |
| o.setUserInfo(a.getUserInfo()); | |
| a.getUserInfo().getLogined() ? $("#fm-main").addClass("logined") : $("#fm-main").removeClass("logined") | |
| }); | |
| a.bind(d.CHANNEL_LIST, function() { | |
| u.setChannelList(a.getChannelList()) | |
| }); | |
| a.bind(d.CHANNEL_SWITCHED, function() { | |
| s.setCurrentChannel(a.getCurrentChannel()); | |
| u.setCurrentChannel(a.getCurrentChannel()); | |
| j.setCurrentChannel(a.getCurrentChannel()); | |
| k.setCurrentChannel(a.getCurrentChannel()) | |
| }); | |
| a.bind(d.FAV_COUNT_UPDATED, function() { | |
| n.setListenCount(a.getBehaviourPrvdr().getListenCount()); | |
| n.setLoveSongCount(a.getBehaviourPrvdr().getLoveSongCount()); | |
| n.setHateSongCount(a.getBehaviourPrvdr().getHateSongCount()); | |
| o.setHistoryListenCount(a.getBehaviourPrvdr().getListenCount()); | |
| o.setLikeSongsCount(a.getBehaviourPrvdr().getLoveSongCount()); | |
| o.setDislikeSongsCount(a.getBehaviourPrvdr().getHateSongCount()); | |
| u.setLoveSongsAvail(0 < a.getBehaviourPrvdr().getLoveSongCount()) | |
| }); | |
| a.bind(d.LISTEN_RECORD_UPDATED, function(a, b) { | |
| o.setSongsToRender(b.list, 0) | |
| }); | |
| a.bind(d.LOVE_RECORD_UPDATED, function(a, b) { | |
| o.setSongsToRender(b.list, | |
| 1) | |
| }); | |
| a.bind(d.HATE_RECORD_UPDATED, function(a, b) { | |
| o.setSongsToRender(b.list, 2) | |
| }); | |
| a.bind(d.SONG_INFO, function(a, b) { | |
| b.currentSong && (k.setCurrentSong(b.currentSong, b.status), k.setPrevSong(b.prevSong, b.status), q.setCurrentSong(b.currentSong), l.setCurrentSong(b.currentSong), "update" != b.status && q.load("")) | |
| }); | |
| a.bind(d.SONG_LINK, function() { | |
| }); | |
| a.bind(d.TIME_INFO, function() { | |
| k.setTimeInfo(a.getCurrentPositionString()); | |
| q.setPosition(a.getCurrentPosition()) | |
| }); | |
| a.bind(d.LRC, function(a, b) { | |
| q.load(b.data) | |
| }); | |
| a.bind(d.VOLUME, | |
| function(a, b) { | |
| k.setVolume(b.volume) | |
| }); | |
| a.bind(d.PLAY_STATUS, function(a, b) { | |
| k.setPlayStatus(b); | |
| s.setPlayStatus(b) | |
| }); | |
| i.bind(c.SceneMgr.PAGE_SWITCH, function(a, b) { | |
| r.attr("title", 1 != b.index ? "返回播放界面" : "").css("cursor", 1 != b.index ? "pointer" : "default"); | |
| s.setSceneIndex(b.index) | |
| }); | |
| u.bind(c.ChannelList.SWITCH, function(a, c) { | |
| b.trigger(e.CHANNEL_SWITCH, {id: c.id}) | |
| }); | |
| o.bind(f.SONG_PLAY, function(a, c) { | |
| bradio.data.enumerable.Song().setId(c.id); | |
| b.trigger(e.SONG_PLAY, {song: c.song,src: "favlist"}) | |
| }); | |
| o.bind(f.SONG_LOVE, function(a, | |
| c) { | |
| bradio.data.enumerable.Song().setId(c.id); | |
| b.trigger(e.SONG_LOVE, {song: c.song,src: "favlist"}) | |
| }); | |
| o.bind(f.SONG_DELOVE, function(a, c) { | |
| bradio.data.enumerable.Song().setId(c.id); | |
| b.trigger(e.SONG_DELOVE, {song: c.song,src: "favlist"}) | |
| }); | |
| o.bind(f.SONG_DEHATE, function(a, c) { | |
| bradio.data.enumerable.Song().setId(c.id); | |
| b.trigger(e.SONG_DEHATE, {song: c.song,src: "favlist"}) | |
| }); | |
| o.bind(f.BACK_PLAYER, function() { | |
| v(1) | |
| }); | |
| o.bind(f.TAB_SWITCH, function(b, c) { | |
| switch (c.index) { | |
| case 0: | |
| a.getBehaviourPrvdr().loadListenRecord(c.pageIndex, | |
| c.pageSize); | |
| break; | |
| case 1: | |
| a.getBehaviourPrvdr().loadLoveRecord(c.pageIndex, c.pageSize); | |
| break; | |
| case 2: | |
| a.getBehaviourPrvdr().loadHateRecord(c.pageIndex, c.pageSize) | |
| } | |
| }); | |
| k.bind(g.PAUSE, function() { | |
| b.trigger(e.PAUSE) | |
| }); | |
| k.bind(g.PLAY, function() { | |
| b.trigger(e.PLAY) | |
| }); | |
| k.bind(g.SKIP, function() { | |
| b.trigger(e.SKIP) | |
| }); | |
| k.bind(g.PREV, function() { | |
| b.trigger(e.PREV) | |
| }); | |
| k.bind(g.DOWNLOAD, function() { | |
| b.trigger(e.DOWNLOAD) | |
| }); | |
| k.bind(g.MUTE, function() { | |
| b.trigger(e.MUTE) | |
| }); | |
| k.bind(g.UNMUTE, function() { | |
| b.trigger(e.UNMUTE) | |
| }); | |
| k.bind(g.VOLUME_CHANGE, | |
| function(a, c) { | |
| b.trigger(e.VOLUME, {volume: c.volume}) | |
| }); | |
| k.bind(g.COVER_CLICK, function() { | |
| b.trigger(e.COVER_CLICK) | |
| }); | |
| k.bind(g.SONG_LOVE, function() { | |
| b.trigger(e.SONG_LOVE, {song: a.getCurrentSong(),src: "favlist"}) | |
| }); | |
| k.bind(g.SONG_DELOVE, function() { | |
| b.trigger(e.SONG_DELOVE, {song: a.getCurrentSong(),src: "favlist"}) | |
| }); | |
| k.bind(g.SONG_HATE, function() { | |
| b.trigger(e.SONG_HATE, {song: a.getCurrentSong(),src: "favlist"}) | |
| }); | |
| k.bind(g.ARTISTCHANNELDOOR_CLICK, function(a, c) { | |
| b.trigger(e.CHANNEL_SWITCH, {id: c.id,original: "artistChannelDoor"}) | |
| }); | |
| k.bind(g.ARTIST_CLICK, function() { | |
| b.trigger(e.ARTIST_CLICK) | |
| }); | |
| k.bind(g.SONG_CLICK, function() { | |
| b.trigger(e.SONG_CLICK) | |
| }); | |
| k.bind(g.ALBUM_CLICK, function() { | |
| b.trigger(e.ALBUM_CLICK) | |
| }); | |
| n.bind(c.UserBar.USER_NAME, function() { | |
| b.trigger(e.USER_NAME_CLICK) | |
| }); | |
| n.bind(c.UserBar.USER_CENTER, function() { | |
| b.trigger(e.USER_CENTER_CLICK) | |
| }); | |
| n.bind(c.UserBar.LOGOUT, function() { | |
| b.trigger(e.LOGOUT_CLICK) | |
| }); | |
| n.bind(c.UserBar.LISTEN_COUNT, function() { | |
| b.trigger(e.LISTEN_COUNT_CLICK) | |
| }); | |
| n.bind(c.UserBar.LOVE_COUNT, function() { | |
| b.trigger(e.LOVE_COUNT_CLICK) | |
| }); | |
| n.bind(c.UserBar.HATE_COUNT, function() { | |
| b.trigger(e.HATE_COUNT_CLICK) | |
| }); | |
| l.bind(c.ShareBar.SHARE, function(a, c) { | |
| b.trigger(e.SHARE, {target: c.target}) | |
| }); | |
| s.bind(c.ChannelBar.SWITCH_CHANNEL, function() { | |
| b.trigger(e.CHANNEL_SELECTOR); | |
| v(0) | |
| }); | |
| s.bind(c.ChannelBar.BACK_PLAYER, function() { | |
| v(1) | |
| }); | |
| s.bind(c.ChannelBar.TIPS_CLICK, function() { | |
| b.trigger(e.CHANNELBAR_TIPS_CLICK) | |
| }); | |
| s.bind(c.ChannelBar.TIPS_SHOW, function() { | |
| b.trigger(e.CHANNELBAR_TIPS_SHOW) | |
| }); | |
| s.bind(c.ChannelBar.TIPS_CLOSE, function() { | |
| b.trigger(e.CHANNELBAR_TIPS_CLOSE) | |
| }); | |
| m.bind(c.PromotionBar.SHOW, function(a, c) { | |
| b.trigger(e.PROMOTIONBAR_SHOW, c) | |
| }); | |
| m.bind(c.PromotionBar.HIDE, function(a, c) { | |
| b.trigger(e.PROMOTIONBAR_HIDE, c) | |
| }); | |
| m.bind(c.PromotionBar.CLICK, function(a, c) { | |
| b.trigger(e.PROMOTIONBAR_CLICK, c) | |
| }); | |
| r.click("click", function() { | |
| v(1) | |
| }); | |
| return b | |
| }; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.Controller = function(a, b) { | |
| var c = bradio.lang.Bindable(), d = bradio.core.Event, e = d.Log, f = d.NSLog, g = d.View, i = d.Model, j = bradio.core.Constant, n = bradio.utils.Logger(), l = bradio.utils.NSLogger(), m = bradio.utils.Share(), k = bradio.utils.UA(), q = "", u, s = 0, o, r = 0, v = [j.PlayStatus.END, j.PlayStatus.ERROR], x = function(b) { | |
| var d = a.getKV(); | |
| a.getStatus() != j.PlayStatus.PAUSE && s == a.getCurrentPosition() ? a.getStatus() == j.PlayStatus.PREBUFFER || a.getStatus() == j.PlayStatus.BUFFERING ? r += 0.5 : r++ : (s = a.getCurrentPosition(), | |
| r = 0); | |
| b ? a.next() : 9 < r && 10 > d.playTimeoutRetry && (r = 0, b = a.getEnv(), d.playSong100msLogged || (d.playSong100msLogged = !0, b.result = "fail", c.trigger(e.PLAY_RESULT, b)), c.trigger(e.PLAY_TIMEOUT, b), d.playTimeoutRetry++, a.error()) | |
| }, y = function() { | |
| var c; | |
| k.isMobile() && !a.getKV().mobileInit ? (b.showMobileInit(), c = !1) : c = !0; | |
| c && (u || (u = setInterval(function() { | |
| x(false) | |
| }, 500)), "" != a.getPendingLink() && a.getPendingLink() != a.getCurrentLink() && a.loadSongLink(a.getPendingLink()), a.play()) | |
| }, z = function() { | |
| var b = a.getEnv(); | |
| c.trigger(e.SONG_SKIP, | |
| b); | |
| c.trigger(f.SONG_SKIP, b); | |
| a.skip() | |
| }, w = function(b) { | |
| a.isLogined() || (o = b.clone()); | |
| var d = a.getEnv(b); | |
| c.trigger(e.SONG_LOVE, d); | |
| c.trigger(e.BTN_LOVE, d); | |
| c.trigger(f.SONG_LOVE, d); | |
| a.loveSong(b) | |
| }, A = function(c, d) { | |
| "undefined" == typeof d && (d = ""); | |
| var e = c = decodeURIComponent(c), f = a.getChannelList(); | |
| if (!(0 < $.grep(f.getData(), function(a) { | |
| return a.getId() == e | |
| }).length) && !/^public_artist_/i.test(c) && !/^public_tag_/i.test(c)) { | |
| if ("" != a.getCurrentChannel().getId()) | |
| return; | |
| c = j.Etc.DEFAULT_CHANNEL_ID | |
| } | |
| if (c == a.getCurrentChannel().getId() && | |
| "" == d) | |
| return b.switchScene(1), !1; | |
| if (!a.isLogined() && -1 !== $.inArray(c, [j.Etc.PRIVATE_CHANNEL_ID, j.Etc.LOVE_CHANNEL_ID])) | |
| return q = c, M3.user.sign(), !1; | |
| if (c == j.Etc.LOVE_CHANNEL_ID && 0 == a.getBehaviourPrvdr().getLoveSongCount()) | |
| return !1; | |
| 1 == a.getViewPath() && b.switchScene(1); | |
| a.loadChannel(c, d); | |
| return !0 | |
| }, E = function(b) { | |
| $.cookie("fm_dv", b, {expires: 365}); | |
| a.setVolume(b) | |
| }, t = function(a, b) { | |
| E(b.volume) | |
| }, D = function() { | |
| var b = a.getEnv(); | |
| c.trigger(e.PLAY_COMPLETE, b); | |
| c.trigger(f.PLAY_COMPLETE, b) | |
| }; | |
| c.extend({setChannelList: function(b) { | |
| a.getChannelListPrvdr().loadChannelListData(b) | |
| }, | |
| setLoginInfo: function(b) { | |
| a.setLoginInfo(b) | |
| },setFavCount: function(b) { | |
| a.getBehaviourPrvdr().loadFavCountData(b) | |
| },loadSongList: function() { | |
| a.loadSongList() | |
| },loadChannel: A}); | |
| b.bind(g.PLAY, function() { | |
| a.getKV().mobileInit = !0; | |
| y(); | |
| var b = a.getEnv(); | |
| c.trigger(e.BTN_PLAY_PAUSE, b); | |
| c.trigger(f.BTN_PLAY_PAUSE, b) | |
| }); | |
| b.bind(g.PAUSE, function() { | |
| a.pause(); | |
| var b = a.getEnv(); | |
| c.trigger(e.BTN_PLAY_PAUSE, b); | |
| c.trigger(f.BTN_PLAY_PAUSE, b) | |
| }); | |
| b.bind(g.SKIP, function() { | |
| z() | |
| }); | |
| b.bind(g.PREV, function() { | |
| a.prev() | |
| }); | |
| b.bind(g.SONG_PLAY, | |
| function(b, c) { | |
| var d = c.song; | |
| A(a.getCurrentChannel().getId(), d.getId()) | |
| }); | |
| b.bind(g.SONG_LOVE, function(a, b) { | |
| w(b.song) | |
| }); | |
| b.bind(g.SONG_DELOVE, function(b, d) { | |
| var g = d.song, i = a.getEnv(g); | |
| c.trigger(e.SONG_DELOVE, i); | |
| c.trigger(f.SONG_DELOVE, i); | |
| a.deloveSong(g) | |
| }); | |
| b.bind(g.SONG_HATE, function(b, d) { | |
| var g = d.song; | |
| if (a.isLogined(g)) { | |
| var i = a.getEnv(); | |
| c.trigger(e.SONG_HATE, i); | |
| c.trigger(f.SONG_HATE, i); | |
| a.hateSong(g); | |
| a.next() | |
| } | |
| }); | |
| b.bind(g.SONG_DEHATE, function(b, d) { | |
| var g = d.song; | |
| if (a.isLogined()) { | |
| var i = a.getEnv(g); | |
| c.trigger(e.SONG_DEHATE, | |
| i); | |
| c.trigger(f.SONG_DEHATE, i); | |
| a.dehateSong(g) | |
| } | |
| }); | |
| b.bind(g.VOLUME, t); | |
| b.bind(g.VOLUME_SHOW, function() { | |
| c.trigger(e.BTN_SHOW_VOLUME, a.getEnv()) | |
| }); | |
| b.bind(g.DOWNLOAD, function() { | |
| window.open("http://ting.baidu.com/song/" + a.getCurrentSong().getId() + "/download?from=fm"); | |
| var b = a.getEnv(); | |
| c.trigger(e.BTN_DOWNLOAD, b); | |
| c.trigger(f.BTN_DOWNLOAD, b) | |
| }); | |
| b.bind(g.COVER_CLICK, function() { | |
| a.pause(); | |
| var b = a.getEnv(); | |
| c.trigger(e.COVER_CLICK, b); | |
| c.trigger(f.COVER_CLICK, b) | |
| }); | |
| b.bind(g.CHANNEL_SELECTOR, function() { | |
| var b = a.getEnv(); | |
| c.trigger(e.CHANNEL_SELECTOR, b); | |
| c.trigger(f.CHANNEL_SELECTOR, b) | |
| }); | |
| b.bind(g.CHANNEL_SWITCH, function(b, d) { | |
| var g = a.getEnv(); | |
| g.to_channel = d.id; | |
| c.trigger(e.CHANEL_CHANGE, g); | |
| c.trigger(f.CHANEL_CHANGE, g); | |
| A(d.id) | |
| }); | |
| b.bind(g.USER_NAME_CLICK, function() { | |
| b.switchScene(2, 0) | |
| }); | |
| b.bind(g.LISTEN_COUNT_CLICK, function() { | |
| b.switchScene(2, 0) | |
| }); | |
| b.bind(g.LOVE_COUNT_CLICK, function() { | |
| b.switchScene(2, 1) | |
| }); | |
| b.bind(g.HATE_COUNT_CLICK, function() { | |
| b.switchScene(2, 2) | |
| }); | |
| b.bind(g.USER_CENTER_CLICK, function() { | |
| b.switchScene(2, 0) | |
| }); | |
| b.bind(g.LOGOUT_CLICK, | |
| function() { | |
| M3.user.signOut() | |
| }); | |
| b.bind(g.VOLUME, t); | |
| b.bind(g.PROMOTIONBAR_SHOW, function(b, d) { | |
| var f = a.getEnv(); | |
| f.promotion_id = d.id; | |
| c.trigger(e.PROMOTIONBAR_SHOW, f) | |
| }); | |
| b.bind(g.PROMOTIONBAR_HIDE, function(b, d) { | |
| var f = a.getEnv(); | |
| f.promotion_id = d.id; | |
| c.trigger(e.PROMOTIONBAR_HIDE, f) | |
| }); | |
| b.bind(g.PROMOTIONBAR_CLICK, function(b, d) { | |
| var f = a.getEnv(); | |
| f.promotion_id = d.id; | |
| c.trigger(e.PROMOTIONBAR_CLICK, f) | |
| }); | |
| b.bind(g.CHANNELBAR_TIPS_CLICK, function() { | |
| c.trigger(e.CHANNELBAR_TIPS_CLICK, a.getEnv()) | |
| }); | |
| b.bind(g.CHANNELBAR_TIPS_SHOW, | |
| function() { | |
| c.trigger(e.CHANNELBAR_TIPS_SHOW, a.getEnv()) | |
| }); | |
| b.bind(g.CHANNELBAR_TIPS_CLOSE, function() { | |
| c.trigger(e.CHANNELBAR_TIPS_CLOSE, a.getEnv()) | |
| }); | |
| b.bind(g.SHARE, function(b, d) { | |
| var g = a.getEnv(); | |
| g.share_target = d.target; | |
| c.trigger(e.SHARE, g); | |
| c.trigger(f.SHARE, g); | |
| m.share(d.target, a.getCurrentSong(), a.getCurrentChannel()) | |
| }); | |
| b.bind(g.ARTIST_CLICK, function() { | |
| var b = a.getEnv(); | |
| b.pos = "artist"; | |
| c.trigger(f.CLICK, b) | |
| }); | |
| b.bind(g.SONG_CLICK, function() { | |
| var b = a.getEnv(); | |
| b.pos = "song"; | |
| c.trigger(f.CLICK, b) | |
| }); | |
| b.bind(g.ALBUM_CLICK, | |
| function() { | |
| var b = a.getEnv(); | |
| b.pos = "album"; | |
| c.trigger(f.CLICK, b) | |
| }); | |
| a.bind(i.DEFAULT_CHANNEL, function(a, b) { | |
| A(b.id) | |
| }); | |
| a.bind(i.CHANNEL_LOADED, function(b, e) { | |
| var f = [], g, i; | |
| g = a.getKV(); | |
| g.tsChannelLoaded || (g.tsChannelLoaded = (new Date).getTime()); | |
| if ("" == e.name || 0 == e.rawData.length) { | |
| if ("" == a.getCurrentChannel().getId() && 3 > g.channelFallbackRetry) | |
| return g.channelFallbackRetry++, A(j.Etc.DEFAULT_CHANNEL_ID) | |
| } else { | |
| for (var l = 0, k = e.rawData.length; l < k; l++) | |
| i = e.rawData[l], g = bradio.data.enumerable.Song(), g.setId(i.id), | |
| g.setChannel(e.id), g.setRecommendMethod(i.method || 0), 0 == i.type && g.setLoved(!0), f.push(g); | |
| e.force && c.trigger(d.Log.CHANNEL_DURATION, a.getEnv()); | |
| a.getCurrentChannel(); | |
| g = bradio.data.enumerable.Channel(); | |
| g.setId(e.id); | |
| g.setName(e.name); | |
| a.setCurrentChannel(g); | |
| a.loadPlayList(f, e.force); | |
| a.logChannelHistory(g) | |
| } | |
| }); | |
| a.bind(i.PLAY_STATUS, function() { | |
| a.getStatus() == j.PlayStatus.END && D(); | |
| -1 != $.inArray(a.getStatus(), v) && x(!0) | |
| }); | |
| a.bind(i.FAV_COUNT_UPDATED, function() { | |
| if (a.isLogined()) { | |
| if ("" != q && (A(q), q = ""), o) { | |
| var b = | |
| o.clone(); | |
| o = null; | |
| w(b) | |
| } | |
| } else | |
| "" != q && (q = "", "" == a.getCurrentChannel().getId() && A(j.Etc.DEFAULT_CHANNEL_ID)), -1 != $.inArray(a.getCurrentChannel().getId(), [j.Etc.PRIVATE_CHANNEL_ID, j.Etc.LOVE_CHANNEL_ID]) && A(j.Etc.DEFAULT_CHANNEL_ID) | |
| }); | |
| a.bind(i.USER_INFO, function() { | |
| }); | |
| a.bind(i.SONG_INFO, function(b, d) { | |
| var g = a.getKV(); | |
| if ("update" != d.status) { | |
| g.playResultLogged = !1; | |
| g.playCompleteLogged = !1; | |
| g.playSongLogged = !1; | |
| g.playSong100msLogged = !1; | |
| var i = a.getEnv(a.getPrevSong(!0)); | |
| g.firstPlayEndLogged && "" != d.prevSong.getName() && | |
| (i.endStatus = 0 == d.auto ? "m" : "e", i.auto = d.auto, c.trigger(e.PLAY_END, i), c.trigger(f.PLAY_END, i)); | |
| g.firstPlayEndLogged = !0; | |
| "prev" == d.status && (c.trigger(e.SONG_PREV, i), c.trigger(f.SONG_PREV, i)); | |
| if (0 != a.getCurrentSong().getId()) | |
| try { | |
| document.location.hash = "/channel/" + encodeURIComponent(a.getCurrentChannel().getId()) | |
| } catch (j) { | |
| } | |
| "" != a.getCurrentSong().getName() && (document.title = a.getCurrentSong().getName() + " - " + a.getCurrentSong().getArtists()[0].getName() + " 百度随心听") | |
| } | |
| }); | |
| a.bind(i.SONG_INFO_ITEM_ERROR, function(b, | |
| d) { | |
| var f = a.getEnv(); | |
| f.code = d.code; | |
| f.id = d.songId; | |
| c.trigger(e.SONG_INFO_ITEM_ERROR, f) | |
| }); | |
| a.bind(i.SONG_INFO_LOADED, function() { | |
| var b = a.getEnv(); | |
| c.trigger(e.SONG_INFO_LOADED, b); | |
| c.trigger(f.SONG_INFO_LOADED, b) | |
| }); | |
| a.bind(i.SONG_INFO_FAILED, function(b, d) { | |
| var g = a.getEnv(); | |
| g.code = d.code; | |
| g.ids = d.ids; | |
| g.linker = d.code; | |
| c.trigger(e.SONG_INFO_FAILED, g); | |
| c.trigger(f.SONG_INFO_FAILED, g) | |
| }); | |
| a.bind(i.SONG_INFO_ALL_FAILED, function() { | |
| c.trigger(e.SONG_INFO_ALL_FAILED, a.getEnv()) | |
| }); | |
| a.bind(i.TIME_INFO, function() { | |
| var b = a.getKV(); | |
| if (!b.firstSongPlayed) { | |
| b.firstSongPlayed = !0; | |
| var d = a.getEnv(); | |
| d.php2js = tsJs - tsPhp; | |
| d.js2channel = b.tsChannelLoaded - tsJs; | |
| d.js2songready = b.tsSongReady - tsJs; | |
| d.js2play = (new Date).getTime() - tsJs; | |
| c.trigger(e.FIRST_SONG, d); | |
| c.trigger(f.FIRST_SONG, d) | |
| } | |
| !b.playSong100msLogged && 100 < a.getCurrentPosition() && (b.playSong100msLogged = !0, b.playTimeoutRetry = 0, d = a.getEnv(), d.result = "success", c.trigger(e.PLAY_RESULT, d), c.trigger(f.PLAY_100MS, d)); | |
| !b.playCompleteLogged && 6E4 < a.getCurrentPosition() && (b.playCompleteLogged = !0, b = | |
| a.getEnv(), c.trigger(e.PLAY_60S, b), c.trigger(f.PLAY_60S, b), a.complete()) | |
| }); | |
| a.bind(i.SONG_READY, function() { | |
| r = 0; | |
| var b = a.getKV(); | |
| b.tsSongReady || (b.tsSongReady = (new Date).getTime()); | |
| var d = a.getNextAvailLink(); | |
| b.playSongLogged || (b.playSongLogged = !0, c.trigger(e.PLAY_SONG, a.getEnv()), c.trigger(f.PLAY_START, a.getEnv())); | |
| "" != d ? (a.setPendingLink(d), y()) : (c.trigger(e.PLAY_NOLINK, a.getEnv()), a.stop(), x(!1)) | |
| }); | |
| a.bind(i.PLAY_COMPLETE, D); | |
| a.bind(i.PLAY_ERROR, function() { | |
| var b = a.getEnv(), d = a.getKV(); | |
| d.playErrorCount++; | |
| 1E3 > a.getCurrentPosition() ? (d.playSong100msLogged || (d.playSong100msLogged = !0, b.result = "fail", c.trigger(e.PLAY_RESULT, b)), c.trigger(e.PLAY_LOAD_ERROR, b), c.trigger(f.PLAY_LOAD_ERROR, b)) : (c.trigger(e.PLAY_ERROR, b), c.trigger(f.PLAY_ERROR, b)) | |
| }); | |
| a.bind(i.PLAY_ERROR_RECOVERED, function() { | |
| var b = a.getKV(); | |
| 0 != b.playErrorCount && (b.playErrorCount = 0) | |
| }); | |
| a.bind(i.PLAYLIST_INITED, function() { | |
| r = 0; | |
| x(!0) | |
| }); | |
| n.setHost(c); | |
| l.setHost(c); | |
| $(document).bind("keydown", function(b) { | |
| switch (b.keyCode) { | |
| case 37: | |
| a.prev(); | |
| break; | |
| case 39: | |
| z(); | |
| break; | |
| case 32: | |
| a.getStatus() == j.PlayStatus.PAUSE ? y() : a.pause() | |
| } | |
| }); | |
| g = a.getKV(); | |
| g.channelFallbackRetry = 0; | |
| g.playTimeoutRetry = 0; | |
| $.cookie("fm_1") || (a.getKV().newUser = !0); | |
| $.cookie("fm_1", (new Date).getTime(), {expires: 365}); | |
| b.switchScene(a.getViewPath()); | |
| E($.cookie("fm_dv") || 50); | |
| return c | |
| }; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.FM = function() { | |
| var a = bradio.lang.Class(), b, c, d; | |
| a.extend({setChannelList: function(a) { | |
| d.setChannelList(a) | |
| },setLoginInfo: function(a) { | |
| d.setLoginInfo(a) | |
| },setFavCount: function(a) { | |
| d.setFavCount(a) | |
| },loadSongList: function() { | |
| d.loadSongList() | |
| },loadChannel: function(a) { | |
| d.loadChannel(a) | |
| },showLogin: function() { | |
| M3.user.sign() | |
| },hideTooltip: function() { | |
| c.hideTooltip() | |
| },switchScene: function(a) { | |
| c.switchScene(a) | |
| }}); | |
| b = bradio.core.Model(); | |
| c = bradio.core.View(b); | |
| d = bradio.core.Controller(b, c); | |
| return a | |
| }; | |
| bradio.namespace("bradio.core"); | |
| bradio.core.AudioKernel = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.AudioKernel, c = bradio.core.Constant, d, e = 0, f = 0, g = 0, i = 0, j = 0, n = function() { | |
| return d.getUrl() | |
| }, l = function(a) { | |
| f = e = 0; | |
| j = +new Date; | |
| g = +new Date; | |
| i = +new Date; | |
| return d.setUrl(a) | |
| }, m = function() { | |
| return d.getState() | |
| }; | |
| a.extend({getUrl: n,setUrl: l,play: function() { | |
| m() == c.PlayStatus.END && l(n()); | |
| return d.play(void 0, !0) | |
| },pause: function() { | |
| return d.pause() | |
| },stop: function() { | |
| return d.stop() | |
| },setMute: function(a) { | |
| return d.setMute(a) | |
| },getMute: function() { | |
| return d.getMute() | |
| }, | |
| setVolume: function(a) { | |
| return d.setVolume(a) | |
| },getVolume: function() { | |
| return d.getVolume() | |
| },getCurrentPosition: function() { | |
| return d.getCurrentPosition() | |
| },getCurrentPositionString: function() { | |
| return d.getCurrentPositionString() | |
| },getTotalTime: function() { | |
| return d.getTotalTime() | |
| },getTotalTimeString: function() { | |
| return d.getTotalTimeString() | |
| },getBytesTotal: function() { | |
| return d.getTotalBytes() | |
| },getBytesLoaded: function() { | |
| return d.getLoadedBytes() | |
| },getCurEngine: function() { | |
| return d.getCurEngine().getEngineType() | |
| }, | |
| getStatus: m,getBufferCount: function() { | |
| return e | |
| },getBufferLength: function() { | |
| return f | |
| },getTimeFromStart: function() { | |
| return (new Date).getTime() - g | |
| },getStart2Play: function() { | |
| return i - g | |
| },getStartTimestamp: function() { | |
| return g | |
| },getConnectTimestamp: function() { | |
| return i | |
| }}); | |
| var k = [{constructorName: "PlayEngine_FMP_AAC",args: {swfPath: "/static/flash/fmp_aac.swf?" + (new Date).getTime(),instanceName: "player"}}, {constructorName: "PlayEngine_FMP_MP3",args: {swfPath: "/static/flash/fmp_mp3.swf?" + (new Date).getTime(),instanceName: "player"}}, | |
| {constructorName: "PlayEngine_Audio",args: {}}]; | |
| /Safari/.test(navigator.userAgent) && /Mac OS X/.test(navigator.userAgent) && (k = [{constructorName: "PlayEngine_Audio",args: {}}, {constructorName: "PlayEngine_FMP_AAC",args: {swfPath: "/static/flash/fmp_aac.swf?" + (new Date).getTime(),instanceName: "player"}}, {constructorName: "PlayEngine_FMP_MP3",args: {swfPath: "/static/flash/fmp_mp3.swf?" + (new Date).getTime(),instanceName: "player"}}]); | |
| window.player = new PlayEngine({el: $("#audiokernel")[0],subEngines: k}); | |
| d = window.player; | |
| d.setEventListener(d.EVENTS.INIT, function() { | |
| a.trigger(b.INITED) | |
| }); | |
| d.setEventListener(d.EVENTS.INITFAIL, function() { | |
| a.trigger(b.INIT_FAILED) | |
| }); | |
| d.setEventListener(d.EVENTS.POSITIONCHANGE, function() { | |
| m() == d.STATES.PLAY && a.trigger(b.PLAY_PROGRESS) | |
| }); | |
| d.setEventListener(d.EVENTS.STATECHANGE, function(c) { | |
| switch (c.newState) { | |
| case d.STATES.ERROR: | |
| a.trigger(b.ERROR); | |
| break; | |
| case d.STATES.BUFFERING: | |
| e++; | |
| j = +new Date; | |
| break; | |
| case d.STATES.PLAY: | |
| c.oldState == d.STATES.BUFFERING && (f += +new Date - j) | |
| } | |
| a.trigger(b.PLAY_STATUS, {status: c.newState, | |
| lastStatus: c.oldState}) | |
| }); | |
| d.setEventListener(d.EVENTS.PROGRESS, function(c) { | |
| a.trigger(b.LOAD_PROGRESS, {loadProgress: c.progress,duration: c.totalTime}) | |
| }); | |
| d.init(); | |
| k = new PlayEngineRulesController({playEngine: d}); | |
| k.addRule(new PlayEngineRules.Prebuffer({time: 8,handler: function() { | |
| this.playEngine.curEngine.state = this.playEngine.STATES.ERROR; | |
| this.playEngine.curEngine.dispatchEvent(this.playEngine.EVENTS.STATECHANGE, {newState: this.playEngine.STATES.ERROR,oldState: this.playEngine.STATES.PREBUFFER,engineType: this.playEngine.curEngine.getEngineType()}) | |
| }})); | |
| k.addRule(new PlayEngineRules.FirstBuffer({time: 8,handler: function() { | |
| this.playEngine.curEngine.state = this.playEngine.STATES.ERROR; | |
| this.playEngine.curEngine.dispatchEvent(this.playEngine.EVENTS.STATECHANGE, {newState: this.playEngine.STATES.ERROR,oldState: this.playEngine.STATES.PREBUFFER,engineType: this.playEngine.curEngine.getEngineType()}) | |
| }})); | |
| k.addRule(new PlayEngineRules.Exception({time: 1,handler: function() { | |
| this.playEngine.curEngine.state = this.playEngine.STATES.ERROR; | |
| this.playEngine.curEngine.dispatchEvent(this.playEngine.EVENTS.STATECHANGE, | |
| {newState: this.playEngine.STATES.ERROR,oldState: this.playEngine.STATES.READY,engineType: this.playEngine.curEngine.getEngineType()}) | |
| }})); | |
| k.addRule(new PlayEngineRules.Play100ms({handler: function() { | |
| i = (new Date).getTime() | |
| }})); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.enumerable"); | |
| bradio.data.enumerable.Song = function() { | |
| var a = {id: 0,name: "",artists: [bradio.data.enumerable.Artist()],albumId: 0,album: "",cover: "",coverBig: "",coverSmall: "",format: "mp3",duration: 0,version: "",rate: 0,size: 0,link: "",showLink: "",lrcLink: "",copyType: "",channel: "",hated: !1,loved: !1,isAd: !1,adUrl: "",relateStatus: 0,resourceType: 0,recommendMethod: 0,completeCountNeed: 0}, b = bradio.lang.Enumerable(a); | |
| b.extend({getPlainArtists: function() { | |
| for (var b = "", d = 0, e = a.artists.length; d < e; d++) | |
| b += a.artists[d].getName() + ","; | |
| return b = b.slice(0, b.length - 1) | |
| },getPlainArtistIds: function() { | |
| for (var b = "", d = 0, e = a.artists.length; d < e; d++) | |
| b += a.artists[d].getId() + ","; | |
| return b = b.slice(0, b.length - 1) | |
| },toKeyString: function() { | |
| return a.name + "$$" + a.artists[0].getName() || "" | |
| },toTitleString: function() { | |
| return a.name + "$$" + a.artists[0].getName() || "$$" | |
| },artistLinkEnable: function() { | |
| if (!(0 === a.relateStatus || 1 === a.relateStatus)) | |
| if (2 === a.relateStatus || 3 === a.relateStatus) | |
| return !1; | |
| return !0 | |
| },albumLinkEnable: function() { | |
| if (!(0 === a.relateStatus || 2 === a.relateStatus)) | |
| if (1 === | |
| a.relateStatus || 3 === a.relateStatus) | |
| return !1; | |
| return !0 | |
| }}); | |
| return b | |
| }; | |
| bradio.namespace("bradio.data.enumerable"); | |
| bradio.data.enumerable.Channel = function() { | |
| return bradio.lang.Enumerable({name: "",id: "",cateName: "",cateId: "",pos: 0}) | |
| }; | |
| bradio.namespace("bradio.data.enumerable"); | |
| bradio.data.enumerable.Artist = function() { | |
| return bradio.lang.Enumerable({name: "",id: "",avatarBig: "",avatarMiddle: "",avatarSmall: "",avatarMini: ""}) | |
| }; | |
| bradio.namespace("bradio.data.enumerable"); | |
| bradio.data.enumerable.User = function() { | |
| return bradio.lang.Enumerable({userId: 0,userName: "",logined: !1,refer: ""}) | |
| }; | |
| bradio.namespace("bradio.data.iterable.playstrategy"); | |
| bradio.data.iterable.PlayStrategy = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.data.providable.Ad(), c = $.cookie("fm_ad") ? $.cookie("fm_ad").split(",") : [], d = 0, e = !1, f, g = function() { | |
| if (e) { | |
| for (var a, g = !1, l = 0, m = b.getLength(); l < m; l++) | |
| if (a = b.getOne(l), -1 == $.inArray(a.getId() + "", c)) { | |
| g = !0; | |
| break | |
| } | |
| if (g && d >= a.getCompleteCountNeed()) | |
| return d = 0, c.push(a.getId() + ""), $.cookie("fm_ad", c.join(","), {expires: 1}), a | |
| } | |
| f.getIndex() + 1 > f.getLength() - 1 && (f.setIndex(-1), f.getData().sort(i)); | |
| f.setIndex(f.getIndex() + 1); | |
| if (1 < f.getLength()) | |
| for (; f.getCurrentSong() && | |
| f.getData()[f.getIndex()].getId() == f.getCurrentSong().getId(); ) | |
| f.setIndex(f.getIndex() + 1); | |
| return f.getData()[f.getIndex()] | |
| }, i = function() { | |
| return 0.5 < Math.random() ? -1 : 1 | |
| }; | |
| a.extend({setPlaylist: function(a) { | |
| f = a | |
| },setAdable: function(a) { | |
| e = a | |
| },skip: function() { | |
| return g() | |
| },next: g,prev: function() { | |
| },complete: function() { | |
| ++d | |
| },clearCompleteCount: function() { | |
| d = 0 | |
| }}); | |
| c = $.cookie("fm_ad") ? $.cookie("fm_ad").split(",") : []; | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.iterable"); | |
| bradio.data.iterable.Playlist = function() { | |
| var a = bradio.lang.Bindable(), b = !1, c = [], d = [], e = bradio.data.iterable.PlayHistory(), f = bradio.data.iterable.PlayStrategy(), g = -1, i, j = bradio.core.Event, n = !1, l = !1, m = function(a) { | |
| var b = e.getHistory(0); | |
| a && (!b || a.getId() != b.getId()) && e.push(a) | |
| }, k = function() { | |
| l ? n = !0 : (l = !0, setTimeout(function() { | |
| n = !1; | |
| var e = $.grep(d, function(a) { | |
| return "" != a.getName() | |
| }); | |
| e.length && (c = e); | |
| !b && c.length && !b && (b = !0, g = -1, a.trigger(j.Playlist.INITED)); | |
| l = !1; | |
| n && k() | |
| }, 50)) | |
| }; | |
| a.extend({load: function(a, c) { | |
| a.length && | |
| (d = a, c && (b = !1, f.clearCompleteCount())) | |
| },getRawData: function() { | |
| return d | |
| },setData: function(a) { | |
| c = a | |
| },getData: function() { | |
| return c | |
| },getLength: function() { | |
| return c.length | |
| },getRawLength: function() { | |
| return d.length | |
| },getCurrentSong: function() { | |
| return i | |
| },getPrevSong: function(a) { | |
| var b = -1, c = e.getHistory(b); | |
| if (!a) | |
| for (; c.getIsAd(); ) | |
| b--, c = e.getHistory(b); | |
| return c | |
| },getAllHistory: function() { | |
| return e.getAllHistory() | |
| },setIndex: function(a) { | |
| g = a | |
| },getIndex: function() { | |
| return g | |
| },next: function() { | |
| i = f.next(); | |
| m(i); | |
| a.trigger(j.Playlist.SONG, | |
| {status: "next",auto: 1}) | |
| },skip: function() { | |
| i = f.skip(); | |
| m(i); | |
| a.trigger(j.Playlist.SONG, {status: "next",auto: 0}) | |
| },prev: function() { | |
| var b = -1; | |
| for (i = e.getHistory(b); i.getIsAd(); ) | |
| b--, i = e.getHistory(b); | |
| f.prev(); | |
| m(i); | |
| a.trigger(j.Playlist.SONG, {status: "prev",auto: 0}) | |
| },complete: function() { | |
| f.complete() | |
| },failed: function() { | |
| e.pop() | |
| },error: function() { | |
| i = f.next(); | |
| m(i); | |
| a.trigger(j.Playlist.SONG, {status: "next",auto: 2}) | |
| },remove: function(a) { | |
| for (var b = 0, d = c.length; b < d && c[b].getId() + "" !== a.getId() + ""; b++) | |
| ; | |
| a = b; | |
| -1 != a && c.splice(a, | |
| 1) | |
| },hate: function() { | |
| e.pop() | |
| },updateSong: function(a) { | |
| for (var b = d, c = 0, e = d.length; c < e && d[c].getId() + "" !== a.getId() + ""; c++) | |
| ; | |
| if (b = b[c]) | |
| b.loadRaw(a.raw(), ["loved", "hated", "channel", "recommendMethod"]), k() | |
| },getReady: function() { | |
| return b | |
| },stage: k,getSongPlayedCount: function() { | |
| return e.getSongPlayedCount() | |
| },setAdable: function(a) { | |
| f.setAdable(a) | |
| }}); | |
| f.setPlaylist(a); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.iterable"); | |
| bradio.data.iterable.PlayHistory = function() { | |
| var a = bradio.lang.Class(), b = [], c = 0, d = bradio.core.Event.Providable.Song; | |
| a.extend({push: function(a) { | |
| if (!(0 < b.length && a.getId() == b[b.length - 1].getId())) { | |
| b.push(a); | |
| 100 < b.length && b.splice(0, b.length - 100); | |
| for (var a = b.length, d = []; a-- && 3 > d.length; ) | |
| b[a].getIsAd() || d.unshift(b[a].getId()); | |
| ++c; | |
| $.cookie("fm_ph3", null); | |
| $.cookie("fm_ph3", d.join(","), {expires: 365}) | |
| } | |
| },pop: function() { | |
| b.pop() | |
| },getHistory: function(a) { | |
| a = Math.min(b.length - 1 + a, b.length - 1); | |
| return -1 < a && b[a] ? b[a] : | |
| bradio.data.enumerable.Song() | |
| },getAllHistory: function() { | |
| return b | |
| },getHistoryByPage: function(a, c) { | |
| return b.slice(a * c, Math.min(b.length, (a + 1) * c)) | |
| },rebase: function() { | |
| },length: function() { | |
| return b.length | |
| },getSongPlayedCount: function() { | |
| return c | |
| }}); | |
| $.cookie("fm_ph", null); | |
| $.cookie("fm_ph2", null); | |
| if ($.cookie("fm_ph3")) { | |
| var e = $.cookie("fm_ph3").split(","), f = bradio.data.providable.Song(), g; | |
| if (e) { | |
| for (var i = 0, j = e.length; i < j; i++) | |
| g = bradio.data.enumerable.Song(), g.setId(e[i]), b.push(g); | |
| f.bind(d.SONG_INFO, function(a, | |
| c) { | |
| var d = $.grep(b, function(a) { | |
| return a.getId() + "" === c.song.getId() + "" | |
| }); | |
| d && 0 < d.length && d[0].loadRaw(c.song.raw()) | |
| }); | |
| f.load(b) | |
| } | |
| } | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Ad = function() { | |
| var a = bradio.lang.Class(), b = [{id: 31930782,name: "新歌首发——梁晓雪《城市》",artists: [{id: 5322,name: "梁晓雪"}],albumId: 31741103,album: "最好还是不说",cover: staticPath + "/ad/images/31930782.jpg?" + Math.random(),link: "http://zhangmenshiting.baidu.com/data2/music/32277408/32277408.mp3?xcode=5850107cc24d7eee145034a7b217121b",lrcLink: "/static/ad/lyrics/31930782.txt?" + Math.random(),isAd: !0,duration: 3E4,completeCountNeed: 4}, {id: 32326660,name: "彭青 新歌首发",artists: [{id: 6254013,name: "彭青"}],albumId: 32326674, | |
| album: "世界大不同",cover: staticPath + "/ad/images/32326660.jpg?" + Math.random(),link: "http://zhangmenshiting.baidu.com/data2/music/32616303/32616303.mp3?xcode=5850107cc24d7eee145034a7b217121b",lrcLink: "/static/ad/lyrics/32326660.txt?" + Math.random(),isAd: !0,duration: 3E4,completeCountNeed: 5}, {id: 31626802,name: "乔任梁《与我无关》",artists: [{id: 2512,name: "乔任梁"}],albumId: 28232233,album: "Pin.K 拼",cover: staticPath + "/ad/images/31626802.jpg?" + Math.random(),link: "http://zhangmenshiting.baidu.com/data2/music/32277418/32277418.mp3?xcode=5850107cc24d7eee145034a7b217121b", | |
| lrcLink: "/static/ad/lyrics/31626802.txt?" + Math.random(),isAd: !0,duration: 3E4,completeCountNeed: 5}], c = []; | |
| a.extend({getConfig: function() { | |
| return c | |
| },getOne: function(a) { | |
| return c[a] | |
| },getRandom: function() { | |
| return c[Math.floor(Math.random() * c.length)] | |
| },getLength: function() { | |
| return c.length | |
| }}); | |
| for (var d, e, f = 0, g = b.length; f < g; f++) | |
| d = bradio.data.enumerable.Song(), d.loadRaw(b[f]), "" == d.getAdUrl() && d.setAdUrl("http://music.baidu.com/song/" + d.getId()), e = bradio.data.enumerable.Artist(), e.loadRaw(b[f].artists[0]), d.setArtists([e]), | |
| c.push(d); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Song = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.Base, c = bradio.core.Event.Providable.Song, d = {}, e = 0, f = 0, g = 0, i = 0, j = !1, n = function(l) { | |
| if (0 == l.length) | |
| return !1; | |
| if (!g) { | |
| var m = l.getUniq().length; | |
| g = m; | |
| m != l.length && (j = !0, g = l.length) | |
| } | |
| var k = "jsonplink" + (new Date).getTime(), q = l.splice(0, 10); | |
| window[k] = function(e) { | |
| clearTimeout(d[k]); | |
| var f, m, r, v, x, y, z, w, A, E, t = 0, D = 0; | |
| if (22E3 != e.errorCode) | |
| a.trigger(b.DATA_FAILED, {ids: q.join(","),code: "CODE_" + e.errorCode}); | |
| else if (0 == e.data.songList.length) | |
| a.trigger(b.DATA_FAILED, | |
| {ids: q.join(","),code: "EMPTY"}); | |
| else { | |
| y = e.data.xcode; | |
| t = e.data.songList.length; | |
| z = 0; | |
| for (A = e.data.songList.length; z < A; z++) | |
| if (f = e.data.songList[z], 4 == +f.resourceType) | |
| --t, --g; | |
| else if (22E3 != f.linkCode && a.trigger(c.SONG_INFO_ERROR, {songId: f.songId,code: "CODE_" + f.linkCode}), "" != f.songName) { | |
| f.artistId ? (m = f.artistId.split(","), r = f.artistName.split(",")) : (m = [], r = []); | |
| v = []; | |
| w = 0; | |
| for (E = m.length; w < E; w++) | |
| x = bradio.data.enumerable.Artist(), x.setId(m[w]), x.setName(r[w]), v.push(x); | |
| r = bradio.data.enumerable.Song(); | |
| r.setId(+f.songId); | |
| r.setName(f.songName); | |
| 0 < v.length && r.setArtists(v); | |
| w = +f.albumId; | |
| v = 0; | |
| v = m.length && m[0] ? w ? 0 : 1 : w ? 2 : 3; | |
| m = -1 == f.songLink.lastIndexOf("xcode"); | |
| m = "" != f.songLink ? f.songLink + (m ? (/\?/.test(f.songLink) ? "&" : "?") + "xcode=" + y : "") : ""; | |
| r.setAlbumId(+f.albumId); | |
| r.setAlbum(f.albumName || ""); | |
| r.setCopyType(f.copy_type || ""); | |
| r.setFormat(f.format || ""); | |
| r.setLrcLink(f.lrcLink ? f.lrcLink : ""); | |
| r.setRate(f.rate || ""); | |
| r.setSize(f.size || ""); | |
| r.setLink(m); | |
| r.setShowLink(f.showLink || ""); | |
| r.setCover(f.songPicRadio || ""); | |
| r.setCoverBig(f.songPicBig || | |
| ""); | |
| r.setCoverSmall(f.songPicSmall || ""); | |
| r.setDuration(1E3 * f.time); | |
| r.setVersion(f.version || ""); | |
| r.setResourceType(+f.resourceType); | |
| r.setRelateStatus(+f.relateStatus || v); | |
| if (j) | |
| for (w = q.length; w--; ) | |
| q[w] + "" == f.songId + "" && (D++, i++, a.trigger(c.SONG_INFO, {song: r,loaded: i,total: g})); | |
| else | |
| D++, i++, a.trigger(c.SONG_INFO, {song: r,loaded: i,total: g}) | |
| } | |
| a.trigger(b.DATA_LOADED); | |
| 0 < l.length ? n(l) : i = g = 0 | |
| } | |
| }; | |
| d[k] = setTimeout(function() { | |
| clearTimeout(d[k]); | |
| window[k] = function() { | |
| }; | |
| a.trigger(b.DATA_FAILED, {ids: q.join(","),code: "TIMEOUT"}); | |
| n(l); | |
| 0 == l.length && e == f && a.trigger(c.ALL_FAILED) | |
| }, 5E3); | |
| setTimeout(function() { | |
| $.ajax({url: bradio.core.Constant.Path.LS_PATH + "?songIds=" + q.join(",") + "&type=mp3",dataType: "jsonp",jsonpCallback: k}) | |
| }, 20) | |
| }; | |
| a.extend({load: function(a) { | |
| if (!a || 0 == a.length) | |
| return !1; | |
| var b = []; | |
| e = 0; | |
| f = Math.ceil(a.length / 10); | |
| for (var c = 0, d = a.length; c < d; c++) | |
| b.push(a[c].getId()); | |
| n(b) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Lyrics = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.Base, c = function(c) { | |
| a.trigger(b.DATA_FAILED, c) | |
| }; | |
| a.extend({load: function(d) { | |
| d.getLrcLink() && "" != d.getLrcLink() && $.ajax({url: d.getLrcLink()}).done(function(c) { | |
| a.trigger(b.DATA_LOADED, {data: c,song: d}) | |
| }).fail(c) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Channel = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.Base, c = function(c) { | |
| a.trigger(b.DATA_LOADED, {id: c.channel_id,name: c.channel_name,rawData: c.list,force: !0}) | |
| }, d = function(c) { | |
| a.trigger(b.DATA_FAILED, c) | |
| }; | |
| a.extend({load: function(a, b) { | |
| $.ajax({url: bradio.core.Constant.Path.DATA_BASE + "?tn=playlist&id=" + encodeURIComponent(a) + "&special=flash&prepend=" + b + "&format=json",dataType: "json",cache: !1}).done(c).fail(d) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.ChannelList = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.Base, c = function(a) { | |
| e(a) | |
| }, d = function(c) { | |
| a.trigger(b.DATA_FAILED, c) | |
| }, e = function(c) { | |
| a.trigger(b.DATA_LOADED, c) | |
| }; | |
| a.extend({load: function() { | |
| $.ajax({url: bradio.core.Constant.Path.DATA_BASE + "?tn=channellist&format=channellist&r=" + (new Date).getTime(),dataType: "json"}).done(c).fail(d) | |
| },loadChannelListData: e}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Behaviour = function() { | |
| var a = bradio.lang.Bindable(), b = [], c = [], d = bradio.lang.Iterable(), e = bradio.lang.Iterable(), f = bradio.lang.Iterable(), g = bradio.data.enumerable.User(), i = 0, j = 0, n = 0, l = !1, m = "", k = 0, q = bradio.core.Event, u = q.Providable.Behaviour, s = q.Providable, o = bradio.core.Constant, r = bradio.core.Constant.Behaviour, v = function() { | |
| $.ajax({url: o.Path.DATA_BASE + "?tn=usercounts&format=json",dataType: "json",cache: !1}).done(function(a) { | |
| z(a) | |
| }).fail(function() { | |
| }) | |
| }, x = function(b, c, d, e) { | |
| v(); | |
| var f = | |
| 0, g = "listenrecord"; | |
| switch (e) { | |
| case "loved": | |
| f = 0; | |
| g = "songlist"; | |
| break; | |
| case "hated": | |
| f = 1, g = "songlist" | |
| } | |
| $.ajax({url: o.Path.DATA_BASE + "?tn=" + g + "&songtype=" + f + "&format=json&pagelen=" + c + "&pageno=" + (b + 1),dataType: "json",cache: !1}).done(function(b) { | |
| if (b) { | |
| var c = [], e, f, g = function(b, e) { | |
| for (var f = c.length; f-- && !(c[f].getId() == e.song.getId() && "" == c[f].getName()); ) | |
| ; | |
| -1 != f && (c[f].loadRaw(e.song.raw(), ["loved", "hated"]), e.loaded == e.total && (a.trigger(d, {list: c}), l.unbind(s.Song.SONG_INFO, g))) | |
| }; | |
| 0 == b.length && a.trigger(d, {list: c}); | |
| for (var i = 0, j = b.list.length; i < j; i++) | |
| if (f = b.list[i], 0 != f.id) { | |
| e = bradio.data.enumerable.Song(); | |
| e.setId(f.id); | |
| e.setRecommendMethod(f.method || 0); | |
| switch (f.type) { | |
| case 0: | |
| e.setLoved(!0); | |
| break; | |
| case 1: | |
| e.setHated(!0) | |
| } | |
| c.push(e) | |
| } | |
| var l = bradio.data.providable.Song(!0); | |
| l.bind(s.Song.SONG_INFO, g); | |
| l.load(c) | |
| } | |
| }).fail(function() { | |
| }) | |
| }, y = function(d) { | |
| k++; | |
| var e = bradio.core.Constant.Path.DATA_BASE + "?action=userop&tn=userop&_=" + +new Date; | |
| 200 < b.length && b.splice(0, b.length - 200); | |
| var f = [], i; | |
| i = ""; | |
| var j = function(b) { | |
| b && (b.list && 0 < | |
| b.list.length) && a.trigger(q.Base.DATA_LOADED, {id: b.channel_id,name: b.channel_name,rawData: b.list,force: !1}); | |
| g.getLogined() && v() | |
| }, l = function() { | |
| g.getLogined() && v() | |
| }; | |
| if (b.length) { | |
| for (var m = 0, n = b.length; m < n; m++) | |
| i = b[m], f.push(i.act + "|" + encodeURIComponent(i.subject.getId()) + "|" + encodeURIComponent(i.channel.getId())); | |
| b.splice(0, b.length); | |
| i = f.join("$$"); | |
| $.ajax({url: e,data: "data=" + i,type: "POST",dataType: "json"}).done(j).fail(l); | |
| d && c.splice(0, c.length) | |
| } | |
| }, z = function(b) { | |
| if (!l || b && b.counts && !(-1 == b.counts.total_listen || | |
| -1 == b.counts.like_songs || -1 == b.counts.dislike_songs)) | |
| l = !0, n = b.counts.total_listen || 0, i = b.counts.like_songs || 0, j = b.counts.dislike_songs || 0, a.trigger(u.FAV_COUNT_UPDATED, b) | |
| }; | |
| a.extend({log: function(l, k, m) { | |
| switch (l) { | |
| case r.SONG.COMPLETE: | |
| g.getLogined() && (n++, f.unshift(k)); | |
| break; | |
| case r.SONG.LOVE: | |
| k.getLoved() || (k.setHated(!1), k.setLoved(!0), d.unshift(k), g.getLogined() && i++); | |
| break; | |
| case r.SONG.DELOVE: | |
| k.getLoved() && (k.setLoved(!1), d.remove(k), g.getLogined() && (i = Math.max(0, i - 1))); | |
| break; | |
| case r.SONG.HATE: | |
| k.setLoved(!1); | |
| k.setHated(!0); | |
| d.remove(k); | |
| e.unshift(k); | |
| g.getLogined() && (k.getLoved() && (i = Math.max(0, i - 1)), j++); | |
| break; | |
| case r.SONG.DEHATE: | |
| k.setHated(!1), e.remove(k), g.getLogined() && (j = Math.max(0, j - 1)) | |
| } | |
| b.push({act: l,subject: k,channel: m}); | |
| g.getLogined() || c.push({act: l,subject: k,channel: m}); | |
| a.trigger(u.FAV_COUNT_UPDATED, {user_id: g.getUserId(),user_name: g.getUserName()}); | |
| y(void 0) | |
| },setUserInfo: function(a) { | |
| g.loadRaw(a.raw()) | |
| },loadFavCountData: z,loadListenRecord: function(a, b) { | |
| x(a, b, u.LISTEN_RECORD_UPDATED, "normal", f) | |
| }, | |
| loadLoveRecord: function(a, b) { | |
| x(a, b, u.LOVE_RECORD_UPDATED, "loved", d) | |
| },loadHateRecord: function(a, b) { | |
| x(a, b, u.HATE_RECORD_UPDATED, "hated", e) | |
| },getCheckCount: function() { | |
| return k | |
| },setChannel: function(a) { | |
| a != m && (m = a) | |
| },getNeedData: function() { | |
| return !1 | |
| },getUserName: function() { | |
| return g.getUserName() | |
| },getListenCount: function() { | |
| return n | |
| },getLoveSongCount: function() { | |
| return i | |
| },getHateSongCount: function() { | |
| return j | |
| },refresh: function(a) { | |
| y(a) | |
| },updateFavData: function() { | |
| v() | |
| },updateFavCount: v}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.data.providable"); | |
| bradio.data.providable.Cookie = function() { | |
| var a = bradio.lang.Bindable(), b = /\/play\/([^\/]+?\/)?(\d+)/i, c = /(\?|\&)s\=(\d+)/i, d = /\/share\/([^\/]+)/i, e = /\/(play|channel)\/(p[^\/]+)/i, f = /\/view\/([^\/]+)/i, g = ["channels", "player", "favlist"], i = 1, j = function() { | |
| try { | |
| if ("" == document.location.hash) | |
| return 1; | |
| var a = f.exec(document.location.hash); | |
| if (a && -1 != $.inArray(a[1], g)) | |
| return $.inArray(a[1], g) | |
| } catch (b) { | |
| } | |
| return 1 | |
| }; | |
| a.extend({setDefaultChannelId: function(a) { | |
| $.cookie("fm_dc", null, {domain: "baidu.com"}); | |
| $.cookie("fm_dc", | |
| a, {expires: 365}) | |
| },getDefaultChannelId: function() { | |
| try { | |
| if ("" != document.location.hash) { | |
| var a = e.exec(document.location.hash); | |
| if (a && a[2] && "" != a[2]) | |
| return a[2] | |
| } | |
| return $.cookie("fm_dc") || bradio.core.Constant.Etc.DEFAULT_CHANNEL_ID | |
| } catch (b) { | |
| return $.cookie("fm_dc") || bradio.core.Constant.Etc.DEFAULT_CHANNEL_ID | |
| } | |
| },getDefaultSongId: function() { | |
| try { | |
| var a; | |
| if ("" != document.location.hash && (a = b.exec(document.location.hash)) || (a = c.exec(document.location.href))) | |
| return a[2] | |
| } catch (d) { | |
| } | |
| return "" | |
| },getDefaultViewPath: function() { | |
| return i | |
| }, | |
| getShareSource: function() { | |
| try { | |
| if ("" == document.location.hash) | |
| return ""; | |
| var a = d.exec(document.location.hash); | |
| if (a) | |
| return a[1] | |
| } catch (b) { | |
| } | |
| return "" | |
| },getViewPath: j}); | |
| i = j(); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.BtnHate = function() { | |
| var a = bradio.lang.Class(), b = {id: "bh",content: "",onclick: function() { | |
| }}; | |
| a.extend({test: function(a, d) { | |
| if ("operation" != d || "hate" != a.operation) | |
| return null; | |
| b.content = a.user.getLogined() ? "我们通过垃圾桶理解你的喜好,帮你推荐其他你可能喜欢的歌曲。" : "登陆后,我们能记住你不喜欢这首歌,帮你推荐更好听的歌曲。"; | |
| return b | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.BtnLove = function() { | |
| var a = bradio.lang.Class(), b = {id: "bl",content: "",onclick: function() { | |
| }}; | |
| a.extend({test: function(a, d) { | |
| if ("operation" != d || "love" != a.operation) | |
| return null; | |
| b.content = a.user.getLogined() ? "红心是你对该歌曲的表态,红心越多,我们越能帮你推荐你可能喜欢的歌曲。" : "登陆后,我们能记住你的喜好,帮你推荐更好听的歌曲。"; | |
| return b | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.BtnPrev = function() { | |
| var a = bradio.lang.Class(), b = {id: "bp",content: "再听一遍,不对好歌留遗憾。",onclick: function() { | |
| }}; | |
| a.extend({test: function(a, d) { | |
| return "operation" != d ? null : "prev" != a.operation ? null : b | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.BtnSkip = function() { | |
| var a = bradio.lang.Class(), b = {id: "bs",content: "多点击<span id='promotionbar-love'></span>和<span id='promotionbar-hate'></span>按钮,好音乐会主动来找你~",onclick: function() { | |
| }}; | |
| a.extend({test: function(a, d) { | |
| return "operation" != d ? null : "skip" != a.operation ? null : b | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.ChannelDescription = function() { | |
| var a = bradio.lang.Class(), b = -1, c = bradio.core.Constant.ChannelDescriptions, d = {id: "cd",content: "",onclick: function() { | |
| }}; | |
| a.extend({test: function(a, f) { | |
| if ("currentChannel" != f) | |
| return null; | |
| ++b; | |
| if (1 > b) | |
| return null; | |
| for (var g = c.length; g-- && c[g].channel != a.currentChannel.getId(); ) | |
| ; | |
| return -1 != g ? (d.content = c[g].content, d.onclick = c[g].onclick ? c[g].onclick : function() { | |
| }, d) : null | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.RedirectToPrivate = function() { | |
| var a = bradio.lang.Class(), b = -1, c = {id: "rd",content: "",onclick: function() { | |
| FM.loadChannel("private") | |
| }}; | |
| a.extend({test: function(a, e) { | |
| if ("userInfo" == e) { | |
| if (-1 < b || a.currentChannel && !/public/.test(a.currentChannel.getId())) | |
| return null; | |
| a.kv.newUser ? c.content = a.user.getLogined() ? "私人频道,帮你发现更多好音乐" : "登陆后去私人频道,可以推荐更多符合口味的歌曲" : a.user.getLogined() && (c.content = "私人频道,帮你发现更多你可能喜欢的好音乐"); | |
| if ("" == c.content) | |
| return null; | |
| b++; | |
| return c | |
| } | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.Init = function() { | |
| var a = bradio.lang.Class(), b = -1, c = [{id: "w",test: function() { | |
| return !0 | |
| },content: "关注官方微博,了解百度随心听更多动态",onclick: function() { | |
| window.open("http://weibo.com/baidufm") | |
| }}, {id: "m",test: function() { | |
| return !0 | |
| },content: "打开手机浏览器直接访问 fm.baidu.com,手机也能随心听 (iPhone或安卓)",onclick: function() { | |
| }}, {id: "f",test: function() { | |
| return /Firefox|MSIE/.test(navigator.userAgent) | |
| },content: "添加百度随心听到收藏夹,直接访问更快捷",onclick: function() { | |
| $.add2fav("http://fm.baidu.com/", "百度随心听") | |
| }}, {id: "f",test: function() { | |
| return /Chrome/.test(navigator.userAgent) | |
| }, | |
| content: "按Ctrl+D,收藏百度随心听,让好音乐发现你。",onclick: function() { | |
| }}, {id: "s",test: function() { | |
| return /Windows/.test(navigator.userAgent) && !/from=sk/.test(document.location.href) | |
| },content: "点击添加百度随心听快捷方式至桌面,直接访问更快捷",onclick: function() { | |
| window.open("/static/etc/BaiduFM.exe") | |
| }}, {id: "cp",test: function() { | |
| return /Chrome/.test(navigator.userAgent) | |
| },content: "点击这里,去Chrome应用商店安装百度随心听插件,打开浏览器就能听",onclick: function() { | |
| window.open("https://chrome.google.com/webstore/detail/%E7%99%BE%E5%BA%A6%E9%9A%8F%E5%BF%83%E5%90%AC/kpbmmodojkohjcmflidhblekanbgjmcl") | |
| }}, | |
| {id: "w8",test: function() { | |
| return /Windows NT 6\.2/.test(navigator.userAgent) | |
| },content: "安装百度随心听win 8版本,歌曲播放更流畅",onclick: function() { | |
| /MSIE/.test(navigator.userAgent) ? window.open("ms-windows-store:PDP?PFN=BaiduMusic.BaiduFM_mnx5vnspd98s0") : window.open("http://apps.microsoft.com/webpdp/app/baidu-fm/76004d7d-3a25-4211-8ecf-8abb44cbf61a") | |
| }}, {id: "ie6",test: function() { | |
| return !1 | |
| },content: "安装百度浏览器,歌曲播放更流畅",onclick: function() { | |
| window.open("http://liulanqi.baidu.com/") | |
| }}]; | |
| a.extend({test: function(a, e, f, g) { | |
| if (0 < g) | |
| return null; | |
| b++; | |
| if (0 < b) | |
| return null; | |
| for (a = c.length; a-- && !(c[a].test() && -1 == $.inArray(c[a].id, f)); ) | |
| ; | |
| return -1 != a ? c[a] : null | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui.pstrategies"); | |
| bradio.ui.pstrategies.SkipInRow = function() { | |
| var a = bradio.lang.Class(), b = 0, c = {id: "sir",content: "",onclick: function() { | |
| FM.loadChannel("private") | |
| }}; | |
| a.extend({test: function(a, e) { | |
| if ("operation" != e) | |
| return null; | |
| "skip" != a.operation ? b = 0 : b++; | |
| return 10 > b ? null : /public/.test(a.currentChannel.getId()) ? (c.content = a.user.getLogined() ? "试试私人频道,发现更多好音乐" : "登陆后,去私人频道,推荐歌曲更符合喜好", c) : null | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.FX = function() { | |
| var a = bradio.lang.Class(), b = !($.browser.msie && 9 > $.browser.version); | |
| a.extend({fadeIn: function(a, d) { | |
| d = d || {}; | |
| if (b) | |
| a.fadeIn(d.duration || 400, d.onafterfinish); | |
| else if (a.show(), "undefined" != typeof d.onafterfinish) | |
| d.onafterfinish() | |
| },fadeOut: function(a, d) { | |
| d = d || {}; | |
| if (b) | |
| a.fadeOut(d.duration || 400, d.onafterfinish); | |
| else if (a.hide(), "undefined" != typeof d.onafterfinish) | |
| d.onafterfinish() | |
| },scrollTo: function(a, b) { | |
| $.browser.safari ? (a.scrollTop(b[0]), a.scrollLeft(b[1])) : a.animate({scrollTop: b[0], | |
| scrollLeft: b[1]}, 400) | |
| },opacity: function(a, d) { | |
| if (b) | |
| d.onafterfinish = function() { | |
| 0 == d.to && a.hide() | |
| }, a.fadeTo(400, d.to, d.onafterfinish); | |
| else if (d.to > d.from ? a.show() : a.hide(), "undefined" != typeof d.onafterfinish) | |
| d.onafterfinish() | |
| },digitRoll: function(a, d) { | |
| d.from = d.from || 0; | |
| d.to = d.to || 0; | |
| a.html(d.from); | |
| if (0 != d.from - d.to) | |
| if (!b || $.browser.msie) | |
| a.text(d.to); | |
| else { | |
| var e = d.from + "", f = d.to - d.from, g = d.from, i = a.clone(), j = g + f + "", n = g = "", l = "", l = -1; | |
| if (j.length != e.length) | |
| n = e, l = j; | |
| else { | |
| for (; ++l < e.length && e.substr(l, 1) == j.substr(l, | |
| 1); ) | |
| g += e.substr(l, 1); | |
| n = e.substr(l); | |
| l = j.substr(l) | |
| } | |
| var e = a.outerHeight(), m = a.outerWidth(); | |
| a.html(j); | |
| i.attr("id", "").css("height", e + "px").css("width", (0 < f ? a.outerWidth() : m) + "px").css("position", "absolute").css("left", 0).css("top", 0).css("padding", "0 0 0 25px").css("border", "none").css("overflow-y", "hidden"); | |
| a.parent().css("position", "relative"); | |
| j = "digitRoll" + +new Date; | |
| 0 < f ? (m = n, n = l) : m = l; | |
| i.html(bradio.lang.string.format('#{same}<span style="position:relative;vertical-align: top;top:0;padding:0;margin:0;border:none"><i id="#{id}" style="font-style:normal;position:absolute; line-height:#{height}px;top:0;padding:0;margin:0;border:none;">#{num1}<br>#{num2}</i></span>', | |
| {same: g,num1: m,num2: n,id: j,height: e})); | |
| a.css("visibility", "hidden"); | |
| a.parent().append(i); | |
| 0 > f && $("#" + j).css({top: -1 * e + "px"}); | |
| $("#" + j).animate({top: 0 < f ? -1 * e : 0}, 400, function() { | |
| a.css("visibility", "visible"); | |
| i.remove() | |
| }) | |
| } | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Lyrics = function() { | |
| var a = bradio.lang.Class(); | |
| bradio.ui.FX(); | |
| var b, c = [], d = $("#playerpanel-lyrics"), e = $("#playerpanel-lyrics-wrapper"); | |
| $("#playerpanel-lyrics-outter"); | |
| var f = 0, g = !1, i = /\[(.*?)\](.*?)(?=(\[|$))/igm, j = 0, n = !1, l = !1, m = null, k = function() { | |
| m && (clearTimeout(m), m = null) | |
| }, q = function() { | |
| d.html(""); | |
| var a = "", b, e, f; | |
| e = 0; | |
| for (f = c.length; e < f; e++) | |
| a += "<li id='lyrics-li-" + e + "'>" + c[e].content + "</li>"; | |
| d.append(a); | |
| e = 0; | |
| for (f = c.length; e < f; e++) | |
| b = $("#lyrics-li-" + e), b.attr("data-top", b.position().top); | |
| g = g || | |
| "" != a | |
| }, u = function() { | |
| if (!n) { | |
| var a; | |
| for (a = c.length; a-- && c[a].time > f; ) | |
| ; | |
| a = Math.min(Math.max(a, 0), c.length - 1); | |
| var b = -1; | |
| if (a != j || l) { | |
| k(); | |
| l = !1; | |
| var b = j, d = j = a; | |
| $("#lyrics-li-" + b).removeClass("current"); | |
| $("#lyrics-li-" + d).addClass("current"); | |
| a -= 3; | |
| 0 > a ? e.animate({scrollTop: 0,scrollLeft: 0}, 100) : (a = $("#lyrics-li-" + a).attr("data-top"), e.animate({scrollTop: a,scrollLeft: 0}, 400)) | |
| } | |
| } | |
| }, s = function(a, b) { | |
| return a.time == b.time ? 0 : a.time > b.time ? 1 : -1 | |
| }; | |
| a.extend({load: function(a) { | |
| var d = a.replace(/\n|\r/gmi, " "), a = {}, e = [], f = 0, e = 0, | |
| j = "", k = 0, a = 0; | |
| g = !1; | |
| c = []; | |
| i.lastIndex = 0; | |
| if (i.test(d)) { | |
| for (; a = i.exec(d); ) { | |
| e = a[1].split(":"); | |
| j = a[2]; | |
| switch (e[0]) { | |
| case "offset": | |
| f = parseInt(e[1]) | |
| } | |
| if (/^\d+$/i.test(e[0])) | |
| if (e = 1E3 * (60 * parseInt(a[1].substr(0, 2)) + parseFloat(a[1].substring(3))) - f, " " == j && (j = " "), c.push({time: e,content: j}), "" == j) | |
| k = c.length - 1; | |
| else { | |
| for (a = c.length - 1; a-- > k; ) | |
| if ("" == c[a].content && (c[a].content = j), c[a].time > e && " " == c[a].content) | |
| c[a].content = j; | |
| k = c.length | |
| } | |
| } | |
| c = c.sort(s) | |
| } else { | |
| d = d.split(" "); | |
| f = (b.getDuration() - 1E3) / d.length; | |
| a = 0; | |
| for (j = d.length; a < | |
| j; a++) | |
| c.push({time: a * f + 1E3,content: d[a]}) | |
| } | |
| q() | |
| },reset: function() { | |
| },refresh: function() { | |
| g || q(); | |
| u() | |
| },setPosition: function(a) { | |
| 0 != c.length && !(1E3 > Math.abs(a - f)) && (f = a, u()) | |
| },setCurrentSong: function(a) { | |
| b = a | |
| }}); | |
| var o = $(e), r = o.get(0), v = $(document); | |
| e.css({cursor: "pointer"}); | |
| o.on("mousedown", function(a) { | |
| var b = o.scrollTop(), c = a.clientY, d = c; | |
| r.setCapture ? r.setCapture() : window.captureEvents && window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); | |
| v.on("mousemove", function(a) { | |
| k(); | |
| n = !0; | |
| d = c; | |
| c = a.clientY; | |
| b -= c - d; | |
| o.scrollTop(b) | |
| }); | |
| v.on("mouseup", function() { | |
| v.off("mousemove"); | |
| v.off("mouseup"); | |
| r.releaseCapture ? r.releaseCapture() : window.captureEvents && window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); | |
| n = !1; | |
| k(); | |
| m = setTimeout(function() { | |
| l = !0; | |
| u() | |
| }, 400) | |
| }) | |
| }); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.PlayerPanel = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.UI.Player, c = bradio.ui.FX(), d = bradio.data.enumerable.Song(), e = bradio.data.enumerable.Song(), f = bradio.data.enumerable.Channel(), g = bradio.data.enumerable.User(), i = $("#playerpanel"), j = $("#playerpanel-btnplay"), n = $("#playerpanel-btnlove"), l = $("#playerpanel-btnhate"), m = $("#playerpanel-btnskip"), k = $("#playerpanel-prev-song"), q = $("#playerpanel-btnmute"), u = $("#playerpanel-btndownload"), s = $("#playerpanel-coverimg"), o = $("#playerpanel-cover-overlay"), | |
| r = $("#playerpanel-prev-song-img"), v = $("#playerpanel-prev-song-overlay"), x = $("#playerpanel-timeinfo"), y = $("#playerpanel-songname"), z = $("#playerpanel-linkname"), w = $("#playerpanel-artistname-wrapper"), A = $("#playerpanel-albumname"), E = bradio.ui.Slider($("#playerpanel-volume")), t = $("#playerpanel-lyrics-outter"), D = "", B, C = function(a) { | |
| D = a.status; | |
| a = ""; | |
| switch (D) { | |
| case "play": | |
| F(); | |
| j.removeClass("play").addClass("pause"); | |
| a = "暂停[空格键]"; | |
| break; | |
| case "pause": | |
| j.removeClass("pause").addClass("play"); | |
| a = "播放[空格键]"; | |
| I(); | |
| break; | |
| default: | |
| j.removeClass("play").addClass("pause"), a = "暂停[空格键]" | |
| } | |
| j.attr("title", d.getIsAd() ? "" : a); | |
| n.attr("title", d.getIsAd() ? "" : "喜欢这首歌"); | |
| l.attr("title", d.getIsAd() ? "" : "不喜欢这首歌"); | |
| m.attr("title", d.getIsAd() ? "" : "切歌[→]"); | |
| $("#playerpanel-coverimg a").attr("title", d.getIsAd() ? "" : a) | |
| }, I = function(a) { | |
| a = a || "点击继续播放"; | |
| $("#playerpanel-cover-overlay-text").text() != a && $("#playerpanel-cover-overlay-text").text(a); | |
| o.hide().removeClass("hidden"); | |
| c.opacity(o, {from: 0,to: 1}) | |
| }, F = function() { | |
| "block" == o.css("display") && c.opacity(o, | |
| {from: 1,to: 0}) | |
| }, G = function(a) { | |
| return function() { | |
| d.getIsAd() || a() | |
| } | |
| }; | |
| a.extend({setTimeInfo: function(a) { | |
| a != x.text() && x.text(a) | |
| },setPlayStatus: C,setCurrentSong: function(e, f) { | |
| if (e && (d = e, d.getRelateStatus(), d.getChannel(), d.getLoved() != n.hasClass("loved") && (d.getLoved() && g.getLogined() ? n.addClass("loved") : n.removeClass("loved")), n.attr("title", d.getLoved() ? "不再喜欢这首歌" : "喜欢这首歌"), "update" != f)) { | |
| C("play"); | |
| x.text("-" + bradio.lang.string.convertTime(d.getDuration())); | |
| bradio.lang.string.ellipsis(d.getName(), y, 250); | |
| var j = "", j = d.getIsAd() ? d.getAdUrl() + "?from=fm" : "http://music.baidu.com/song/" + d.getId() + "?from=fm"; | |
| y.attr("title", bradio.lang.string.encodeHTML(d.getName())).attr("href", j); | |
| y.attr("target", "_blank"); | |
| "" != d.getAlbum() ? bradio.lang.string.ellipsis(d.getAlbum(), A, 250, "《", "》") : A.text(""); | |
| A.attr("title", bradio.lang.string.encodeHTML(d.getAlbum())); | |
| d.albumLinkEnable() ? (j = "", j = d.getIsAd() ? d.getAdUrl() + "?from=fm" : "http://music.baidu.com/album/" + d.getAlbumId() + "?from=fm", A.attr("href", j).removeClass("disable").attr("target", | |
| "_blank")) : A.attr("href", "javascript:void(0);").addClass("disable").attr("target", ""); | |
| 1 < d.getResourceType() ? (z.attr("title", bradio.lang.string.encodeHTML(d.getShowLink())).attr("href", "javascript:void(0);").attr("onclick", "return false;").click(function() { | |
| a.trigger(b.DOWNLOAD) | |
| }), bradio.lang.string.ellipsis(d.getShowLink(), z, 250, "", "", "center"), t.addClass("minHeight"), z.show()) : (z.hide(), t.removeClass("minHeight")); | |
| w.html(""); | |
| $.each(d.getArtists(), function(a, b) { | |
| var c = $('<a href="javascript:void(0);" hideFocus="true" title="" class="playerpanel-artistname" target="_blank"></a>').attr("title", | |
| bradio.lang.string.encodeHTML(b.getName())).text(b.getName()); | |
| if (d.artistLinkEnable() && b.getId() != 0) { | |
| var e = "", e = d.getIsAd() ? d.getAdUrl() + "?from=fm" : "http://music.baidu.com/artist/" + b.getId() + "?from=fm"; | |
| c.attr("href", e).removeClass("disable").attr("target", "_blank") | |
| } else | |
| c.attr("href", "javascript:void(0);").addClass("disable").attr("target", ""); | |
| w.append(c); | |
| a < d.getArtists().length - 1 && w.append($("<span class='seperator'>/</span>")) | |
| }); | |
| !$.cookie("fm_1p") && ("prev" == f && !d.getLoved()) && (g.getLogined() ? bradio.ui.Tooltip("喜欢这首歌?把它标上<img class='png tooltip-love' src='" + | |
| staticPath + "/images/love.png' />吧~", n, {offsetX: 7}) : bradio.ui.Tooltip("喜欢这首歌?把它标上<img class='png tooltip-love' src='" + staticPath + "/images/love.png' />吧~ <a href='javascript:void(0)' onclick='FM.hideTooltip();FM.showLogin();'>登录</a>", n, {offsetX: 7}), $.cookie("fm_1p", null), $.cookie("fm_1p", 1, {expires: 365})); | |
| var j = function() { | |
| s.html(""); | |
| if (d.getCover() != "") { | |
| var a = $("<img/>").attr("width", 240).attr("height", 240).attr("alt", d.getName()).on("load", function() { | |
| c.fadeIn(a, {duration: 400}) | |
| }); | |
| a.hide(); | |
| var b = $("<a />"); | |
| b.append(a); | |
| s.append(b); | |
| a.attr("src", d.getCover()) | |
| } | |
| }, k = $("#playerpanel-coverimg a img")[0]; | |
| k ? $(k).fadeOut(200, j) : j(); | |
| d.getIsAd() ? i.addClass("ad") : i.removeClass("ad") | |
| } | |
| },setCurrentChannel: function(a) { | |
| f = a | |
| },setPrevSong: function(a, b) { | |
| if (a && "update" != b) { | |
| var d = !1; | |
| "next" == b && (d = !0); | |
| if ("" == a.getName()) | |
| k.hide(); | |
| else if (d && "0" != k.css("left") && (k.show(), k.animate({left: 0}, 800, function() { | |
| })), !(e && e.getId() == a.getId())) | |
| if (e = a, k.removeClass("hidden").show(), r.html(""), "" != e.getCover()) { | |
| var f = $("<img />").width(100).height(100).hide(), | |
| d = $("<a />").attr("href", "javascript:void(0);").attr("onclick", "return false;").append(f); | |
| r.append(d); | |
| f.load(function() { | |
| c.fadeIn(f) | |
| }).attr("src", e.getCoverBig()) | |
| } | |
| } | |
| },setUserInfo: function(a) { | |
| g.loadRaw(a.raw()) | |
| },setVolume: function(a) { | |
| a ? q.removeClass("muted") : q.addClass("muted"); | |
| q.attr("title", a ? "静音" : "取消静音"); | |
| E.setValue(a) | |
| },showMobileInit: function() { | |
| I("点击开始播放") | |
| }}); | |
| o.hide(); | |
| k.hide(); | |
| v.hide(); | |
| j.click(function() { | |
| j.hasClass("pause") ? (a.trigger(b.PAUSE), j.removeClass("pause").addClass("play")) : (a.trigger(b.PLAY), | |
| j.removeClass("play").addClass("pause")) | |
| }); | |
| n.click(G(function() { | |
| f.getId() == bradio.core.Constant.Etc.PRIVATE_CHANNEL_ID && ($.cookie("fm_1pl") || bradio.ui.Tooltip("好滴,我们会为您推荐更多这类歌曲", n, {hideDelay: 2E3,offsetX: 7}), $.cookie("fm_1pl"), $.cookie("fm_1pl", 1, {expires: 365})); | |
| g.getLogined() || bradio.ui.Tooltip("马上<a href='javascript:void(0)' onclick='FM.hideTooltip();FM.showLogin();'>登录</a>,收藏到红心频道", n, {offsetX: 7}); | |
| n.hasClass("loved") ? a.trigger(b.SONG_DELOVE) : a.trigger(b.SONG_LOVE) | |
| })); | |
| l.click(G(function() { | |
| g.getLogined() ? | |
| ($.cookie("fm_1h") || bradio.ui.Tooltip("好的,这首歌不会再出现了", l, {hideDelay: 2E3,offsetX: 7}), $.cookie("fm_1h", null), $.cookie("fm_1h", 1, {expires: 365}), a.trigger(b.SONG_HATE)) : bradio.ui.Tooltip("<a href='javascript:void(0)' onclick='FM.hideTooltip();FM.showLogin();'>登录</a>后可用", l, {offsetX: 7}) | |
| })); | |
| m.click(function() { | |
| a.trigger(b.SKIP) | |
| }); | |
| k.click(function() { | |
| B && (B.hide(), B = null); | |
| k.animate({left: 145}, 800, function() { | |
| a.trigger(b.PREV); | |
| c.fadeOut(v, {duration: 300}) | |
| }) | |
| }); | |
| if (!bradio.utils.UA().isMobile()) | |
| k.on("mouseenter", function() { | |
| c.fadeIn(v, | |
| {duration: 300}); | |
| B || (B = bradio.ui.Tooltip(e.getName() + " - " + e.getArtists()[0].getName(), k, {noCloseButton: !0,offsetX: -1})) | |
| }).on("mouseleave", function() { | |
| c.fadeOut(v, {duration: 300}); | |
| B && (B.hide(), B = null) | |
| }); | |
| o.click(function() { | |
| a.trigger(b.PLAY); | |
| F() | |
| }); | |
| q.click(function(a) { | |
| bradio.utils.UA().isMobile() ? a.preventDefault() : q.hasClass("muted") ? E.unmute() : E.mute() | |
| }); | |
| u.click(function() { | |
| a.trigger(b.DOWNLOAD) | |
| }); | |
| s.click(function() { | |
| a.trigger(b.COVER_CLICK) | |
| }); | |
| E.bind(bradio.core.Event.UI.Slider.UPDATE, function(c, d) { | |
| q.hasClass("muted") && | |
| a.trigger(b.UNMUTE); | |
| a.trigger(b.VOLUME_CHANGE, {volume: d.value}) | |
| }); | |
| y.click(function() { | |
| a.trigger(b.SONG_CLICK) | |
| }); | |
| w.click(function() { | |
| a.trigger(b.ARTIST_CLICK) | |
| }); | |
| A.click(function() { | |
| a.trigger(b.ALBUM_CLICK) | |
| }); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Button = function() { | |
| return bradio.lang.Bindable() | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.ChannelList = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.UI, c = bradio.core.Constant.ChannelDescriptions, d = $("#channellist-top"), e = $("#channellist-bottom"), f = {}, g, i = !1, j = bradio.data.enumerable.User(), n = [{id: bradio.core.Constant.Etc.PRIVATE_CHANNEL_ID,notLoginedTitle: "让好音乐主动找到你,登录可用",loginedTitle: "让好音乐主动找到你"}, {id: bradio.core.Constant.Etc.LOVE_CHANNEL_ID,notLoginedTitle: "收听我喜欢的歌曲,登录可用",loginedTitle: "收听我喜欢的歌曲"}]; | |
| a.extend({setChannelList: function(g) { | |
| for (var g = g.getData(), m, k, n = | |
| 0, u = g.length; n < u; n++) | |
| m = g[n], f[m.getCateId()] || (f[m.getCateId()] = []), f[m.getCateId()].push(m); | |
| for (var s in f) { | |
| g = f[s]; | |
| m = bradio.ui.ChannelCate(); | |
| m.setChannelCate({cateName: g[0].getCateName(),cateId: g[0].getCateId()}); | |
| n = 0; | |
| for (u = g.length; n < u; n++) { | |
| k = g[n]; | |
| var o = bradio.ui.ChannelBtn(); | |
| o.setChannelData(k); | |
| k = o; | |
| m.add(k); | |
| k.bind(b.ChannelBtn.CLICK, function(c) { | |
| return function() { | |
| c.getChannelData().getId() == bradio.core.Constant.Etc.LOVE_CHANNEL_ID && (!i && j.getLogined()) && bradio.ui.Tooltip("您还没收藏过歌曲呢,去其他频道把您喜爱的音乐标上红心吧", | |
| $("#channel-btn-lovesongs")); | |
| a.trigger(b.ChannelList.SWITCH, {id: c.getChannelData().getId()}) | |
| } | |
| }(k)) | |
| } | |
| switch (s) { | |
| case "private": | |
| case "love": | |
| d.append(m.getHTMLElm()); | |
| break; | |
| default: | |
| e.append(m.getHTMLElm()) | |
| } | |
| } | |
| for (s in c) | |
| $("#channel-btn-" + c[s].channel + " a").attr("title", c[s].content) | |
| },setCurrentChannel: function(a) { | |
| g && !/(artist|tag)/.test(g.getId()) && $("#channel-btn-" + g.getId()).removeClass("channel-btn-current"); | |
| g = a; | |
| /(artist|tag)/.test(g.getId()) || (a = $("#channel-btn-" + g.getId())) && a.addClass("channel-btn-current") | |
| }, | |
| setLoveSongsAvail: function(a) { | |
| i = a | |
| },setUserInfo: function(a) { | |
| j.loadRaw(a.raw()); | |
| for (var b in n) | |
| $("#channel-btn-" + n[b].id + " a").attr("title", j.getLogined() ? n[b].loginedTitle : n[b].notLoginedTitle) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.ChannelBtn = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.UI.ChannelBtn, c, d, e = ["private", "lovesongs", "public_tuijian_winter"], f = function(a) { | |
| return "channel-btn-hover" + (-1 < $.inArray(a, e) ? "-" + a : "") | |
| }; | |
| a.extend({setChannelData: function(e) { | |
| c = e; | |
| d = $("<li class='channel-btn channel-btn-" + c.getId() + "' id='channel-btn-" + c.getId() + "'><div class='channel-btn-bg' /><div class='channel-btn-border' /><div class='channel-btn-inner'><a href='javascript:void(0);' onclick='return false;'>" + c.getName() + | |
| "</a><div class='channel-btn-icon' /></div></li>"); | |
| d.on("mouseover", function() { | |
| d.addClass(f(c.getId())) | |
| }).on("mouseout", function() { | |
| d.removeClass(f(c.getId())) | |
| }).on("click", function() { | |
| a.trigger(b.CLICK, {id: c.getId()}) | |
| }) | |
| },getChannelData: function() { | |
| return c | |
| },getHTMLElm: function() { | |
| return d | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.ChannelCate = function() { | |
| var a = bradio.lang.Class(), b, c; | |
| a.extend({add: function(a) { | |
| c.append(a.getHTMLElm()) | |
| },setChannelCate: function(a) { | |
| "private" == a.cateId || "love" == a.cateId || elmName.html(a.cateName) | |
| },getHTMLElm: function() { | |
| return b | |
| }}); | |
| b = $("<div class='channel-cate'><div class='channel-cate-name'></div><ul class='channel-cate-list'></ul></div>"); | |
| elmName = b.find(".channel-cate-name"); | |
| c = b.find(".channel-cate-list"); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.ChannelBar = function() { | |
| var a = bradio.lang.Bindable(), b = $("#channelbar-wrap"), c = $("#currentchannel"), d = $("#currentchannel-text"), e = $("#switchchannel"), f = $("#btn-switchchannel"), g = $("#currentchannel-icon"), i = bradio.core.Event.UI.ChannelBar, j = bradio.ui.FX(), n = 1, l = !$.cookie("fm_1"), m = !1; | |
| a.extend({setCurrentChannel: function(c) { | |
| d.text() != c.getName() && ("" == d.text() && (j.fadeIn(b), j.fadeIn($("#channelbar-xmas-deco")), l && (bradio.ui.Tooltip("更多好频道等你来发现~", e, {offsetX: 0,offsetY: 5}).bind(bradio.core.Event.UI.Tooltip.CLOSE, | |
| function() { | |
| a.trigger(i.TIPS_CLOSE) | |
| }), a.trigger(i.TIPS_SHOW), m = !0), l = !1), bradio.lang.string.ellipsis("当前频道:" + c.getName(), d, 150), bradio.core.Constant.Etc.LOVE_CHANNEL_ID == c.getId() && $.cookie("fm_loveSongCollectionUsed", 1, {expires: 365})) | |
| },setSceneIndex: function(a) { | |
| n != a && (n = a, f.html(1 != n ? "返回" : "换台"), c.css("cursor", 1 != n ? "pointer" : "default")) | |
| },setPlayStatus: function(a) { | |
| "pause" == a.status ? g.addClass("paused") : g.removeClass("paused") | |
| }}); | |
| e.click(function() { | |
| 1 != n ? a.trigger(i.BACK_PLAYER) : (m && a.trigger(i.TIPS_CLICK), | |
| a.trigger(i.SWITCH_CHANNEL)) | |
| }).on("mouseenter", function() { | |
| b.addClass("hover") | |
| }).on("mouseleave", function() { | |
| b.removeClass("hover") | |
| }); | |
| c.click("click", function() { | |
| 1 != n && a.trigger(i.BACK_PLAYER) | |
| }); | |
| b.hide().removeClass("hidden"); | |
| $("#channelbar-xmas-deco").hide().removeClass("hidden"); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.SceneMgr = function() { | |
| var a = bradio.lang.Bindable(), b = $("#main-tab-list"), c = $("#main-tab-list").find(".tab-page"), d = $("body"), e = bradio.core.Event.UI.SceneMgr, f = bradio.ui.FX(), g = 1; | |
| a.extend({switchScene: function(b) { | |
| if (b != g) { | |
| f.scrollTo(d, [0, 0]); | |
| for (var j = 0; j < c.length; j++) | |
| j == b ? f.fadeIn($(c[j])) : $(c[j]).hide(); | |
| g = b; | |
| a.trigger(e.PAGE_SWITCH, {index: b}) | |
| } | |
| },getCurrentIndex: function() { | |
| return g | |
| }}); | |
| $.each(c, function(a, b) { | |
| $(b).hide() | |
| }); | |
| b.css("display", "block"); | |
| $(c[g]).show(); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.ShareBar = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.UI.ShareBar; | |
| bradio.data.enumerable.Song(); | |
| var c = "tsina tqq qzone renren tieba douban".split(" "); | |
| a.extend({setCurrentSong: function() { | |
| }}); | |
| for (var d = c.length - 1; 0 <= d; d--) | |
| $("#playerpanel-share-" + c[d]).click(function(c) { | |
| return function() { | |
| a.trigger(b.SHARE, {target: c}) | |
| } | |
| }(c[d])); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.PromotionBar = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.ui.FX(), c = bradio.core.Event.UI.PromotionBar, d = $("#promotionbar"), e = $("#promotionbar-text"), f = $("#promotionbar-close"), g, i = [], j = !1, n = $.cookie("fm_pb") ? $.cookie("fm_pb").split(",") : [], l = 0, m = [bradio.ui.pstrategies.RedirectToPrivate(), bradio.ui.pstrategies.Init(), bradio.ui.pstrategies.ChannelDescription(), bradio.ui.pstrategies.SkipInRow(), bradio.ui.pstrategies.BtnHate(), bradio.ui.pstrategies.BtnLove(), bradio.ui.pstrategies.BtnPrev(), | |
| bradio.ui.pstrategies.BtnSkip()], k = 0, q = function() { | |
| i.length ? j || (j = !0, g = i.pop(), b.fadeOut(d, {onafterfinish: function() { | |
| l++; | |
| lastTimestamp = +new Date; | |
| e.html(g.content); | |
| b.fadeIn(d); | |
| a.trigger(c.SHOW, {id: g.id}) | |
| }}), clearTimeout(k), k = setTimeout(function() { | |
| b.fadeOut(d); | |
| j = !1; | |
| q() | |
| }, 3E4)) : j = !1 | |
| }; | |
| a.extend({test: function(a, b) { | |
| for (var c, d = 0, e = m.length; d < e; d++) | |
| (c = m[d].test(a, b, n, l)) && -1 == $.inArray(c.id, n) && i.push(c); | |
| q() | |
| }}); | |
| d.bind("mouseenter", function() { | |
| d.addClass("hover") | |
| }).bind("mouseleave", function() { | |
| d.removeClass("hover") | |
| }); | |
| f.click(function(e) { | |
| e.stopPropagation(); | |
| n.push(g.id); | |
| b.fadeOut(d); | |
| a.trigger(c.HIDE, {id: g.id}) | |
| }); | |
| d.click(function() { | |
| a.trigger(c.CLICK, {id: g.id}); | |
| g.onclick(); | |
| b.fadeOut(d) | |
| }); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.FavList = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.data.enumerable.User(), c = bradio.core.Event.UI.FavList, d = bradio.ui.FX(), e = 0, f = 0, g = 0, i = $("#btn-backplayer-userlist"), j = $("#user-list-tabs li.tab a"), n = $("#song-container .song-list-wrapper"), l = -1, m = [], k = [{container: $("#total-listen"),wrapper: $("#total-listen-wrapper")}, {container: $("#like-songs"),wrapper: $("#like-songs-wrapper")}, {container: $("#dislike-songs"),wrapper: $("#dislike-songs-wrapper")}], q = {li: {"data-id": function() { | |
| return this.id | |
| }, | |
| "class": function() { | |
| return "" == this.name ? "black" : "white" | |
| }},picWrp: {href: function() { | |
| return "http://music.baidu.com/song/" + this.id | |
| },title: function() { | |
| return "" == this.album ? "" : "查看《" + this.album + "》" | |
| }},pic: {src: function() { | |
| return this.picUrl | |
| },"class": function() { | |
| return "" == this.picUrl ? "hidden" : "" | |
| }},title: {title: function() { | |
| return this.name | |
| },href: function() { | |
| return "http://music.baidu.com/song/" + this.id | |
| },text: function() { | |
| return this.name | |
| }},artists: {artist: {title: function() { | |
| return this.name | |
| },href: function() { | |
| return this.artistLinkEnable ? | |
| "http://music.baidu.com/artist/" + this.id : "javascript:void(0);" | |
| },target: function() { | |
| return this.artistLinkEnable ? "_blank" : "" | |
| },"class": function() { | |
| return this.artistLinkEnable ? "song-artist " : "song-artist linkUnable" | |
| },text: function() { | |
| return this.name | |
| }}},album: {title: function() { | |
| return "" == this.album ? "" : "《" + this.album + "》" | |
| },href: function() { | |
| return this.albumLinkEnable ? "http://music.baidu.com/album/" + this.albumId : "javascript:void(0);" | |
| },target: function() { | |
| return this.albumLinkEnable ? "_blank" : "" | |
| },"class": function() { | |
| return this.albumLinkEnable ? | |
| "song-album clear " : "song-album clear linkUnable" | |
| },text: function() { | |
| return "" == this.album ? "" : "《" + this.album + "》" | |
| }},"song-op1": {style: function() { | |
| return "display: " + (this.showBtnPlay ? "inline-block" : "none") | |
| }},"song-op2": {title: function() { | |
| return this.opt | |
| },"class": function() { | |
| return "icon " + this.status | |
| }}}, u = function(a, b) { | |
| k[a].wrapper.find(".pager").pageNavigator("setParam", b); | |
| void 0 != b.total && k[a].wrapper.find(".pager").css("display", 1 < b.total ? "block" : "none") | |
| }, s = function(a) { | |
| g = a; | |
| v(); | |
| $("#user-list-tabs .music-history a").text("我听过的 (" + | |
| a + ")"); | |
| u(0, {total: Math.ceil(a)}) | |
| }, o = function(a) { | |
| e = a; | |
| v(); | |
| $("#user-list-tabs .music-like a").text("我喜欢的 (" + a + ")"); | |
| u(1, {total: Math.ceil(a)}) | |
| }, r = function(a) { | |
| f = a; | |
| v(); | |
| $("#user-list-tabs .music-hate a").text("不喜欢的 (" + a + ")"); | |
| u(2, {total: Math.ceil(a)}) | |
| }, v = function() { | |
| 0 < g ? $("#total-listen-wrapper .song-list-empty").addClass("hidden") : $("#total-listen-wrapper .song-list-empty").removeClass("hidden"); | |
| 0 < e ? $("#like-songs-wrapper .song-list-empty").addClass("hidden") : $("#like-songs-wrapper .song-list-empty").removeClass("hidden"); | |
| 0 < f ? $("#dislike-songs-wrapper .song-list-empty").addClass("hidden") : $("#dislike-songs-wrapper .song-list-empty").removeClass("hidden") | |
| }, x = function(b) { | |
| -1 != b && (-1 == l && ($("#total-listen-wrapper .song-list-empty").css("background", ' transparent url("' + staticPath + '/images/uc-history-bg.jpg") no-repeat center center'), $("#like-songs-wrapper .song-list-empty").css("background", 'transparent url("' + staticPath + '/images/uc-love-bg.jpg") no-repeat center center'), $("#dislike-songs-wrapper .song-list-empty").css("background", | |
| 'transparent url("' + staticPath + '/images/uc-hate-bg.jpg") no-repeat center center')), -1 != l && k[l].container.html(""), l = b, k[l].container.html(""), $.each(j, function(a, b) { | |
| $(b).removeClass("currentList") | |
| }), $(j[b]).addClass("currentList"), $.each(n, function(a, c) { | |
| a == b ? $(n[a]).removeClass("hidden") : $(c).addClass("hidden") | |
| }), u(l, {page: 1}), a.trigger(c.TAB_SWITCH, {index: l,pageIndex: 0,pageSize: 10})) | |
| }, y = function(a) { | |
| for (var b = m.length; b-- && m[b].getId() != a; ) | |
| ; | |
| return -1 == b ? bradio.data.enumerable.Song() : m[b] | |
| }; | |
| a.extend({setSongsToRender: function(b, | |
| d) { | |
| if (d == l) { | |
| var e = k[l].wrapper, f = "song-normal", g = "收藏", i = e.find(".song-list-inner"), f = e.find(".song-list-empty"), j = []; | |
| m = b; | |
| 0 < b.length ? f.addClass("hidden") : f.removeClass("hidden"); | |
| i.html(""); | |
| for (var n = 0, o = b.length; n < o; n++) | |
| f = "song-normal", g = "收藏", b[n].getLoved() && (f = "song-like", g = "取消收藏"), b[n].getHated() && "dislike-songs-wrapper" == e.attr("id") && (f = "song-hate", g = "移除出垃圾桶"), !b[n].getLoved() && !b[n].getHated() && (f = "song-normal", g = "收藏"), j.push({id: b[n].getId(),name: b[n].getName(),album: b[n].getAlbum(),albumId: b[n].getAlbumId(), | |
| artists: function() { | |
| var a = [], c; | |
| $(b[n].getArtists()).each(function(d, e) { | |
| c = e.raw(); | |
| c.artistLinkEnable = b[n].artistLinkEnable(); | |
| a.push(c) | |
| }); | |
| return a | |
| }(),picUrl: b[n].getCoverSmall(),status: f,opt: g,showBtnPlay: "dislike-songs" != i.attr("id"),artistLinkEnable: b[n].artistLinkEnable(),albumLinkEnable: b[n].albumLinkEnable(),relationStatus: b[n].getRelateStatus()}); | |
| $("<ul class='song-list'><li data-bind='li'><div class='album-face'><a data-bind='picWrp' target='_blank'><img data-bind='pic' width=80 height=80 /></a></div><div class='song-summary'><a data-bind='title' target='_blank' class='song-title' hidefocus='true'></a><span data-bind='artists' class='song-artists'><a class='song-artist' data-bind='artist' target='' hidefocus='true'></a></span><a class='song-album clear' data-bind='album' target='' hidefocus='true'></a></div><div class='song-operation'><a href='javascript:void(0)' title='播放' data-bind='song-op1' hidefocus='true' onfocus='this.blur()' class='icon song-play'></a><a href='javascript:void(0)' data-bind='song-op2' hidefocus='true' onfocus='this.blur()'></a></div></li></ul>").render(j, | |
| q).appendTo(i); | |
| $("#song-container").find(".song-list .song-operation .song-normal"); | |
| $("#song-container").find(".song-list .song-operation .song-like"); | |
| e = $("#song-container").find(".song-list .song-operation .song-hate"); | |
| i = $("#song-container").find(".song-list .song-operation .song-play"); | |
| $.each($(".song-list .song-operation a"), function(a, b) { | |
| $(b).off("click") | |
| }); | |
| $.each(i, function(b, d) { | |
| $(d).click(function() { | |
| var b = $(d).parent().parent().attr("data-id"); | |
| a.trigger(c.SONG_PLAY, {song: y(b)}) | |
| }) | |
| }); | |
| $.each($(".song-list .song-operation .song-normal, .song-list .song-operation .song-like"), | |
| function(b, d) { | |
| $(d).click(function() { | |
| var b = $(d).parent().parent().attr("data-id"); | |
| $(d).hasClass("song-normal") ? ($(d).attr("class", $(d).attr("class").replace("song-normal", "song-like")), a.trigger(c.SONG_LOVE, {song: y(b)}), $(d).attr("title", "取消收藏")) : $(d).hasClass("song-like") && ($(d).attr("class", $(d).attr("class").replace("song-like", "song-normal")), a.trigger(c.SONG_DELOVE, {song: y(b)}), $(d).attr("title", "收藏")) | |
| }) | |
| }); | |
| $.each(e, function(b, d) { | |
| $(d).click(function() { | |
| var b = $(d).parent().parent().attr("data-id"); | |
| $.each($("#dislike-songs-wrapper .song-list li"), function(d, e) { | |
| var f = $(e).attr("data-id"); | |
| b == f && ($(e).remove(), a.trigger(c.SONG_DEHATE, {song: y(b)})) | |
| }) | |
| }) | |
| }) | |
| } | |
| },setHistoryListenCount: s,setLikeSongsCount: o,setDislikeSongsCount: r,showTab: x,setUserInfo: function(a) { | |
| a.getLogined() != b.getLogined() && x(l); | |
| b.loadRaw(a.raw()); | |
| if (!b.getLogined()) | |
| for (var a = 0, c = k.length; a < c; a++) | |
| k[a].wrapper.find(".song-list-inner").html("") | |
| }}); | |
| i.click("click", function() { | |
| a.trigger(c.BACK_PLAYER) | |
| }).on("mouseenter", function() { | |
| i.addClass("hover") | |
| }).on("mouseleave", | |
| function() { | |
| i.removeClass("hover") | |
| }); | |
| $.each(j, function(a, b) { | |
| $(b).click(function(a) { | |
| return function() { | |
| x(a) | |
| } | |
| }(a)) | |
| }); | |
| for (var z = 0, w = k.length; z < w; z++) | |
| k[z].wrapper.find(".pager").pageNavigator({hash: "#",size: 10,pageChange: function(b, e) { | |
| return function(f, g) { | |
| d.scrollTo($("body"), [0, 0]); | |
| a.trigger(c.TAB_SWITCH, {index: b,pageIndex: parseInt(g.page) - 1,pageSize: g.size}); | |
| 0 == b && g.page == e.pageNavigator("getTotal") + "" ? $("#history-notice").hasClass("hidden") && $("#history-notice").removeClass("hidden") : $("#history-notice").hasClass("hidden") || | |
| $("#history-notice").addClass("hidden") | |
| } | |
| }(z, k[z].wrapper.find(".pager"))}); | |
| s(0); | |
| o(0); | |
| r(0); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.UserBar = function() { | |
| var a = bradio.lang.Bindable(), b = bradio.core.Event.UI.UserBar, c = bradio.ui.FX(), d = 0, e = 0, f = 0, g = bradio.data.enumerable.User(), i = $("#user-bar"), j = $("#userinfo-username"), n = $("#userinfo-listencount"), l = $("#userinfo-lovecount"), m = $("#userinfo-hatecount"), k = $("#userinfo-listencount-fake"), q = $("#userinfo-lovecount-fake"), u = $("#userinfo-hatecount-fake"); | |
| $("#userinfo-username-bg"); | |
| var s = $("#userinfo-menu-bg"), o = $("#userinfo-menu"), r = $("#userinfo-btn-usercenter"), v = $("#userinfo-btn-logout"), | |
| x = $("#userinfo-menutrigger"); | |
| $("#userinfo-menutrigger-debugie6"); | |
| var y = null, z = function() { | |
| s.removeClass("hidden"); | |
| x.addClass("mHover"); | |
| o.show() | |
| }, w = function() { | |
| x.removeClass("mHover"); | |
| s.addClass("hidden"); | |
| o.hide() | |
| }; | |
| a.extend({setUserInfo: function(a) { | |
| g.loadRaw(a.raw()); | |
| g.getLogined() ? i.removeClass("notlogined").addClass("logined") : i.removeClass("logined").addClass("notlogined"); | |
| $.browser.msie && 7 == $.browser.version && ($("#userinfo-username-out").css("display", "block"), $("#userinfo-username").css("display", | |
| "block")); | |
| bradio.lang.string.ellipsis(g.getUserName(), j, 160) | |
| },setListenCount: function(a) { | |
| g.getLogined() && c.digitRoll(n, {from: d,to: a}); | |
| d = a | |
| },setLoveSongCount: function(a) { | |
| g.getLogined() && c.digitRoll(l, {from: e,to: a}); | |
| e = a; | |
| !g.getLogined() && !$.cookie("fm_1u") && ($.cookie("fm_1u", 1, {expires: 365}), bradio.ui.Tooltip("看看登录后能做什么?", q, {offsetX: -18,offsetY: 5})); | |
| g.getLogined() && (($.cookie("fm_firstGetLoveInfo") ? ($.cookie("fm_firstGetLoveInfo", 1, {expires: 365}), a && (!$.cookie("fm_loveSongCollection") && $.cookie("fm_loveSongCollectionUsed", | |
| 1, {expires: 365}) && $.cookie("fm_loveSongCollection", 1, {expires: 365}) || $.cookie("fm_loveSongCollection", 1, {expires: 365}))) : ($.cookie("fm_firstGetLoveInfo", 1, {expires: 365}), a && $.cookie("fm_loveSongCollection", 1, {expires: 365})), $.cookie("fm_loveSongCollection")) ? $.cookie("fm_loveSongCollectionUsed") || ($.cookie("fm_loveSongCollectionUsed", 1, {expires: 365}), bradio.ui.Tooltip("收藏歌曲可以在红心频道一键播放哦~", l, {offsetX: -18,offsetY: 5})) : ($.cookie("fm_loveSongCollectionUsed", 1, {expires: 365}), $.cookie("fm_loveSongCollection", | |
| 1, {expires: 365}), bradio.ui.Tooltip("收藏歌曲可以在红心频道一键播放哦,快试试标红心吧~", l, {offsetX: -18,offsetY: 5}))) | |
| },setHateSongCount: function(a) { | |
| g.getLogined() && c.digitRoll(m, {from: f,to: a}); | |
| f = a | |
| }}); | |
| d = $.trim(n.text()) || 0; | |
| e = $.trim(l.text()) || 0; | |
| f = $.trim(m.text()) || 0; | |
| j.click(function() { | |
| a.trigger(b.USER_CENTER) | |
| }); | |
| r.click(function() { | |
| a.trigger(b.USER_CENTER); | |
| w() | |
| }); | |
| v.click(function() { | |
| a.trigger(b.LOGOUT); | |
| w() | |
| }); | |
| if (bradio.utils.UA().isMobile()) | |
| x.click(function() { | |
| s.hasClass("hidden") ? z() : w() | |
| }); | |
| else | |
| x.on("mouseenter", function() { | |
| z() | |
| }); | |
| if ($.browser.msie && 7 >= $.browser.version) | |
| $("#userinfo-username-wrapper").on("mouseleave", function() { | |
| y = setTimeout(function() { | |
| w() | |
| }, 400) | |
| }), $("#userinfo-menu").on("mouseenter", function() { | |
| y && (clearTimeout(y), y = null) | |
| }), $("#userinfo-menu").on("mouseleave", function() { | |
| w() | |
| }); | |
| else | |
| $("#userinfo-username-wrapper").on("mouseleave", function() { | |
| w() | |
| }); | |
| n.click(function() { | |
| a.trigger(b.LISTEN_COUNT) | |
| }); | |
| l.click(function() { | |
| a.trigger(b.LOVE_COUNT) | |
| }); | |
| m.click(function() { | |
| a.trigger(b.HATE_COUNT) | |
| }); | |
| k.click(function() { | |
| a.trigger(b.LISTEN_COUNT) | |
| }); | |
| q.click(function() { | |
| a.trigger(b.LOVE_COUNT) | |
| }); | |
| u.click(function() { | |
| a.trigger(b.HATE_COUNT) | |
| }); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Background = function() { | |
| var a = bradio.lang.Class(), b = $("#body-bg"), c, d = "", e = bradio.ui.FX(), f = [{ids: [bradio.core.Constant.Etc.PRIVATE_CHANNEL_ID],img: "private-bg3.jpg"}, {ids: ["public_xinqing_yonglanwuhou"],img: "public-bg4.jpg"}, {ids: ["public_shiguang_erge"],img: "erge-bg2.jpg"}, {ids: ["public_xinqing_qingsongjiari"],img: "qingsongjiari-bg2.jpg"}, {ids: ["public_xinqing_tianmi"],img: "tianmi-bg.jpg"}]; | |
| a.extend({setCurrentChannel: function(a) { | |
| for (var i = f.length; i-- && -1 == $.inArray(a.getId(), f[i].ids); ) | |
| ; | |
| a = staticPath + "/themes/public-xmas.jpg"; | |
| if (a != d) { | |
| d = a; | |
| var j = $("<img />"); | |
| $(j).load(function() { | |
| c && (e.fadeOut(c, {duration: 400}), c.remove()); | |
| e.fadeIn(j, {onafterfinish: function() { | |
| c = j | |
| }}) | |
| }); | |
| j.hide(); | |
| b.append(j); | |
| j.attr("src", d) | |
| } | |
| },show: function() { | |
| b.show() | |
| },hide: function() { | |
| b.hide() | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Tooltip = function(a, b, c) { | |
| var d = bradio.lang.Bindable(), e = bradio.core.Event.UI.Tooltip, c = c || {}, f = function() { | |
| b.tooltip("destroy") | |
| }; | |
| d.extend({show: function() { | |
| c.hideDelay && setTimeout(function() { | |
| f() | |
| }, c.hideDelay) | |
| },hide: f}); | |
| b.tooltip({innerHtml: a,autoCloseEnable: !1,closeEnable: !c.noCloseButton,offset: {top: c.offsetY || 0,left: c.offsetX || 0},autoCloseEnable: c.otherClickHide,destroyed: function() { | |
| d.trigger(e.CLOSE) | |
| }}); | |
| return d | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Slider = function(a) { | |
| var b = bradio.lang.Bindable(), c = bradio.core.Event.UI.Slider, d = 50, e = !1, f, g = function() { | |
| e && (e = !1); | |
| f.css({width: i() + "%"}); | |
| b.trigger(c.UPDATE, {value: i()}) | |
| }, i = function() { | |
| return a.slider("option", "value") | |
| }; | |
| b.extend({show: function() { | |
| a.removeClass("hidden") | |
| },hide: function() { | |
| a.addClass("hidden") | |
| },setValue: function(b) { | |
| b != i() && a.slider("option", "value", b) | |
| },getValue: i,mute: function() { | |
| d = i(); | |
| a.slider("option", "value", 0); | |
| e = !0 | |
| },unmute: function() { | |
| a.slider("option", "value", d); | |
| e = !1 | |
| }}); | |
| a.slider({animate: !1, | |
| range: !1,value: 50,slide: g,change: g}); | |
| f = $('<div class="ui-slider-range ui-widget-header" style="left: 0%; width: 50%; "></div>'); | |
| f.insertBefore($(".ui-slider-handle")); | |
| return b | |
| }; | |
| bradio.namespace("bradio.ui"); | |
| bradio.ui.Lightbox = function(a, b) { | |
| var c = bradio.lang.Bindable(), d = bradio.core.Event.UI.Lightbox, e = $("<div />"), f = $("<div />"), g; | |
| c.extend({}); | |
| e.addClass("pop-wrapper"); | |
| f.addClass("pop").addClass("lightbox"); | |
| e.append(f); | |
| f.append($("<div />").addClass("pop-header")); | |
| var i = $("<div />").addClass("pop-cont"); | |
| $("<a />").attr("href", "javascript:void(0);").attr("onclick", "return false;").click(function() { | |
| M3.mask.hide(g); | |
| M3.popup.hide(e[0]); | |
| e.remove(); | |
| setTimeout(function() { | |
| c.trigger(d.CLICK) | |
| }, 400) | |
| }); | |
| g = M3.mask.create(999); | |
| M3.mask.show(g); | |
| M3.popup.show(e[0]); | |
| e.insertBefore($("#overlay")); | |
| i.append(a); | |
| f.append(i); | |
| b(); | |
| return c | |
| }; | |
| bradio.namespace("bradio.utils"); | |
| bradio.utils.Logger = function() { | |
| var a = bradio.lang.Class(), b, c = bradio.core.Event.Log, d = function(a, b) { | |
| _hmt.push(["_trackEvent", "log", a, ""]); | |
| b || (b = {}); | |
| var c = {name: a}, d = +new Date, e = [], l = ""; | |
| $.extend(c, b); | |
| $.each(c, function(a, b) { | |
| e.push(a + "=" + encodeURIComponent(b)) | |
| }); | |
| l = e.join("&"); | |
| setTimeout(function() { | |
| var a = bradio.core.Constant.Path.LOG_PATH + "?" + l + "&r=" + d, b = new Image, c = "bradio_sio_log_" + Math.floor(2147483648 * Math.random()).toString(36); | |
| window[c] = b; | |
| b.onload = b.onerror = b.onabort = function() { | |
| b.onload = b.onerror = | |
| b.onabort = null; | |
| b = window[c] = null | |
| }; | |
| b.src = a | |
| }, 20) | |
| }, e = function(a, b) { | |
| var c = a.type.substring(10); | |
| d(c, b) | |
| }; | |
| a.extend({setHost: function(a) { | |
| b = a; | |
| b.bind(c.FIRST_SONG, e); | |
| b.bind(c.SONG_LOVE, e); | |
| b.bind(c.SONG_DELOVE, e); | |
| b.bind(c.SONG_HATE, e); | |
| b.bind(c.SONG_DEHATE, e); | |
| b.bind(c.SONG_SKIP, e); | |
| b.bind(c.SONG_PREV, e); | |
| b.bind(c.SONG_LINK, e); | |
| b.bind(c.SONG_LINL_FAIL, e); | |
| b.bind(c.SONG_INFO_LOADED, e); | |
| b.bind(c.SONG_INFO_ITEM_ERROR, e); | |
| b.bind(c.SONG_INFO_FAILED, e); | |
| b.bind(c.SONG_INFO_ALL_FAILED, e); | |
| b.bind(c.PLAY_TIMEOUT, e); | |
| b.bind(c.PLAY_START, | |
| e); | |
| b.bind(c.PLAY_SONG, e); | |
| b.bind(c.PLAY_COMPLETE, e); | |
| b.bind(c.PLAY_RESULT, e); | |
| b.bind(c.PLAY_END, e); | |
| b.bind(c.PLAY_ERROR, e); | |
| b.bind(c.PLAY_NOLINK, e); | |
| b.bind(c.PLAY_60S, e); | |
| b.bind(c.PLAY_100MS, e); | |
| b.bind(c.PLAY_LOAD_ERROR, e); | |
| b.bind(c.BTN_LOVE, e); | |
| b.bind(c.BTN_PLAY_PAUSE, e); | |
| b.bind(c.BTN_SOUND_ON, e); | |
| b.bind(c.BTN_SOUND_OFF, e); | |
| b.bind(c.BTN_DOWNLOAD, e); | |
| b.bind(c.CHANNEL_SELECTOR, e); | |
| b.bind(c.CHANNEL_DEFAULT, e); | |
| b.bind(c.CHANEL_CHANGE, e); | |
| b.bind(c.CHANNEL_DURATION, e); | |
| b.bind(c.COVER_CLICK, e); | |
| b.bind(c.SHARE, e); | |
| b.bind(c.CHANGE_CHANNEL_BY_ARTIST, | |
| e); | |
| b.bind(c.PROMOTIONBAR_SHOW, e); | |
| b.bind(c.PROMOTIONBAR_HIDE, e); | |
| b.bind(c.PROMOTIONBAR_CLICK, e); | |
| b.bind(c.CHANNELBAR_TIPS_CLICK, e); | |
| b.bind(c.CHANNELBAR_TIPS_SHOW, e); | |
| b.bind(c.CHANNELBAR_TIPS_CLOSE, e) | |
| },log: function(a, b) { | |
| d(a, b) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.utils"); | |
| bradio.utils.NSLogger = function() { | |
| var a = bradio.lang.Class(), b, c = bradio.core.Event.NSLog, d = function(a, b) { | |
| var b = b || {}, c = {type: a,ref: "radio",pid: 304,url: "",username: b.user || ""}, d = +new Date, e = [], l = ""; | |
| $.extend(c, b); | |
| $.each(c, function(a, b) { | |
| e.push(a + "=" + encodeURIComponent(b)) | |
| }); | |
| l = e.join("&"); | |
| setTimeout(function() { | |
| var a = bradio.core.Constant.Path.LOG_PATH_NS + "?" + l + "&r=" + d, b = new Image, c = "bradio_ns_sio_log_" + Math.floor(2147483648 * Math.random()).toString(36); | |
| window[c] = b; | |
| b.onload = b.onerror = b.onabort = function() { | |
| b.onload = | |
| b.onerror = b.onabort = null; | |
| b = window[c] = null | |
| }; | |
| b.src = a | |
| }, 20) | |
| }, e = function(a, b) { | |
| var c = a.type.substring(12); | |
| d(c, b) | |
| }; | |
| a.extend({setHost: function(a) { | |
| b = a; | |
| b.bind(c.FIRST_SONG, e); | |
| b.bind(c.SONG_LOVE, e); | |
| b.bind(c.SONG_DELOVE, e); | |
| b.bind(c.SONG_HATE, e); | |
| b.bind(c.SONG_DEHATE, e); | |
| b.bind(c.SONG_SKIP, e); | |
| b.bind(c.SONG_PREV, e); | |
| b.bind(c.SONG_INFO_LOADED, e); | |
| b.bind(c.SONG_INFO_FAILED, e); | |
| b.bind(c.PLAY_START, e); | |
| b.bind(c.PLAY_COMPLETE, e); | |
| b.bind(c.PLAY_END, e); | |
| b.bind(c.PLAY_ERROR, e); | |
| b.bind(c.PLAY_60S, e); | |
| b.bind(c.PLAY_100MS, e); | |
| b.bind(c.PLAY_LOAD_ERROR, | |
| e); | |
| b.bind(c.BTN_PLAY_PAUSE, e); | |
| b.bind(c.BTN_DOWNLOAD, e); | |
| b.bind(c.CHANNEL_SELECTOR, e); | |
| b.bind(c.CHANEL_CHANGE, e); | |
| b.bind(c.COVER_CLICK, e); | |
| b.bind(c.SHARE, e); | |
| b.bind(c.CLICK, e) | |
| },log: function(a, b) { | |
| d(a, b) | |
| }}); | |
| return a | |
| }; | |
| bradio.namespace("bradio.utils"); | |
| bradio.utils.Share = function() { | |
| var a = bradio.lang.Class(), b = function(a, b, c) { | |
| return encodeURIComponent("http://fm.baidu.com/#/play/" + (-1 != $.inArray(c.getId(), ["lovesongs", "private"]) ? "" : c.getId() + "/") + b.getId() + "/share/" + a) | |
| }, c = function(a, b, c) { | |
| c = /频道/.test(c.getName()) ? c.getName() : c.getName() + "电台"; | |
| return encodeURIComponent("推荐 " + ("tieba" == a ? "" : "♪") + b.getArtists()[0].getName() + " 的《" + b.getName() + "》(来自 " + c + ("tsina" == a ? " @百度随心听" : "") + ")") | |
| }; | |
| a.extend({share: function(a, e, f) { | |
| if (3 <= e.getResourceType()) | |
| bradio.ui.Tooltip("您不能分享该歌曲", | |
| $("#playerpanel-share-" + a)); | |
| else { | |
| var g = "http://share.baidu.com/s?", i = ["url=" + b(a, e, f), "uid=41163", "to=" + a, "type=text", "pic=" + encodeURIComponent(e.getCover()), "title=" + c(a, e, f), "desc=", "sign=off", "searchPic=0", "key=2239739986"], g = g + i.join("&"), a = "http://s.share.baidu.com/commit?url=" + b("", e, f) + "&title=" + c("", e, f) + "&uid=41163&to=" + a, j = new Image, n = "bradio_share_" + Math.floor(2147483648 * Math.random()).toString(36); | |
| window[n] = j; | |
| j.onload = j.onerror = j.onabort = function() { | |
| j.onload = j.onerror = j.onabort = null; | |
| j = | |
| window[n] = null | |
| }; | |
| j.src = a; | |
| window.open(g) | |
| } | |
| }}); | |
| window.testJsonp = function() { | |
| }; | |
| return a | |
| }; | |
| bradio.namespace("bradio.utils"); | |
| bradio.utils.UA = function() { | |
| var a = bradio.lang.Class(); | |
| a.extend({isMobile: function() { | |
| return /(iPad|iPhone|Android)/.test(navigator.userAgent) | |
| }}); | |
| return a | |
| }; | |
| fmSetup = function() { | |
| var a = bradio.core.FM(); | |
| a.setChannelList(rawChannelList); | |
| a.setLoginInfo(rawLoginInfo); | |
| window.FM = a | |
| }; | |
| $(document).ready(function() { | |
| bradio.data.providable.Cookie(); | |
| fmSetup() | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment