small code formatting changes

This commit is contained in:
dkanada 2019-03-10 08:53:30 +09:00
parent e66682ea51
commit de5fa4b8ea
4 changed files with 31 additions and 48 deletions

View File

@ -1,5 +1,6 @@
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.ExamplePlugin.Configuration
namespace Jellyfin.Plugin.Template.Configuration
{ {
public enum SomeOptions public enum SomeOptions
{ {
@ -9,10 +10,10 @@ namespace Jellyfin.Plugin.ExamplePlugin.Configuration
public class PluginConfiguration : BasePluginConfiguration public class PluginConfiguration : BasePluginConfiguration
{ {
//This is where you should store configurable settings your plugin might need. //This is where you should store configurable settings your plugin might need.
public bool TrueFalseSetting {get; set;} public bool TrueFalseSetting { get; set; }
public int AnInteger {get; set;} public int AnInteger { get; set; }
public string AString {get; set;} public string AString { get; set; }
public SomeOptions Options {get; set;} public SomeOptions Options { get; set; }
public PluginConfiguration() public PluginConfiguration()
{ {
Options = SomeOptions.AnotherOption; Options = SomeOptions.AnotherOption;
@ -21,4 +22,4 @@ namespace Jellyfin.Plugin.ExamplePlugin.Configuration
AString = "This is a string setting"; AString = "This is a string setting";
} }
} }
} }

View File

@ -1,5 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -9,28 +8,27 @@
<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">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
<form id="ExamplePluginConfigurationForm"> <form id="ExamplePluginConfigurationForm">
<div class="selectContainer"> <div class="selectContainer">
<label class="selectLabel" for="Options">Options:</label> <label class="selectLabel" for="Options">Options</label>
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select"> <select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
<option id="optOneOption" value="OneOption">One Option</option> <option id="optOneOption" value="OneOption">One Option</option>
<option id="optAnotherOption" value="AnotherOption">AnotherOption</option> <option id="optAnotherOption" value="AnotherOption">Another Option</option>
</select> </select>
</div> </div>
<div class="inputContainer"> <div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AnInteger">An Integer:</label> <label class="inputeLabel inputLabelUnfocused" for="AnInteger">An Integer</label>
<input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0"/> <input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0" />
<div class="fieldDescription">Numbers go here</div> <div class="fieldDescription">Numbers go here</div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescripton"> <div class="checkboxContainer checkboxContainer-withDescripton">
<label class="emby-checkbox-label"> <label class="emby-checkbox-label">
<input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox"/> <input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox" />
<span>True or False</span> <span>True or False</span>
</label> </label>
</div> </div>
<div class="inputContainer"> <div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AString">A String:</label> <label class="inputeLabel inputLabelUnfocused" for="AString">A String</label>
<input id="AString" name="AString" type="text" is="emby-input" /> <input id="AString" name="AString" type="text" is="emby-input" />
<div class="fieldDescription">Words go here</div> <div class="fieldDescription">Words go here</div>
</div> </div>
@ -42,38 +40,23 @@
</form> </form>
</div> </div>
</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",
virtualFolders: [],
physicalFolders: [],
loadConfiguration: function() { loadConfiguration: function() {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) { ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) {
var page = $.mobile.activePage; $('#Options').val(config.Options).change();
$('#AnInteger').val(config.AnInteger).change();
$('#Options', page).val(config.Options).change(); $('#TrueFalseSetting').checked(config.TrueFalseSetting).checkboxradio("refresh");
$('#AnInteger', page).val(config.AnInteger).change(); $('#AString').val(config.AString).change();
$('#TrueFalseSetting', page).checked(config.TrueFalseSetting).checkboxradio("refresh");
$('#AString', page).val(config.AString).change();
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
}, },
saveConfiguration: function() { saveConfiguration: function() {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) {
var page = $.mobile.activePage; config.Options = $('#Options').val();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function(config) {
config.Options = $('#Options', page).val();
config.AnInteger = $('#AnInteger').val(); config.AnInteger = $('#AnInteger').val();
config.TrueFalseSetting = $('#TrueFalseSetting').prop('checked'); config.TrueFalseSetting = $('#TrueFalseSetting').prop('checked');
config.AString = $('#AString').val(); config.AString = $('#AString').val();
@ -81,7 +64,7 @@
Dashboard.processPluginConfigurationUpdateResult(result); Dashboard.processPluginConfigurationUpdateResult(result);
}); });
}); });
}, }
}; };
$('#ExamplePluginConfigurationPage').on('pageshow', function () { $('#ExamplePluginConfigurationPage').on('pageshow', function () {
@ -94,5 +77,5 @@
}); });
</script> </script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,17 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Jellyfin.Plugin.ExamplePlugin.Configuration; using Jellyfin.Plugin.Template.Configuration;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
namespace Jellyfin.Plugin.ExamplePlugin namespace Jellyfin.Plugin.Template
{ {
public class Plugin : BasePlugin<PluginConfiguration>, public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
IHasWebPages
{ {
public override string Name => "ExamplePlugin"; public override string Name => "Template";
public override Guid Id => Guid.Parse("eb5d7894-8eef-4b36-aa6f-5d124e828ce1"); public override Guid Id => Guid.Parse("eb5d7894-8eef-4b36-aa6f-5d124e828ce1");
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer) public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
{ {
@ -27,9 +26,9 @@ namespace Jellyfin.Plugin.ExamplePlugin
new PluginPageInfo new PluginPageInfo
{ {
Name = this.Name, Name = this.Name,
EmbeddedResourcePath = string.Format("Jellyfin.Plugin.{0}.Configuration.configPage.html",this.Name) EmbeddedResourcePath = string.Format("Jellyfin.Plugin.{0}.Configuration.configPage.html", this.Name)
} }
}; };
} }
} }
} }

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Jellyfin.Plugin.ExamplePlugin</RootNamespace> <RootNamespace>Jellyfin.Plugin.Template</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>