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>
</head>
<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 class="content-primary">
@ -73,10 +73,6 @@
</div>
</div>
<script type="text/javascript">
$('.channelSettingsForm').off('submit', ChannelSettingsPage.onSubmit).on('submit', ChannelSettingsPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>${TitleDevices}</title>
</head>
<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 class="content-primary">
@ -60,9 +60,6 @@
</div>
</div>
</div>
<script type="text/javascript">
$('.devicesUploadForm').off('submit', DevicesUploadPage.onSubmit).on('submit', DevicesUploadPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<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 class="editPageSidebar smoothScrollY">
<div class="libraryTree">
@ -49,11 +49,6 @@
<pre class="subtitleContent" style="margin: 0; border-radius: 0;"></pre>
</div>
</div>
<script type="text/javascript">
$('.subtitleSearchForm').off('submit', EditItemSubtitlesPage.onSearchSubmit).on('submit', EditItemSubtitlesPage.onSearchSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>${TitleForgotPassword}</title>
</head>
<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">
@ -36,10 +36,6 @@
</form>
</div>
<script type="text/javascript">
$('.forgotPasswordForm').off('submit', ForgotPasswordPage.onSubmit).on('submit', ForgotPasswordPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>${TitlePasswordReset}</title>
</head>
<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">
@ -33,10 +33,6 @@
</form>
</div>
<script type="text/javascript">
$('.forgotPasswordPinForm').off('submit', ForgotPasswordPinPage.onSubmit).on('submit', ForgotPasswordPinPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>${TitleNotifications}</title>
</head>
<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 class="content-primary">
@ -85,10 +85,6 @@
</div>
</div>
<script type="text/javascript">
$('.notificationSettingForm').off('submit', NotificationSettingPage.onSubmit).on('submit', NotificationSettingPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -4,7 +4,7 @@
<title>${TitleNotifications}</title>
</head>
<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 class="content-primary">

View file

@ -54,50 +54,6 @@
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#channelSettingsPage", function () {
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectChannelDownloadPath'),
instruction: Globalize.translate('HeaderSelectChannelDownloadPathHelp')
});
});
}).on('pageshow', "#channelSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getNamedConfiguration("channels");
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Channels/Features"));
$.when(promise1, promise2).done(function (response1, response2) {
var config = response1[0];
var allFeatures = response2[0];
loadPage(page, config, allFeatures);
});
});
function onSubmit() {
Dashboard.showLoadingMsg();
@ -126,8 +82,50 @@
return false;
}
window.ChannelSettingsPage = {
onSubmit: onSubmit
};
$(document).on('pageinitdepends', "#channelSettingsPage", function () {
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectChannelDownloadPath'),
instruction: Globalize.translate('HeaderSelectChannelDownloadPathHelp')
});
});
$('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#channelSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getNamedConfiguration("channels");
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Channels/Features"));
$.when(promise1, promise2).done(function (response1, response2) {
var config = response1[0];
var allFeatures = response2[0];
loadPage(page, config, allFeatures);
});
});
})(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);
});
}
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);
});
}
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

@ -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 {