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

@ -4,7 +4,7 @@
<title>${TitlePlugins}</title> <title>${TitlePlugins}</title>
</head> </head>
<body> <body>
<div id="channelSettingsPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Channels"> <div id="channelSettingsPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Channels" data-require="scripts/channelsettings">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -73,10 +73,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.channelSettingsForm').off('submit', ChannelSettingsPage.onSubmit).on('submit', ChannelSettingsPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitleDevices}</title> <title>${TitleDevices}</title>
</head> </head>
<body> <body>
<div id="devicesUploadPage" data-role="page" class="page type-interior devicesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Camera%20upload"> <div id="devicesUploadPage" data-role="page" class="page type-interior devicesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Camera%20upload" data-require="scripts/devicesupload">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -60,9 +60,6 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript">
$('.devicesUploadForm').off('submit', DevicesUploadPage.onSubmit).on('submit', DevicesUploadPage.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="editItemSubtitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}"> <div id="editItemSubtitlesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="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">
@ -49,11 +49,6 @@
<pre class="subtitleContent" style="margin: 0; border-radius: 0;"></pre> <pre class="subtitleContent" style="margin: 0; border-radius: 0;"></pre>
</div> </div>
</div> </div>
<script type="text/javascript">
$('.subtitleSearchForm').off('submit', EditItemSubtitlesPage.onSearchSubmit).on('submit', EditItemSubtitlesPage.onSearchSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitleForgotPassword}</title> <title>${TitleForgotPassword}</title>
</head> </head>
<body> <body>
<div data-role="page" class="page standalonePage forgotPasswordPage" data-theme="b"> <div data-role="page" class="page standalonePage forgotPasswordPage" data-theme="b" data-require="scripts/forgotpassword">
<div data-role="content"> <div data-role="content">
@ -36,10 +36,6 @@
</form> </form>
</div> </div>
<script type="text/javascript">
$('.forgotPasswordForm').off('submit', ForgotPasswordPage.onSubmit).on('submit', ForgotPasswordPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitlePasswordReset}</title> <title>${TitlePasswordReset}</title>
</head> </head>
<body> <body>
<div data-role="page" class="page standalonePage forgotPasswordPage" data-theme="b"> <div data-role="page" class="page standalonePage forgotPasswordPinPage" data-theme="b" data-require="scripts/forgotpasswordpin">
<div data-role="content"> <div data-role="content">
@ -33,10 +33,6 @@
</form> </form>
</div> </div>
<script type="text/javascript">
$('.forgotPasswordPinForm').off('submit', ForgotPasswordPinPage.onSubmit).on('submit', ForgotPasswordPinPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitleNotifications}</title> <title>${TitleNotifications}</title>
</head> </head>
<body> <body>
<div id="notificationSettingPage" data-role="page" class="page type-interior notificationConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Notifications"> <div id="notificationSettingPage" data-role="page" class="page type-interior notificationConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Notifications" data-require="scripts/notificationsetting">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
@ -85,10 +85,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.notificationSettingForm').off('submit', NotificationSettingPage.onSubmit).on('submit', NotificationSettingPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>${TitleNotifications}</title> <title>${TitleNotifications}</title>
</head> </head>
<body> <body>
<div id="notificationSettingsPage" data-role="page" class="page type-interior notificationConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Notifications"> <div id="notificationSettingsPage" data-role="page" class="page type-interior notificationConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Notifications" data-require="scripts/notificationsettings">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View file

@ -54,7 +54,35 @@
Dashboard.hideLoadingMsg(); 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; var page = this;
@ -78,7 +106,9 @@
}); });
}); });
}).on('pageshow', "#channelSettingsPage", function () { $('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#channelSettingsPage", function () {
Dashboard.showLoadingMsg(); 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); })(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; 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; 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; 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; var page = this;
@ -340,18 +352,4 @@
$(ApiClient).off("websocketmessage", onWebSocketMessageReceived); $(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); })(jQuery, window, document);

View file

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

View file

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

View file

@ -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; 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; var page = this;
reload(page); reload(page);
}); });
window.NotificationSettingPage = {
onSubmit: function () {
var page = $(this).parents('.page');
save(page);
return false;
}
};
})(jQuery, window); })(jQuery, window);

View file

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

View file

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