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

extract scripts

This commit is contained in:
Luke Pulverenti 2015-06-12 23:42:19 -04:00
parent e0b22930c0
commit 2f544f923b
18 changed files with 104 additions and 140 deletions

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="appServicesPage" data-role="page" class="page type-interior appServicesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync"> <div id="appServicesPage" data-role="page" class="page type-interior appServicesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Sync" data-require="scripts/appservices">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -157,7 +157,7 @@ input[type="range"]::-ms-fill-upper {
margin-bottom: 0; margin-bottom: 0;
} }
.nowPlayingBar .mediaButton:not(.unpauseButton):not(.pauseButton):not(.remoteControlButton):not(.stopButton) { .nowPlayingBar .mediaButton:not(.unpauseButton):not(.pauseButton):not(.remoteControlButton) {
display: none; display: none;
} }
@ -165,7 +165,7 @@ input[type="range"]::-ms-fill-upper {
float: right; float: right;
} }
.nowPlayingBar .unpauseButton, .nowPlayingBar .pauseButton, .nowPlayingBar .stopButton { .nowPlayingBar .unpauseButton, .nowPlayingBar .pauseButton {
float: right; float: right;
} }

View file

@ -4,12 +4,11 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="editCollectionTitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editcollectionitems"> <div id="editCollectionTitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editorsidebar,scripts/editcollectionitems">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar"> <div class="editPageSidebar">
<div class="libraryTree"> <div class="libraryTree">
<ul> <ul></ul>
</ul>
</div> </div>
</div> </div>
@ -38,7 +37,8 @@
<div data-role="popup" class="popupIdentify popup" data-theme="a"> <div data-role="popup" class="popupIdentify popup" data-theme="a">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;"> <div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
<h3>${HeaderAddTitles} <h3>
${HeaderAddTitles}
</h3> </h3>
</div> </div>

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="editItemImagesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/edititemimages"> <div id="editItemImagesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editorsidebar,scripts/edititemimages">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar smoothScrollY"> <div class="editPageSidebar smoothScrollY">
<div class="libraryTree"> <div class="libraryTree">

View file

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="editItemMetadataPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}"> <div id="editItemMetadataPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editorsidebar,scripts/edititemmetadata">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar smoothScrollY"> <div class="editPageSidebar smoothScrollY">
<div class="libraryTree"> <div class="libraryTree">
@ -540,15 +540,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit);
$('.popupIdentifyForm').off('submit', EditItemMetadataPage.onIdentificationFormSubmitted).on('submit', EditItemMetadataPage.onIdentificationFormSubmitted);
$('.popupEditPersonForm').off('submit', EditItemMetadataPage.onPersonInfoFormSubmit).on('submit', EditItemMetadataPage.onPersonInfoFormSubmit);
$('.popupAdvancedRefreshForm').off('submit', EditItemMetadataPage.onRefreshFormSubmit).on('submit', EditItemMetadataPage.onRefreshFormSubmit);
$('.identifyOptionsForm').off('submit', EditItemMetadataPage.onIdentificationOptionsSubmit).on('submit', EditItemMetadataPage.onIdentificationOptionsSubmit);
</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="editItemSubtitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/edititemsubtitles"> <div id="editItemSubtitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/editorsidebar,scripts/edititemsubtitles">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar smoothScrollY"> <div class="editPageSidebar smoothScrollY">
<div class="libraryTree"> <div class="libraryTree">

View file

@ -4,7 +4,7 @@
<title></title> <title></title>
</head> </head>
<body> <body>
<div id="itemDetailPage" data-role="page" class="page libraryPage itemDetailPage" data-theme="b"> <div id="itemDetailPage" data-role="page" class="page libraryPage itemDetailPage" data-theme="b" data-require="scripts/itemdetailpage">
<div class="itemTabs homeTabs" style="display: none;"> <div class="itemTabs homeTabs" style="display: none;">
<div class="libraryViewNav scopedLibraryViewNav"> <div class="libraryViewNav scopedLibraryViewNav">

View file

@ -39,7 +39,7 @@
return false; return false;
} }
$(document).on('pageinitpdepends', "#dlnaServerSettingsPage", function () { $(document).on('pageinitdepends', "#dlnaServerSettingsPage", function () {
$('.dlnaServerSettingsForm').off('submit', onSubmit).on('submit', onSubmit); $('.dlnaServerSettingsForm').off('submit', onSubmit).on('submit', onSubmit);

View file

@ -32,6 +32,7 @@
if (item.Type == "UserRootFolder") { if (item.Type == "UserRootFolder") {
$('.editPageInnerContent', page).hide(); $('.editPageInnerContent', page).hide();
Dashboard.hideLoadingMsg();
return; return;
} else { } else {
$('.editPageInnerContent', page).show(); $('.editPageInnerContent', page).show();
@ -1378,7 +1379,7 @@
$(ApiClient).off("websocketmessage", onWebSocketMessageReceived); $(ApiClient).off("websocketmessage", onWebSocketMessageReceived);
} }
$(document).on('pageinit', "#editItemMetadataPage", function () { $(document).on('pageinitdepends', "#editItemMetadataPage", function () {
var page = this; var page = this;
@ -1437,7 +1438,13 @@
editPerson(page, {}); editPerson(page, {});
}); });
}).on('pagebeforeshow', "#editItemMetadataPage", function () { $('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit);
$('.popupIdentifyForm').off('submit', EditItemMetadataPage.onIdentificationFormSubmitted).on('submit', EditItemMetadataPage.onIdentificationFormSubmitted);
$('.popupEditPersonForm').off('submit', EditItemMetadataPage.onPersonInfoFormSubmit).on('submit', EditItemMetadataPage.onPersonInfoFormSubmit);
$('.popupAdvancedRefreshForm').off('submit', EditItemMetadataPage.onRefreshFormSubmit).on('submit', EditItemMetadataPage.onRefreshFormSubmit);
$('.identifyOptionsForm').off('submit', EditItemMetadataPage.onIdentificationOptionsSubmit).on('submit', EditItemMetadataPage.onIdentificationOptionsSubmit);
}).on('pageshowready', "#editItemMetadataPage", function () {
var page = this; var page = this;

View file

@ -326,7 +326,7 @@
$('.subtitleSearchForm').off('submit', onSearchSubmit).on('submit', onSearchSubmit); $('.subtitleSearchForm').off('submit', onSearchSubmit).on('submit', onSearchSubmit);
}).on('pagebeforeshowready', "#editItemSubtitlesPage", function () { }).on('pageshowready', "#editItemSubtitlesPage", function () {
var page = this; var page = this;

View file

@ -1604,7 +1604,7 @@
}); });
} }
$(document).on('pageinit', "#itemDetailPage", function () { $(document).on('pageinitdepends', "#itemDetailPage", function () {
var page = this; var page = this;
@ -1661,7 +1661,7 @@
}); });
}).on('pageshow', "#itemDetailPage", function () { }).on('pageshowready', "#itemDetailPage", function () {
var page = this; var page = this;
@ -1720,5 +1720,4 @@
window.ItemDetailPage = new itemDetailPage(); window.ItemDetailPage = new itemDetailPage();
})(jQuery, document, LibraryBrowser, window); })(jQuery, document, LibraryBrowser, window);

View file

@ -128,7 +128,7 @@
buttonCount++; buttonCount++;
} }
html += '<button data-role="button" class="btnMoreCommands" data-mini="true" data-inline="true" data-icon="ellipsis-v" data-iconpos="notext" title="' + Globalize.translate('ButtonMore') + '" style="' + buttonMargin + '">' + Globalize.translate('ButtonMore') + '</button>'; html += '<button type="button" class="btnMoreCommands" data-mini="true" data-inline="true" data-icon="ellipsis-v" data-iconpos="notext" title="' + Globalize.translate('ButtonMore') + '" style="' + buttonMargin + '">' + Globalize.translate('ButtonMore') + '</button>';
buttonCount++; buttonCount++;
html += '</div>'; html += '</div>';

View file

@ -52,6 +52,64 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
function updateUserInfo(user, newConnectUsername, actionCallback, noActionCallback) {
var currentConnectUsername = user.ConnectUserName || '';
var enteredConnectUsername = newConnectUsername;
var linkUrl = ApiClient.getUrl('Users/' + user.Id + '/Connect/Link');
if (currentConnectUsername && !enteredConnectUsername) {
// Remove connect info
// Add/Update connect info
ApiClient.ajax({
type: "DELETE",
url: linkUrl
}).done(function () {
Dashboard.alert({
message: Globalize.translate('MessageEmbyAccontRemoved'),
title: Globalize.translate('HeaderEmbyAccountRemoved'),
callback: actionCallback
});
});
}
else if (currentConnectUsername != enteredConnectUsername) {
// Add/Update connect info
ApiClient.ajax({
type: "POST",
url: linkUrl,
data: {
ConnectUsername: enteredConnectUsername
},
dataType: 'json'
}).done(function (result) {
var msgKey = result.IsPending ? 'MessagePendingEmbyAccountAdded' : 'MessageEmbyAccountAdded';
Dashboard.alert({
message: Globalize.translate(msgKey),
title: Globalize.translate('HeaderEmbyAccountAdded'),
callback: actionCallback
});
});
} else {
if (noActionCallback) {
noActionCallback();
}
}
}
function onSaveComplete(page, user) { function onSaveComplete(page, user) {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
@ -63,7 +121,7 @@
Dashboard.alert(Globalize.translate('SettingsSaved')); Dashboard.alert(Globalize.translate('SettingsSaved'));
} else { } else {
ConnectHelper.updateUserInfo(user, $('#txtConnectUserName', page).val(), function () { updateUserInfo(user, $('#txtConnectUserName', page).val(), function () {
loadData(page); loadData(page);
}); });
@ -103,23 +161,17 @@
}); });
} }
function editUserPage() { function onSubmit() {
var page = $(this).parents('.page');
var self = this; Dashboard.showLoadingMsg();
self.onSubmit = function () { getUser().done(function (result) {
saveUser(result, page);
});
var page = $(this).parents('.page'); // Disable default form submission
return false;
Dashboard.showLoadingMsg();
getUser().done(function (result) {
saveUser(result, page);
});
// Disable default form submission
return false;
};
} }
function getUser() { function getUser() {
@ -136,13 +188,14 @@
getUser().done(function (user) { getUser().done(function (user) {
loadUser(page, user); loadUser(page, user);
}); });
} }
window.EditUserPage = new editUserPage(); $(document).on('pageinitdepends', "#editUserPage", function () {
$(document).on('pagebeforeshow', "#editUserPage", function () { $('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pagebeforeshowready', "#editUserPage", function () {
var page = this; var page = this;
@ -150,73 +203,4 @@
}); });
})(jQuery, window, document); })(jQuery, window, document);
(function () {
window.ConnectHelper = {
updateUserInfo: function (user, newConnectUsername, actionCallback, noActionCallback) {
var currentConnectUsername = user.ConnectUserName || '';
var enteredConnectUsername = newConnectUsername;
var linkUrl = ApiClient.getUrl('Users/' + user.Id + '/Connect/Link');
if (currentConnectUsername && !enteredConnectUsername) {
// Remove connect info
// Add/Update connect info
ApiClient.ajax({
type: "DELETE",
url: linkUrl
}).done(function () {
Dashboard.alert({
message: Globalize.translate('MessageEmbyAccontRemoved'),
title: Globalize.translate('HeaderEmbyAccountRemoved'),
callback: actionCallback
});
});
}
else if (currentConnectUsername != enteredConnectUsername) {
// Add/Update connect info
ApiClient.ajax({
type: "POST",
url: linkUrl,
data: {
ConnectUsername: enteredConnectUsername
},
dataType: 'json'
}).done(function (result) {
var msgKey = result.IsPending ? 'MessagePendingEmbyAccountAdded' : 'MessageEmbyAccountAdded';
Dashboard.alert({
message: Globalize.translate(msgKey),
title: Globalize.translate('HeaderEmbyAccountAdded'),
callback: actionCallback
});
});
} else {
if (noActionCallback) {
noActionCallback();
}
}
}
};
})();

View file

@ -62,20 +62,6 @@
AndroidSharedPreferences.remove(name); AndroidSharedPreferences.remove(name);
}; };
function migrateKey(key) {
var json = localStorage.getItem(key);
if (json) {
self.setItem(key, json);
localStorage.removeItem(key);
}
}
function migrate() {
migrateKey('servercredentials3');
}
migrate();
} }
globalScope.appStorage = new preferencesStore(); globalScope.appStorage = new preferencesStore();

View file

@ -302,7 +302,7 @@
self.getTargets = function () { self.getTargets = function () {
return ConnectHelper.getDeviceList().filter(function (d) { return ConnectSDKHelper.getDeviceList().filter(function (d) {
return isChromecast(d.getModelName()) || isChromecast(d.getFriendlyName()); return isChromecast(d.getModelName()) || isChromecast(d.getFriendlyName());
@ -590,7 +590,7 @@
var deferred = $.Deferred(); var deferred = $.Deferred();
var device = ConnectHelper.getDeviceList().filter(function (d) { var device = ConnectSDKHelper.getDeviceList().filter(function (d) {
return d.getId() == target.id; return d.getId() == target.id;
})[0]; })[0];

View file

@ -26,7 +26,7 @@
return ConnectSDK.discoveryManager.getDeviceList(); return ConnectSDK.discoveryManager.getDeviceList();
} }
window.ConnectHelper = { window.ConnectSDKHelper = {
getDeviceList: getDeviceList getDeviceList: getDeviceList
}; };

View file

@ -400,7 +400,7 @@
self.getTargets = function () { self.getTargets = function () {
return ConnectHelper.getDeviceList().filter(function (d) { return ConnectSDKHelper.getDeviceList().filter(function (d) {
return isValid(d); return isValid(d);
@ -504,7 +504,7 @@
var deferred = $.Deferred(); var deferred = $.Deferred();
var device = ConnectHelper.getDeviceList().filter(function (d) { var device = ConnectSDKHelper.getDeviceList().filter(function (d) {
return d.getId() == target.id; return d.getId() == target.id;
})[0]; })[0];

View file

@ -4,7 +4,7 @@
<title></title> <title></title>
</head> </head>
<body> <body>
<div id="editUserPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users"> <div id="editUserPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/useredit">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -19,7 +19,7 @@
<a class="lnkEditUserPreferences" href="#" target="_blank">${ButtonEditOtherUserPreferences}</a> <a class="lnkEditUserPreferences" href="#" target="_blank">${ButtonEditOtherUserPreferences}</a>
</p> </p>
<br /> <br />
<form id="editUserProfileForm"> <form class="editUserProfileForm">
<div class="disabledUserBanner" style="display:none;"> <div class="disabledUserBanner" style="display:none;">
<div class="btn btnDarkAccent btnStatic"> <div class="btn btnDarkAccent btnStatic">
@ -130,9 +130,6 @@
</form> </form>
</div> </div>
</div> </div>
<script type="text/javascript">
$('#editUserProfileForm').on('submit', EditUserPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>