mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
make scripts more modular
This commit is contained in:
parent
284e61038d
commit
ce35317652
11 changed files with 109 additions and 86 deletions
|
@ -35,7 +35,31 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#advancedConfigurationPage", function () {
|
||||
function onSubmit() {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
|
||||
|
||||
config.RunAtStartup = $('#chkRunAtStartup', form).checked();
|
||||
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
|
||||
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
|
||||
|
||||
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
||||
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#advancedConfigurationPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -51,7 +75,7 @@
|
|||
|
||||
});
|
||||
|
||||
}).on('pageinit', "#advancedConfigurationPage", function () {
|
||||
}).on('pageinitdepends', "#advancedConfigurationPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -81,37 +105,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
$('.advancedConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
});
|
||||
|
||||
function advancedConfigurationPage() {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.onSubmit = function () {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
|
||||
|
||||
config.RunAtStartup = $('#chkRunAtStartup', form).checked();
|
||||
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
|
||||
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
|
||||
|
||||
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
||||
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
window.AdvancedConfigurationPage = new advancedConfigurationPage();
|
||||
|
||||
})(jQuery, document, window);
|
||||
|
|
|
@ -17,7 +17,30 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#dashboardHostingPage", function () {
|
||||
function onSubmit() {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
config.HttpServerPortNumber = $('#txtPortNumber', form).val();
|
||||
config.PublicPort = $('#txtPublicPort', form).val();
|
||||
config.PublicHttpsPort = $('#txtPublicHttpsPort', form).val();
|
||||
config.EnableHttps = $('#chkEnableHttps', form).checked();
|
||||
config.HttpsPortNumber = $('#txtHttpsPort', form).val();
|
||||
config.EnableUPnP = $('#chkEnableUpnp', form).checked();
|
||||
config.WanDdns = $('#txtDdns', form).val();
|
||||
config.CertificatePath = $('#txtCertificatePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#dashboardHostingPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -29,7 +52,7 @@
|
|||
|
||||
});
|
||||
|
||||
}).on('pageinit', "#dashboardHostingPage", function () {
|
||||
}).on('pageinitdepends', "#dashboardHostingPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -53,33 +76,8 @@
|
|||
header: Globalize.translate('HeaderSelectCertificatePath')
|
||||
});
|
||||
});
|
||||
|
||||
$('.dashboardHostingForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
});
|
||||
|
||||
window.DashboardHostingPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
config.HttpServerPortNumber = $('#txtPortNumber', form).val();
|
||||
config.PublicPort = $('#txtPublicPort', form).val();
|
||||
config.PublicHttpsPort = $('#txtPublicHttpsPort', form).val();
|
||||
config.EnableHttps = $('#chkEnableHttps', form).checked();
|
||||
config.HttpsPortNumber = $('#txtHttpsPort', form).val();
|
||||
config.EnableUPnP = $('#chkEnableUpnp', form).checked();
|
||||
config.WanDdns = $('#txtDdns', form).val();
|
||||
config.CertificatePath = $('#txtCertificatePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(jQuery, document, window);
|
||||
|
|
|
@ -714,7 +714,7 @@
|
|||
|
||||
|
||||
var href = LibraryBrowser.getHref(item, options.context);
|
||||
html += '<li class="' + cssClass + '"' + dataAttributes + ' data-itemid="' + item.Id + '" data-playlistitemid="' + (item.PlaylistItemId || '') + '" data-href="' + href + '">';
|
||||
html += '<li class="' + cssClass + '"' + dataAttributes + ' data-itemid="' + item.Id + '" data-playlistitemid="' + (item.PlaylistItemId || '') + '" data-href="' + href + '" data-icon="false">';
|
||||
|
||||
var defaultAction = options.defaultAction;
|
||||
if (defaultAction == 'play' || defaultAction == 'playallfromhere') {
|
||||
|
@ -848,9 +848,9 @@
|
|||
}
|
||||
html += '</a>';
|
||||
|
||||
// Render out the jqm classes so that we don't have to call trigger create
|
||||
html += '<a href="#" data-icon="ellipsis-v" class="listviewMenuButton ui-btn ui-icon-ellipsis-v ui-btn-icon-notext ui-btn-inline">';
|
||||
html += '</a>';
|
||||
html += '<button type="button" data-role="none" class="listviewMenuButton imageButton listViewMoreButton" data-icon="none">';
|
||||
html += '<i class="fa fa-ellipsis-v"></i>';
|
||||
html += '</button>';
|
||||
|
||||
html += '</li>';
|
||||
|
||||
|
@ -1558,8 +1558,6 @@
|
|||
|
||||
if (options.cardLayout) {
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
// Render out the jqm classes so that we don't have to call trigger create
|
||||
//html += '<button class="listviewMenuButton ui-btn ui-icon-ellipsis-v ui-btn-icon-notext ui-btn-inline ui-shadow ui-corner-all" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 4px 0 0;"></button>';
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions" type="button" data-role="none" style="margin: 4px 0 0;"><i class="fa fa-ellipsis-v"></i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@
|
|||
showTitle: true,
|
||||
coverImage: true,
|
||||
centerImage: true,
|
||||
textLines: getAdditionalTextLines
|
||||
textLines: getAdditionalTextLines,
|
||||
cardLayout: true
|
||||
});
|
||||
$('.itemsContainer', elem).html(html).lazyChildren();
|
||||
}
|
||||
|
|
|
@ -1824,6 +1824,36 @@ $(document).on('pagecreate', ".page", function () {
|
|||
$(document.body).addClass('removeScrollbars');
|
||||
}
|
||||
|
||||
}).on('pageinit', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs([require], function() {
|
||||
|
||||
$(page).trigger('pageinitdepends');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageinitdepends');
|
||||
}
|
||||
|
||||
}).on('pageshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs([require], function () {
|
||||
|
||||
$(page).trigger('pageshown');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageshown');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
var page = $(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue