From c3331c43e1ed66e713a2fa55a62f7264a0f86e0c Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 15 Jan 2011 15:12:08 -0800 Subject: [PATCH] dialog centering --- 4chan_x.coffee | 19 +++++++++++-------- 4chan_x.js | 9 ++++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 646d7a4d2..a00121a3d 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -80,20 +80,23 @@ AEOS = switch position when 'topleft' left = '0px' - top = '0px' + top = '0px' when 'topright' left = null - top = '0px' + top = '0px' when 'bottomleft' left = '0px' - top = null + top = null when 'bottomright' left = null - top = null + top = null + when 'center' + left = '50%' + top = '25%' left = GM_getValue "#{id}Left", left - top = GM_getValue "#{id}Top", top - if left then dialog.style.left = left else dialog.style.right = '0px' - if top then dialog.style.top = top else dialog.style.bottom = '0px' + top = GM_getValue "#{id}Top", top + if left then dialog.style.left = left else dialog.style.right = '0px' + if top then dialog.style.top = top else dialog.style.bottom = '0px' $('div.move', dialog).addEventListener 'mousedown', AEOS.move, true $('div.move a[name=close]', dialog)?.addEventListener 'click', (-> remove $ id), true @@ -1219,7 +1222,7 @@ if getConfig 'Quick Report' if getConfig 'Thread Watcher' #create watcher - watcher.innerHTML = '
Thread Watcher
' + html = '
Thread Watcher
' watcher = AEOS.makeDialog 'watcher', 'topleft', html addTo d.body, watcher watcherUpdate() diff --git a/4chan_x.js b/4chan_x.js index fa9088a9e..1690380fa 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -94,6 +94,10 @@ case 'bottomright': left = null; top = null; + break; + case 'center': + left = '50%'; + top = '25%'; } left = GM_getValue("" + id + "Left", left); top = GM_getValue("" + id + "Top", top); @@ -1379,8 +1383,7 @@ if (getConfig('Image Expansion')) { delform = $('form[name=delform]'); expand = n('div', { - innerHTML: '\ - ' + innerHTML: "" }); $("input", expand).addEventListener('click', imageExpandClick, true); inBefore(delform.firstChild, expand); @@ -1523,7 +1526,7 @@ }); } if (getConfig('Thread Watcher')) { - watcher.innerHTML = '
Thread Watcher
'; + html = '
Thread Watcher
'; watcher = AEOS.makeDialog('watcher', 'topleft', html); addTo(d.body, watcher); watcherUpdate();