79 lines
4.1 KiB
HTML
Raw Normal View History

2020-07-04 23:33:19 +09:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Template</title>
</head>
<body>
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<form id="TemplateConfigForm">
<div class="selectContainer">
<label class="selectLabel" for="Options">Several Options</label>
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
<option id="optOneOption" value="OneOption">One Option</option>
<option id="optAnotherOption" value="AnotherOption">Another Option</option>
</select>
</div>
<div class="inputContainer">
2021-01-09 23:47:03 +09:00
<label class="inputLabel inputLabelUnfocused" for="AnInteger">An Integer</label>
2020-07-04 23:33:19 +09:00
<input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0" />
<div class="fieldDescription">A Description</div>
</div>
2021-01-10 00:25:51 +09:00
<div class="checkboxContainer checkboxContainer-withDescription">
2020-07-04 23:33:19 +09:00
<label class="emby-checkbox-label">
<input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox" />
<span>A Checkbox</span>
</label>
</div>
<div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AString">A String</label>
<input id="AString" name="AString" type="text" is="emby-input" />
<div class="fieldDescription">Another Description</div>
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
<span>Save</span>
</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
var TemplateConfig = {
pluginUniqueId: 'eb5d7894-8eef-4b36-aa6f-5d124e828ce1'
};
2020-12-02 17:47:22 -07:00
document.querySelector('#TemplateConfigPage')
2021-01-10 00:25:51 +09:00
.addEventListener('pageshow', function() {
2020-12-02 17:47:22 -07:00
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
document.querySelector('#Options').value = config.Options;
document.querySelector('#AnInteger').value = config.AnInteger;
document.querySelector('#TrueFalseSetting').checked = config.TrueFalseSetting;
2020-12-02 17:47:22 -07:00
document.querySelector('#AString').value = config.AString;
Dashboard.hideLoadingMsg();
});
2021-01-10 00:25:51 +09:00
});
2020-12-02 17:47:22 -07:00
document.querySelector('#TemplateConfigForm')
.addEventListener('submit', function() {
2020-07-04 23:33:19 +09:00
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
2020-12-02 17:47:22 -07:00
config.Options = document.querySelector('#Options').value;
config.AnInteger = document.querySelector('#AnInteger').value;
config.TrueFalseSetting = document.querySelector('#TrueFalseSetting').checked;
2020-12-02 17:47:22 -07:00
config.AString = document.querySelector('#AString').value;
2020-07-04 23:33:19 +09:00
ApiClient.updatePluginConfiguration(TemplateConfig.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});
2021-01-10 00:25:51 +09:00
2020-07-04 23:33:19 +09:00
return false;
});
</script>
</div>
</body>
</html>