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

modularize scripts

This commit is contained in:
Luke Pulverenti 2015-06-08 00:47:19 -04:00
parent 1dd2833ed7
commit bbfda77868
15 changed files with 95 additions and 133 deletions

View file

@ -54,7 +54,35 @@
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#channelSettingsPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("channels").done(function (config) {
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
config.DownloadPath = $('#txtCachePath', form).val() || null;
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
.get()
.map(function (i) {
return i.getAttribute('data-channelid');
});
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#channelSettingsPage", function () {
var page = this;
@ -78,7 +106,9 @@
});
});
}).on('pageshow', "#channelSettingsPage", function () {
$('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#channelSettingsPage", function () {
Dashboard.showLoadingMsg();
@ -98,36 +128,4 @@
});
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("channels").done(function (config) {
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
config.DownloadPath = $('#txtCachePath', form).val() || null;
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
.get()
.map(function(i) {
return i.getAttribute('data-channelid');
});
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
window.ChannelSettingsPage = {
onSubmit: onSubmit
};
})(jQuery, document, window);

View file

@ -102,7 +102,16 @@
}
$(document).on('pageinit', "#devicesUploadPage", function () {
function onSubmit() {
var form = this;
var page = $(form).parents('.page');
save(page);
return false;
}
$(document).on('pageinitdepends', "#devicesUploadPage", function () {
var page = this;
@ -124,8 +133,10 @@
});
});
$('.devicesUploadForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshow', "#devicesUploadPage", function () {
}).on('pageshowready', "#devicesUploadPage", function () {
var page = this;
@ -133,17 +144,4 @@
});
window.DevicesUploadPage = {
onSubmit: function () {
var form = this;
var page = $(form).parents('.page');
save(page);
return false;
}
};
})();

View file

@ -295,7 +295,17 @@
}
}
$(document).on('pageinit', "#editItemSubtitlesPage", function () {
function onSearchSubmit() {
var form = this;
var lang = $('#selectLanguage', form).val();
searchForSubtitles($(form).parents('.page'), lang);
return false;
}
$(document).on('pageinitdepends', "#editItemSubtitlesPage", function () {
var page = this;
@ -314,7 +324,9 @@
}
});
}).on('pagebeforeshow', "#editItemSubtitlesPage", function () {
$('.subtitleSearchForm').off('submit', onSearchSubmit).on('submit', onSearchSubmit);
}).on('pagebeforeshowready', "#editItemSubtitlesPage", function () {
var page = this;
@ -340,18 +352,4 @@
$(ApiClient).off("websocketmessage", onWebSocketMessageReceived);
});
window.EditItemSubtitlesPage = {
onSearchSubmit: function () {
var form = this;
var lang = $('#selectLanguage', form).val();
searchForSubtitles($(form).parents('.page'), lang);
return false;
}
};
})(jQuery, window, document);

View file

@ -40,7 +40,9 @@
}
}
function onSubmit(page) {
function onSubmit() {
var page = $(this).parents('.page');
ApiClient.ajax({
@ -55,18 +57,13 @@
processForgotPasswordResult(page, result);
});
return false;
}
window.ForgotPasswordPage = {
onSubmit: function () {
var page = $(this).parents('.page');
onSubmit(page);
return false;
}
};
$(document).on('pageinitdepends', '#forgotPasswordPage', function () {
$('.forgotPasswordForm').off('submit', onSubmit).on('submit', onSubmit);
});
})(window);

View file

@ -31,7 +31,9 @@
return;
}
function onSubmit(page) {
function onSubmit() {
var page = $(this).parents('.page');
ApiClient.ajax({
@ -46,18 +48,11 @@
processForgotPasswordResult(page, result);
});
return false;
}
window.ForgotPasswordPinPage = {
onSubmit: function () {
var page = $(this).parents('.page');
onSubmit(page);
return false;
}
};
$(document).on('pageinitdepends', '#forgotPasswordPinPage', function () {
$('.forgotPasswordPinForm').off('submit', onSubmit).on('submit', onSubmit);
});
})(window);

View file

@ -1,7 +1,7 @@
(function () {
var notificationsConfigurationKey = "notifications";
function fillItems(elem, items, cssClass, idPrefix, currentList, isEnabledList) {
var html = '<div data-role="controlgroup">';
@ -155,7 +155,13 @@
});
}
$(document).on('pageinit', "#notificationSettingPage", function () {
function onSubmit() {
var page = $(this).parents('.page');
save(page);
return false;
}
$(document).on('pageinitdepends', "#notificationSettingPage", function () {
var page = this;
@ -169,21 +175,13 @@
});
}).on('pageshow', "#notificationSettingPage", function () {
$('.notificationSettingForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#notificationSettingPage", function () {
var page = this;
reload(page);
});
window.NotificationSettingPage = {
onSubmit: function () {
var page = $(this).parents('.page');
save(page);
return false;
}
};
})(jQuery, window);

View file

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

View file

@ -35,6 +35,8 @@ var Dashboard = {
//$.mobile.popup.prototype.options.theme = "c";
$.mobile.popup.prototype.options.transition = "pop";
//$.mobile.keepNative = "input[type='text'],input[type='password'],input[type='number']";
if ($.browser.mobile) {
$.mobile.defaultPageTransition = "none";
} else {