options: #advanced block is collapsed by default in Chrome

* Chrome has a hardcoded limit for the options dialog height at 640px
  and it's better to avoid the vertical scrollbar on smaller displays
* Chrome users are less likely to change the weird stuff we have there
This commit is contained in:
tophf 2017-09-09 17:21:17 +03:00
parent 7bde873b3b
commit df80a84469
3 changed files with 19 additions and 1 deletions

View File

@ -104,7 +104,7 @@
</div>
</div>
<div class="block">
<div class="block collapsible" id="advanced">
<h1 i18n-text="optionsAdvanced"></h1>
<div class="items">
<label>

View File

@ -50,6 +50,14 @@ body {
padding-bottom: 0;
}
.collapsed, .collapsible h1 {
cursor: pointer;
}
.collapsed .items {
display: none;
}
h1 {
width: 30%;
margin: 0;

View File

@ -4,6 +4,16 @@ setupLivePrefs();
setupRadioButtons();
enforceInputRange($('#popupWidth'));
if (!FIREFOX && !OPERA) {
const block = $('#advanced');
block.classList.add('collapsed');
block.onclick = event => {
if (block.classList.contains('collapsed') || event.target.closest('h1')) {
block.classList.toggle('collapsed');
}
};
}
// actions
document.onclick = e => {
const target = e.target.closest('[data-cmd]');