From 4b61eb230cc0a8bd998291b384bb61def5477be3 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 20 Dec 2010 09:34:55 -0800 Subject: [PATCH] fix w keybind --- 4chan_x.coffee | 9 +++++---- 4chan_x.js | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 6db8a364a..dbbbc112b 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -555,8 +555,9 @@ keyModeNormal = (e) -> else GM_openInTab href when "W" - watchButton = $("#{hash} ~ img") - watch.call watchButton + root = if g.REPLY then null else getThread()[0] + watchButton = $ "span.filesize ~ img", root + watch.call watchButton nodeInserted = (e) -> target = e.target @@ -801,7 +802,7 @@ threadF = (current) -> watch = -> id = @nextSibling.name - if @src[0] is 'd'#data:png + if @src is g.favEmpty @src = g.favNormal text = "/#{g.BOARD}/ - " + x('following-sibling::blockquote', this).textContent.slice(0,25) @@ -847,7 +848,7 @@ g = callbacks: [] count: 0 expand: false - favEmpty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==' + favEmpty: 'http://static.4chan.org/image/favicon-dis.ico' favNormal: $('link[rel="shortcut icon"]', $('head', d))?.href or 'http://static.4chan.org/image/favicon.ico' flavors: [ 'http://regex.info/exif.cgi?url=' diff --git a/4chan_x.js b/4chan_x.js index eeb2cb7fc..69d9195ae 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -723,7 +723,8 @@ } break; case "W": - watchButton = $("" + hash + " ~ img"); + root = g.REPLY ? null : getThread()[0]; + watchButton = $("span.filesize ~ img", root); return watch.call(watchButton); } }; @@ -1063,7 +1064,7 @@ watch = function() { var id, text, _base, _name; id = this.nextSibling.name; - if (this.src[0] === 'd') { + if (this.src === g.favEmpty) { this.src = g.favNormal; text = ("/" + g.BOARD + "/ - ") + x('following-sibling::blockquote', this).textContent.slice(0, 25); (_base = g.watched)[_name = g.BOARD] || (_base[_name] = []); @@ -1116,7 +1117,7 @@ callbacks: [], count: 0, expand: false, - favEmpty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==', + favEmpty: 'http://static.4chan.org/image/favicon-dis.ico', favNormal: ((_ref = $('link[rel="shortcut icon"]', $('head', d))) != null ? _ref.href : void 0) || 'http://static.4chan.org/image/favicon.ico', flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://saucenao.com/search.php?db=999&url=', 'http://tineye.com/search?url='].join('\n'), iframe: false,