mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
extract scripts
This commit is contained in:
parent
e0b22930c0
commit
2f544f923b
18 changed files with 104 additions and 140 deletions
|
@ -39,7 +39,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitpdepends', "#dlnaServerSettingsPage", function () {
|
||||
$(document).on('pageinitdepends', "#dlnaServerSettingsPage", function () {
|
||||
|
||||
$('.dlnaServerSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
if (item.Type == "UserRootFolder") {
|
||||
$('.editPageInnerContent', page).hide();
|
||||
Dashboard.hideLoadingMsg();
|
||||
return;
|
||||
} else {
|
||||
$('.editPageInnerContent', page).show();
|
||||
|
@ -1378,7 +1379,7 @@
|
|||
$(ApiClient).off("websocketmessage", onWebSocketMessageReceived);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#editItemMetadataPage", function () {
|
||||
$(document).on('pageinitdepends', "#editItemMetadataPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1437,7 +1438,13 @@
|
|||
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;
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@
|
|||
|
||||
$('.subtitleSearchForm').off('submit', onSearchSubmit).on('submit', onSearchSubmit);
|
||||
|
||||
}).on('pagebeforeshowready', "#editItemSubtitlesPage", function () {
|
||||
}).on('pageshowready', "#editItemSubtitlesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -1604,7 +1604,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#itemDetailPage", function () {
|
||||
$(document).on('pageinitdepends', "#itemDetailPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1661,7 +1661,7 @@
|
|||
|
||||
});
|
||||
|
||||
}).on('pageshow', "#itemDetailPage", function () {
|
||||
}).on('pageshowready', "#itemDetailPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1720,5 +1720,4 @@
|
|||
|
||||
window.ItemDetailPage = new itemDetailPage();
|
||||
|
||||
|
||||
})(jQuery, document, LibraryBrowser, window);
|
|
@ -128,7 +128,7 @@
|
|||
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++;
|
||||
|
||||
html += '</div>';
|
||||
|
|
|
@ -52,6 +52,64 @@
|
|||
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) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
@ -63,7 +121,7 @@
|
|||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
} else {
|
||||
|
||||
ConnectHelper.updateUserInfo(user, $('#txtConnectUserName', page).val(), function () {
|
||||
updateUserInfo(user, $('#txtConnectUserName', page).val(), function () {
|
||||
|
||||
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');
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
getUser().done(function (result) {
|
||||
saveUser(result, page);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
};
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
function getUser() {
|
||||
|
@ -136,13 +188,14 @@
|
|||
getUser().done(function (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;
|
||||
|
||||
|
@ -150,73 +203,4 @@
|
|||
|
||||
});
|
||||
|
||||
})(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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
})(jQuery, window, document);
|
Loading…
Add table
Add a link
Reference in a new issue