Add advanced toggle and hide certain settings by default

This commit is contained in:
Al McKinlay 2017-12-19 13:49:17 +00:00 committed by Alistair McKinlay
parent bd619220d0
commit 1a9ad1a7e3
2 changed files with 18 additions and 6 deletions

View File

@ -24,6 +24,7 @@ let $warningBlocked;
// Default settings // Default settings
const settings = { const settings = {
syncSettings: false, syncSettings: false,
advanced: false,
autocomplete: true, autocomplete: true,
nickPostfix: "", nickPostfix: "",
coloredNicks: true, coloredNicks: true,
@ -155,6 +156,8 @@ function applySetting(name, value) {
} else if (!value) { } else if (!value) {
$warningBlocked.hide(); $warningBlocked.hide();
} }
} else if (name === "advanced") {
$("#settings [data-advanced]").toggle(settings[name]);
} }
} }

View File

@ -4,9 +4,18 @@
<div class="container"> <div class="container">
<h1 class="title">Settings</h1> <h1 class="title">Settings</h1>
<div class="row">
<div class="col-sm-6">
<label class="opt">
<input type="checkbox" name="advanced">
Advanced settings
</label>
</div>
</div>
<div class="row"> <div class="row">
{{#unless public}} {{#unless public}}
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<h2> <h2>
Settings synchronisation Settings synchronisation
<span class="tooltipped tooltipped-n tooltipped-no-delay" aria-label="Note: This is an experimental feature and may change in future releases."> <span class="tooltipped tooltipped-n tooltipped-no-delay" aria-label="Note: This is an experimental feature and may change in future releases.">
@ -71,7 +80,7 @@
Enable autocomplete Enable autocomplete
</label> </label>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<label class="opt"> <label class="opt">
<label for="nickPostfix" class="sr-only">Nick autocomplete postfix (e.g. <code>, </code>)</label> <label for="nickPostfix" class="sr-only">Nick autocomplete postfix (e.g. <code>, </code>)</label>
<input type="text" id="nickPostfix" name="nickPostfix" class="input" placeholder="Nick autocomplete postfix (e.g. ', ')"> <input type="text" id="nickPostfix" name="nickPostfix" class="input" placeholder="Nick autocomplete postfix (e.g. ', ')">
@ -153,14 +162,14 @@
</div> </div>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<label class="opt"> <label class="opt">
<input type="checkbox" name="notifyAllMessages"> <input type="checkbox" name="notifyAllMessages">
Enable notification for all messages Enable notification for all messages
</label> </label>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<label class="opt"> <label class="opt">
<label for="highlights" class="sr-only">Custom highlights (comma-separated keywords)</label> <label for="highlights" class="sr-only">Custom highlights (comma-separated keywords)</label>
<input type="text" id="highlights" name="highlights" class="input" placeholder="Custom highlights (comma-separated keywords)"> <input type="text" id="highlights" name="highlights" class="input" placeholder="Custom highlights (comma-separated keywords)">
@ -194,10 +203,10 @@
</div> </div>
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<h2>Custom Stylesheet</h2> <h2>Custom Stylesheet</h2>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12" data-advanced>
<label for="user-specified-css-input" class="sr-only">Custom stylesheet. You can override any style with CSS here.</label> <label for="user-specified-css-input" class="sr-only">Custom stylesheet. You can override any style with CSS here.</label>
<textarea class="input" name="userStyles" id="user-specified-css-input" placeholder="/* You can override any style with CSS here */"></textarea> <textarea class="input" name="userStyles" id="user-specified-css-input" placeholder="/* You can override any style with CSS here */"></textarea>
</div> </div>