From 2985529016f941c1f694e5e81f2b8fac7d36e5bb Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 16 Apr 2011 19:59:59 -0700 Subject: [PATCH] titlepost --- 4chan_x.js | 16 +++++++++------- script.coffee | 10 ++++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 0b5c78dc2..c3d01629c 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -59,7 +59,7 @@ */ (function() { - var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, localize, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, sauce, scroll, temp, text, threadHiding, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4; + var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, localize, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, sauce, scroll, temp, threadHiding, titlePost, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4; var __slice = Array.prototype.slice; if (typeof console != "undefined" && console !== null) { log = console.log; @@ -1647,6 +1647,13 @@ }); } }; + titlePost = { + init: function() { + var el; + el = $('span.filetitle') || $('blockquote'); + return d.title = "/" + g.BOARD + "/ - " + el.textContent; + } + }; imageClick = function(e) { if (e.shiftKey || e.altKey || e.ctrlKey) { return; @@ -2148,12 +2155,7 @@ qr.persist(); } if ($.config('Post in Title')) { - if (!(text = $('span.filetitle').textContent)) { - text = $('blockquote').textContent; - } - if (text) { - d.title = "/" + g.BOARD + "/ - " + text; - } + titlePost.init(); } if ($.config('Unread Count')) { g.replies = []; diff --git a/script.coffee b/script.coffee index fc750cd67..27ecc2820 100644 --- a/script.coffee +++ b/script.coffee @@ -1290,6 +1290,11 @@ localize = ][date.getDay()] s.textContent = " #{month}/#{day}/#{year}(#{dotw})#{hour}:#{min_sec} " +titlePost = + init: -> + el = $('span.filetitle') or $('blockquote') + d.title = "/#{g.BOARD}/ - #{el.textContent}" + # TODO rewrite these ************************************************************************** imageClick = (e) -> @@ -1693,10 +1698,7 @@ if g.REPLY if $.config('Quick Reply') and $.config 'Persistent QR' qr.persist() if $.config 'Post in Title' - unless text = $('span.filetitle').textContent - text = $('blockquote').textContent - if text - d.title = "/#{g.BOARD}/ - #{text}" + titlePost.init() if $.config 'Unread Count' g.replies = [] d.title = '(0) ' + d.title