Merge remote-tracking branch 'saxamaphone69/settings-change'

This commit is contained in:
ccd0 2019-07-16 11:21:03 -07:00
commit 8dfc6ca665
3 changed files with 45 additions and 51 deletions

View File

@ -4,7 +4,7 @@ Settings =
link = $.el 'a',
className: 'settings-link fa fa-wrench'
textContent: 'Settings'
title: '<%= meta.name %> Settings'
title: '<%= meta.name %> Settings'
href: 'javascript:;'
$.on link, 'click', Settings.open
@ -38,16 +38,13 @@ Settings =
Object.defineProperty window, 'Config', {value: {disableAll: true}}
open: (openSection) ->
return if Settings.overlay
return if Settings.dialog
$.event 'CloseMenu'
Settings.dialog = dialog = $.el 'div',
id: 'fourchanx-settings'
className: 'dialog'
$.extend dialog, <%= readHTML('Settings.html') %>
Settings.overlay = overlay = $.el 'div',
id: 'overlay'
id: 'overlay'
,
<%= readHTML('Settings.html') %>
$.on $('.export', dialog), 'click', Settings.export
$.on $('.import', dialog), 'click', Settings.import
@ -68,10 +65,12 @@ Settings =
(if sectionToOpen then sectionToOpen else links[0]).click() unless openSection is 'none'
$.on $('.close', dialog), 'click', Settings.close
$.on overlay, 'click', Settings.close
$.on window, 'beforeunload', Settings.close
$.on dialog, 'click', Settings.close
$.on dialog.firstElementChild, 'click', (e) -> e.stopPropagation()
$.add d.body, [overlay, dialog]
$.addClass d.body, 'unscroll'
$.add d.body, dialog
$.event 'OpenSettings', null, dialog
@ -79,9 +78,8 @@ Settings =
return unless Settings.dialog
# Unfocus current field to trigger change event.
d.activeElement?.blur()
$.rm Settings.overlay
$.rmClass d.body, 'unscroll'
$.rm Settings.dialog
delete Settings.overlay
delete Settings.dialog
sections: []
@ -388,7 +386,7 @@ Settings =
if compareString < '00001.00011.00017.00006'
if data['sauces']?
set 'sauces', data['sauces'].replace(/^(#?\s*)http:\/\/iqdb\.org\//mg, '$1//iqdb.org/')
if compareString < '00001.00011.00019.00003' and not Settings.overlay
if compareString < '00001.00011.00019.00003' and not Settings.dialog
$.queueTask -> Settings.warnings.ads (item) -> new Notice 'warning', [item.childNodes...]
if compareString < '00001.00011.00020.00003'
for key, value of {'Inline Cross-thread Quotes Only': false, 'Pass Link': true}

View File

@ -1,15 +1,17 @@
<nav>
<div class="sections-list"></div>
<p class="imp-exp-result warning"></p>
<div class="credits">
<a class="export">Export</a>&nbsp|&nbsp
<a class="import">Import</a>&nbsp|&nbsp
<a class="reset">Reset Settings</a>&nbsp|&nbsp
<input type="file" hidden>
<a href="<%= meta.page %>" target="_blank"><%= meta.name %></a>&nbsp|&nbsp
<a href="<%= meta.changelog %>" target="_blank">${g.VERSION}</a>&nbsp|&nbsp
<a href="<%= meta.issues %>" target="_blank">Issues</a>&nbsp|&nbsp
<a href="javascript:;" class="close fa fa-times" title="Close"></a>
</div>
</nav>
<div class="section-container"><section></section></div>
<div id="fourchanx-settings" class="dialog">
<nav>
<div class="sections-list"></div>
<p class="imp-exp-result warning"></p>
<div class="credits">
<a class="export">Export</a>&nbsp|&nbsp
<a class="import">Import</a>&nbsp|&nbsp
<a class="reset">Reset Settings</a>&nbsp|&nbsp
<input type="file" hidden>
<a href="<%= meta.page %>" target="_blank"><%= meta.name %></a>&nbsp|&nbsp
<a href="<%= meta.changelog %>" target="_blank">${g.VERSION}</a>&nbsp|&nbsp
<a href="<%= meta.issues %>" target="_blank">Issues</a>&nbsp|&nbsp
<a href="javascript:;" class="close fa fa-times" title="Close"></a>
</div>
</nav>
<div class="section-container"><section></section></div>
</div>

View File

@ -186,7 +186,6 @@ audio.controls-added {
/* fixed, z-index */
#overlay,
#fourchanx-settings,
#qp, #ihover,
#navlinks, .fixed #header-bar,
:root.float #updater,
@ -194,11 +193,8 @@ audio.controls-added {
#qr {
position: fixed;
}
#fourchanx-settings {
z-index: 999;
}
#overlay {
z-index: 900;
z-index: 999;
}
#qp, #ihover {
z-index: 60;
@ -509,6 +505,8 @@ audio.controls-added {
}
#overlay {
background-color: rgba(0, 0, 0, .5);
display: -webkit-flex;
display: flex;
top: 0;
left: 0;
height: 100%;
@ -523,16 +521,16 @@ audio.controls-added {
width: 900px;
max-width: 100%;
margin: auto;
padding: 3px;
top: 50%;
left: 50%;
-moz-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding: 5px;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
}
#fourchanx-settings > nav {
padding: 2px 2px 0;
height: 15px;
padding: 2px 2px 8px;
display: -webkit-flex;
display: flex;
}
#fourchanx-settings > nav a {
text-decoration: underline;
@ -543,20 +541,16 @@ audio.controls-added {
margin: 0;
}
.section-container {
-webkit-flex: 1;
flex: 1;
position: relative;
overflow: auto;
position: absolute;
top: 2.1em;
right: 5px;
bottom: 5px;
left: 5px;
padding-top: 8px;
padding-right: 5px;
}
.sections-list {
padding: 0 3px;
float: left;
}
.credits {
float: right;
-webkit-flex: 1;
flex: 1;
}
.export, .import, .reset {
cursor: pointer;