|
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 | 4 | <meta charset="utf-8">
|
5 |
| - <title>Template</title> |
| 5 | + <title>Prevent Sleep</title> |
6 | 6 | </head>
|
7 | 7 | <body>
|
8 |
| - <div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox"> |
| 8 | + <div id="PreventSleepConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox"> |
9 | 9 | <div data-role="content">
|
10 | 10 | <div class="content-primary">
|
11 |
| - <form id="TemplateConfigForm"> |
12 |
| - <div class="selectContainer"> |
13 |
| - <label class="selectLabel" for="Options">Several Options</label> |
14 |
| - <select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select"> |
15 |
| - <option id="optOneOption" value="OneOption">One Option</option> |
16 |
| - <option id="optAnotherOption" value="AnotherOption">Another Option</option> |
17 |
| - </select> |
18 |
| - </div> |
19 |
| - <div class="inputContainer"> |
20 |
| - <label class="inputLabel inputLabelUnfocused" for="AnInteger">An Integer</label> |
21 |
| - <input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0" /> |
22 |
| - <div class="fieldDescription">A Description</div> |
23 |
| - </div> |
24 |
| - <div class="checkboxContainer checkboxContainer-withDescription"> |
25 |
| - <label class="emby-checkbox-label"> |
26 |
| - <input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox" /> |
27 |
| - <span>A Checkbox</span> |
28 |
| - </label> |
29 |
| - </div> |
| 11 | + <form id="PreventSleepConfigForm"> |
30 | 12 | <div class="inputContainer">
|
31 |
| - <label class="inputeLabel inputLabelUnfocused" for="AString">A String</label> |
32 |
| - <input id="AString" name="AString" type="text" is="emby-input" /> |
33 |
| - <div class="fieldDescription">Another Description</div> |
| 13 | + <label class="inputLabel inputLabelUnfocused" for="UnblockSleepDelay">Delay before unblocking sleep (in minutes)</label> |
| 14 | + <input id="UnblockSleepDelay" name="UnblockSleepDelay" type="number" is="emby-input" min="1" /> |
| 15 | + <div class="fieldDescription">Wait for the specified time after all playback has ended before allowing sleep again.</div> |
34 | 16 | </div>
|
35 | 17 | <div>
|
36 | 18 | <button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
|
41 | 23 | </div>
|
42 | 24 | </div>
|
43 | 25 | <script type="text/javascript">
|
44 |
| - var TemplateConfig = { |
| 26 | + var PreventSleepConfig = { |
45 | 27 | pluginUniqueId: 'd6b0196a-9885-4d87-b25c-562a57ebbe0b'
|
46 | 28 | };
|
47 | 29 |
|
48 |
| - document.querySelector('#TemplateConfigPage') |
| 30 | + document.querySelector('#PreventSleepConfigPage') |
49 | 31 | .addEventListener('pageshow', function() {
|
50 | 32 | Dashboard.showLoadingMsg();
|
51 |
| - ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) { |
52 |
| - document.querySelector('#Options').value = config.Options; |
53 |
| - document.querySelector('#AnInteger').value = config.AnInteger; |
54 |
| - document.querySelector('#TrueFalseSetting').checked = config.TrueFalseSetting; |
55 |
| - document.querySelector('#AString').value = config.AString; |
| 33 | + ApiClient.getPluginConfiguration(PreventSleepConfig.pluginUniqueId).then(function (config) { |
| 34 | + document.querySelector('#UnblockSleepDelay').value = config.UnblockSleepDelay; |
56 | 35 | Dashboard.hideLoadingMsg();
|
57 | 36 | });
|
58 | 37 | });
|
59 | 38 |
|
60 |
| - document.querySelector('#TemplateConfigForm') |
| 39 | + document.querySelector('#PreventSleepConfigForm') |
61 | 40 | .addEventListener('submit', function(e) {
|
62 | 41 | Dashboard.showLoadingMsg();
|
63 |
| - ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) { |
64 |
| - config.Options = document.querySelector('#Options').value; |
65 |
| - config.AnInteger = document.querySelector('#AnInteger').value; |
66 |
| - config.TrueFalseSetting = document.querySelector('#TrueFalseSetting').checked; |
67 |
| - config.AString = document.querySelector('#AString').value; |
68 |
| - ApiClient.updatePluginConfiguration(TemplateConfig.pluginUniqueId, config).then(function (result) { |
| 42 | + ApiClient.getPluginConfiguration(PreventSleepConfig.pluginUniqueId).then(function (config) { |
| 43 | + config.UnblockSleepDelay = document.querySelector('#UnblockSleepDelay').value; |
| 44 | + ApiClient.updatePluginConfiguration(PreventSleepConfig.pluginUniqueId, config).then(function (result) { |
69 | 45 | Dashboard.processPluginConfigurationUpdateResult(result);
|
70 | 46 | });
|
71 | 47 | });
|
|
0 commit comments