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