Move dialog positions into Config.

This commit is contained in:
ccd0 2016-11-05 18:15:32 -07:00
parent 21a1c58c97
commit eb7c48af0c
8 changed files with 14 additions and 10 deletions

View File

@ -1,11 +1,9 @@
dialog = (id, position, properties) ->
dialog = (id, properties) ->
el = $.el 'div',
className: 'dialog'
id: id
$.extend el, properties
el.style.cssText = position
$.get "#{id}.position", position, (item) ->
(el.style.cssText = item["#{id}.position"])
el.style.cssText = Conf["#{id}.position"]
move = $ '.move', el
$.on move, 'touchstart mousedown', dragstart

View File

@ -5,7 +5,7 @@ Embedding =
@types[type.key] = type for type in @ordered_types
if Conf['Embedding']
@dialog = UI.dialog 'embedding', 'top: 50px; right: 0px;',
@dialog = UI.dialog 'embedding',
<%= readHTML('Embed.html') %>
@media = $ '#media-embed', @dialog
$.one d, '4chanXInitFinished', @ready

View File

@ -19,7 +19,7 @@ ThreadStats =
Header.addShortcut 'stats', sc, 200
else
@dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;',
@dialog = sc = UI.dialog 'thread-stats',
<%= html('<div class="move" title="${statsTitle}">&{statsHTML}</div>') %>
$.addClass doc, 'float'
$.ready ->

View File

@ -14,7 +14,7 @@ ThreadUpdater =
$.extend sc, <%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>
Header.addShortcut 'updater', sc, 100
else
@dialog = sc = UI.dialog 'updater', 'bottom: 0px; left: 0px;',
@dialog = sc = UI.dialog 'updater',
<%= html('<div class="move"></div><span id="update-status"></span><span id="update-timer" title="Update now"></span>') %>
$.addClass doc, 'float'
$.ready ->

View File

@ -10,7 +10,7 @@ ThreadWatcher =
className: 'fa fa-eye'
@db = new DataBoard 'watchedThreads', @refresh, true
@dialog = UI.dialog 'thread-watcher', 'top: 50px; left: 0px;', <%= readHTML('ThreadWatcher.html') %>
@dialog = UI.dialog 'thread-watcher', <%= readHTML('ThreadWatcher.html') %>
@status = $ '#watcher-status', @dialog
@list = @dialog.lastElementChild

View File

@ -456,7 +456,7 @@ QR =
dialog: ->
QR.nodes = nodes =
el: dialog = UI.dialog 'qr', 'top: 50px; right: 0px;',
el: dialog = UI.dialog 'qr',
<%= readHTML('QuickReply.html') %>
setNode = (name, query) ->

View File

@ -1053,3 +1053,10 @@ Config =
'Max Replies': 1000
'Autohiding Scrollbar': false
position:
'embedding.position': 'top: 50px; right: 0px;'
'thread-stats.position': 'bottom: 0px; right: 0px;'
'updater.position': 'bottom: 0px; left: 0px;'
'thread-watcher.position': 'top: 50px; left: 0px;'
'qr.position': 'top: 50px; right: 0px;'

View File

@ -602,7 +602,6 @@ $.clear = (cb) ->
# Also support case where GM_listValues is not defined.
$.delete Object.keys(Conf)
$.delete ['previousversion', 'QR Size', 'captchas', 'QR.persona', 'hiddenPSA']
$.delete ("#{id}.position" for id in ['embedding', 'updater', 'thread-stats', 'thread-watcher', 'qr'])
try
$.delete $.listValues().map (key) -> key.replace g.NAMESPACE, ''
cb?()