Watcher shortcut, #55
This commit is contained in:
parent
b63e0b9a3f
commit
06900d0a21
@ -1,5 +1,6 @@
|
||||
seaweedchan:
|
||||
- Disable settings removing scroll bar when opened, thus fixing the issue where it jumps up the page randomly
|
||||
- Hide watcher by default, add [Watcher] shortcut.
|
||||
|
||||
### 1.1.12 - 2013-05-06
|
||||
detharonil
|
||||
|
||||
@ -6731,7 +6731,9 @@
|
||||
innerHTML: "<span id=post-count>0</span> / <span id=file-count>0</span>",
|
||||
id: 'thread-stats'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', "<div class=move><span id=post-count>0</span> / <span id=file-count>0</span></div>");
|
||||
$.ready(function() {
|
||||
@ -6796,7 +6798,9 @@
|
||||
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>",
|
||||
id: 'updater'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('updater', 'bottom: 0px; left: 0px;', "<div class=move></div><span id=update-status></span><span id=update-timer title='Update now'></span>");
|
||||
$.addClass(doc, 'float');
|
||||
@ -7190,13 +7194,28 @@
|
||||
|
||||
ThreadWatcher = {
|
||||
init: function() {
|
||||
var sc,
|
||||
_this = this;
|
||||
|
||||
if (!Conf['Thread Watcher']) {
|
||||
return;
|
||||
}
|
||||
this.sc = sc = $.el('a', {
|
||||
textContent: 'Watcher',
|
||||
id: 'watcher-link',
|
||||
href: 'javascript:;',
|
||||
className: 'disabled'
|
||||
});
|
||||
this.dialog = UI.dialog('watcher', 'top: 50px; left: 0px;', '<div class=move>Thread Watcher</div>');
|
||||
$.on(d, 'QRPostSuccessful', this.cb.post);
|
||||
$.on(d, '4chanXInitFinished', this.ready);
|
||||
$.sync('WatchedThreads', this.refresh);
|
||||
$.on(sc, 'click', this.toggleWatcher);
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
ThreadWatcher.refresh();
|
||||
$.add(d.body, ThreadWatcher.dialog);
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
});
|
||||
return Thread.prototype.callbacks.push({
|
||||
name: 'Thread Watcher',
|
||||
cb: this.node
|
||||
@ -7222,14 +7241,6 @@
|
||||
return $["delete"]('AutoWatch');
|
||||
});
|
||||
},
|
||||
ready: function() {
|
||||
$.off(d, '4chanXInitFinished', ThreadWatcher.ready);
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
ThreadWatcher.refresh();
|
||||
return $.add(d.body, ThreadWatcher.dialog);
|
||||
},
|
||||
refresh: function(watched) {
|
||||
var ID, board, div, favicon, id, link, nodes, props, thread, x, _ref, _ref1;
|
||||
|
||||
@ -7267,6 +7278,14 @@
|
||||
favicon.src = ID in watched ? Favicon["default"] : Favicon.empty;
|
||||
}
|
||||
},
|
||||
toggleWatcher: function() {
|
||||
$.toggleClass(ThreadWatcher.sc, 'disabled');
|
||||
if (ThreadWatcher.dialog.hidden) {
|
||||
return ThreadWatcher.dialog.hidden = false;
|
||||
} else {
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
}
|
||||
},
|
||||
cb: {
|
||||
toggle: function() {
|
||||
return ThreadWatcher.toggle(Get.postFromNode(this).thread);
|
||||
|
||||
@ -6752,7 +6752,9 @@
|
||||
innerHTML: "<span id=post-count>0</span> / <span id=file-count>0</span>",
|
||||
id: 'thread-stats'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', "<div class=move><span id=post-count>0</span> / <span id=file-count>0</span></div>");
|
||||
$.ready(function() {
|
||||
@ -6817,7 +6819,9 @@
|
||||
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>",
|
||||
id: 'updater'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('updater', 'bottom: 0px; left: 0px;', "<div class=move></div><span id=update-status></span><span id=update-timer title='Update now'></span>");
|
||||
$.addClass(doc, 'float');
|
||||
@ -7211,13 +7215,28 @@
|
||||
|
||||
ThreadWatcher = {
|
||||
init: function() {
|
||||
var sc,
|
||||
_this = this;
|
||||
|
||||
if (!Conf['Thread Watcher']) {
|
||||
return;
|
||||
}
|
||||
this.sc = sc = $.el('a', {
|
||||
textContent: 'Watcher',
|
||||
id: 'watcher-link',
|
||||
href: 'javascript:;',
|
||||
className: 'disabled'
|
||||
});
|
||||
this.dialog = UI.dialog('watcher', 'top: 50px; left: 0px;', '<div class=move>Thread Watcher</div>');
|
||||
$.on(d, 'QRPostSuccessful', this.cb.post);
|
||||
$.on(d, '4chanXInitFinished', this.ready);
|
||||
$.sync('WatchedThreads', this.refresh);
|
||||
$.on(sc, 'click', this.toggleWatcher);
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
ThreadWatcher.refresh();
|
||||
$.add(d.body, ThreadWatcher.dialog);
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
});
|
||||
return Thread.prototype.callbacks.push({
|
||||
name: 'Thread Watcher',
|
||||
cb: this.node
|
||||
@ -7243,14 +7262,6 @@
|
||||
return $["delete"]('AutoWatch');
|
||||
});
|
||||
},
|
||||
ready: function() {
|
||||
$.off(d, '4chanXInitFinished', ThreadWatcher.ready);
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
ThreadWatcher.refresh();
|
||||
return $.add(d.body, ThreadWatcher.dialog);
|
||||
},
|
||||
refresh: function(watched) {
|
||||
var ID, board, div, favicon, id, link, nodes, props, thread, x, _ref, _ref1;
|
||||
|
||||
@ -7288,6 +7299,14 @@
|
||||
favicon.src = ID in watched ? Favicon["default"] : Favicon.empty;
|
||||
}
|
||||
},
|
||||
toggleWatcher: function() {
|
||||
$.toggleClass(ThreadWatcher.sc, 'disabled');
|
||||
if (ThreadWatcher.dialog.hidden) {
|
||||
return ThreadWatcher.dialog.hidden = false;
|
||||
} else {
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
}
|
||||
},
|
||||
cb: {
|
||||
toggle: function() {
|
||||
return ThreadWatcher.toggle(Get.postFromNode(this).thread);
|
||||
|
||||
@ -6731,7 +6731,9 @@
|
||||
innerHTML: "<span id=post-count>0</span> / <span id=file-count>0</span>",
|
||||
id: 'thread-stats'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', "<div class=move><span id=post-count>0</span> / <span id=file-count>0</span></div>");
|
||||
$.ready(function() {
|
||||
@ -6796,7 +6798,9 @@
|
||||
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>",
|
||||
id: 'updater'
|
||||
});
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
return Header.addShortcut(sc);
|
||||
});
|
||||
} else {
|
||||
this.dialog = sc = UI.dialog('updater', 'bottom: 0px; left: 0px;', "<div class=move></div><span id=update-status></span><span id=update-timer title='Update now'></span>");
|
||||
$.addClass(doc, 'float');
|
||||
@ -7190,13 +7194,28 @@
|
||||
|
||||
ThreadWatcher = {
|
||||
init: function() {
|
||||
var sc,
|
||||
_this = this;
|
||||
|
||||
if (!Conf['Thread Watcher']) {
|
||||
return;
|
||||
}
|
||||
this.sc = sc = $.el('a', {
|
||||
textContent: 'Watcher',
|
||||
id: 'watcher-link',
|
||||
href: 'javascript:;',
|
||||
className: 'disabled'
|
||||
});
|
||||
this.dialog = UI.dialog('watcher', 'top: 50px; left: 0px;', '<div class=move>Thread Watcher</div>');
|
||||
$.on(d, 'QRPostSuccessful', this.cb.post);
|
||||
$.on(d, '4chanXInitFinished', this.ready);
|
||||
$.sync('WatchedThreads', this.refresh);
|
||||
$.on(sc, 'click', this.toggleWatcher);
|
||||
Header.addShortcut(sc);
|
||||
$.ready(function() {
|
||||
ThreadWatcher.refresh();
|
||||
$.add(d.body, ThreadWatcher.dialog);
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
});
|
||||
return Thread.prototype.callbacks.push({
|
||||
name: 'Thread Watcher',
|
||||
cb: this.node
|
||||
@ -7222,14 +7241,6 @@
|
||||
return $["delete"]('AutoWatch');
|
||||
});
|
||||
},
|
||||
ready: function() {
|
||||
$.off(d, '4chanXInitFinished', ThreadWatcher.ready);
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
ThreadWatcher.refresh();
|
||||
return $.add(d.body, ThreadWatcher.dialog);
|
||||
},
|
||||
refresh: function(watched) {
|
||||
var ID, board, div, favicon, id, link, nodes, props, thread, x, _ref, _ref1;
|
||||
|
||||
@ -7267,6 +7278,14 @@
|
||||
favicon.src = ID in watched ? Favicon["default"] : Favicon.empty;
|
||||
}
|
||||
},
|
||||
toggleWatcher: function() {
|
||||
$.toggleClass(ThreadWatcher.sc, 'disabled');
|
||||
if (ThreadWatcher.dialog.hidden) {
|
||||
return ThreadWatcher.dialog.hidden = false;
|
||||
} else {
|
||||
return ThreadWatcher.dialog.hidden = true;
|
||||
}
|
||||
},
|
||||
cb: {
|
||||
toggle: function() {
|
||||
return ThreadWatcher.toggle(Get.postFromNode(this).thread);
|
||||
|
||||
@ -6,7 +6,8 @@ ThreadStats =
|
||||
@dialog = sc = $.el 'span',
|
||||
innerHTML: "<span id=post-count>0</span> / <span id=file-count>0</span>"
|
||||
id: 'thread-stats'
|
||||
Header.addShortcut sc
|
||||
$.ready =>
|
||||
Header.addShortcut sc
|
||||
else
|
||||
@dialog = sc = UI.dialog 'thread-stats', 'bottom: 0px; right: 0px;',
|
||||
"<div class=move><span id=post-count>0</span> / <span id=file-count>0</span></div>"
|
||||
|
||||
@ -8,7 +8,8 @@ ThreadUpdater =
|
||||
@dialog = sc = $.el 'span',
|
||||
innerHTML: "<span id=update-status></span><span id=update-timer title='Update now'></span>"
|
||||
id: 'updater'
|
||||
Header.addShortcut sc
|
||||
$.ready =>
|
||||
Header.addShortcut sc
|
||||
else
|
||||
@dialog = sc = UI.dialog 'updater', 'bottom: 0px; left: 0px;',
|
||||
"<div class=move></div><span id=update-status></span><span id=update-timer title='Update now'></span>"
|
||||
|
||||
@ -1,12 +1,25 @@
|
||||
ThreadWatcher =
|
||||
init: ->
|
||||
return unless Conf['Thread Watcher']
|
||||
@sc = sc = $.el 'a',
|
||||
textContent: 'Watcher'
|
||||
id: 'watcher-link'
|
||||
href: 'javascript:;'
|
||||
className: 'disabled'
|
||||
|
||||
@dialog = UI.dialog 'watcher', 'top: 50px; left: 0px;',
|
||||
'<div class=move>Thread Watcher</div>'
|
||||
|
||||
$.on d, 'QRPostSuccessful', @cb.post
|
||||
$.on d, '4chanXInitFinished', @ready
|
||||
$.sync 'WatchedThreads', @refresh
|
||||
$.on sc, 'click', @toggleWatcher
|
||||
|
||||
|
||||
Header.addShortcut sc
|
||||
$.ready =>
|
||||
ThreadWatcher.refresh()
|
||||
$.add d.body, ThreadWatcher.dialog
|
||||
ThreadWatcher.dialog.hidden = true
|
||||
|
||||
Thread::callbacks.push
|
||||
name: 'Thread Watcher'
|
||||
@ -23,18 +36,12 @@ ThreadWatcher =
|
||||
ThreadWatcher.watch @
|
||||
$.delete 'AutoWatch'
|
||||
|
||||
ready: ->
|
||||
$.off d, '4chanXInitFinished', ThreadWatcher.ready
|
||||
return unless Main.isThisPageLegit()
|
||||
ThreadWatcher.refresh()
|
||||
$.add d.body, ThreadWatcher.dialog
|
||||
|
||||
refresh: (watched) ->
|
||||
unless watched
|
||||
$.get 'WatchedThreads', {}, (item) ->
|
||||
ThreadWatcher.refresh item['WatchedThreads']
|
||||
return
|
||||
nodes = [$('.move', ThreadWatcher.dialog)]
|
||||
nodes = [$('.move', ThreadWatcher.dialog)]
|
||||
for board of watched
|
||||
for id, props of watched[board]
|
||||
x = $.el 'a',
|
||||
@ -48,7 +55,7 @@ ThreadWatcher =
|
||||
div = $.el 'div'
|
||||
$.add div, [x, $.tn(' '), link]
|
||||
nodes.push div
|
||||
|
||||
|
||||
$.rmAll ThreadWatcher.dialog
|
||||
$.add ThreadWatcher.dialog, nodes
|
||||
|
||||
@ -61,6 +68,13 @@ ThreadWatcher =
|
||||
Favicon.empty
|
||||
return
|
||||
|
||||
toggleWatcher: ->
|
||||
$.toggleClass ThreadWatcher.sc, 'disabled'
|
||||
if ThreadWatcher.dialog.hidden
|
||||
ThreadWatcher.dialog.hidden = false
|
||||
else
|
||||
ThreadWatcher.dialog.hidden = true
|
||||
|
||||
cb:
|
||||
toggle: ->
|
||||
ThreadWatcher.toggle Get.postFromNode(@).thread
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user