From a784a608ec43cdac2f746a46b1898fdf2b6cafc4 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 23 Aug 2011 18:25:27 -0700 Subject: [PATCH] refactor --- 4chan_x.user.js | 14 ++++---------- script.coffee | 11 +++-------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4a16884ed..f624cc3f1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1881,19 +1881,13 @@ watch: function(thread, id) { var el, props, watched, _name; el = $('span.filetitle', thread); - props = { - href: "/" + g.BOARD + "/res/" + id - }; if (!el.textContent) { el = $('blockquote', thread); - if (el.textContent) { - props.textContent = "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)); - } else { - props.textContent = d.title; - } - } else { - props.textContent = "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)); } + props = { + href: "/" + g.BOARD + "/res/" + id, + textContent: el.textContent ? "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)) : d.title + }; watched = $.get('watched', {}); watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; diff --git a/script.coffee b/script.coffee index c6aa1decb..75d267c4b 100644 --- a/script.coffee +++ b/script.coffee @@ -1541,16 +1541,11 @@ watcher = watch: (thread, id) -> el = $ 'span.filetitle', thread - props = - href: "/#{g.BOARD}/res/#{id}" if not el.textContent el = $ 'blockquote', thread - if el.textContent - props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" - else - props.textContent = d.title - else - props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" + props = + href: "/#{g.BOARD}/res/#{id}" + textContent: if el.textContent then "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" else d.title watched = $.get 'watched', {} watched[g.BOARD] or= {}