1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

extract more scripts

This commit is contained in:
Luke Pulverenti 2015-06-09 01:56:46 -04:00
parent f64e0c7c53
commit d84e09e501
24 changed files with 238 additions and 90 deletions

View file

@ -4,7 +4,7 @@
<title>${TitleAutoOrganize}</title> <title>${TitleAutoOrganize}</title>
</head> </head>
<body> <body>
<div id="libraryFileOrganizerLogPage" data-role="page" class="page type-interior organizePage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Auto-Organize" data-require="scripts/autoorganizelog"> <div id="libraryFileOrganizerLogPage" data-role="page" class="page type-interior organizePage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Auto-Organize" data-require="scripts/autoorganizelog,scripts/taskbutton">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="editCollectionTitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}"> <div id="editCollectionTitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editcollectionitems">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar"> <div class="editPageSidebar">
<div class="libraryTree"> <div class="libraryTree">
@ -68,10 +68,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.collectionItemSearchForm').off('submit', EditCollectionItemsPage.onSearchFormSubmit).on('submit', EditCollectionItemsPage.onSearchFormSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitleMediaLibrary}</title> <title>${TitleMediaLibrary}</title>
</head> </head>
<body> <body>
<div id="mediaLibraryPage" data-role="page" class="page type-interior mediaLibraryPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Library%20setup" data-require="scripts/medialibrarypage"> <div id="mediaLibraryPage" data-role="page" class="page type-interior mediaLibraryPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Library%20setup" data-require="scripts/medialibrarypage,scripts/taskbutton">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -4,7 +4,7 @@
<title>${TitleLiveTV}</title> <title>${TitleLiveTV}</title>
</head> </head>
<body> <body>
<div id="liveTvStatusPage" data-role="page" class="page type-interior liveTvSettingsPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Live%20TV" data-require="scripts/livetvstatus"> <div id="liveTvStatusPage" data-role="page" class="page type-interior liveTvSettingsPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Live%20TV" data-require="scripts/livetvstatus,scripts/taskbutton">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -155,7 +155,7 @@
<br /> <br />
<div> <div>
<label for="chkEnableChromecastAc3">${LabelEnableChromecastAc3Passthrough}</label> <label for="chkEnableChromecastAc3">${LabelEnableChromecastAc3Passthrough}</label>
<input type="checkbox" id="chkEnableChromecastAc3" /> <input type="checkbox" id="chkEnableChromecastAc3" data-mini="true" />
</div> </div>
</div> </div>

View file

@ -4,7 +4,7 @@
<title>${TitleSync}</title> <title>${TitleSync}</title>
</head> </head>
<body> <body>
<div id="mySyncActivityPage" data-role="page" class="page libraryPage syncActivityPage mySyncPage" data-contextname="${TitleSync}"> <div id="mySyncActivityPage" data-role="page" class="page libraryPage syncActivityPage mySyncPage" data-contextname="${TitleSync}" data-require="scripts/syncactivity,scripts/taskbutton">
<div class="libraryViewNav"> <div class="libraryViewNav">
<a href="#" class="ui-btn-active">${TabSyncJobs}</a> <a href="#" class="ui-btn-active">${TabSyncJobs}</a>
@ -13,7 +13,7 @@
<div data-role="content"> <div data-role="content">
<div class="ehsContent"> <div class="ehsContent">
<br/> <br />
<div class="syncActivity"> <div class="syncActivity">
</div> </div>

View file

@ -4,7 +4,7 @@
<title>${TitleSync}</title> <title>${TitleSync}</title>
</head> </head>
<body> <body>
<div id="mySyncJobPage" data-role="page" class="page libraryPage syncJobPage mySyncPage" data-contextname="${TitleSync}"> <div id="mySyncJobPage" data-role="page" class="page libraryPage syncJobPage mySyncPage" data-contextname="${TitleSync}" data-require="scripts/syncjob">
<div class="libraryViewNav"> <div class="libraryViewNav">
<a href="mysync.html" class="ui-btn-active">${TabSyncJobs}</a> <a href="mysync.html" class="ui-btn-active">${TabSyncJobs}</a>
@ -20,9 +20,6 @@
<div class="jobItems"></div> <div class="jobItems"></div>
</div> </div>
</div> </div>
<script type="text/javascript">
$('.syncJobForm').off('submit', SyncJobPage.onSubmit).on('submit', SyncJobPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="nowPlayingPage" data-role="page" class="page libraryPage nowPlayingPage" data-contextname="${TitleRemoteControl}" data-theme="b"> <div id="nowPlayingPage" data-role="page" class="page libraryPage nowPlayingPage" data-contextname="${TitleRemoteControl}" data-theme="b" data-require="scripts/nowplayingpage">
<div class="libraryViewNav"> <div class="libraryViewNav">
<a href="#" class="ui-btn-active tabButton" data-tab="tabNowPlaying">${TabNowPlaying}</a> <a href="#" class="ui-btn-active tabButton" data-tab="tabNowPlaying">${TabNowPlaying}</a>
@ -149,11 +149,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.sendMessageForm').off('submit', NowPlayingPage.onMessageSubmit).on('submit', NowPlayingPage.onMessageSubmit);
$('.typeTextForm').off('submit', NowPlayingPage.onSendStringSubmit).on('submit', NowPlayingPage.onSendStringSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -743,12 +743,18 @@
self.volumeDown = function () { self.volumeDown = function () {
self.setVolume(getCurrentVolume() - 2); castPlayer.sendMessage({
options: {},
command: 'VolumeDown'
});
}; };
self.volumeUp = function () { self.volumeUp = function () {
self.setVolume(getCurrentVolume() + 2); castPlayer.sendMessage({
options: {},
command: 'VolumeUp'
});
}; };
self.setVolume = function (vol) { self.setVolume = function (vol) {

View file

@ -1377,7 +1377,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on('
var apiClient = ApiClient; var apiClient = ApiClient;
if (apiClient) { if (apiClient && !AppInfo.isNativeApp) {
showWelcomeIfNeeded(page, apiClient); showWelcomeIfNeeded(page, apiClient);
} }

View file

@ -230,7 +230,14 @@
}); });
} }
$(document).on('pageinit', "#editCollectionTitlesPage", function () { function onSearchFormSubmit() {
var page = $(this).parents('.page');
showSearchResults(page, $('#txtLookupName', page).val());
return false;
}
$(document).on('pageinitdepends', "#editCollectionTitlesPage", function () {
var page = this; var page = this;
@ -270,8 +277,9 @@
removeItemsFromCollection(page); removeItemsFromCollection(page);
}); });
$('.collectionItemSearchForm').off('submit', onSearchFormSubmit).on('submit', onSearchFormSubmit);
}).on('pagebeforeshow', "#editCollectionTitlesPage", function () { }).on('pagebeforeshowready', "#editCollectionTitlesPage", function () {
var page = this; var page = this;
@ -290,15 +298,4 @@
$("body").off("popupafteropen.collections"); $("body").off("popupafteropen.collections");
}); });
window.EditCollectionItemsPage = {
onSearchFormSubmit: function () {
var page = $(this).parents('.page');
showSearchResults(page, $('#txtLookupName', page).val());
return false;
}
};
})(jQuery, document, window, window.FileReader, escape); })(jQuery, document, window, window.FileReader, escape);

View file

@ -396,7 +396,7 @@
updateEditorNode(this, item); updateEditorNode(this, item);
}).on('pagebeforeshow', ".metadataEditorPage", function () { }).on('pagebeforeshowready', ".metadataEditorPage", function () {
window.MetadataEditor = new metadataEditor(); window.MetadataEditor = new metadataEditor();

View file

@ -714,13 +714,16 @@
return null; return null;
}; };
$(document).on('pageinit', "#nowPlayingPage", function () { $(document).on('pageinitdepends', "#nowPlayingPage", function () {
var page = this; var page = this;
bindEvents(page); bindEvents(page);
}).on('pageshow', "#nowPlayingPage", function () { $('.sendMessageForm').off('submit', NowPlayingPage.onMessageSubmit).on('submit', NowPlayingPage.onMessageSubmit);
$('.typeTextForm').off('submit', NowPlayingPage.onSendStringSubmit).on('submit', NowPlayingPage.onSendStringSubmit);
}).on('pageshowready', "#nowPlayingPage", function () {
var page = this; var page = this;

View file

@ -230,8 +230,7 @@
{ {
complete: function () { complete: function () {
$('.viewMenuSearch').addClass('hide'); $('.viewMenuSearch').addClass('hide');
}, }
duration: 'fast'
}); });
}); });
} }

View file

@ -1822,13 +1822,13 @@ var AppInfo = {};
return false; return false;
}); });
require(['filesystem']);
if (Dashboard.isRunningInCordova()) { if (Dashboard.isRunningInCordova()) {
requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices', 'thirdparty/cordova/volume', 'thirdparty/cordova/back']); requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices', 'thirdparty/cordova/volume', 'thirdparty/cordova/back']);
if ($.browser.android) { if ($.browser.android) {
requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/filesystem']); requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/mediasession']);
} else {
requirejs(['thirdparty/cordova/filesystem']);
} }
if ($.browser.safari) { if ($.browser.safari) {
@ -1839,7 +1839,6 @@ var AppInfo = {};
if ($.browser.chrome) { if ($.browser.chrome) {
requirejs(['scripts/chromecast']); requirejs(['scripts/chromecast']);
} }
requirejs(['thirdparty/filesystem']);
} }
} }
@ -1884,6 +1883,16 @@ var AppInfo = {};
define("localassetmanager", ["thirdparty/apiclient/localassetmanager"]); define("localassetmanager", ["thirdparty/apiclient/localassetmanager"]);
} }
if (Dashboard.isRunningInCordova() && $.browser.android) {
define("filesystem", ["thirdparty/cordova/android/filesystem"]);
}
else if (Dashboard.isRunningInCordova()) {
define("filesystem", ["thirdparty/cordova/filesystem"]);
}
else {
define("filesystem", ["thirdparty/filesystem"]);
}
define("connectservice", ["thirdparty/apiclient/connectservice"]); define("connectservice", ["thirdparty/apiclient/connectservice"]);
//requirejs(['http://viblast.com/player/free-version/qy2fdwajo1/viblast.js']); //requirejs(['http://viblast.com/player/free-version/qy2fdwajo1/viblast.js']);

View file

@ -289,7 +289,7 @@
} }
$(document).on('pageshow', ".syncActivityPage", function () { $(document).on('pageshowready', ".syncActivityPage", function () {
var page = this; var page = this;

View file

@ -373,7 +373,21 @@
} }
$(document).on('pageshow', ".syncJobPage", function () { function onSubmit() {
var form = this;
var page = $(form).parents('.page');
saveJob(page);
return false;
}
$(document).on('pageinitdepends', ".syncJobPage", function () {
$('.syncJobForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', ".syncJobPage", function () {
var page = this; var page = this;
loadJob(page); loadJob(page);
@ -389,18 +403,4 @@
$(ApiClient).off(".syncJobPage"); $(ApiClient).off(".syncJobPage");
}); });
window.SyncJobPage = {
onSubmit: function () {
var form = this;
var page = $(form).parents('.page');
saveJob(page);
return false;
}
};
})(); })();

View file

@ -430,26 +430,7 @@
}); });
} }
$(document).on('pageinit', "#userProfilesPage", function () { function onSubmit() {
var page = this;
$('.btnInvite', page).on('click', function () {
showInvitePopup(page);
});
}).on('pagebeforeshow', "#userProfilesPage", function () {
var page = this;
loadData(page);
});
window.UserProfilesPage = {
onSubmit: function () {
var form = this; var form = this;
var page = $(form).parents('.page'); var page = $(form).parents('.page');
@ -458,6 +439,23 @@
return false; return false;
} }
};
$(document).on('pageinitdepends', "#userProfilesPage", function () {
var page = this;
$('.btnInvite', page).on('click', function () {
showInvitePopup(page);
});
$('.addUserForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pagebeforeshowready', "#userProfilesPage", function () {
var page = this;
loadData(page);
});
})(document, window, jQuery); })(document, window, jQuery);

View file

@ -4,7 +4,7 @@
<title>${TitleSync}</title> <title>${TitleSync}</title>
</head> </head>
<body> <body>
<div id="syncActivityPage" data-role="page" class="page type-interior syncConfigurationPage syncActivityPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync"> <div id="syncActivityPage" data-role="page" class="page type-interior syncConfigurationPage syncActivityPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync" data-require="scripts/syncactivity,scripts/taskbutton">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -4,7 +4,7 @@
<title>${TitleSync}</title> <title>${TitleSync}</title>
</head> </head>
<body> <body>
<div id="syncJobPage" data-role="page" class="page type-interior syncConfigurationPage syncJobPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync"> <div id="syncJobPage" data-role="page" class="page type-interior syncConfigurationPage syncJobPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync" data-require="scripts/syncjob">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -23,9 +23,6 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
$('.syncJobForm').off('submit', SyncJobPage.onSubmit).on('submit', SyncJobPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -0,0 +1,148 @@
(function () {
// Reports media playback to the device for lock screen control
var currentPlayer;
var lastPlayerState;
function updatePlayerState(state, eventName) {
if (!state.NowPlayingItem) {
hideMediaControls();
return;
}
// dummy this up
if (eventName == 'init') {
eventName = 'positionchange';
}
lastPlayerState = state;
var playState = state.PlayState || {};
var nameHtml = MediaController.getNowPlayingNameHtml(state.NowPlayingItem) || '';
var parts = nameHtml.split('<br/>');
var artist = parts.length == 1 ? '' : parts[0];
var title = parts[parts.length - 1];
var album = state.NowPlayingItem.Album || '';
var duration = state.NowPlayingItem.RunTimeTicks ? (state.NowPlayingItem.RunTimeTicks / 10000000) : 0;
var position = playState.PositionTicks ? (playState.PositionTicks / 10000000) : 0;
var isPaused = playState.IsPaused || false;
var canSeek = playState.CanSeek || false;
var url = '';
var imgHeight = 200;
var nowPlayingItem = state.NowPlayingItem;
if (nowPlayingItem.PrimaryImageTag) {
url = ApiClient.getScaledImageUrl(nowPlayingItem.PrimaryImageItemId, {
type: "Primary",
height: imgHeight,
tag: nowPlayingItem.PrimaryImageTag
});
} else if (nowPlayingItem.ThumbImageTag) {
url = ApiClient.getScaledImageUrl(nowPlayingItem.ThumbImageItemId, {
type: "Thumb",
height: imgHeight,
tag: nowPlayingItem.ThumbImageTag
});
}
else if (nowPlayingItem.BackdropImageTag) {
url = ApiClient.getScaledImageUrl(nowPlayingItem.BackdropItemId, {
type: "Backdrop",
height: imgHeight,
tag: nowPlayingItem.BackdropImageTag,
index: 0
});
}
MainActivity.updateMediaSession(eventName, title, artist, album, parseInt(duration), parseInt(position), url, canSeek, isPaused);
}
function onStateChanged(e, state) {
updatePlayerState(state, e.type);
}
function onPlaybackStart(e, state) {
console.log('nowplaying event: ' + e.type);
var player = this;
player.beginPlayerUpdates();
onStateChanged.call(player, e, state);
}
function onPlaybackStopped(e, state) {
console.log('nowplaying event: ' + e.type);
var player = this;
player.endPlayerUpdates();
hideMediaControls();
}
function releaseCurrentPlayer() {
if (currentPlayer) {
$(currentPlayer).off('.cordovaremote');
currentPlayer.endPlayerUpdates();
currentPlayer = null;
hideMediaControls();
}
}
function hideMediaControls() {
MainActivity.hideMediaSession();
}
function bindToPlayer(player) {
releaseCurrentPlayer();
currentPlayer = player;
console.log('binding remotecontrols to MediaPlayer');
player.getPlayerState().done(function (state) {
if (state.NowPlayingItem) {
player.beginPlayerUpdates();
}
onStateChanged.call(player, { type: 'init' }, state);
});
$(player).on('playbackstart.cordovaremote', onPlaybackStart)
.on('playbackstop.cordovaremote', onPlaybackStopped)
.on('playstatechange.cordovaremote', onStateChanged)
.on('positionchange.cordovaremote', onStateChanged);
}
Dashboard.ready(function () {
console.log('binding remotecontrols to MediaController');
$(MediaController).on('playerchange', function () {
bindToPlayer(MediaController.getCurrentPlayer());
});
bindToPlayer(MediaController.getCurrentPlayer());
});
})();

View file

@ -371,12 +371,18 @@
self.volumeDown = function () { self.volumeDown = function () {
self.setVolume(getCurrentVolume() - 2); sendMessageToDevice({
options: {},
command: 'VolumeDown'
});
}; };
self.volumeUp = function () { self.volumeUp = function () {
self.setVolume(getCurrentVolume() + 2); sendMessageToDevice({
options: {},
command: 'VolumeUp'
});
}; };
self.setVolume = function (vol) { self.setVolume = function (vol) {

View file

@ -4,7 +4,7 @@
<title>${TitleUsers}</title> <title>${TitleUsers}</title>
</head> </head>
<body> <body>
<div id="userProfilesPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users"> <div id="userProfilesPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/userprofilespage">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -84,9 +84,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.addUserForm').off('submit', UserProfilesPage.onSubmit).on('submit', UserProfilesPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="wizardLibraryPage" data-role="page" class="page standalonePage wizardPage mediaLibraryPage" data-require="scripts/medialibrarypage"> <div id="wizardLibraryPage" data-role="page" class="page standalonePage wizardPage mediaLibraryPage" data-require="scripts/medialibrarypage,scripts/taskbutton">
<div data-role="content"> <div data-role="content">