/* * jPlayer Plugin for jQuery JavaScript Library * http://www.jplayer.org * * Copyright (c) 2009 - 2013 Happyworm Ltd * Licensed under the MIT license. * http://opensource.org/licenses/MIT * * Author: Mark J Panaghiston * Version: 2.5.0 * Date: 7th November 2013 */ (function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):t.jQuery?e(t.jQuery):e(t.Zepto)})(this,function(t,e){t.fn.jPlayer=function(s){var i="string"==typeof s,a=Array.prototype.slice.call(arguments,1),n=this;return s=!i&&a.length?t.extend.apply(null,[!0,s].concat(a)):s,i&&"_"===s.charAt(0)?n:(i?this.each(function(){var i=t(this).data("jPlayer"),o=i&&t.isFunction(i[s])?i[s].apply(i,a):i;if(o!==i&&o!==e)return n=o,!1}):this.each(function(){var e=t(this).data("jPlayer");e?e.option(s||{}):t(this).data("jPlayer",new t.jPlayer(s,this))}),n)},t.jPlayer=function(e,s){if(arguments.length){this.element=t(s),this.options=t.extend(!0,{},this.options,e);var i=this;this.element.bind("remove.jPlayer",function(){i.destroy()}),this._init()}},"function"!=typeof t.fn.stop&&(t.fn.stop=function(){}),t.jPlayer.emulateMethods="load play pause",t.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate",t.jPlayer.emulateOptions="muted volume",t.jPlayer.reservedEvent="ready flashreset resize repeat error warning",t.jPlayer.event={},t.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){t.jPlayer.event[this]="jPlayer_"+this}),t.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough".split(" "),t.jPlayer.pause=function(){t.each(t.jPlayer.prototype.instances,function(t,e){e.data("jPlayer").status.srcSet&&e.jPlayer("pause")})},t.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var s=function(){this.init()};s.prototype={init:function(){this.options={timeFormat:t.jPlayer.timeFormat}},time:function(t){var e=new Date(1e3*(t&&"number"==typeof t?t:0)),s=e.getUTCHours();return t=this.options.timeFormat.showHour?e.getUTCMinutes():e.getUTCMinutes()+60*s,e=this.options.timeFormat.showMin?e.getUTCSeconds():e.getUTCSeconds()+60*t,s=this.options.timeFormat.padHour&&10>s?"0"+s:s,t=this.options.timeFormat.padMin&&10>t?"0"+t:t,e=this.options.timeFormat.padSec&&10>e?"0"+e:e,s=""+(this.options.timeFormat.showHour?s+this.options.timeFormat.sepHour:""),s+=this.options.timeFormat.showMin?t+this.options.timeFormat.sepMin:"",s+(this.options.timeFormat.showSec?e+this.options.timeFormat.sepSec:"")}};var i=new s;t.jPlayer.convertTime=function(t){return i.time(t)},t.jPlayer.uaBrowser=function(t){t=t.toLowerCase();var e=/(opera)(?:.*version)?[ \/]([\w.]+)/,s=/(msie) ([\w.]+)/,i=/(mozilla)(?:.*? rv:([\w.]+))?/;return t=/(webkit)[ \/]([\w.]+)/.exec(t)||e.exec(t)||s.exec(t)||0>t.indexOf("compatible")&&i.exec(t)||[],{browser:t[1]||"",version:t[2]||"0"}},t.jPlayer.uaPlatform=function(t){var e=t.toLowerCase(),s=/(android)/,i=/(mobile)/;return t=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(e)||[],e=/(ipad|playbook)/.exec(e)||!i.exec(e)&&s.exec(e)||[],t[1]&&(t[1]=t[1].replace(/\s/g,"_")),{platform:t[1]||"",tablet:e[1]||""}},t.jPlayer.browser={},t.jPlayer.platform={};var a=t.jPlayer.uaBrowser(navigator.userAgent);a.browser&&(t.jPlayer.browser[a.browser]=!0,t.jPlayer.browser.version=a.version),a=t.jPlayer.uaPlatform(navigator.userAgent),a.platform&&(t.jPlayer.platform[a.platform]=!0,t.jPlayer.platform.mobile=!a.tablet,t.jPlayer.platform.tablet=!!a.tablet),t.jPlayer.getDocMode=function(){var e;return t.jPlayer.browser.msie&&(document.documentMode?e=document.documentMode:(e=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(e=7))),e},t.jPlayer.browser.documentMode=t.jPlayer.getDocMode(),t.jPlayer.nativeFeatures={init:function(){var t,e,s=document,i=s.createElement("video"),a={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "),webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "),webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},n=["w3c","moz","webkit","webkitVideo"];for(this.fullscreen=i={support:{w3c:!!s[a.w3c[0]],moz:!!s[a.moz[0]],webkit:"function"==typeof s[a.webkit[3]],webkitVideo:"function"==typeof i[a.webkitVideo[2]]},used:{}},t=0,e=n.length;t','','','',''],i=document.createElement('');for(var n=0;n").join(">").split('"').join(""")},_qualifyURL:function(t){var e=document.createElement("div");return e.innerHTML='x',e.firstChild.href},_absoluteMediaUrls:function(e){var s=this;return t.each(e,function(t,i){s.format[t]&&(e[t]=s._qualifyURL(i))}),e},setMedia:function(e){var s=this,i=!1,a=this.status.media.poster!==e.poster;this._resetMedia(),this._resetGate(),this._resetActive(),e=this._absoluteMediaUrls(e),t.each(this.formats,function(a,n){var o="video"===s.format[n].media;if(t.each(s.solutions,function(t,a){if(s[a].support[n]&&s._validString(e[n])){var r="html"===a;return o?(r?(s.html.video.gate=!0,s._html_setVideo(e),s.html.active=!0):(s.flash.gate=!0,s._flash_setVideo(e),s.flash.active=!0),s.css.jq.videoPlay.length&&s.css.jq.videoPlay.show(),s.status.video=!0):(r?(s.html.audio.gate=!0,s._html_setAudio(e),s.html.active=!0):(s.flash.gate=!0,s._flash_setAudio(e),s.flash.active=!0),s.css.jq.videoPlay.length&&s.css.jq.videoPlay.hide(),s.status.video=!1),i=!0,!1}}),i)return!1}),i?(this.status.nativeVideoControls&&this.html.video.gate||!this._validString(e.poster)||(a?this.htmlElement.poster.src=e.poster:this.internal.poster.jq.show()),this.status.srcSet=!0,this.status.media=t.extend({},e),this._updateButtons(!1),this._updateInterface()):this._error({type:t.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:t.jPlayer.errorMsg.NO_SUPPORT,hint:t.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")},focus:function(){this.options.keyEnabled&&(t.jPlayer.focus=this)},play:function(t){t="number"==typeof t?t:NaN,this.status.srcSet?(this.focus(),this.html.active?this._html_play(t):this.flash.active&&this._flash_play(t)):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(t){t="number"==typeof t?t:NaN,this.status.srcSet?this.html.active?this._html_pause(t):this.flash.active&&this._flash_pause(t):this._urlNotSetError("pause")},tellOthers:function(e,s){var i=this,a="function"==typeof s,n=Array.prototype.slice.call(arguments);"string"==typeof e&&(a&&n.splice(1,1),t.each(this.instances,function(){i.element!==this&&(a&&!s.call(this.data("jPlayer"),i)||this.jPlayer.apply(this,n))}))},pauseOthers:function(t){this.tellOthers("pause",function(){return this.status.srcSet},t)},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(t){t=this._limitValue(t,0,100),this.status.srcSet?this.html.active?this._html_playHead(t):this.flash.active&&this._flash_playHead(t):this._urlNotSetError("playHead")},_muted:function(t){this.mutedWorker(t),this.options.globalVolume&&this.tellOthers("mutedWorker",function(){return this.options.globalVolume},t)},mutedWorker:function(e){this.options.muted=e,this.html.used&&this._html_setProperty("muted",e),this.flash.used&&this._flash_mute(e),this.html.video.gate||this.html.audio.gate||(this._updateMute(e),this._updateVolume(this.options.volume),this._trigger(t.jPlayer.event.volumechange))},mute:function(t){t=t===e||!!t,this._muted(t)},unmute:function(t){t=t===e||!!t,this._muted(!t)},_updateMute:function(t){t===e&&(t=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()):t?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(t){this.volumeWorker(t),this.options.globalVolume&&this.tellOthers("volumeWorker",function(){return this.options.globalVolume},t)},volumeWorker:function(e){e=this._limitValue(e,0,1),this.options.volume=e,this.html.used&&this._html_setProperty("volume",e),this.flash.used&&this._flash_volume(e),this.html.video.gate||this.html.audio.gate||(this._updateVolume(e),this._trigger(t.jPlayer.event.volumechange))},volumeBar:function(e){if(this.css.jq.volumeBar.length){var s=t(e.currentTarget),i=s.offset(),a=e.pageX-i.left,n=s.width();e=s.height()-e.pageY+i.top,s=s.height(),this.options.verticalVolume?this.volume(e/s):this.volume(a/n)}this.options.muted&&this._muted(!1)},volumeBarValue:function(){},_updateVolume:function(t){t===e&&(t=this.options.volume),t=this.options.muted?0:t,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"](100*t+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1),this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(e){var s=this;this.options.cssSelectorAncestor=e,this._removeUiClass(),this.ancestorJq=e?t(e):[],e&&1!==this.ancestorJq.length&&this._warning({type:t.jPlayer.warning.CSS_SELECTOR_COUNT,context:e,message:t.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:t.jPlayer.warningHint.CSS_SELECTOR_COUNT}),this._addUiClass(),t.each(this.options.cssSelector,function(t,e){s._cssSelector(t,e)}),this._updateInterface(),this._updateButtons(),this._updateAutohide(),this._updateVolume(),this._updateMute()},_cssSelector:function(e,s){var i=this;"string"==typeof s?t.jPlayer.prototype.options.cssSelector[e]?(this.css.jq[e]&&this.css.jq[e].length&&this.css.jq[e].off(".jPlayer"),this.options.cssSelector[e]=s,this.css.cs[e]=this.options.cssSelectorAncestor+" "+s,this.css.jq[e]=s?t(this.css.cs[e]):[],this.css.jq[e].length&&this.css.jq[e].bind("click.jPlayer",function(s){s.preventDefault(),i[e](s),t(this).blur()}),s&&1!==this.css.jq[e].length&&this._warning({type:t.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[e],message:t.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[e].length+" found for "+e+" method.",hint:t.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:t.jPlayer.warning.CSS_SELECTOR_METHOD,context:e,message:t.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:t.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:t.jPlayer.warning.CSS_SELECTOR_STRING,context:s,message:t.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:t.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(e){if(this.css.jq.seekBar.length){var s=t(e.currentTarget),i=s.offset();e=e.pageX-i.left,s=s.width(),this.playHead(100*e/s)}},playBar:function(){},playbackRate:function(t){this._setOption("playbackRate",t)},playbackRateBar:function(e){if(this.css.jq.playbackRateBar.length){var s=t(e.currentTarget),i=s.offset(),a=e.pageX-i.left,n=s.width();e=s.height()-e.pageY+i.top,s=s.height(),this.playbackRate((this.options.verticalPlaybackRate?e/s:a/n)*(this.options.maxPlaybackRate-this.options.minPlaybackRate)+this.options.minPlaybackRate)}},playbackRateBarValue:function(){},_updatePlaybackRate:function(){var t=(this.options.playbackRate-this.options.minPlaybackRate)/(this.options.maxPlaybackRate-this.options.minPlaybackRate);this.status.playbackRateEnabled?(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.show(),this.css.jq.playbackRateBarValue.length&&(this.css.jq.playbackRateBarValue.show(),this.css.jq.playbackRateBarValue[this.options.verticalPlaybackRate?"height":"width"](100*t+"%"))):(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.hide(),this.css.jq.playbackRateBarValue.length&&this.css.jq.playbackRateBarValue.hide())},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(e){this.options.loop!==e&&(this.options.loop=e,this._updateButtons(),this._trigger(t.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(s,i){var a=s;if(0===arguments.length)return t.extend(!0,{},this.options);if("string"==typeof s){var n=s.split(".");if(i===e){a=t.extend(!0,{},this.options);for(var o=0;o=t&&(e=!0),e},_validString:function(t){return t&&"string"==typeof t},_limitValue:function(t,e,s){return ts?s:t},_urlNotSetError:function(e){this._error({type:t.jPlayer.error.URL_NOT_SET,context:e,message:t.jPlayer.errorMsg.URL_NOT_SET,hint:t.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(e){var s;s=this.internal.ready?"FLASH_DISABLED":"FLASH",this._error({type:t.jPlayer.error[s],context:this.internal.flash.swf,message:t.jPlayer.errorMsg[s]+e.message,hint:t.jPlayer.errorHint[s]}),this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(e){this._trigger(t.jPlayer.event.error,e),this.options.errorAlerts&&this._alert("خطا!"+(e.message?"\n"+e.message:"")+(e.hint?"\n"+e.hint:"")+"\nContext: "+e.context)},_warning:function(s){this._trigger(t.jPlayer.event.warning,e,s),this.options.warningAlerts&&this._alert("هشدار!"+(s.message?"\n"+s.message:"")+(s.hint?"\n"+s.hint:"")+"\nContext: "+s.context)},_alert:function(t){t="jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+t,this.options.consoleAlerts?console&&console.log&&console.log(t):alert(t)},_emulateHtmlBridge:function(){var e=this;t.each(t.jPlayer.emulateMethods.split(/\s+/g),function(t,s){e.internal.domNode[s]=function(t){e[s](t)}}),t.each(t.jPlayer.event,function(s,i){var a=!0;t.each(t.jPlayer.reservedEvent.split(/\s+/g),function(t,e){if(e===s)return a=!1}),a&&e.element.bind(i+".jPlayer.jPlayerHtml",function(){e._emulateHtmlUpdate();var t=document.createEvent("Event");t.initEvent(s,!1,!0),e.internal.domNode.dispatchEvent(t)})})},_emulateHtmlUpdate:function(){var e=this;t.each(t.jPlayer.emulateStatus.split(/\s+/g),function(t,s){e.internal.domNode[s]=e.status[s]}),t.each(t.jPlayer.emulateOptions.split(/\s+/g),function(t,s){e.internal.domNode[s]=e.options[s]})},_destroyHtmlBridge:function(){var e=this;this.element.off(".jPlayerHtml"),t.each((t.jPlayer.emulateMethods+" "+t.jPlayer.emulateStatus+" "+t.jPlayer.emulateOptions).split(/\s+/g),function(t,s){delete e.internal.domNode[s]})}},t.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"},t.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 "+t.jPlayer.prototype.version.script+" needs Jplayer.swf version "+t.jPlayer.prototype.version.needFlash+" but found "},t.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."},t.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"},t.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."},t.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."}});