fix indentation and move load and submit out of plugin object

This commit is contained in:
dkanada 2019-03-10 08:55:35 +09:00
parent de5fa4b8ea
commit b4e85a0196

View File

@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>ExamplePlugin Configuration</title> <title>Template</title>
</head> </head>
<body> <body>
<div id="ExamplePluginConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox"> <div id="ExamplePluginConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
@ -42,8 +42,10 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var ExamplePluginConfigurationPage = { var ExamplePluginConfigurationPage = {
pluginUniqueId: 'eb5d7894-8eef-4b36-aa6f-5d124e828ce1', pluginUniqueId: 'eb5d7894-8eef-4b36-aa6f-5d124e828ce1'
loadConfiguration: function() { };
$('#ExamplePluginConfigurationPage').on('pageshow', function () {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) { ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) {
$('#Options').val(config.Options).change(); $('#Options').val(config.Options).change();
@ -52,8 +54,9 @@
$('#AString').val(config.AString).change(); $('#AString').val(config.AString).change();
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
}, });
saveConfiguration: function() {
$('#ExamplePluginConfigurationForm').on('submit', function () {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) { ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) {
config.Options = $('#Options').val(); config.Options = $('#Options').val();
@ -64,15 +67,6 @@
Dashboard.processPluginConfigurationUpdateResult(result); Dashboard.processPluginConfigurationUpdateResult(result);
}); });
}); });
}
};
$('#ExamplePluginConfigurationPage').on('pageshow', function () {
ExamplePluginConfigurationPage.loadConfiguration();
});
$('#ExamplePluginConfigurationForm').on('submit', function () {
ExamplePluginConfigurationPage.saveConfiguration();
return false; return false;
}); });
</script> </script>