fix thread watcher position

This commit is contained in:
James Campos 2011-03-12 15:52:36 -08:00
parent 88c88894d4
commit 1ef79b7bdd
2 changed files with 48 additions and 40 deletions

View File

@ -140,26 +140,30 @@
el.className = 'reply dialog'; el.className = 'reply dialog';
el.innerHTML = html; el.innerHTML = html;
el.id = id; el.id = id;
switch (position) { if (typeof position === 'object') {
case 'topleft': left = position.left, top = position.top;
left = '0px'; } else {
top = '0px'; switch (position) {
break; case 'topleft':
case 'topright': left = '0px';
left = null; top = '0px';
top = '0px'; break;
break; case 'topright':
case 'bottomleft': left = null;
left = '0px'; top = '0px';
top = null; break;
break; case 'bottomleft':
case 'bottomright': left = '0px';
left = null; top = null;
top = null; break;
break; case 'bottomright':
case 'center': left = null;
left = '50%'; top = null;
top = '25%'; break;
case 'center':
left = '50%';
top = '25%';
}
} }
left = GM_getValue("" + id + "Left", left); left = GM_getValue("" + id + "Left", left);
top = GM_getValue("" + id + "Top", top); top = GM_getValue("" + id + "Top", top);
@ -1798,8 +1802,10 @@
} }
if (getConfig('Thread Watcher')) { if (getConfig('Thread Watcher')) {
html = '<div class="move">Thread Watcher</div><div></div>'; html = '<div class="move">Thread Watcher</div><div></div>';
watcher = new Dialog('watcher', 'topleft', html).el; watcher = new Dialog('watcher', {
watcher.style.top = '50px'; top: '50px',
left: '0px'
}, html).el;
mv(watcher, d.body); mv(watcher, d.body);
watcherUpdate(); watcherUpdate();
threads = g.watched[g.BOARD] || []; threads = g.watched[g.BOARD] || [];

View File

@ -78,22 +78,25 @@ class Dialog
el.className = 'reply dialog' el.className = 'reply dialog'
el.innerHTML = html el.innerHTML = html
el.id = id el.id = id
switch position if typeof position is 'object'
when 'topleft' {left, top} = position
left = '0px' else
top = '0px' switch position
when 'topright' when 'topleft'
left = null left = '0px'
top = '0px' top = '0px'
when 'bottomleft' when 'topright'
left = '0px' left = null
top = null top = '0px'
when 'bottomright' when 'bottomleft'
left = null left = '0px'
top = null top = null
when 'center' when 'bottomright'
left = '50%' left = null
top = '25%' top = null
when 'center'
left = '50%'
top = '25%'
left = GM_getValue "#{id}Left", left left = GM_getValue "#{id}Left", left
top = GM_getValue "#{id}Top", top top = GM_getValue "#{id}Top", top
if left then el.style.left = left else el.style.right = '0px' if left then el.style.left = left else el.style.right = '0px'
@ -1364,8 +1367,7 @@ if getConfig 'Quick Report'
if getConfig 'Thread Watcher' if getConfig 'Thread Watcher'
#create watcher #create watcher
html = '<div class="move">Thread Watcher</div><div></div>' html = '<div class="move">Thread Watcher</div><div></div>'
watcher = new Dialog('watcher', 'topleft', html).el watcher = new Dialog('watcher', top: '50px', left: '0px', html).el
watcher.style.top = '50px' #don't cover the board links
mv watcher, d.body mv watcher, d.body
watcherUpdate() watcherUpdate()