From d111f9822f37a91a6a160094d0bcfbff1de54419 Mon Sep 17 00:00:00 2001 From: bkoval Date: Mon, 29 Oct 2018 10:02:46 +0100 Subject: [PATCH 1/4] IW-130 | Custom dimension for user-intended video plays --- dist/wikiajwplayer.js | 2 +- src/events.js | 4 -- src/index.js | 11 +++- src/user-intended-play-control.js | 102 ++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 src/user-intended-play-control.js diff --git a/dist/wikiajwplayer.js b/dist/wikiajwplayer.js index c6f72bb6..37f1c9b3 100644 --- a/dist/wikiajwplayer.js +++ b/dist/wikiajwplayer.js @@ -1 +1 @@ -!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(k.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return x.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){i.info("related plugin play"),r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&(e.trigger("videoResumed",t),i.info("videoResumed triggered")),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&(e.trigger("playerStart",{auto:t}),i.info("playerStart triggered")),e.trigger("videoStart"),i.info("videoStart triggered")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),k[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),k[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(k.volumeOff),this.playIcon=a(k.play),this.pauseIcon=a(k.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function y(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var f={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},k={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var b=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&y.register(),t.showSmallPlayerControls&&h.register(),b.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(b.push(i),1===b.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=f[s]||f.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),!1!==t.watermark&&v.register(),i&&i(p)})};var x=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(k.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},v.prototype.getWatermarkElement=function(){var e=k.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},y.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},y.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},y.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},y.prototype.addButton=function(){var e=a(k.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},y.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},y.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},y.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},y.prototype.hide=function(){this.close(),this.removeButton()},y.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},y.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},y.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},y.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(k[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},y.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},y.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},y.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},y.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},y.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},y.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},y.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},y.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},y.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},y.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},y.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},y.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},y.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},y.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},y.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},y.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},y.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",y)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file +!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n,a){p!==e&&(p=e,e?h=n:n=null,"function"==typeof i.setCustomDimension&&(a?i.setCustomDimension(39,e?"user-intended":"not-user-intended"):t.on("relatedVideoImpression",function(){i.setCustomDimension(39,e?"user-intended":"not-user-intended")})))}function s(e){"interaction"===e.pauseReason&&(g=!0)}function o(e){g&&a(!0,m.unpausing)}function r(){a(!0,m.fullScreen)}function l(){a(!0,m.unmuting)}function c(){p&&h===m.unmuting&&a(!1)}function d(){a(!0,m.videoThumbnailInsidePlayer,!0)}function u(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e&&a(!0,m.playerInitializedByUserInteraction,!0):a(!0,m.clickToPlay,!0)}var p=null,h=null,g=!1,m={unpausing:"unpausing",fullScreen:"fullscreen",unmuting:"unmuting",videoThumbnailInsidePlayer:"videothumbnailinsideplayer",clickToPlay:"clicktoplay",playerInitializedByUserInteraction:"playerinitializedbyuserinteraction"};t.once("ready",function(){u()})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat,isUserIntended:t.isUserIntended};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(window.location.search.indexOf("wikia-footer-wiki-rec")>-1,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file diff --git a/src/events.js b/src/events.js index 51a703bc..46f7bcca 100644 --- a/src/events.js +++ b/src/events.js @@ -91,7 +91,6 @@ function wikiaJWPlayerEvents(playerInstance, willAutoplay, logger) { }); relatedPlugin.on('play', function (data) { - logger.info('related plugin play'); depth++; playerInstance.trigger('relatedVideoPlay', { @@ -106,7 +105,6 @@ function wikiaJWPlayerEvents(playerInstance, willAutoplay, logger) { playerInstance.on('play', function (data) { if (isPlayerPaused) { playerInstance.trigger('videoResumed', data); - logger.info('videoResumed triggered'); } isPlayerPaused = false; @@ -119,11 +117,9 @@ function wikiaJWPlayerEvents(playerInstance, willAutoplay, logger) { playerInstance.on('firstFrame', function () { if (depth === 0) { playerInstance.trigger('playerStart', { auto: willAutoplay }); - logger.info('playerStart triggered'); } playerInstance.trigger('videoStart'); - logger.info('videoStart triggered'); }); playerInstance.on('mute', function () { diff --git a/src/index.js b/src/index.js index 8070c41c..53a110dc 100644 --- a/src/index.js +++ b/src/index.js @@ -84,7 +84,8 @@ window.wikiaJWPlayer = function (elementId, options, callback) { playlist: options.videoDetails.playlist, title: options.videoDetails.title, localization: i18n, - repeat: options.repeat + repeat: options.repeat, + isUserIntended: options.isUserIntended }; playerSetup.plugins = {}; @@ -154,6 +155,14 @@ window.wikiaJWPlayer = function (elementId, options, callback) { wikiaJWPlayerAllowControllOnTouchDevices(playerInstance); + wikiaJWPlayerUserIntendedPlayControl( + //user coming from footer must've clicked the video thumbnail + window.location.search.indexOf('wikia-footer-wiki-rec') > -1, + playerInstance, + options.tracking, + options.autoplay + ); + if(options.watermark !== false) { WikiaJWPlayerWatermarkPlugin.register(); } diff --git a/src/user-intended-play-control.js b/src/user-intended-play-control.js new file mode 100644 index 00000000..69d1730b --- /dev/null +++ b/src/user-intended-play-control.js @@ -0,0 +1,102 @@ +function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playerInstance, tracker, willAutoplay) { + var isUserIntendedPlay = null; + var userIntendedPlayReason = null; + var wasPausedByUserInteraction = false; + var reasonsForUserIntendedPlay = { + unpausing: 'unpausing', + fullScreen: 'fullscreen', + unmuting: 'unmuting', + videoThumbnailInsidePlayer: 'videothumbnailinsideplayer', + clickToPlay: 'clicktoplay', + playerInitializedByUserInteraction: 'playerinitializedbyuserinteraction' + }; + + function setUserIntendedPlay(isUserIntended, userIntendedReason, immediate) { + if (isUserIntendedPlay === isUserIntended) { + return; + } + + isUserIntendedPlay = isUserIntended; + + if (isUserIntended) { + userIntendedPlayReason = userIntendedReason; + } else { + userIntendedReason = null; + } + + if (typeof tracker.setCustomDimension !== 'function') { + return; + } + + if (immediate) { + tracker.setCustomDimension(39, isUserIntended ? 'user-intended' : 'not-user-intended'); + } else { + // Related video impression happens just before the potential subsequent video play + playerInstance.on('relatedVideoImpression', function () { + tracker.setCustomDimension(39, isUserIntended ? 'user-intended' : 'not-user-intended'); + }); + } + } + + function onPause(data) { + if (data.pauseReason === 'interaction') { + wasPausedByUserInteraction = true; + } + } + + function onPlay(data) { + if (wasPausedByUserInteraction) { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.unpausing); + } + } + + function onFullScreen() { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.fullScreen); + } + + function onUnmute() { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.unmuting); + } + + function onMute() { + if (isUserIntendedPlay && userIntendedPlayReason === reasonsForUserIntendedPlay.unmuting) { + setUserIntendedPlay(false); + } + } + + function onVideoThumbnailInsidePlayerClicked() { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.videoThumbnailInsidePlayer, true); + } + + function init() { + playerInstance.on('mute', function () { + if (playerInstance.getMute()) { + onMute(); + } else { + onUnmute(); + } + }); + + playerInstance.on('pause', onPause); + playerInstance.on('play', onPlay); + playerInstance.on('fullscreen', onFullScreen); + + playerInstance.on('relatedVideoPlay', function (data) { + if (!data.auto) { + onVideoThumbnailInsidePlayerClicked(); + } + }); + + if (!willAutoplay) { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.clickToPlay, true); + } else if (isInitiallyUserIntendedPlay) { + setUserIntendedPlay(true, reasonsForUserIntendedPlay.playerInitializedByUserInteraction, true); + } + } + + playerInstance.once('ready', function () { + init(); + }); +} + +window.wikiaJWPlayerUserIntendedPlayControl = wikiaJWPlayerUserIntendedPlayControl; From 3ff85e688c81f838fed33630a149ab74d58de0c2 Mon Sep 17 00:00:00 2001 From: bkoval Date: Mon, 29 Oct 2018 10:23:31 +0100 Subject: [PATCH 2/4] IW-130 | If video autoplays set user-intended play to false --- dist/wikiajwplayer.js | 2 +- src/user-intended-play-control.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/wikiajwplayer.js b/dist/wikiajwplayer.js index 37f1c9b3..cf5c79ff 100644 --- a/dist/wikiajwplayer.js +++ b/dist/wikiajwplayer.js @@ -1 +1 @@ -!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n,a){p!==e&&(p=e,e?h=n:n=null,"function"==typeof i.setCustomDimension&&(a?i.setCustomDimension(39,e?"user-intended":"not-user-intended"):t.on("relatedVideoImpression",function(){i.setCustomDimension(39,e?"user-intended":"not-user-intended")})))}function s(e){"interaction"===e.pauseReason&&(g=!0)}function o(e){g&&a(!0,m.unpausing)}function r(){a(!0,m.fullScreen)}function l(){a(!0,m.unmuting)}function c(){p&&h===m.unmuting&&a(!1)}function d(){a(!0,m.videoThumbnailInsidePlayer,!0)}function u(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e&&a(!0,m.playerInitializedByUserInteraction,!0):a(!0,m.clickToPlay,!0)}var p=null,h=null,g=!1,m={unpausing:"unpausing",fullScreen:"fullscreen",unmuting:"unmuting",videoThumbnailInsidePlayer:"videothumbnailinsideplayer",clickToPlay:"clicktoplay",playerInitializedByUserInteraction:"playerinitializedbyuserinteraction"};t.once("ready",function(){u()})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat,isUserIntended:t.isUserIntended};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(window.location.search.indexOf("wikia-footer-wiki-rec")>-1,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file +!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n,a){p!==e&&(p=e,e?h=n:n=null,"function"==typeof i.setCustomDimension&&(a?i.setCustomDimension(39,e?"user-intended":"not-user-intended"):t.on("relatedVideoImpression",function(){i.setCustomDimension(39,e?"user-intended":"not-user-intended")})))}function s(e){"interaction"===e.pauseReason&&(g=!0)}function o(e){g&&a(!0,m.unpausing)}function r(){a(!0,m.fullScreen)}function l(){a(!0,m.unmuting)}function c(){p&&h===m.unmuting&&a(!1)}function d(){a(!0,m.videoThumbnailInsidePlayer,!0)}function u(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e?a(!0,m.playerInitializedByUserInteraction,!0):a(!1,null,!0):a(!0,m.clickToPlay,!0)}var p=null,h=null,g=!1,m={unpausing:"unpausing",fullScreen:"fullscreen",unmuting:"unmuting",videoThumbnailInsidePlayer:"videothumbnailinsideplayer",clickToPlay:"clicktoplay",playerInitializedByUserInteraction:"playerinitializedbyuserinteraction"};t.once("ready",function(){u()})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat,isUserIntended:t.isUserIntended};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(window.location.search.indexOf("wikia-footer-wiki-rec")>-1,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file diff --git a/src/user-intended-play-control.js b/src/user-intended-play-control.js index 69d1730b..b22c0ba0 100644 --- a/src/user-intended-play-control.js +++ b/src/user-intended-play-control.js @@ -91,6 +91,8 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe setUserIntendedPlay(true, reasonsForUserIntendedPlay.clickToPlay, true); } else if (isInitiallyUserIntendedPlay) { setUserIntendedPlay(true, reasonsForUserIntendedPlay.playerInitializedByUserInteraction, true); + } else { + setUserIntendedPlay(false, null, true); } } From 52d1053fce16e6aafb856e3043ba3f1156ba5dd3 Mon Sep 17 00:00:00 2001 From: bkoval Date: Wed, 31 Oct 2018 16:16:53 +0100 Subject: [PATCH 3/4] IW-130 | Addressing CR --- dist/wikiajwplayer.js | 2 +- src/index.js | 6 ++-- src/user-intended-play-control.js | 54 +++++++++++++------------------ 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/dist/wikiajwplayer.js b/dist/wikiajwplayer.js index cf5c79ff..f6703e1c 100644 --- a/dist/wikiajwplayer.js +++ b/dist/wikiajwplayer.js @@ -1 +1 @@ -!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n,a){p!==e&&(p=e,e?h=n:n=null,"function"==typeof i.setCustomDimension&&(a?i.setCustomDimension(39,e?"user-intended":"not-user-intended"):t.on("relatedVideoImpression",function(){i.setCustomDimension(39,e?"user-intended":"not-user-intended")})))}function s(e){"interaction"===e.pauseReason&&(g=!0)}function o(e){g&&a(!0,m.unpausing)}function r(){a(!0,m.fullScreen)}function l(){a(!0,m.unmuting)}function c(){p&&h===m.unmuting&&a(!1)}function d(){a(!0,m.videoThumbnailInsidePlayer,!0)}function u(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e?a(!0,m.playerInitializedByUserInteraction,!0):a(!1,null,!0):a(!0,m.clickToPlay,!0)}var p=null,h=null,g=!1,m={unpausing:"unpausing",fullScreen:"fullscreen",unmuting:"unmuting",videoThumbnailInsidePlayer:"videothumbnailinsideplayer",clickToPlay:"clicktoplay",playerInitializedByUserInteraction:"playerinitializedbyuserinteraction"};t.once("ready",function(){u()})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat,isUserIntended:t.isUserIntended};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(window.location.search.indexOf("wikia-footer-wiki-rec")>-1,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file +!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e,t){function i(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||n)}var n=!1;document.addEventListener("visibilitychange",function(){i()&&(e.play(),n=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),n=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n){u!==e&&(u=e,"function"==typeof i.setCustomDimension&&(n?i.setCustomDimension(g,e?m:w):t.on("relatedVideoImpression",function(){i.setCustomDimension(g,e?m:w)})))}function s(e){"interaction"===e.pauseReason&&(h=!0)}function o(){h&&a(!0)}function r(){a(!0)}function l(){a(!0),p=!0}function c(){u&&p&&a(!1)}function d(){a(!0,!0)}var u=null,p=!1,h=!1,g=39,m="user-intended",w="not-user-intended";t.once("ready",function(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e?a(!0,!0):a(!1,!0):a(!0,!0)})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(t.shouldForceUserIntendedPlay,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file diff --git a/src/index.js b/src/index.js index 53a110dc..a491129e 100644 --- a/src/index.js +++ b/src/index.js @@ -84,8 +84,7 @@ window.wikiaJWPlayer = function (elementId, options, callback) { playlist: options.videoDetails.playlist, title: options.videoDetails.title, localization: i18n, - repeat: options.repeat, - isUserIntended: options.isUserIntended + repeat: options.repeat }; playerSetup.plugins = {}; @@ -156,8 +155,7 @@ window.wikiaJWPlayer = function (elementId, options, callback) { wikiaJWPlayerAllowControllOnTouchDevices(playerInstance); wikiaJWPlayerUserIntendedPlayControl( - //user coming from footer must've clicked the video thumbnail - window.location.search.indexOf('wikia-footer-wiki-rec') > -1, + options.shouldForceUserIntendedPlay, playerInstance, options.tracking, options.autoplay diff --git a/src/user-intended-play-control.js b/src/user-intended-play-control.js index b22c0ba0..6f236b46 100644 --- a/src/user-intended-play-control.js +++ b/src/user-intended-play-control.js @@ -1,39 +1,32 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playerInstance, tracker, willAutoplay) { var isUserIntendedPlay = null; - var userIntendedPlayReason = null; + var isUserIntendedByUnmuting = false; var wasPausedByUserInteraction = false; - var reasonsForUserIntendedPlay = { - unpausing: 'unpausing', - fullScreen: 'fullscreen', - unmuting: 'unmuting', - videoThumbnailInsidePlayer: 'videothumbnailinsideplayer', - clickToPlay: 'clicktoplay', - playerInitializedByUserInteraction: 'playerinitializedbyuserinteraction' - }; - - function setUserIntendedPlay(isUserIntended, userIntendedReason, immediate) { + var customDimensionNumber = 39; + var customDimensionValueWhenIntended = 'user-intended'; + var customDimensionValueWhenNotIntended = 'not-user-intended'; + + function setUserIntendedPlay(isUserIntended, immediate) { if (isUserIntendedPlay === isUserIntended) { return; } isUserIntendedPlay = isUserIntended; - if (isUserIntended) { - userIntendedPlayReason = userIntendedReason; - } else { - userIntendedReason = null; - } - if (typeof tracker.setCustomDimension !== 'function') { return; } if (immediate) { - tracker.setCustomDimension(39, isUserIntended ? 'user-intended' : 'not-user-intended'); + tracker.setCustomDimension( + customDimensionNumber, isUserIntended ?customDimensionValueWhenIntended : customDimensionValueWhenNotIntended + ); } else { // Related video impression happens just before the potential subsequent video play playerInstance.on('relatedVideoImpression', function () { - tracker.setCustomDimension(39, isUserIntended ? 'user-intended' : 'not-user-intended'); + tracker.setCustomDimension( + customDimensionNumber, isUserIntended ? customDimensionValueWhenIntended : customDimensionValueWhenNotIntended + ); }); } } @@ -44,28 +37,29 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe } } - function onPlay(data) { + function onPlay() { if (wasPausedByUserInteraction) { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.unpausing); + setUserIntendedPlay(true); } } function onFullScreen() { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.fullScreen); + setUserIntendedPlay(true); } function onUnmute() { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.unmuting); + setUserIntendedPlay(true); + isUserIntendedByUnmuting = true; } function onMute() { - if (isUserIntendedPlay && userIntendedPlayReason === reasonsForUserIntendedPlay.unmuting) { + if (isUserIntendedPlay && isUserIntendedByUnmuting) { setUserIntendedPlay(false); } } function onVideoThumbnailInsidePlayerClicked() { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.videoThumbnailInsidePlayer, true); + setUserIntendedPlay(true, true); } function init() { @@ -88,17 +82,15 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe }); if (!willAutoplay) { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.clickToPlay, true); + setUserIntendedPlay(true, true); } else if (isInitiallyUserIntendedPlay) { - setUserIntendedPlay(true, reasonsForUserIntendedPlay.playerInitializedByUserInteraction, true); + setUserIntendedPlay(true, true); } else { - setUserIntendedPlay(false, null, true); + setUserIntendedPlay(false, true); } } - playerInstance.once('ready', function () { - init(); - }); + playerInstance.once('ready', init); } window.wikiaJWPlayerUserIntendedPlayControl = wikiaJWPlayerUserIntendedPlayControl; From 1ee943751013fc9bb57b1d5f0f58966669a320c9 Mon Sep 17 00:00:00 2001 From: bkoval Date: Wed, 7 Nov 2018 15:15:16 +0100 Subject: [PATCH 4/4] IW-130 | Apply custom dimension right away, not with the next video --- dist/wikiajwplayer.js | 2 +- src/user-intended-play-control.js | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/dist/wikiajwplayer.js b/dist/wikiajwplayer.js index 3925b5d2..98d9d5cc 100644 --- a/dist/wikiajwplayer.js +++ b/dist/wikiajwplayer.js @@ -1 +1 @@ -!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e){function t(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||i)}var i=!1;e.on("playerStart",function(){document.addEventListener("visibilitychange",function(){t()&&(e.play(),i=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1)}),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),i=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e,n){u!==e&&(u=e,"function"==typeof i.setCustomDimension&&(n?i.setCustomDimension(g,e?m:w):t.on("relatedVideoImpression",function(){i.setCustomDimension(g,e?m:w)})))}function s(e){"interaction"===e.pauseReason&&(h=!0)}function o(){h&&a(!0)}function r(){a(!0)}function l(){a(!0),p=!0}function c(){u&&p&&a(!1)}function d(){a(!0,!0)}var u=null,p=!1,h=!1,g=39,m="user-intended",w="not-user-intended";t.once("ready",function(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),n?e?a(!0,!0):a(!1,!0):a(!0,!0)})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(t.shouldForceUserIntendedPlay,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file +!function(e){function t(e){var t=document.createElement("li"),i=document.createElement("input"),n=document.createElement("label");return t.className="wikia-jw-settings__toggle",i.className="wds-toggle__input",i.id=e.id,i.type="checkbox",i.checked=e.checked,n.className="wds-toggle__label",n.setAttribute("for",e.id),n.appendChild(document.createTextNode(e.label)),t.appendChild(i),t.appendChild(n),t}function i(e){var t=a(b.back);return"left"===e?t.classList.add("wikia-jw-settings__back-icon"):t.classList.add("wikia-jw-settings__right-arrow-icon"),t}function n(e){if(e)for(;e.childElementCount>1;)e.removeChild(e.firstChild)}function a(e){return L.parseFromString(e,"image/svg+xml").documentElement}function s(e){e&&(e.style.display="block")}function o(e){e&&(e.style.display="none")}function r(e){e.on("playerStart",function(){var t=document.querySelector(".jw-autostart-mute");t&&(e.getContainer().classList.remove("jw-flag-autostart"),t.style.display="none")})}function l(e,t,i){function n(){return{wasFirstQuartileTriggered:!1,wasMidPointTriggered:!1,wasThirdQuartileTriggered:!1,progress:{durationWatched:0,percentWatched:0}}}function a(t,n){var a=Math.floor(n.position),o=Math.floor(100*a/n.duration),r=e.getPlaylistItem();o>100&&r&&(n.mediaId=r.mediaid,i.error("played-percentage",n)),a>s[t].progress.durationWatched&&a%5==0&&(e.trigger(t+"SecondsPlayed",{value:a}),s[t].progress.durationWatched=a),o>=25&&!s[t].wasFirstQuartileTriggered&&(e.trigger(t+"FirstQuartile"),s[t].wasFirstQuartileTriggered=!0),o>=50&&!s[t].wasMidPointTriggered&&(e.trigger(t+"MidPoint"),s[t].wasMidPointTriggered=!0),o>=75&&!s[t].wasThirdQuartileTriggered&&(e.trigger(t+"ThirdQuartile"),s[t].wasThirdQuartileTriggered=!0),o>s[t].progress.percentWatched&&o%10==0&&(e.trigger(t+"PercentPlayed",{value:o}),s[t].progress.percentWatched=o)}var s={ad:n(),video:n()},o=!1,r=0,l={ad:"ad",video:"video"},c=!1;i.info("before ready"),e.once("ready",function(){i.info("player ready");var t=e.getPlugin("related");t.on("open",function(){i.info("related plugin open"),e.trigger("relatedVideoImpression"),s[l.video]=n()}),t.on("play",function(t){r++,e.trigger("relatedVideoPlay",{auto:t.auto,item:t.item,position:t.position,depth:r})})}),e.on("play",function(t){c&&e.trigger("videoResumed",t),c=!1}),e.on("pause",function(){c=!0}),e.on("firstFrame",function(){0===r&&e.trigger("playerStart",{auto:t}),e.trigger("videoStart")}),e.on("mute",function(){e.getMute()||o||(e.trigger("firstUnmute"),o=!0)}),e.on("time",function(e){a(l.video,e)}),e.on("adTime",function(e){a(l.ad,e)}),e.on("adRequest",function(){s[l.ad]=n()})}function c(e,t){function i(e){var t=Math.floor(e/60),i=e%60;return i<10&&(i="0"+i),t<10&&(t="0"+t),t+":"+i}e.on("ready",function(){var n=e.id,a=document.getElementById(n),s=a.querySelector(".jw-title"),o=a.querySelector(".jw-title-primary"),r=document.createElement("div"),l=document.createElement("span"),c=document.createElement("span");r.className="wikia-jw-title-duration",l.className="wikia-jw-title-duration-watch",c.className="wikia-jw-title-duration-time",l.innerText=t.watch,c.innerText=i(e.getDuration()),r.appendChild(l),r.appendChild(c),s.insertBefore(r,o)})}function d(e){function t(e,t,i){var s=new XMLHttpRequest,o={name:a+" "+t};i&&(o.description="string"==typeof i?i:JSON.stringify(i)),c&&(o.client=c),d&&(o.client_version=d),s.open("POST",n+e,!0),s.setRequestHeader("Content-type","application/json"),s.send(JSON.stringify(o))}function i(e,i){r<=s.error&&(console.error(a,e,i),t("error",e,i))}var n="https://"+(e.servicesDomain||"services.wikia.com")+"/event-logger/",a="JWPlayer",s={debug:0,info:1,warn:2,error:3,off:4},o=e.logger||{},r=o.logLevel?s[o.logLevel]:s.error,l=o.logDebugToService,c=o.clientName,d=o.clientVersion;return{debug:function(e,i){r<=s.debug&&console.log(a,e,i),l&&t("debug",e,i)},info:function(e,t){r<=s.info&&console.info(a,e,t)},warn:function(e,t){r<=s.warn&&console.warn(a,e,t)},error:i,subscribeToPlayerErrors:function(e){e.on("setupError",function(e){i("setupError",e)}),e.on("error",function(e){i("error",e)})}}}function u(e){function t(e,t){if(e){var i=n.parseFromString(t,"image/svg+xml").documentElement;i.setAttribute("class",e.getAttribute("class")),e.parentNode.replaceChild(i,e)}}function i(e){var i=e.querySelector(".jw-controlbar"),n=e.querySelector(".jw-display");[{selector:".jw-svg-icon-play",iconName:"play"},{selector:".jw-svg-icon-pause",iconName:"pause"},{selector:".jw-svg-icon-fullscreen-on",iconName:"fullScreenOn"},{selector:".jw-svg-icon-fullscreen-off",iconName:"fullScreenOff"},{selector:".jw-svg-icon-settings",iconName:"settings"},{selector:".jw-svg-icon-volume-0",iconName:"volumeOff"},{selector:".jw-svg-icon-volume-50",iconName:"volumeOn"},{selector:".jw-svg-icon-volume-100",iconName:"volumeOn"}].forEach(function(e){t(i.querySelector(e.selector),b[e.iconName])}),[{selector:".jw-svg-icon-play",iconName:"displayPlay"},{selector:".jw-svg-icon-pause",iconName:"pause"}].forEach(function(e){t(n.querySelector(e.selector),b[e.iconName])})}var n=new DOMParser;e.on("ready",function(){i(e.getContainer())})}function p(e,t,i){this.player=e,this.container=i,this.wikiaSettingsElement=document.createElement("div"),this.buttonID="wikiaSettings",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSettingsElement.classList.add("wikia-jw-settings"),this.wikiaSettingsElement.classList.add("wikia-jw"),this.addSettingsContent(this.wikiaSettingsElement),this.container.appendChild(this.wikiaSettingsElement),this.player.on("levels",this.onQualityLevelsChange.bind(this)),this.player.on("relatedVideoPlay",this.onCaptionsChange.bind(this)),this.player.once("ready",this.onCaptionsChange.bind(this))}function h(e,t,i){this.player=e,this.container=i,this.config=t,this.muteIcon=a(b.volumeOff),this.playIcon=a(b.play),this.pauseIcon=a(b.pause),this.container.classList.add("wikia-jw-small-player-controls-plugin"),this.wikiaControlsElement=document.createElement("div"),this.wikiaControlsElement.appendChild(this.muteIcon),this.wikiaControlsElement.appendChild(this.pauseIcon),this.unmuteHandler=this.unmuteHandler.bind(this),this.playHandler=this.playHandler.bind(this),this.pauseHandler=this.pauseHandler.bind(this),this.readyHandler=this.readyHandler.bind(this),this.resizeHandler=this.resizeHandler.bind(this),this.container.addEventListener("click",this.unmuteHandler),this.pauseIcon.addEventListener("click",this.pauseHandler),this.playIcon.addEventListener("click",this.playHandler),this.player.on("resize",this.resizeHandler),this.player.on("ready",this.readyHandler)}function g(e){e.on("relatedVideoPlay",function(t){t.auto||e.setMute(!1)})}function m(e){function t(){return!document.hidden&&(-1===["playing","paused","complete"].indexOf(e.getState())||i)}var i=!1;e.on("playerStart",function(){document.addEventListener("visibilitychange",function(){t()&&(e.play(),i=!1,e.trigger("playerResumedByBrowserTabSwitch"))},!1)}),e.on("relatedVideoPlay",function(){document.hidden&&e.once("play",function(){e.pause(),i=!0,e.trigger("playerPausedByBrowserTabSwitch")})})}function w(e,t,i){function n(e){"function"==typeof i.setCustomDimension&&(i.setCustomDimension(34,e.mediaid),i.setCustomDimension(35,e.title),i.setCustomDimension(36,e.tags))}function a(e,t){var i=document.getElementById(e);i&&i.parentElement.removeChild(i);var n=document.createElement("img");n.src=t,n.id=e,document.body.appendChild(n)}function s(){if(i.comscore){a("comscoreVideoMetrixTrack","https://sb.scorecardresearch.com/p?C1=1&C2=6177433&C5=04")}}function o(e){e&&a("wikiaJWPlayerCustomPixel",e)}function r(t){if(!t.label)throw new Error("No tracking label provided");var n={action:t.action||"click",category:c,label:t.label,value:Number(e.getMute()),eventName:l,videoId:e.getPlaylistItem().mediaid,player:"jwplayer",onScroll:d,trackingMethod:"analytics"};i.track(n)}var l="videoplayerevent",c=i.category||"featured-video",d=!1,u=0;"function"==typeof i.setCustomDimension&&i.setCustomDimension(37,t?"Yes":"No"),e.once("ready",function(){n(e.getPlaylistItem()),r({label:"load",action:"impression"})}),e.on("relatedVideoImpression",function(){r({label:"recommended-video",action:"impression"})}),e.on("relatedVideoPlay",function(e){n(e.item),r({label:e.auto?"recommended-video-autoplay":"recommended-video-select-"+e.position,action:"impression"}),r({label:"recommended-video-depth-"+e.depth,action:"impression"}),s(),o(e.item.pixel)}),e.on("videoResumed",function(e){"interaction"===e.playReason&&r({label:"play-resumed"})}),e.on("playerStart",function(e){r(e.auto?{label:"autoplay-start",action:"impression"}:{label:"user-start"}),s(),o(i.pixel)}),e.on("pause",function(e){"interaction"===e.pauseReason&&r({label:"paused"})}),e.on("firstUnmute",function(){r({label:"unmuted"})}),e.on("videoPercentPlayed",function(e){r({label:"played-percentage-"+(u=e.value),action:"view"})}),e.on("complete",function(){r({label:"completed",action:"impression"})}),e.on("onScrollStateChanged",function(e){"closed"===e.state&&r({label:"played-percentage-"+u,action:"close"}),d="active"===e.state,i.setCustomDimension(38,d?"Yes":"No")}),e.on("videoFeedbackImpression",function(){r({label:"feedback",action:"impression"})}),e.on("videoFeedbackThumbUp",function(){r({label:"feedback-thumb-up",action:"click"})}),e.on("videoFeedbackThumbDown",function(){r({label:"feedback-thumb-down",action:"click"})}),e.on("videoFeedbackClosed",function(){r({label:"feedback",action:"close"})}),e.on("autoplayToggle",function(e){r({label:"autoplay-"+(e.enabled?"enabled":"disabled")})}),e.on("captionsSelected",function(e){r({label:"language-selected-"+e.selectedLang.toLowerCase()})}),e.on("watermarkClicked",function(e){r({label:"watermark-fandom"})}),e.on("wikiaShareMenuExpanded",function(e){r({label:"share"})}),e.on("socialNetworkClicked",function(e){r({action:"share",label:e.socialNetwork})}),e.on("playerResumedByBrowserTabSwitch",function(){r({action:"view",label:"player-resumed-by-browser-tab-switch"})}),e.on("playerPausedByBrowserTabSwitch",function(){r({action:"view",label:"player-paused-by-browser-tab-switch"})})}function y(e,t,i,n){function a(e){u!==e&&(u=e,"function"==typeof i.setCustomDimension&&i.setCustomDimension(g,e?m:w))}function s(e){"interaction"===e.pauseReason&&(h=!0)}function o(){h&&a(!0)}function r(){a(!0)}function l(){a(!0),p=!0}function c(){u&&p&&a(!1)}function d(){a(!0)}var u=null,p=!1,h=!1,g=39,m="user-intended",w="not-user-intended";t.once("ready",function(){t.on("mute",function(){t.getMute()?c():l()}),t.on("pause",s),t.on("play",o),t.on("fullscreen",r),t.on("relatedVideoPlay",function(e){e.auto||d()}),a(!n||!!e)})}function v(e,t,i){this.player=e,this.container=i,this.config=t,this.watermarkElement=this.getWatermarkElement(),this.watermarkElement.addEventListener("click",function(){e.trigger("watermarkClicked")}),this.container.classList.add("wikia-watermark-container"),this.container.appendChild(this.watermarkElement),this.isEnabled=!!this.player.getPlaylistItem(0).watermark,this.player.on("play",this.update.bind(this)),this.player.on("pause",this.update.bind(this)),this.player.on("idle",this.update.bind(this)),this.player.on("relatedVideoPlay",this.onVideoChange.bind(this))}function f(e,t,i){this.player=e,this.container=i,this.wikiaSharingElement=document.createElement("div"),this.buttonID="wikiaSharing",this.config=t,this.documentClickHandler=this.documentClickHandler.bind(this),this.isDocumentHandlerMounted=!1,this.container.classList.add("wikia-jw__plugin"),this.wikiaSharingElement.classList.add("wikia-jw"),this.wikiaSharingElement.classList.add("wikia-jw-sharing"),this.addSharingContent(this.wikiaSharingElement),this.container.appendChild(this.wikiaSharingElement)}var k={de:{admessage:"Die Werbung endet in xx Sekunden",autoplayVideos:"Automatische Wiedergabe",back:"Zurück",captions:"Untertitel",close:"Schließen",cuetext:"Werbung",fullscreen:"Vollbild",next:"Nächstes",nextUp:"Als nächstes",nextUpInSeconds:"Als nächstes in xx Sekunden",pause:"Pause",play:"Abspielen",playback:"Wiedergabe starten",player:"Video-Player",prev:"Vorheriges",replay:"Erneut abspielen",settings:"Einstellungen",skipmessage:"Werbung überspringen in xx Sekunden",skiptext:"Überspringen",videoQuality:"Video-Qualität",volume:"Lautstärke",watch:"ansehen"},en:{admessage:"The ad will end in xx seconds",autoplayVideos:"Autoplay Videos",back:"Back",captions:"Captions",close:"Close",cuetext:"Advertisement",fullscreen:"Fullscreen",next:"Next",nextUp:"Next Up",nextUpInSeconds:"Next up in xx",pause:"Pause",play:"Play",playback:"Start playback",player:"Video Player",prev:"Previous",replay:"Replay",settings:"Settings",skipmessage:"Skip ad in xx",sharing:"Sharing",skiptext:"Skip",videoQuality:"Video Quality",volume:"Volume",watch:"watch"},es:{admessage:"El anuncio termina en xx segundos",autoplayVideos:"Videos autoreproducidos",back:"Atrás",captions:"Subtítulos",close:"Cerrar",cuetext:"Anuncio",fullscreen:"Pantalla completa",next:"Siguiente",nextUp:"Siguiente",nextUpInSeconds:"Siguiente en xx",pause:"Pausa",play:"Play",playback:"Iniciar la reproducción",player:"Reproductor de video",prev:"Anterior",replay:"Replay",settings:"Configuración",sharing:"Sharing",skipmessage:"Pasar anuncio en xx",skiptext:"Pasar",videoQuality:"Calidad de video",volume:"Volumen",watch:"mirar"},fr:{admessage:"Fin de la publicité dans xx secondes",autoplayVideos:"Lecture automatique des vidéos",back:"Retour",captions:"Sous-titres",close:"Fermer",cuetext:"Publicité",fullscreen:"Plein écran",next:"Suivante",nextUp:"À suivre",nextUpInSeconds:"À suivre dans xx",pause:"Pause",play:"Lecture",playback:"Démarrer la lecture",player:"Lecteur vidéo",prev:"Précédente",replay:"Revoir",settings:"Paramètres",sharing:"Sharing",skipmessage:"Ignorer la publicité dans xx",skiptext:"Ignorer",videoQuality:"Qualité vidéo",volume:"Volume",watch:"regarder"},it:{admessage:"L'annuncio terminerà in xx secondi",autoplayVideos:"Riproduzione automatica",back:"Indietro",captions:"Didascalie",close:"Chiudi",cuetext:"Pubblicità",fullscreen:"Schermo intero",next:"Successivo",nextUp:"Prossimo",nextUpInSeconds:"Prossimo in xx",pause:"Pausa",play:"Riproduci",playback:"Avvia la riproduzione",player:"Lettore video",prev:"Precedente",replay:"Replay",settings:"Impostazioni",sharing:"Sharing",skipmessage:"Salta annuncio in xx",skiptext:"Salta",videoQuality:"Qualità video",volume:"Volume",watch:"guarda"},ja:{admessage:"広告はxx秒後に終了します",autoplayVideos:"動画を自動再生",back:"戻る",captions:"字幕",close:"閉じる",cuetext:"広告",fullscreen:"全画面",next:"次へ",nextUp:"次の動画",nextUpInSeconds:"次の動画まであとxx秒",pause:"一時停止",play:"再生",playback:"再生をスタート",player:"動画プレーヤー",prev:"前へ",replay:"もう一回見る",settings:"設定",sharing:"Sharing",skipmessage:"xx秒後に広告をスキップ",skiptext:"スキップ",videoQuality:"動画の品質",volume:"音量",watch:"再生時間"},pl:{admessage:"Reklama skończy się za xx sek.",autoplayVideos:"Odtwarzaj automatycznie",back:"Wstecz",captions:"Napisy",close:"Zamknij",cuetext:"Reklama",fullscreen:"Pełny ekran",next:"Następny",nextUp:"Następny",nextUpInSeconds:"Następny za xx",pause:"Wstrzymaj",play:"Odtwarzaj",playback:"Rozpocznij odtwarzanie",player:"Odtwarzacz wideo",prev:"Poprzedni",replay:"Odtwarzaj ponownie",settings:"Ustawienia",sharing:"Sharing",skipmessage:"Pomiń reklamę za xx",skiptext:"Pomiń",videoQuality:"Jakość obrazu",volume:"Głośność",watch:"obejrzyj"},pt:{admessage:"O anúncio vai acabar em xx segundos",autoplayVideos:"Vídeos AutoPlay",back:"Voltar",captions:"Legendas",close:"Fechar",cuetext:"Anúncio",fullscreen:"Tela cheia",next:"Próximo",nextUp:"Próximo",nextUpInSeconds:"Próximo em xx",pause:"Pausa",play:"Tocar",playback:"Iniciar a reprodução",player:"Player de vídeo",prev:"Anterior",replay:"Repetição",settings:"Configurações",sharing:"Sharing",skipmessage:"Pular anúncio em xx",skiptext:"Pular",videoQuality:"Qualidade de vídeo",volume:"Volume",watch:"assistir"},ru:{admessage:"Реклама закончится через xx секунд(ы)",autoplayVideos:"Автовоспроизведение",back:"Назад",captions:"Описания",close:"Закрыть",cuetext:"Реклама",fullscreen:"Во весь экран",next:"Далее",nextUp:"Следующее",nextUpInSeconds:"Следующее видео через xx сек.",pause:"Пауза",play:"Воспроизвести",playback:"Начать",player:"Видеоплеер",prev:"Предыдущее",replay:"Повторить",settings:"Настройки",sharing:"Sharing",skipmessage:"Пропустить рекламу через xx",skiptext:"Пропустить",videoQuality:"Качество видео",volume:"Громкость",watch:"длительность"},zh:{admessage:"广告将在xx秒结束",autoplayVideos:"自动播放视频",back:"返回",captions:"标题",close:"关闭",cuetext:"广告",fullscreen:"全屏",next:"下一个",nextUp:"即将播放",nextUpInSeconds:"等待xx秒即将播放",pause:"暂停",play:"播放",playback:"重新播放",player:"视频播放器",prev:"上一个",replay:"重播",settings:"设置",sharing:"Sharing",skipmessage:"等待xx秒跳过广告",skiptext:"跳过",videoQuality:"视频质量",volume:"音量",watch:"观看"},"zh-hant":{admessage:"廣告將在xx秒後結束",autoplayVideos:"自動播放影片",back:"返回",captions:"標題",close:"關閉",cuetext:"廣告",fullscreen:"全螢幕",next:"下一個",nextUp:"即將播放",nextUpInSeconds:"等待xx秒即將播放",pause:"暫停",play:"播放",playback:"重新播放",player:"影片播放器",prev:"上一個",replay:"重新播放",settings:"設置",sharing:"Sharing",skipmessage:"在xx中跳過廣告",skiptext:"跳過",videoQuality:"影片品質",volume:"音量",watch:"觀看"}},b={displayPlay:'',play:'',pause:'',fullScreenOn:'',fullScreenOff:'',settings:'',volumeOff:'',volumeOn:'',back:'',quality:'',fandomLogo:'',sharing:'',facebook:'',twitter:'',tumblr:'',reddit:'',line:'',wykop:'',nk:'',meneame:'',odnoklassniki:'',vkontakte:'',google:'',weibo:''};window.wikiaJWPlayerIdleScreen=c;var x=[];window.wikiaJWPlayer=function(e,t,i){function n(e,i){var n=document.createElement("script"),a=document.getElementById(e);n.onload=function(){p.register(),t.sharing&&f.register(),t.showSmallPlayerControls&&h.register(),x.forEach(function(e){e()})},n.async=!0,n.src=i||"https://content.jwplatform.com/libraries/VXc5h4Tf.js",a.parentNode.insertBefore(n,a.nextSibling)}function a(e,t,i,n,a){var s=jwplayer(e),o=t.videoDetails.playlist[0].mediaid,r=t.autoplay,l=n.substr(0,2),c={advertising:{autoplayadsmuted:r,client:"googima",vpaidcontrols:!0,admessage:a.admessage,cuetext:a.cuetext,skipmessage:a.skipmessage,skiptext:a.skiptext,setLocale:l},autostart:r&&!document.hidden,description:t.videoDetails.description,image:"//content.jwplatform.com/thumbs/"+o+"-640.jpg",mute:t.mute,playlist:t.videoDetails.playlist,title:t.videoDetails.title,localization:a,repeat:t.repeat};return c.plugins={},t.settings&&(c.plugins.wikiaSettings={showAutoplayToggle:t.settings.showAutoplayToggle,showQuality:t.settings.showQuality,showCaptions:t.settings.showCaptions,autoplay:t.autoplay,selectedCaptionsLanguage:t.selectedCaptionsLanguage,i18n:a}),t.sharing&&(c.plugins.wikiaSharing={i18n:a}),t.related&&(c.related={autoplaytimer:t.related.time||3,file:"//cdn.jwplayer.com/v2/playlists/"+t.related.playlistId+"?related_media_id="+o,oncomplete:t.related.autoplay?"autoplay":"show",autoplaymessage:a.nextUpInSeconds}),!1!==t.watermark&&(c.plugins.wikiaWatermark={}),t.showSmallPlayerControls&&(c.plugins.smallPlayerControls={}),i.info("setupPlayer"),s.setup(c),i.info("after setup"),i.subscribeToPlayerErrors(s),s}!function(e,t,i){"undefined"!=typeof jwplayer?i():(x.push(i),1===x.length&&n(e,t))}(e,t.playerURL,function(){var n=d(t),s=t.lang||"en",o=k[s]||k.en,p=a(e,t,n,s,o);c(p,o),u(p),l(p,t.autoplay,n),t.related&&g(p),t.tracking&&(t.tracking.pixel=t.videoDetails.playlist[0].pixel,w(p,t.autoplay,t.tracking)),m(p,t.autoplay),r(p),y(t.shouldForceUserIntendedPlay,p,t.tracking,t.autoplay),!1!==t.watermark&&v.register(),i&&i(p)})};var L=new DOMParser;p.prototype.isSettingsMenuOrSettingsButton=function(e){var t=this.getSettingsButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSettingsElement===e||this.wikiaSettingsElement.contains(e))},p.prototype.getSettingsButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},p.prototype.documentClickHandler=function(e){!this.isSettingsMenuOrSettingsButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},p.prototype.addButton=function(){var e=a(b.settings);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-settings"),this.player.addButton(e.outerHTML,this.config.i18n.settings,function(e){this.wikiaSettingsElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},p.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},p.prototype.close=function(){var e=this.player.getContainer();this.showSettingsList(),this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},p.prototype.open=function(e){s(this.container),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},p.prototype.hide=function(){this.close(),this.removeButton()},p.prototype.show=function(){this.getSettingsButtonElement()||this.addButton()},p.prototype.showSettingsList=function(){s(this.settingsList),o(this.qualityLevelsList),o(this.captionsList)},p.prototype.addSettingsContent=function(e){return e.classList.add("wikia-jw"),e.classList.add("wikia-jw-settings"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.settingsList=this.createSettingsListElement(),e.appendChild(this.settingsList),this.config.showQuality&&(this.createQualityLevelsList(),e.appendChild(this.qualityLevelsList)),this.config.showCaptions&&(this.createCaptionsList(),e.appendChild(this.captionsList)),e},p.prototype.createSettingsListElement=function(){var e=document.createElement("ul");return e.className="wikia-jw__list wds-list",this.config.showQuality&&e.appendChild(this.createQualityButton()),this.config.showCaptions&&e.appendChild(this.createCaptionsButton()),this.config.showAutoplayToggle&&(e.appendChild(this.createAutoplayToggle()),this.show()),e},p.prototype.createSubmenuWrapper=function(){var e=document.createElement("li"),t=document.createElement("ul");return e.className="wikia-jw-settings__back",e.innerHTML=i("left").outerHTML+" "+this.config.i18n.back,e.addEventListener("click",this.showSettingsList.bind(this)),t.className="wikia-jw-settings__submenu wds-list",t.appendChild(e),t},p.prototype.createAutoplayToggle=function(){var e=t({id:this.player.getContainer().id+"-videoAutoplayToggle",label:this.config.i18n.autoplayVideos,checked:this.config.autoplay});return e.querySelector("label").addEventListener("click",function(e){this.player.trigger("autoplayToggle",{enabled:!e.target.previousSibling.checked})}.bind(this)),e},p.prototype.createQualityButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__quality-button",e.innerHTML=this.config.i18n.videoQuality+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.qualityLevelsList)}.bind(this)),e},p.prototype.createQualityLevelsList=function(){this.qualityLevelsList=this.createSubmenuWrapper(),this.player.on("levelsChanged",this.updateCurrentQuality.bind(this))},p.prototype.onQualityLevelsChange=function(e){var t=!e.levels.length||1===e.levels.length&&"0"===e.levels[0].label,i=!t&&this.config.showQuality||this.config.showAutoplayToggle;t?this.wikiaSettingsElement.classList.add("is-quality-list-empty"):this.wikiaSettingsElement.classList.remove("is-quality-list-empty"),i&&this.show(),this.qualityLevelsList&&this.updateQualityLevelsList(e.levels)},p.prototype.updateQualityLevelsList=function(e){n(this.qualityLevelsList),e.forEach(function(e,t){var i=document.createElement("li");i.addEventListener("click",function(){this.player.setCurrentQuality(t),this.close()}.bind(this)),this.player.getCurrentQuality()===t&&i.classList.add("is-active"),i.appendChild(document.createTextNode(e.label)),this.qualityLevelsList.insertBefore(i,this.qualityLevelsList.lastElementChild)},this)},p.prototype.updateCurrentQuality=function(e){for(var t=0;t1?(e.forEach(this.createCaptionsListItem,this),this.wikiaSettingsElement.classList.remove("are-captions-empty"),this.show(),!1!==this.config.selectedCaptionsLanguage&&-1!==t?this.player.setCurrentCaptions(t):this.player.setCurrentCaptions(0)):this.wikiaSettingsElement.classList.add("are-captions-empty")},p.prototype.createCaptionsList=function(){this.captionsList=this.createSubmenuWrapper(),this.player.on("captionsChanged",this.updateCurrentCaptions.bind(this))},p.prototype.createCaptionsListItem=function(e,t){var i=document.createElement("li"),n="Off"===e.label?"No captions":e.label;i.dataset.track=t,i.addEventListener("click",function(){this.player.setCurrentCaptions(t),this.close(),this.player.trigger("captionsSelected",{selectedLang:e.label})}.bind(this)),i.appendChild(document.createTextNode(n)),this.captionsList.insertBefore(i,this.captionsList.firstElementChild)},p.prototype.createCaptionsButton=function(){var e=document.createElement("li");return e.className="wikia-jw-settings__captions-button",e.innerHTML=this.config.i18n.captions+i("right").outerHTML,e.addEventListener("click",function(){o(this.settingsList),s(this.captionsList)}.bind(this)),e},p.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},p.prototype.getSuitableCaptionsIndex=function(e,t){return t.map(function(e){return e.label}).indexOf(e)},p.prototype.updateCurrentCaptions=function(e){for(var t=0;t250&&this.player.getContainer().classList.remove("wikia-jw-small-player-controls")},h.register=function(){jwplayer().registerPlugin("smallPlayerControls","8.0.0",h)},window.wikiaJWPlayerUserIntendedPlayControl=y,v.prototype.getWatermarkElement=function(){var e=b.fandomLogo,t=document.createElement("a");return t.classList.add("wikia-watermark"),t.innerHTML=e,t.href="https://fandom.com",t},v.prototype.update=function(){this.isEnabled&&"playing"===this.player.getState()?this.container.style.display="block":this.container.style.display=""},v.prototype.onVideoChange=function(e){this.isEnabled=!!e.item.watermark,this.update()},v.register=function(){jwplayer().registerPlugin("wikiaWatermark","8.0.0",v)},f.prototype.isSharingMenuOrSharingButton=function(e){var t=this.getSharingButtonElement();return t&&(t===e||t.contains(e)||this.wikiaSharingElement===e||this.wikiaSharingElement.contains(e))},f.prototype.getSharingButtonElement=function(){return this.player.getContainer().querySelector("[button="+this.buttonID+"]")},f.prototype.documentClickHandler=function(e){!this.isSharingMenuOrSharingButton(e.target)&&this.container.style.display&&this.isDocumentHandlerMounted&&(document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!1,this.close())},f.prototype.addButton=function(){var e=a(b.sharing);e.classList.add("jw-svg-icon"),e.classList.add("jw-svg-icon-wikia-sharing"),this.player.addButton(e.outerHTML,this.config.i18n.sharing,function(e){this.wikiaSharingElement.style.display||(this.open(e.currentTarget),setTimeout(function(){this.isDocumentHandlerMounted||(document.addEventListener("click",this.documentClickHandler),document.addEventListener("touchend",this.documentClickHandler),this.isDocumentHandlerMounted=!0)}.bind(this),0))}.bind(this),this.buttonID,"wikia-jw-button")},f.prototype.removeButton=function(){this.player.removeButton(this.buttonID)},f.prototype.close=function(){var e=this.player.getContainer();this.container.style.display=null,e.classList.remove("wikia-jw-open"),e.querySelector(".wikia-jw-button__open").classList.remove("wikia-jw-button__open")},f.prototype.open=function(e){this.wikiaSharingElement.innerHTML="",this.wikiaSharingElement.appendChild(this.createSharingListElement()),s(this.container),this.player.trigger("wikiaShareMenuExpanded"),this.player.getContainer().classList.add("wikia-jw-open"),e.classList.add("wikia-jw-button__open")},f.prototype.hide=function(){this.close(),this.removeButton()},f.prototype.show=function(){this.getSharingButtonElement()||this.addButton()},f.prototype.addSharingContent=function(e){e.classList.add("wikia-jw"),e.classList.add("wikia-jw-sharing"),e.classList.remove("jw-reset"),e.classList.remove("jw-plugin"),this.show()},f.prototype.createSharingListElement=function(){var e=document.createElement("ul");e.className="wikia-jw__list wds-list";var t=this.getUserLang(),i=this.socialNetworks[t];return i&&i.forEach(function(t){e.appendChild(this.getSocialNetworkButton(t))}.bind(this)),e},f.prototype.getSocialNetworkButton=function(e){var t=document.createElement("button");return t.className="wds-is-square wds-is-"+e+"-color wds-button",t.appendChild(a(b[e])),t.addEventListener("click",function(){this.player.trigger("socialNetworkClicked",{socialNetwork:e}),window.open(this[e]())}.bind(this)),t},f.prototype.getUserLang=function(){return(window.navigator.userLanguage||window.navigator.language).slice(0,2)},f.prototype.socialNetworks={en:["facebook","twitter","reddit","tumblr"],ja:["facebook","twitter","google","line"],"pt-br":["facebook","twitter","reddit","tumblr"],zh:["facebook","weibo"],de:["facebook","twitter","tumblr"],fr:["facebook","twitter"],es:["facebook","twitter","meneame","tumblr"],ru:["vkontakte","facebook","odnoklassniki","twitter"],pl:["facebook","twitter","nk","wykop"]},f.prototype.getVideoPageUrl=function(){return console.log(this.player.getPlaylistItem()),"https://fandom.wikia.com/video/"+this.player.getPlaylistItem().mediaid},f.prototype.getVideoTitle=function(){return this.player.getPlaylistItem().title},f.prototype.line=function(){return"http://line.me/R/msg/text/?"+encodeURIComponent(this.getVideoTitle()+" "+this.getVideoPageUrl())},f.prototype.facebook=function(){return"http://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.twitter=function(){return"https://twitter.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.google=function(){return"https://plus.google.com/share?url="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.reddit=function(){return"http://www.reddit.com/submit?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.tumblr=function(){return"http://www.tumblr.com/share/link?url="+encodeURIComponent(this.getVideoPageUrl())+"&name="+encodeURIComponent(this.getVideoTitle())},f.prototype.weibo=function(){return"http://service.weibo.com/share/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.vkontakte=function(){return"http://vk.com/share.php?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.odnoklassniki=function(){return"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.nk=function(){return"http://nk.pl/sledzik?shout="+encodeURIComponent(this.getVideoPageUrl())},f.prototype.wykop=function(){return"http://www.wykop.pl/dodaj/link/?url="+encodeURIComponent(this.getVideoPageUrl())+"&title="+encodeURIComponent(this.getVideoTitle())},f.prototype.meneame=function(){return"https://www.meneame.net/submit.php?url="+encodeURIComponent(this.getVideoPageUrl())},f.register=function(){jwplayer().registerPlugin("wikiaSharing","8.0.0",f)}}("undefined"==typeof wikiaJWPlayer?wikiaJWPlayer={}:wikiaJWPlayer); \ No newline at end of file diff --git a/src/user-intended-play-control.js b/src/user-intended-play-control.js index 6f236b46..7c272034 100644 --- a/src/user-intended-play-control.js +++ b/src/user-intended-play-control.js @@ -6,7 +6,7 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe var customDimensionValueWhenIntended = 'user-intended'; var customDimensionValueWhenNotIntended = 'not-user-intended'; - function setUserIntendedPlay(isUserIntended, immediate) { + function setUserIntendedPlay(isUserIntended) { if (isUserIntendedPlay === isUserIntended) { return; } @@ -17,18 +17,9 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe return; } - if (immediate) { - tracker.setCustomDimension( - customDimensionNumber, isUserIntended ?customDimensionValueWhenIntended : customDimensionValueWhenNotIntended - ); - } else { - // Related video impression happens just before the potential subsequent video play - playerInstance.on('relatedVideoImpression', function () { - tracker.setCustomDimension( - customDimensionNumber, isUserIntended ? customDimensionValueWhenIntended : customDimensionValueWhenNotIntended - ); - }); - } + tracker.setCustomDimension( + customDimensionNumber, isUserIntended ?customDimensionValueWhenIntended : customDimensionValueWhenNotIntended + ); } function onPause(data) { @@ -59,7 +50,7 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe } function onVideoThumbnailInsidePlayerClicked() { - setUserIntendedPlay(true, true); + setUserIntendedPlay(true); } function init() { @@ -82,11 +73,11 @@ function wikiaJWPlayerUserIntendedPlayControl(isInitiallyUserIntendedPlay, playe }); if (!willAutoplay) { - setUserIntendedPlay(true, true); + setUserIntendedPlay(true); } else if (isInitiallyUserIntendedPlay) { - setUserIntendedPlay(true, true); + setUserIntendedPlay(true); } else { - setUserIntendedPlay(false, true); + setUserIntendedPlay(false); } }