14 lines
67 KiB
JavaScript
14 lines
67 KiB
JavaScript
/**
|
|
* Ajax Autocomplete for jQuery, version 1.1.3
|
|
* (c) 2010 Tomas Kirda
|
|
*
|
|
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
|
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
|
|
*
|
|
* Last Review: 04/19/2010
|
|
*/
|
|
/*jslint onevar: true, evil: true, nomen: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
|
/*global window: true, document: true, clearInterval: true, setInterval: true, jQuery: true */
|
|
(function($){function fnFormatResult(a,b,c){if(c==="and"||c==="&"||c==="n'")var d="(and|&|n')";else var d="("+c.replace(reEscape,"\\$1")+")";return a.replace(new RegExp(d,"gi"),"<strong>$1</strong>")}function Autocomplete(a,b){this.el=$(a),this.el.attr("autocomplete","off"),this.suggestions=[],this.data=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.el.val(),this.intervalId=0,this.cachedResponse=[],this.onChangeInterval=null,this.ignoreValueChange=!1,this.serviceUrl=b.serviceUrl,this.isLocal=!1,this.containerId=b.containerId,this.containerItemsId=b.containerItemsId,this.options={autoSubmit:!1,minChars:1,maxHeight:300,deferRequestBy:0,width:0,highlight:!0,params:{},fnFormatResult:fnFormatResult,delimiter:null,zIndex:9999},this.initialize(),this.setOptions(b)}var reEscape=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g");$.fn.bh_autocomplete=function(a){return new Autocomplete(this.get(0)||$("<input />"),a)},Autocomplete.prototype={killerFn:null,initialize:function(){var a,b,c;a=this,b=Math.floor(Math.random()*1048576).toString(16),c="Autocomplete_"+b,this.killerFn=function(b){$(b.target).parents(".autocomplete").size()===0&&(a.killSuggestions(),a.disableKillerFn())},this.options.width||(this.options.width=this.el.width()),this.mainContainerId="AutocompleteContainter_"+b,this.mainContainerId=this.containerId,this.container=$("#"+c),this.container_items=$("#"+this.containerItemsId),this.fixPosition(),window.opera?this.el.keypress(function(b){a.onKeyPress(b)}):this.el.keydown(function(b){a.onKeyPress(b)}),this.el.keyup(function(b){a.onKeyUp(b)}),this.el.blur(function(){a.enableKillerFn()}),this.el.focus(function(){a.fixPosition()})},setOptions:function(a){var b=this.options;$.extend(b,a),b.lookup&&(this.isLocal=!0,$.isArray(b.lookup)&&(b.lookup={suggestions:b.lookup,data:[]}))},clearCache:function(){this.cachedResponse=[],this.badQueries=[]},disable:function(){this.disabled=!0},enable:function(){this.disabled=!1},fixPosition:function(){var a=this.el.offset()},enableKillerFn:function(){var a=this;$(document).bind("click",a.killerFn)},disableKillerFn:function(){var a=this;$(document).unbind("click",a.killerFn)},killSuggestions:function(){var a=this;this.stopKillSuggestions(),this.intervalId=window.setInterval(function(){a.hide(),a.stopKillSuggestions()},300)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},onKeyPress:function(a){if(this.disabled||!this.enabled)return;switch(a.keyCode){case 27:this.el.val(this.currentValue),this.hide();break;case 9:case 13:if(this.selectedIndex===-1){this.hide();return}this.select(this.selectedIndex);if(a.keyCode===9)return;break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()},onKeyUp:function(a){if(this.disabled)return;switch(a.keyCode){case 38:case 40:return}clearInterval(this.onChangeInterval);if(this.currentValue!==this.el.val())if(this.options.deferRequestBy>0){var b=this;this.onChangeInterval=setInterval(function(){b.onValueChange()},this.options.deferRequestBy)}else this.onValueChange()},onValueChange:function(){clearInterval(this.onChangeInterval),this.currentValue=this.el.val();var a=this.getQuery(this.currentValue);this.selectedIndex=-1;if(this.ignoreValueChange){this.ignoreValueChange=!1;return}a===""||a.length<this.options.minChars?this.hide():this.getSuggestions(a)},getQuery:function(a){var b,c;return b=this.options.delimiter,b?(c=a.split(b),$.trim(c[c.length-1])):$.trim(a)},getSuggestionsLocal:function(a){var b,c,d,e,f;c=this.options.lookup,d=c.suggestions.length,b={suggestions:[],data:[]},a=a.toLowerCase();for(f=0;f<d;f++)e=c.suggestions[f],e.toLowerCase().indexOf(a)===0&&(b.suggestions.push(e),b.data.push(c.data[f]));return b},getSuggestions:function(a){var b,c;b=this.isLocal?this.getSuggestionsLocal(a):this.cachedResponse[a],b&&$.isArray(b.suggestions)?(this.suggestions=b.suggestions,this.data=b.data,this.suggest()):this.isBadQuery(a)||(c=this,c.options.params.query=a,$("#artist-load-spinner").show(),$.get(this.serviceUrl,c.options.params,function(a){c.processResponse(a),$("#artist-load-spinner").hide()},"text"))},isBadQuery:function(a){var b=this.badQueries.length;while(b--)if(a.indexOf(this.badQueries[b])===0)return!0;return!1},hide:function(){this.enabled=!1,this.selectedIndex=-1,this.container.hide(),$(".popover-wrapper").hide()},suggest:function(){if(this.suggestions.length===0){this.hide();return}var a,b,c,d,e,f,g,h,i;a=this,b=this.suggestions.length,d=this.options.fnFormatResult,e=this.getQuery(this.currentValue),h=function(b){return function(){a.activate(b)}},i=function(b){return function(){a.select(b)}},this.container=$("#"+this.containerId),this.container_items=$("#"+this.containerItemsId),this.container_items.empty();for(f=0;f<b;f++)g=this.suggestions[f],c=$((a.selectedIndex===f?'<div class="selected"':"<div")+' title="'+g+'">'+d(g,this.data[f],e)+"</div>"),c.mouseover(h(f)),c.click(i(f)),this.container_items.append(c);this.enabled=!0,this.container.show(),$(".popover-wrapper").show()},processResponse:function(text){var response;try{response=eval("("+text+")")}catch(err){return}$.isArray(response.data)||(response.data=[]),this.options.noCache||(this.cachedResponse[response.query]=response,response.suggestions.length===0&&this.badQueries.push(response.query)),response.query===this.getQuery(this.currentValue)&&(this.suggestions=response.suggestions,this.data=response.data,this.suggest())},activate:function(a){var b,c;return b=this.container_items.children(),this.selectedIndex!==-1&&b.length>this.selectedIndex&&$(b.get(this.selectedIndex)).removeClass(),this.selectedIndex=a,this.selectedIndex!==-1&&b.length>this.selectedIndex&&(c=b.get(this.selectedIndex),$(c).addClass("selected")),c},deactivate:function(a,b){a.className="",this.selectedIndex===b&&(this.selectedIndex=-1)},select:function(a){var b,c;b=this.suggestions[a],b&&(this.el.val(b),this.options.autoSubmit&&(c=this.el.parents("form"),c.length>0&&c.get(0).submit()),this.ignoreValueChange=!0,this.hide(),this.onSelect(a))},moveUp:function(){if(this.selectedIndex===-1)return;if(this.selectedIndex===0){this.container_items.children().get(0).className="",this.selectedIndex=-1,this.el.val(this.currentValue);return}this.adjustScroll(this.selectedIndex-1)},moveDown:function(){if(this.selectedIndex===this.suggestions.length-1)return;this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(a){var b,c,d,e;b=this.activate(a),c=b.offsetTop,d=this.container_items.scrollTop(),e=d+this.options.maxHeight-25,c<d?this.container_items.scrollTop(c):c>e&&this.container_items.scrollTop(c-this.options.maxHeight+25),this.el.val(this.getValue(this.suggestions[a]))},onSelect:function(a){var b,c,d,e;b=this,c=b.options.onSelect,d=b.suggestions[a],e=b.data[a],b.el.val(b.getValue(d)),$.isFunction(c)&&c(d,e,b.el)},getValue:function(a){var b,c,d,e;return e=this,b=e.options.delimiter,b?(c=e.currentValue,d=c.split(b),d.length===1?a:c.substr(0,c.length-d[d.length-1].length)+a):a}}})(jQuery),function(a,b){a.fn.jPlayer=function(c){var d=typeof c=="string",e=Array.prototype.slice.call(arguments,1),g=this,c=!d&&e.length?a.extend.apply(null,[!0,c].concat(e)):c;return d&&c.charAt(0)==="_"?g:(d?this.each(function(){var d=a.data(this,"jPlayer"),h=d&&a.isFunction(d[c])?d[c].apply(d,e):d;if(h!==d&&h!==b)return g=h,!1}):this.each(function(){var b=a.data(this,"jPlayer");b?b.option(c||{}):a.data(this,"jPlayer",new a.jPlayer(c,this))}),g)},a.jPlayer=function(b,c){if(arguments.length){this.element=a(c),this.options=a.extend(!0,{},this.options,b);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()}),this._init()}},a.jPlayer.emulateMethods="load play pause",a.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate",a.jPlayer.emulateOptions="muted volume",a.jPlayer.reservedEvent="ready flashreset resize repeat error warning",a.jPlayer.event={ready:"jPlayer_ready",flashreset:"jPlayer_flashreset",resize:"jPlayer_resize",repeat:"jPlayer_repeat",click:"jPlayer_click",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"},a.jPlayer.htmlEvent="loadstart,abort,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,ratechange".split(","),a.jPlayer.pause=function(){a.each(a.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})},a.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""},a.jPlayer.convertTime=function(b){var c=new Date(b*1e3),d=c.getUTCHours(),b=c.getUTCMinutes(),c=c.getUTCSeconds(),d=a.jPlayer.timeFormat.padHour&&d<10?"0"+d:d,b=a.jPlayer.timeFormat.padMin&&b<10?"0"+b:b,c=a.jPlayer.timeFormat.padSec&&c<10?"0"+c:c;return(a.jPlayer.timeFormat.showHour?d+a.jPlayer.timeFormat.sepHour:"")+(a.jPlayer.timeFormat.showMin?b+a.jPlayer.timeFormat.sepMin:"")+(a.jPlayer.timeFormat.showSec?c+a.jPlayer.timeFormat.sepSec:"")},a.jPlayer.uaBrowser=function(a){var a=a.toLowerCase(),b=/(opera)(?:.*version)?[ \/]([\w.]+)/,c=/(msie) ([\w.]+)/,d=/(mozilla)(?:.*? rv:([\w.]+))?/,a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||c.exec(a)||a.indexOf("compatible")<0&&d.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},a.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),c=/(android)/,d=/(mobile)/,a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[],b=/(ipad|playbook)/.exec(b)||!d.exec(b)&&c.exec(b)||[];return a[1]&&(a[1]=a[1].replace(/\s/g,"_")),{platform:a[1]||"",tablet:b[1]||""}},a.jPlayer.browser={},a.jPlayer.platform={};var c=a.jPlayer.uaBrowser(navigator.userAgent);c.browser&&(a.jPlayer.browser[c.browser]=!0,a.jPlayer.browser.version=c.version),c=a.jPlayer.uaPlatform(navigator.userAgent),c.platform&&(a.jPlayer.platform[c.platform]=!0,a.jPlayer.platform.mobile=!c.tablet,a.jPlayer.platform.tablet=!!c.tablet),a.jPlayer.prototype={count:0,version:{script:"2.1.0",needFlash:"2.1.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},fullScreen:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1e3},loop:!1,repeat:function(b){b.jPlayer.options.loop?a(this).unbind(".jPlayerRepeat").bind(a.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){a(this).jPlayer("play")}):a(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullScreen:{msie:/msie [0-6]/,ipad:/ipad.*?os [0-4]/,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3](?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/,playbook:/playbook/},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"}},_init:function(){var c=this;this.element.empty(),this.status=a.extend({},this.status),this.internal=a.extend({},this.internal),this.internal.domNode=this.element.get(0),this.formats=[],this.solutions=[],this.require={},this.htmlElement={},this.html={},this.html.audio={},this.html.video={},this.flash={},this.css={},this.css.cs={},this.css.jq={},this.ancestorJq=[],this.options.volume=this._limitValue(this.options.volume,0,1),a.each(this.options.supplied.toLowerCase().split(","),function(b,d){var e=d.replace(/^\s+|\s+$/g,"");if(c.format[e]){var f=!1;a.each(c.formats,function(a,b){if(e===b)return f=!0,!1}),f||c.formats.push(e)}}),a.each(this.options.solution.toLowerCase().split(","),function(b,d){var e=d.replace(/^\s+|\s+$/g,"");if(c.solution[e]){var f=!1;a.each(c.solutions,function(a,b){if(e===b)return f=!0,!1}),f||c.solutions.push(e)}}),this.internal.instance="jp_"+this.count,this.instances[this.internal.instance]=this.element,this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count),this.internal.self=a.extend({},{id:this.element.attr("id"),jq:this.element}),this.internal.audio=a.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:b}),this.internal.video=a.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:b}),this.internal.flash=a.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:b,swf:this.options.swfPath+(this.options.swfPath.toLowerCase().slice(-4)!==".swf"?(this.options.swfPath&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf":"")}),this.internal.poster=a.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:b}),a.each(a.jPlayer.event,function(a,d){c.options[a]!==b&&(c.element.bind(d+".jPlayer",c.options[a]),c.options[a]=b)}),this.require.audio=!1,this.require.video=!1,a.each(this.formats,function(a,b){c.require[c.format[b].media]=!0}),this.options=this.require.video?a.extend(!0,{},this.optionsVideo,this.options):a.extend(!0,{},this.optionsAudio,this.options),this._setSize(),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen),this.status.noVolume=this._uaBlocklist(this.options.noVolume),this._restrictNativeVideoControls(),this.htmlElement.poster=document.createElement("img"),this.htmlElement.poster.id=this.internal.poster.id,this.htmlElement.poster.onload=function(){(!c.status.video||c.status.waitForPlay)&&c.internal.poster.jq.show()},this.element.append(this.htmlElement.poster),this.internal.poster.jq=a("#"+this.internal.poster.id),this.internal.poster.jq.css({width:this.status.width,height:this.status.height}),this.internal.poster.jq.hide(),this.internal.poster.jq.bind("click.jPlayer",function(){c._trigger(a.jPlayer.event.click)}),this.html.audio.available=!1,this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio)),this.html.video.available=!1,this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video)),this.flash.available=this._checkForFlash(10),this.html.canPlay={},this.flash.canPlay={},a.each(this.formats,function(a,b){c.html.canPlay[b]=c.html[c.format[b].media].available&&""!==c.htmlElement[c.format[b].media].canPlayType(c.format[b].codec),c.flash.canPlay[b]=c.format[b].flashCanPlay&&c.flash.available}),this.html.desired=!1,this.flash.desired=!1,a.each(this.solutions,function(b,d){if(b===0)c[d].desired=!0;else{var e=!1,f=!1;a.each(c.formats,function(a,b){c[c.solutions[0]].canPlay[b]&&(c.format[b].media==="video"?f=!0:e=!0)}),c[d].desired=c.require.audio&&!e||c.require.video&&!f}}),this.html.support={},this.flash.support={},a.each(this.formats,function(a,b){c.html.support[b]=c.html.canPlay[b]&&c.html.desired,c.flash.support[b]=c.flash.canPlay[b]&&c.flash.desired}),this.html.used=!1,this.flash.used=!1,a.each(this.solutions,function(b,d){a.each(c.formats,function(a,b){if(c[d].support[b])return c[d].used=!0,!1})}),this._resetActive(),this._resetGate(),this._cssSelectorAncestor(this.options.cssSelectorAncestor),!this.html.used&&!this.flash.used?(this._error({type:a.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:a.jPlayer.errorMsg.NO_SOLUTION,hint:a.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var d,e="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(a.browser.msie&&Number(a.browser.version)<=8){e=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+e+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'],d=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0"></object>');for(var g=0;g<e.length;g++)d.appendChild(document.createElement(e[g]))}else g=function(a,b,c){var d=document.createElement("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)},d=document.createElement("object"),d.setAttribute("id",this.internal.flash.id),d.setAttribute("data",this.internal.flash.swf),d.setAttribute("type","application/x-shockwave-flash"),d.setAttribute("width","1"),d.setAttribute("height","1"),g(d,"flashvars",e),g(d,"allowscriptaccess","always"),g(d,"bgcolor",this.options.backgroundColor),g(d,"wmode",this.options.wmode);this.element.append(d),this.internal.flash.jq=a(d)}this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=a("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),this.internal.video.jq=a("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){c._trigger(a.jPlayer.event.click)}))),this.options.emulateHtml&&this._emulateHtmlBridge(),this.html.used&&!this.flash.used&&setTimeout(function(){c.internal.ready=!0,c.version.flash="n/a",c._trigger(a.jPlayer.event.repeat),c._trigger(a.jPlayer.event.ready)},100),this._updateNativeVideoControls(),this._updateInterface(),this._updateButtons(!1),this._updateAutohide(),this._updateVolume(this.options.volume),this._updateMute(this.options.muted),this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),a.jPlayer.prototype.count++},destroy:function(){this.clearMedia(),this._removeUiClass(),this.css.jq.currentTime.length&&this.css.jq.currentTime.text(""),this.css.jq.duration.length&&this.css.jq.duration.text(""),a.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")}),this.internal.poster.jq.unbind(".jPlayer"),this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer"),this.options.emulateHtml&&this._destroyHtmlBridge(),this.element.removeData("jPlayer"),this.element.unbind(".jPlayer"),this.element.empty(),delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(b){var c=navigator.userAgent.toLowerCase(),d=!1;return a.each(b,function(a,b){if(b&&b.test(c))return d=!0,!1}),d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullScreen=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(b,c){var d=this;b.preload=this.options.preload,b.muted=this.options.muted,b.volume=this.options.volume,b.addEventListener("progress",function(){c.gate&&(d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.progress))},!1),b.addEventListener("timeupdate",function(){c.gate&&(d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.timeupdate))},!1),b.addEventListener("durationchange",function(){c.gate&&(d.status.duration=this.duration,d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.durationchange))},!1),b.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(a.jPlayer.event.play))},!1),b.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(a.jPlayer.event.playing))},!1),b.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(a.jPlayer.event.pause))},!1),b.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(a.jPlayer.event.waiting))},!1),b.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(a.jPlayer.event.seeking))},!1),b.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(a.jPlayer.event.seeked))},!1),b.addEventListener("volumechange",function(){c.gate&&(d.options.volume=b.volume,d.options.muted=b.muted,d._updateMute(),d._updateVolume(),d._trigger(a.jPlayer.event.volumechange))},!1),b.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(a.jPlayer.event.suspend))},!1),b.addEventListener("ended",function(){c.gate&&(a.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(b,!0),d._updateInterface(),d._trigger(a.jPlayer.event.ended))},!1),b.addEventListener("error",function(){c.gate&&(d._updateButtons(!1),d._seeked(),d.status.srcSet)&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:a.jPlayer.error.URL,context:d.status.src,message:a.jPlayer.errorMsg.URL,hint:a.jPlayer.errorHint.URL}))},!1),a.each(a.jPlayer.htmlEvent,function(e,f){b.addEventListener(this,function(){c.gate&&d._trigger(a.jPlayer.event[f])},!1)})},_getHtmlStatus:function(a,b){var c=0,d=0,e=0,f=0;a.duration&&(this.status.duration=a.duration),c=a.currentTime,d=this.status.duration>0?100*c/this.status.duration:0,typeof a.seekable=="object"&&a.seekable.length>0?(e=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=100*a.currentTime/a.seekable.end(a.seekable.length-1)):(e=100,f=d),b&&(d=f=c=0),this.status.seekPercent=e,this.status.currentPercentRelative=f,this.status.currentPercentAbsolute=d,this.status.currentTime=c,this.status.readyState=a.readyState,this.status.networkState=a.networkState,this.status.playbackRate=a.playbackRate,this.status.ended=a.ended},_resetStatus:function(){this.status=a.extend({},this.status,a.jPlayer.prototype.status)},_trigger:function(b,c,d){b=a.Event(b),b.jPlayer={},b.jPlayer.version=a.extend({},this.version),b.jPlayer.options=a.extend(!0,{},this.options),b.jPlayer.status=a.extend(!0,{},this.status),b.jPlayer.html=a.extend(!0,{},this.html),b.jPlayer.flash=a.extend(!0,{},this.flash),c&&(b.jPlayer.error=a.extend({},c)),d&&(b.jPlayer.warning=a.extend({},d)),this.element.trigger(b)},jPlayerFlashEvent:function(b,c){if(b===a.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media),d>0&&(e?this.pause(d):this.play(d))}this._trigger(a.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:a.jPlayer.error.VERSION,context:this.version.flash,message:a.jPlayer.errorMsg.VERSION+this.version.flash,hint:a.jPlayer.errorHint.VERSION}),this._trigger(a.jPlayer.event.repeat),this._trigger(b);if(this.flash.gate)switch(b){case a.jPlayer.event.progress:this._getFlashStatus(c),this._updateInterface(),this._trigger(b);break;case a.jPlayer.event.timeupdate:this._getFlashStatus(c),this._updateInterface(),this._trigger(b);break;case a.jPlayer.event.play:this._seeked(),this._updateButtons(!0),this._trigger(b);break;case a.jPlayer.event.pause:this._updateButtons(!1),this._trigger(b);break;case a.jPlayer.event.ended:this._updateButtons(!1),this._trigger(b);break;case a.jPlayer.event.click:this._trigger(b);break;case a.jPlayer.event.error:this.status.waitForLoad=!0,this.status.waitForPlay=!0,this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"}),this._validString(this.status.media.poster)&&this.internal.poster.jq.show(),this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show(),this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media),this._updateButtons(!1),this._error({type:a.jPlayer.error.URL,context:c.src,message:a.jPlayer.errorMsg.URL,hint:a.jPlayer.errorHint.URL});break;case a.jPlayer.event.seeking:this._seeking(),this._trigger(b);break;case a.jPlayer.event.seeked:this._seeked(),this._trigger(b);break;case a.jPlayer.event.ready:break;default:this._trigger(b)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent,this.status.currentPercentRelative=a.currentPercentRelative,this.status.currentPercentAbsolute=a.currentPercentAbsolute,this.status.currentTime=a.currentTime,this.status.duration=a.duration,this.status.readyState=4,this.status.networkState=0,this.status.playbackRate=1,this.status.ended=!1},_updateButtons:function(a){a!==b&&(this.status.paused=!a,this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()))),this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide())),this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%"),this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%"),this.css.jq.currentTime.length&&this.css.jq.currentTime.text(a.jPlayer.convertTime(this.status.currentTime)),this.css.jq.duration.length&&this.css.jq.duration.text(a.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},_resetGate:function(){this.html.audio.gate=!1,this.html.video.gate=!1,this.flash.gate=!1},_resetActive:function(){this.html.active=!1,this.flash.active=!1},setMedia:function(b){var c=this,d=!1,e=this.status.media.poster!==b.poster;this._resetMedia(),this._resetGate(),this._resetActive(),a.each(this.formats,function(e,f){var g=c.format[f].media==="video";a.each(c.solutions,function(a,e){if(c[e].support[f]&&c._validString(b[f])){var h=e==="html";return g?(h?(c.html.video.gate=!0,c._html_setVideo(b),c.html.active=!0):(c.flash.gate=!0,c._flash_setVideo(b),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(h?(c.html.audio.gate=!0,c._html_setAudio(b),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(b),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1),d=!0,!1}});if(d)return!1}),d?((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(b.poster)&&(e?this.htmlElement.poster.src=b.poster:this.internal.poster.jq.show()),this.status.srcSet=!0,this.status.media=a.extend({},b),this._updateButtons(!1),this._updateInterface()):this._error({type:a.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:a.jPlayer.errorMsg.NO_SUPPORT,hint:a.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus(),this._updateButtons(!1),this._updateInterface(),this._seeked(),this.internal.poster.jq.hide(),clearTimeout(this.internal.htmlDlyCmdId),this.html.active?this._html_resetMedia():this.flash.active&&this._flash_resetMedia()},clearMedia:function(){this._resetMedia(),this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia(),this._resetGate(),this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},play:function(a){a=typeof a=="number"?a:NaN,this.status.srcSet?this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a=typeof a=="number"?a:NaN,this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var b=this;a.each(this.instances,function(a,c){b.element!==c&&c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100),this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(b){this.options.muted=b,this.html.used&&this._html_mute(b),this.flash.used&&this._flash_mute(b),!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(b),this._updateVolume(this.options.volume),this._trigger(a.jPlayer.event.volumechange))},mute:function(a){a=a===b?!0:!!a,this._muted(a)},unmute:function(a){a=a===b?!0:!!a,this._muted(!a)},_updateMute:function(a){a===b&&(a=this.options.muted),this.css.jq.mute.length&&
|
|
this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(b){b=this._limitValue(b,0,1),this.options.volume=b,this.html.used&&this._html_volume(b),this.flash.used&&this._flash_volume(b),!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(b),this._trigger(a.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var b=this.css.jq.volumeBar.offset(),c=a.pageX-b.left,d=this.css.jq.volumeBar.width(),a=this.css.jq.volumeBar.height()-a.pageY+b.top,b=this.css.jq.volumeBar.height();this.options.verticalVolume?this.volume(a/b):this.volume(c/d)}this.options.muted&&this._muted(!1)},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){a===b&&(a=this.options.volume),a=this.options.muted?0:a,this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](a*100+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1),this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(b){var c=this;this.options.cssSelectorAncestor=b,this._removeUiClass(),this.ancestorJq=b?a(b):[],b&&this.ancestorJq.length!==1&&this._warning({type:a.jPlayer.warning.CSS_SELECTOR_COUNT,context:b,message:a.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:a.jPlayer.warningHint.CSS_SELECTOR_COUNT}),this._addUiClass(),a.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)})},_cssSelector:function(b,c){var d=this;typeof c=="string"?a.jPlayer.prototype.options.cssSelector[b]?(this.css.jq[b]&&this.css.jq[b].length&&this.css.jq[b].unbind(".jPlayer"),this.options.cssSelector[b]=c,this.css.cs[b]=this.options.cssSelectorAncestor+" "+c,this.css.jq[b]=c?a(this.css.cs[b]):[],this.css.jq[b].length&&this.css.jq[b].bind("click.jPlayer",function(c){return d[b](c),a(this).blur(),!1}),c&&this.css.jq[b].length!==1&&this._warning({type:a.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[b],message:a.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[b].length+" found for "+b+" method.",hint:a.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:a.jPlayer.warning.CSS_SELECTOR_METHOD,context:b,message:a.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:a.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:a.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:a.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:a.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset(),a=a.pageX-b.left,b=this.css.jq.seekBar.width();this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(b){this.options.loop!==b&&(this.options.loop=b,this._updateButtons(),this._trigger(a.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(c,d){var e=c;if(arguments.length===0)return a.extend(!0,{},this.options);if(typeof c=="string"){var g=c.split(".");if(d===b){for(var e=a.extend(!0,{},this.options),h=0;h<g.length;h++)if(e[g[h]]!==b)e=e[g[h]];else return this._warning({type:a.jPlayer.warning.OPTION_KEY,context:c,message:a.jPlayer.warningMsg.OPTION_KEY,hint:a.jPlayer.warningHint.OPTION_KEY}),b;return e}for(var h=e={},i=0;i<g.length;i++)i<g.length-1?(h[g[i]]={},h=h[g[i]]):h[g[i]]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(b,c){var d=this;switch(b){case"volume":this.volume(c);break;case"muted":this._muted(c);break;case"cssSelectorAncestor":this._cssSelectorAncestor(c);break;case"cssSelector":a.each(c,function(a,b){d._cssSelector(a,b)});break;case"fullScreen":this.options[b]!==c&&(this._removeUiClass(),this.options[b]=c,this._refreshSize());break;case"size":!this.options.fullScreen&&this.options[b].cssClass!==c.cssClass&&this._removeUiClass(),this.options[b]=a.extend({},this.options[b],c),this._refreshSize();break;case"sizeFull":this.options.fullScreen&&this.options[b].cssClass!==c.cssClass&&this._removeUiClass(),this.options[b]=a.extend({},this.options[b],c),this._refreshSize();break;case"autohide":this.options[b]=a.extend({},this.options[b],c),this._updateAutohide();break;case"loop":this._loop(c);break;case"nativeVideoControls":this.options[b]=a.extend({},this.options[b],c),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this._restrictNativeVideoControls(),this._updateNativeVideoControls();break;case"noFullScreen":this.options[b]=a.extend({},this.options[b],c),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen),this._restrictNativeVideoControls(),this._updateButtons();break;case"noVolume":this.options[b]=a.extend({},this.options[b],c),this.status.noVolume=this._uaBlocklist(this.options.noVolume),this._updateVolume(),this._updateMute();break;case"emulateHtml":this.options[b]!==c&&((this.options[b]=c)?this._emulateHtmlBridge():this._destroyHtmlBridge())}return this},_refreshSize:function(){this._setSize(),this._addUiClass(),this._updateSize(),this._updateButtons(),this._updateAutohide(),this._trigger(a.jPlayer.event.resize)},_setSize:function(){this.options.fullScreen?(this.status.width=this.options.sizeFull.width,this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass),this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height}),!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&this.flash.active&&this.status.video&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId),a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullScreen&&this.options.autohide.full||!this.options.fullScreen&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_html_initMedia:function(){this.htmlElement.media.src=this.status.src,this.options.preload!=="none"&&this._html_load(),this._trigger(a.jPlayer.event.timeupdate)},_html_setAudio:function(b){var c=this;a.each(this.formats,function(a,d){if(c.html.support[d]&&b[d])return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}),this.htmlElement.media=this.htmlElement.audio,this._html_initMedia()},_html_setVideo:function(b){var c=this;a.each(this.formats,function(a,d){if(c.html.support[d]&&b[d])return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}),this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(b.poster)?b.poster:""),this.htmlElement.media=this.htmlElement.video,this._html_initMedia()},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load()),clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load(),this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(c){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId),this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(c){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable=="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime=a*this.htmlElement.media.duration/100;else throw"e"}catch(c){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_volume:function(a){this.html.audio.available&&(this.htmlElement.audio.volume=a),this.html.video.available&&(this.htmlElement.video.volume=a)},_html_mute:function(a){this.html.audio.available&&(this.htmlElement.audio.muted=a),this.html.video.available&&(this.htmlElement.video.muted=a)},_flash_setAudio:function(b){var c=this;try{if(a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4a":case"fla":c._getMovie().fl_setAudio_m4a(b[d]);break;case"mp3":c._getMovie().fl_setAudio_mp3(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_setVideo:function(b){var c=this;try{if(a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4v":case"flv":c._getMovie().fl_setVideo_m4v(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"}),this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}a>0&&(this.status.waitForLoad=!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=!1,c;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a),b=!0}catch(d){}else navigator.plugins&&navigator.mimeTypes.length>0&&(c=navigator.plugins["Shockwave Flash"])&&navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a&&(b=!0);return b},_validString:function(a){return a&&typeof a=="string"},_limitValue:function(a,b,c){return a<b?b:a>c?c:a},_urlNotSetError:function(b){this._error({type:a.jPlayer.error.URL_NOT_SET,context:b,message:a.jPlayer.errorMsg.URL_NOT_SET,hint:a.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(b){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH",this._error({type:a.jPlayer.error[c],context:this.internal.flash.swf,message:a.jPlayer.errorMsg[c]+b.message,hint:a.jPlayer.errorHint[c]}),this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(b){this._trigger(a.jPlayer.event.error,b),this.options.errorAlerts&&this._alert("Error!"+(b.message?"\n\n"+b.message:"")+(b.hint?"\n\n"+b.hint:"")+"\n\nContext: "+b.context)},_warning:function(c){this._trigger(a.jPlayer.event.warning,b,c),this.options.warningAlerts&&this._alert("Warning!"+(c.message?"\n\n"+c.message:"")+(c.hint?"\n\n"+c.hint:"")+"\n\nContext: "+c.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var b=this;a.each(a.jPlayer.emulateMethods.split(/\s+/g),function(a,c){b.internal.domNode[c]=function(a){b[c](a)}}),a.each(a.jPlayer.event,function(c,d){var e=!0;a.each(a.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1}),e&&b.element.bind(d+".jPlayer.jPlayerHtml",function(){b._emulateHtmlUpdate();var a=document.createEvent("Event");a.initEvent(c,!1,!0),b.internal.domNode.dispatchEvent(a)})})},_emulateHtmlUpdate:function(){var b=this;a.each(a.jPlayer.emulateStatus.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.status[c]}),a.each(a.jPlayer.emulateOptions.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.options[c]})},_destroyHtmlBridge:function(){var b=this;this.element.unbind(".jPlayerHtml"),a.each((a.jPlayer.emulateMethods+" "+a.jPlayer.emulateStatus+" "+a.jPlayer.emulateOptions).split(/\s+/g),function(a,c){delete b.internal.domNode[c]})}},a.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"},a.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+a.jPlayer.prototype.version.script+" needs Jplayer.swf version "+a.jPlayer.prototype.version.needFlash+" but found "},a.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."},a.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"},a.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."},a.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}}(jQuery),function(){window.VkontakteMusic=function(){function a(){}return a.prototype.query_results={},a.prototype.search=function(a,b,c,d,e){var f,g;return e==null&&(e=!1),f=this.prepareQuery(a,b),this.query_results[f]!=null&&!e&&d(this.query_results[f]),g=this,VK.Api.call("audio.search",{q:f},function(h){var i,j;return i=g.range(h.response,a,b,c),j=null,i.length>0&&(j=i[0].url),g.query_results[f]=i,d(e?i:j)})},a.prototype.range=function(a,b,c,d){var e,f,g,h,i;typeof d=="string"&&(d=d.split(":"),d=parseInt(d[0],10)*60+parseInt(d[1],10));for(f=0,i=a.length;f<i;f++){g=a[f];if(typeof g!="object")continue;g.score=0,g.artist=this.trim(g.artist),g.title=this.trim(g.title),h=0,g.artist.length>0&&(g.artist===b?h+=10:g.artist.split(b).length===2?h+=5:g.title.split(b).length===2&&(h+=4)),g.artist.length>0&&(g.title===c?h+=10:g.title.split(c).length===2&&(h+=5)),parseInt(g.duration,10)===d?h+=15:(e=Math.abs(parseInt(g.duration,10)-d),e<10&&(h+=10-e)),a[f].score=h}return a.length>0&&typeof a[0]!="object"&&(a.splice(0,1),a.sort(function(a,b){return b.score-a.score})),a},a.prototype.prepareQuery=function(a,b){return a+" "+b.replace(/\(.*\)/i,"").split("/")[0]},a.prototype.trim=function(a){while(a.indexOf(" ")!==-1)a=a.replace(" "," ");return a.charAt(0)===" "&&(a=a.substring(1)),a.charAt(a.length-1)===" "&&(a=a.substring(0,a.length-1)),a},a}()}.call(this),function(){window.Session=function(){function a(a){var b,c,d,e,f;b=["expire","mid","secret","sid","sig"],f={};for(d=0,e=b.length;d<e;d++)c=b[d],a[c]!=null&&(f[c]=a[c]);this.vk_params=f}return a.prototype.vk_params=null,a.prototype.user=null,a.prototype.setUser=function(a){return this.user=a,_beathaven.lang=this.user.lang||"ru",_beathaven.localizeHTML(),!1},a.prototype.getUser=function(){return this.user},a.prototype.query=function(a,b,c){var d;return d=$.extend({},this.vk_params,b),$.post(a,d,c),!1},a.prototype.secureLoad=function(a,b){var c;return c=$.extend({},this.vk_params),$("#content").load(a,c,b),!1},a.prototype.reloadSession=function(){return _session.query("/user/auth",{},function(a){return _session.setUser(a.user),!1}),!1},a.prototype.displayAuthorizedContent=function(){return $(".playlist, .player").show(),$(".ad_here, #login").hide(),$("#authorized").css({display:"block"})},a.prototype.hideAuthorizedContent=function(){return $(".playlist, .player, #authorized").hide(),$(".ad_here").show(),$("#login").css({display:"block"})},a}()}.call(this),function(){window.Vkontakte=function(){function a(a){this.api_id=a}return a.prototype.api_id=null,a.prototype.getApiId=function(){return this.api_id},a.prototype.init=function(){return window.vkAsyncInit=function(){return VK.init({apiId:_vkontakte.getApiId()}),VK.Auth.getLoginStatus(function(a){return _vkontakte.authInfo(a)})},setTimeout(function(){return $("#vk_api_transport").append('<script async="async" type="text/javascript" src="http://vkontakte.ru/js/api/openapi.js"></script>')},0)},a.prototype.authInfo=function(a){var b;if(typeof a=="undefined"||!a.session)return b=new Session({}),b.setUser({}),b.hideAuthorizedContent(),window._session=b,_ajax.detectPage(),$(".fullscreen").hide();b=new Session(a.session),b.query("/user/auth",{},function(a){return a.newbie?VK.Api.call("getVariable",{key:1281},function(c){return b.query("/user/update",{params:{name:c.response}},function(c){b.setUser(c.user),$("#username").html(b.getUser().name?b.getUser().name:"%username%"),window._session=b,_ajax.detectPage(),b.displayAuthorizedContent(),$("#authorized").css({display:"block"});if(a.ok_reload)return window.location.reload(),!1})}):a.ok_reload?(window.location.reload(),!1):b.setUser(a.user),$("#username").html(b.getUser().name?b.getUser().name:"%username%"),b.displayAuthorizedContent(),window._session=b,_ajax.detectPage(),$(".fullscreen").hide()});if(a.session.expire!=null)return setTimeout(function(){return _vkontakte.auth(),!1},a.session.expire*1e3-(new Date).getTime()+1e3)},a.prototype.auth=function(){return VK.Auth.getLoginStatus(function(a){return _vkontakte.authInfo(a),!1},8),!1},a}(),$("#login").live("click",function(){return VK.Auth.login(function(a){return _vkontakte.authInfo(a),!1},8),!1}),$("#logout").live("click",function(){return VK.Auth.logout(function(a){return _vkontakte.authInfo(a),$(".button-container").hide(),!1}),!1})}.call(this),function(){window.Ajax=function(){function a(){}return a.prototype.referer=!1,a.prototype.load404Page=function(){return $.get("/404.html",function(a){return $(".data-container .inner").html(a)}),!1},a.prototype.loadIndexPage=function(){return $("#content").load("/greetings/"),_ajax.setTitle(""),!1},a.prototype.loadAboutPage=function(){return $("#content").load("/about/"),_ajax.setTitle("About"),!1},a.prototype.setArchor=function(a){return this.referer=this.getAnchor(),window.location.hash="#"+a},a.prototype.getAnchor=function(){return window.location.hash.substring(1)},a.prototype.setTitle=function(a){return a!=null?document.title=a+" @ BeatHaven":document.title="BeatHaven"},a.prototype.go=function(a){return this.setArchor(a),!1},a.prototype.detectPage=function(){var a;return(a=_ajax.getAnchor().match(/\/artist\/(.+)\//))?_search.loadArtistData(a[1]):_ajax.getAnchor().match(/\/settings\//)?_settings.loadSettingsPage():_ajax.getAnchor().match(/\/about\//)?_ajax.loadAboutPage():_ajax.loadIndexPage(),!1},a}(),$(window).bind("hashchange",function(){return _ajax.detectPage(),!1})}.call(this),function(){window.Player=function(){function a(){}return a.prototype.bar_width=263,a.prototype.jp=null,a.prototype.scrobbled=!1,a.prototype.albums=[],a.prototype.playlist=[],a.prototype.initJplayer=function(){var a;return a=this,this.jp=$("#jplayer"),this.jp.jPlayer({swfPath:"/js",supplied:"mp3",cssSelectorAncestor:"",cssSelector:{play:".player .play",pause:".player .pause",stop:"",videoPlay:"",seekBar:"",playBar:"",mute:"",unmute:"",volumeBar:"",volumeBarValue:"",currentTime:"",duration:""}}),this.jp.bind($.jPlayer.event.timeupdate,function(b){var c,d;return d=b.jPlayer.status,!_player.scrobbled&&d.currentPercentAbsolute>50&&(c=$(".playlist li.now"),a.scrobble(_player.getTrackInfo(c.attr("data-id"))),_player.scrobbled=!0),$(".player .progress .loaded").width(d.seekPercent*a.bar_width/100),$(".player .progress .played").width(d.currentPercentAbsolute*a.bar_width/100)}),this.jp.bind($.jPlayer.event.ended,function(b){var c;return c=a.nextTrack(),c?a.setTrack(c):($("#jplayer").jPlayer("clearMedia"),$(".player .now-playing").html("Nothing left to <strike>lose</strike> play"),$(".player .loaded, .player .played").width(0),$(".playlist li").removeClass("now"))}),!1},a.prototype.addTracks=function(a,b){var c,d,e,f;b==null&&(b=!1),c=$(".playlist li").length;for(e=0,f=a.length;e<f;e++)d=a[e],$(".playlist").append(' <li id="i'+Math.round(Math.random()*999999)+'" data-id="'+d.id+'"> <div class="song-duration">'+d.duration+'</div> <div class="remove">remove</div> <div class="artist-name">'+d.artist+'</div> <div class="song-title">'+d.name+"</div> </li>"),_player.playlist.push(d);return $(".playlist").sortable({axis:"y",cursor:"move"}),c===0&&!_player.hasTrack()&&_player.setTrack($(".playlist li").first().attr("id").split("i")[1]),!1},a.prototype.getDataFromLi=function(a){var b,c,d;return b=$(a).attr("data-id"),d=$(a).find(".trackname").html(),c=$(a).find(".length").html(),{id:b,name:d,length:c}},a.prototype.setTrack=function(a){var b,c,d;return b=$("#i"+a),d=_player.getTrackInfo(b.attr("data-id")),c=d.artist+" — "+d.name,$(".player .loaded, .player .played").width(0),$(".player .now-playing").html(c),$(".playlist li").removeClass("now"),b.addClass("now"),_vk_music.search(d.artist,d.name,d.duration,function(a){return _player.playSource(a)}),this.updateNowListening(d),!1},a.prototype.getTrackInfo=function(a){var b,c,d,e;e=_player.playlist;for(c=0,d=e.length;c<d;c++){b=e[c];if(parseInt(b.id,10)===parseInt(a,10))return b}return!1},a.prototype.hasTrack=function(){return $("#jplayer audio").length>0?$("#jplayer audio").attr("src")!=null&&$("#jplayer audio").attr("src")!=="":($("#jplayer object").length>0&&($("#jplayer").jPlayer("play"),!0),!1)},a.prototype.playSource=function(a){return this.scrobbled=!1,$("#jplayer").jPlayer("setMedia",{mp3:a}),$("#jplayer").jPlayer("play"),!1},a.prototype.nextTrack=function(a){var b,c,d;a=a!=null,c=$(".playlist li").length;if(!this.onShuffle()){if($(".playlist .now").next().length!==0)return $(".playlist .now").next().attr("id").split("i")[1];if(_player.onRepeat()||a)return $(".playlist li").first().attr("id").split("i")[1];!1}else{if(c===1)return $(".playlist li").first().attr("id").split("i")[1];for(;;){d=Math.floor(Math.random()*(c+.999)),b=$(".playlist li").eq(d);if(b.length>0&&!b.hasClass("now"))return b.attr("id").split("i")[1]}}return!1},a.prototype.prevTrack=function(){var a,b,c;b=$(".playlist li").length;if(!_player.onShuffle())return $(".playlist .now").prev().length===0?$(".playlist li").last().attr("id").split("i")[1]:$(".playlist .now").prev().attr("id").split("i")[1];if(b===1)return $(".playlist li").first().attr("id").split("i")[1];for(;;){c=Math.floor(Math.random()*(b+.999)),a=$(".playlist li").eq(c);if(a.length>0&&!a.hasClass("now"))return a.attr("id").split("i")[1]}return!1},a.prototype.onShuffle=function(){return $(".shuffle").hasClass("on")},a.prototype.onRepeat=function(){return $(".repeat").hasClass("on")},a.prototype.updateNowListening=function(a){return _session.getUser().lastfm_username&&_session.query("/lastfm/listening?r="+Math.random(),a),!1},a.prototype.scrobble=function(a){return _session.getUser().lastfm_username&&_session.query("/lastfm/scrobble?r="+Math.random(),a),!1},a}(),$(".player .prev").live("click",function(){return _player.setTrack(_player.prevTrack()),!1}),$(".player .next").live("click",function(){return _player.setTrack(_player.nextTrack(!0)),!1}),$(".player .play").live("click",function(){return $(".playlist li").length>0&&!_player.hasTrack()&&_player.setTrack($(".playlist li").first().attr("id").split("i")[1]),!1}),$(".player .progress").live("click",function(a){return $("#jplayer").jPlayer("playHead",Math.round(a.offsetX/_player.bar_width*100)),!1}),$(".repeat, .shuffle").live("click",function(){return $(this).toggleClass("on"),!1}),$(".do_empty").live("click",function(){return confirm("Are you sure?")&&($(".playlist li").remove(),$("#jplayer").jPlayer("clearMedia"),$(".player .now-playing").text("Add some music to playlist"),$(".player .loaded, .player .played").width(0)),!1}),$(".playlist li .artist-name, .playlist li .song-title, .playlist li .song-duration, .playlist li .remove").live("mousemove mouseover mouseout",function(a){var b;return((b=a.type)==="mouseover"||b==="mousemove")&&$(".playlist").offset().left+$(".playlist").outerWidth()-a.clientX<60?($(this).parent().find(".song-duration").hide(),$(this).parent().find(".remove").show()):($(this).parent().find(".remove").hide(),$(this).parent().find(".song-duration").show()),!1}),$(".playlist li .remove").live("click",function(a){var b;return b=$(this).parent(),b.hasClass("now")&&($("#jplayer").jPlayer("clearMedia"),$(".player .now-playing").text("..."),$(".player .loaded, .player .played").width(0)),b.remove(),a.preventDefault(),!1}),$(".playlist li").live("click",function(){return _player.setTrack($(this).attr("id").split("i")[1]),!1}),$(".add-album").live("click",function(){var a,b,c,d,e,f;b=$(".artist-info h2").text(),a=_player.albums[$(this).attr("data-album-id")],f=a.tracks;for(d=0,e=f.length;d<e;d++)c=f[d],c.artist=b,c.album=a.name;return _player.addTracks(a.tracks),!1}),$(".s-add").live("click",function(){var a,b,c;return b=$(".artist-info h2").text(),a=_player.albums[$(this).attr("data-album-id")],c=a.tracks[$(this).attr("data-id")-1],c.artist=b,c.album=a.name,_player.addTracks([c])})}.call(this),function(){window.Search=function(){function a(){}return a.prototype.showSpinner=function(){return $("#search").attr({disabled:"disabled"}).blur(),$("#autocomplete-container").hide(),$("#artist-load-spinner").show(),this.hideSuggestions(),!1},a.prototype.hideSpinner=function(){return $("#search").val("").removeAttr("disabled"),$("#artist-load-spinner").hide(),!1},a.prototype.loadArtistData=function(a){return _search.showSpinner(),a=a.split(" ").join("+"),$.get("/artist/"+a+"/",function(b){var c,d,e,f,g;if((f=b.status)==="ok"||f==="loading"){_ajax.setArchor("/artist/"+a+"/"),_page.print(b.html);if(_session.getUser().id){if(b.albums!=null){g=b.albums;for(d=0,e=g.length;d<e;d++)c=g[d],_player.albums[c.id]=c}$(".button-container").show()}return _search.hideSpinner(),b.status==="loading"&&setTimeout(function(){return _search.loadArtistData(a)},1e4),_ajax.setTitle($("#main h2").text())}if(b.status==="corrected")return _search.loadArtistData(b.correct_name);if(b.status==="suggestions")return _search.hideSpinner(),_page.print(b.html);if(b.status==="fail")return _search.hideSpinner(),_page.print(b.html)}),!1},a.prototype.showSuggestions=function(a){var b,c,d;for(c=0,d=a.length;c<d;c++)b=a[c],$(".suggestions ul").append(' <li> <a class="data artist">'+b.name+"</a> "+(b.desc!=null?"<br/><span>"+b.desc+"</span>":"")+" </li>");return $(".suggestions").show(),!1},a.prototype.hideSuggestions=function(){return $(".suggestions ul li").remove(),$(".suggestions").hide(),!1},a}(),$("#search-form").live("submit",function(){return $("#autocomplete-container").remove(),_search.loadArtistData($("#search").val()),!1}),$(".data.artist").live("click",function(){return _search.loadArtistData($(this).html()),!1})}.call(this),function(){window.Page=function(){function a(){}return a.prototype.print=function(a){return $("#content").html(a),!1},a.prototype.renderArtist=function(a){return $("#content").html(a),yaCounter7596904.hit(_ajax.getAnchor(),a.artist.name,_ajax.referer),_ajax.setTitle(a.artist.name),!1},a.prototype.renderSearch=function(a){return $(".pulldown").html(a),setTimeout(function(){return $(".search_field").first().bh_autocomplete({serviceUrl:"/artist/autocomplete",minChars:2,delimiter:/(,|;)\s*/,maxHeight:400,width:415,zIndex:9999,deferRequestBy:500,onSelect:function(){return _ajax.loadArtistData($(".search_field").first().val())}}),$(".search_field").first().focus()},1),!1},a}(),$(function(){return $("#logo").live("click",function(){return _ajax.go("/"),!1}),$(".about").live("click",function(){return _ajax.go("/about/"),!1}),$("body").live("click",function(){return $(".dropdown-toggle, .menu").parent("li").removeClass("open"),!1}),$(".dropdown-toggle, .menu").live("click",function(){return $(this).parent("li").toggleClass("open"),!1}),$(".dropdown-menu li a").live("click",function(){return $(this).parent().parent().parent().toggleClass("open"),!1}),$(".foreign-link").live("click",function(a){return a.preventDefault(),!1})})}.call(this),function(){window.Settings=function(){function a(){}return a.prototype.loadSettingsPage=function(){return _session.getUser().id==null&&(_ajax.go("/"),!1),_session.secureLoad("/settings/",function(a){return!1}),_ajax.setTitle("Settings"),!1},a.prototype.getAccountInfo=function(a){return _session.query("/user/update/",{},a),!1},a.prototype.saveAccountInfo=function(a,b){return _session.query("/user/update",a,b),!1},a.prototype.updateLastfmLogin=function(){return window.lastfm_popup.closed?_session.query("/user/auth",{},function(a){return _session.setUser(a.user),$("#lastfm_username").val(a.user.lastfm_username),$(".lastfm-connect").hide()}):setTimeout(_settings.updateLastfmLogin,100),!1},a}(),$("#preferences").live("click",function(){return _ajax.go("/settings/"),!1}),$("#settings-tabs li").live("click"
|
|
,function(){return $(this).hasClass("active")||($("#settings-tabs li").removeClass("active"),$(this).addClass("active"),$("#settings-forms > div").hide(),$("#settings-forms > ."+$(this).find("a").attr("data-tab")).show()),!1}),$(".lastfm-connect").live("click",function(){return window.lastfm_popup=window.open(_session.getUser().lastfm_login_url,"lastfm_popup","status=1,width=960,height=585"),setTimeout(_settings.updateLastfmLogin,100),!1}),$("#settings-forms form").live("submit",function(){var a;return a={},$(this).find("input, select").each(function(){if($(this).attr("name"))return $(this).attr("type")==="checkbox"?a[$(this).attr("name")]=$(this).attr("checked")==="checked":a[$(this).attr("name")]=$(this).val()}),_session.query("/user/update/",{params:a}),!1}),$('#settings-forms input[type$="submit"]').live("mouseup",function(){return $(this).parent().parent().parent().submit(),!1}),$('#settings-forms input[type$="checkbox"]').live("click",function(a){return sorry,!1})}.call(this),function(){window._beathaven=null,window._session=null,window._vkontakte=null,window._vk_music=null,window._ajax=null,window._player=null,window._search=null,window._page=null,window._settings=null,$(function(){var a,b;return a=document.location,(b=a.hostname)!=="beathaven.org"&&b!=="dev.beathaven.org"&&(a.href="http://beathaven.org/"+a.hash),window._beathaven=new BeatHaven,window._beathaven.init()}),window.BeatHaven=function(){function a(){}return a.prototype.last_height=!1,a.prototype.lang="ru",a.prototype.init=function(){return window._vkontakte=new Vkontakte(2335068),window._vkontakte.init(),window._vk_music=new VkontakteMusic,window._ajax=new Ajax,window._player=new Player,window._player.initJplayer(),window._search=new Search,window._page=new Page,window._settings=new Settings,this.setupAutocomplete(),!1},a.prototype.setupAutocomplete=function(){return $("#search").first().bh_autocomplete({serviceUrl:"/artist/autocomplete",minChars:3,delimiter:/(,|;)\s*/,maxHeight:400,width:415,zIndex:9999,deferRequestBy:500,containerId:"autocomplete-container",containerItemsId:"autocomplete-items",onSelect:function(){return _search.loadArtistData($("#search").val())}})},a.prototype.localizeHTML=function(a,b){return a==null&&(a=$("body")),b==null&&(b=_beathaven.lang),$(a).find("[data-ls]").each(function(){if(_locale[$(this).attr("data-ls")]!=null&&_locale[$(this).attr("data-ls")][b]!=null)return this.nodeName==="INPUT"?$(this).val(_locale[$(this).attr("data-ls")][b]):$(this).text(_locale[$(this).attr("data-ls")][b])}),a},a.prototype.ls=function(a,b){return b==null&&(b=_beathaven.lang),_locale[a]!=null&&_locale[a][b]!=null?_locale[a][b]:a},a}(),String.prototype.htmlsafe=function(){var a,b,c,d,e;b=[["\\","\\\\"],['"',"""],["<","<"],[">",">"]],c=this;for(d=0,e=b.length;d<e;d++)a=b[d],c=c.replace(a[0],a[1]);return c},String.prototype.trim=function(){var a;a=this;while(a.indexOf(" ")!==-1)a=a.replace(" "," ");return a.charAt(0)===" "&&(a=a.substring(1)),a.charAt(a.length-1)===" "&&(a=a.substring(0,a.length-1)),a}}.call(this) |