jellyfin-web/dashboard-ui/themes/halloween/theme.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-10-12 23:31:20 -07:00
(function () {
Dashboard.importCss('themes/halloween/style.css');
2015-10-14 10:52:49 -07:00
var lastSound = 0;
2015-10-12 23:31:20 -07:00
function onPageShow() {
var page = this;
2015-10-13 19:41:46 -07:00
if (!$.browser.mobile && !page.classList.contains('itemDetailPage')) {
2015-10-12 23:31:20 -07:00
Backdrops.setBackdropUrl(page, 'themes/halloween/bg.jpg');
}
2015-10-14 10:52:49 -07:00
if (lastSound == 0) {
playSound('http://github.com/MediaBrowser/Emby.Resources/raw/master/themes/halloween/monsterparade.mp3', .2);
} else if ((new Date().getTime() - lastSound) > 30000) {
playSound('http://github.com/MediaBrowser/Emby.Resources/raw/master/themes/halloween/howl.wav');
}
2015-10-12 23:31:20 -07:00
}
pageClassOn('pageshow', "libraryPage", onPageShow);
if ($($.mobile.activePage)[0].classList.contains('libraryPage')) {
onPageShow.call($($.mobile.activePage)[0]);
}
2015-10-14 10:52:49 -07:00
function playSound(path, volume) {
require(['howler'], function (howler) {
var sound = new Howl({
urls: [path],
volume: volume || .3
});
sound.play();
lastSound = new Date().getTime();
});
}
2015-10-12 23:31:20 -07:00
})();