define(["appSettings","backdrop","browser","globalize","require","events","paper-icon-button-light"],function(appSettings,backdrop,browser,globalize,require,events){"use strict";function onPageShow(){if(!browser.mobile){if("off"==getHolidayTheme())return;var page=this;require(["css!./style.css"]),page.classList.contains("itemDetailPage")||setBackdrop(page),playThemeMusic(),addSnowflakes(),addIcon(),setBodyClass()}}function playThemeMusic(){"off"!=getHolidayTheme()&&(0==lastSound?playSound("https://github.com/MediaBrowser/Emby.Resources/raw/master/themes/holiday/christmas.wav",.1):(new Date).getTime()-lastSound>3e4&&playSound("https://github.com/MediaBrowser/Emby.Resources/raw/master/themes/holiday/sleighbells.wav",.25))}function destroyTheme(){document.documentElement.classList.remove("christmas"),stopSnowflakes(),currentSound&¤tSound.stop();var holidayInfoButton=document.querySelector(".holidayInfoButton");holidayInfoButton&&holidayInfoButton.parentNode.removeChild(holidayInfoButton),backdrop.clear(),window.location.reload(!0)}function addSnowflakes(){snowFlakesInitialized||(snowFlakesInitialized=!0,document.body.insertAdjacentHTML("beforeend",'

*

'),generateSnowflakes(),events.on(MediaController,"beforeplaybackstart",onPlaybackStart))}function onPlaybackStart(){currentSound&¤tSound.stop(),stopSnowflakes()}function setBackdrop(page){page.classList.contains("itemDetailPage")||("christmas"==getHolidayTheme()?backdrop.setBackdrop("https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/themes/holiday/bgc.jpg"):backdrop.setBackdrop("https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/themes/holiday/bg.jpg"))}function getHolidayTheme(){return appSettings.get(holidayThemeKey)}function setHolidayTheme(value){appSettings.set(holidayThemeKey,value),setBodyClass(),playThemeMusic()}function setBodyClass(){"christmas"==getHolidayTheme()?document.documentElement.classList.add("christmas"):document.documentElement.classList.remove("christmas")}function onIconClick(e){var items=[],current=getHolidayTheme();items.push({name:"None",id:"none",ironIcon:"off"==current?"check":null}),items.push({name:"Joy!",id:"joy",ironIcon:"off"!=current&&"christmas"!=current?"check":null}),items.push({name:"Christmas",id:"christmas",ironIcon:"christmas"==current?"check":null}),require(["actionsheet"],function(actionsheet){actionsheet.show({title:"Happy holidays from the Emby team! Select your holiday theme:",items:items,callback:function(id){switch(id){case"none":setHolidayTheme("off"),destroyTheme();break;case"joy":setHolidayTheme(""),setBackdrop($.mobile.activePage);break;case"christmas":setHolidayTheme("christmas"),setBackdrop($.mobile.activePage)}}})})}function addIcon(){if(!iconCreated){iconCreated=!0;var viewMenuSecondary=document.querySelector(".viewMenuSecondary");if(viewMenuSecondary){var html='';viewMenuSecondary.insertAdjacentHTML("afterbegin",html),viewMenuSecondary.querySelector(".holidayInfoButton").addEventListener("click",onIconClick)}}}function playSound(path,volume){require(["howler"],function(howler){var sound=new Howl({urls:[path],volume:volume||.3});sound.play(),currentSound=sound,lastSound=(new Date).getTime()})}var iconCreated,currentSound,snowFlakesInitialized,lastSound=0,holidayThemeKey="holidaytheme9";pageClassOn("pageshow","libraryPage",onPageShow)}),function(){function setup(){window.addEventListener("resize",setResetFlag,!1)}function getSupportedPropertyName(properties){for(var i=0;ibrowserHeight&&(this.yPos=-50)};var stopped=!1;window.generateSnowflakes=generateSnowflakes,window.stopSnowflakes=function(){stopped=!0;for(var elems=document.querySelectorAll(".snowflake"),i=0,length=elems.length;i