From e19cbc8fc52c8fbcdbdd15e76f133e3e03ff0f4d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 04:53:52 +0200 Subject: [PATCH 1/6] Fix selector in watcher.watch(). --- 4chan_x.user.js | 4 ++-- script.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index c2d9bbbba..4156d45f3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1876,9 +1876,9 @@ }, watch: function(thread, id) { var el, props, watched, _name; - el = $('span.filetitle'); + el = $('span.filetitle', thread); if (!el.textContent) { - el = $('blockquote'); + el = $('blockquote', thread); if (!el.textContent) { return; } diff --git a/script.coffee b/script.coffee index 36f451a26..b1c99dd5b 100644 --- a/script.coffee +++ b/script.coffee @@ -1538,9 +1538,9 @@ watcher = watcher.refresh() watch: (thread, id) -> - el = $ 'span.filetitle' + el = $ 'span.filetitle', thread if not el.textContent - el = $ 'blockquote' + el = $ 'blockquote', thread if not el.textContent return props = From 026903528a1d8b541d391ecc3d70ff4a1a1fb88b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 05:16:08 +0200 Subject: [PATCH 2/6] Don't return watcher.watch() if there's no text. --- 4chan_x.user.js | 15 ++++++++------- script.coffee | 12 +++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 4156d45f3..73bee6fa0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1875,18 +1875,19 @@ return watcher.refresh(); }, watch: function(thread, id) { - var el, props, watched, _name; + var el, watched, _name; el = $('span.filetitle', thread); + props.href = "/" + g.BOARD + "/res/" + id; if (!el.textContent) { el = $('blockquote', thread); - if (!el.textContent) { - return; + 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 = { - textContent: "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)), - href: "/" + g.BOARD + "/res/" + id - }; watched = $.get('watched', {}); watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; diff --git a/script.coffee b/script.coffee index b1c99dd5b..2bcb43d8d 100644 --- a/script.coffee +++ b/script.coffee @@ -1539,13 +1539,15 @@ watcher = watch: (thread, id) -> el = $ 'span.filetitle', thread + props.href = "/#{g.BOARD}/res/#{id}" if not el.textContent el = $ 'blockquote', thread - if not el.textContent - return - props = - textContent: "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" - href: "/#{g.BOARD}/res/#{id}" + if el.textContent + props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" + else + props.textContent = d.title + else + props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" watched = $.get 'watched', {} watched[g.BOARD] or= {} From 450dfe5daa529580b677495554c09003d9d34e1c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 05:41:47 +0200 Subject: [PATCH 3/6] Fix #214 --- 4chan_x.user.js | 3 ++- script.coffee | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 73bee6fa0..65fb0f7b4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2284,9 +2284,10 @@ } else { qp.innerHTML = "Loading " + id + "..."; threadID = this.pathname.split('/').pop() || $.x('ancestor::div[@class="thread"]/div', this).id; - return $.cache(this.pathname, (function() { + $.cache(this.pathname, (function() { return quotePreview.parse(this, id, threadID); })); + return ui.hover(); } }, mouseout: function() { diff --git a/script.coffee b/script.coffee index 2bcb43d8d..48423580b 100644 --- a/script.coffee +++ b/script.coffee @@ -1790,6 +1790,7 @@ quotePreview = qp.innerHTML = "Loading #{id}..." threadID = @pathname.split('/').pop() or $.x('ancestor::div[@class="thread"]/div', @).id $.cache @pathname, (-> quotePreview.parse @, id, threadID) + ui.hover() mouseout: -> $.removeClass el, 'qphl' if el = $.id @hash[1..] ui.hoverend() From fbdc956a9f2d189896a20ff225e092d8cec0a900 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 06:14:29 +0200 Subject: [PATCH 4/6] Bring back auto post. Close #231 --- 4chan_x.user.js | 10 ++++++---- script.coffee | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 65fb0f7b4..200fdf542 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1216,7 +1216,7 @@ submit.disabled = false; submit.value = 'Submit'; } - if (!qr.postInvalid()) { + if (qr.el && $('#auto', qr.el).checked || !qr.postInvalid()) { return qr.submit.call($('form', qr.el)); } } @@ -1296,7 +1296,7 @@ THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; spoiler = $('.postarea label') ? '' : ''; challenge = $('#recaptcha_challenge_field').value; - html = " X
Quick Reply
" + spoiler + "
" + ($.get('captchas', []).length) + " captchas
"; + html = " X
Quick Reply
" + spoiler + "
" + ($.get('captchas', []).length) + " captchas
"; qr.el = ui.dialog('qr', { top: '0px', left: '0px' @@ -1875,9 +1875,11 @@ return watcher.refresh(); }, watch: function(thread, id) { - var el, watched, _name; + var el, props, watched, _name; el = $('span.filetitle', thread); - props.href = "/" + g.BOARD + "/res/" + id; + props = { + href: "/" + g.BOARD + "/res/" + id + }; if (!el.textContent) { el = $('blockquote', thread); if (el.textContent) { diff --git a/script.coffee b/script.coffee index 48423580b..800940f57 100644 --- a/script.coffee +++ b/script.coffee @@ -958,7 +958,7 @@ cooldown = for submit in submits submit.disabled = false submit.value = 'Submit' - unless qr.postInvalid() + if qr.el and $('#auto', qr.el).checked or not qr.postInvalid() qr.submit.call $ 'form', qr.el qr = @@ -1042,7 +1042,7 @@ qr =
#{spoiler}
-
+
#{$.get('captchas', []).length} captchas
@@ -1539,7 +1539,8 @@ watcher = watch: (thread, id) -> el = $ 'span.filetitle', thread - props.href = "/#{g.BOARD}/res/#{id}" + props = + href: "/#{g.BOARD}/res/#{id}" if not el.textContent el = $ 'blockquote', thread if el.textContent From 41ad2541dd4db6955abb5633b4e661f92a982be6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 06:19:47 +0200 Subject: [PATCH 5/6] Don't start the post cooldown on thread creation. Close #230 --- 4chan_x.user.js | 4 +++- script.coffee | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 200fdf542..fb3cefd07 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1183,7 +1183,9 @@ return cooldown.start(); } }); - return $('.postarea form').action += '?cooldown'; + if (g.REPLY) { + return $('.postarea form').action += '?cooldown'; + } }, start: function() { var submit, _i, _len, _ref; diff --git a/script.coffee b/script.coffee index 800940f57..264b50a64 100644 --- a/script.coffee +++ b/script.coffee @@ -938,7 +938,7 @@ cooldown = $.set g.BOARD+'/cooldown', time if $.get(g.BOARD+'/cooldown', 0) < time cooldown.start() if Date.now() < $.get g.BOARD+'/cooldown', 0 $.bind window, 'storage', (e) -> cooldown.start() if e.key is "#{NAMESPACE}#{g.BOARD}/cooldown" - $('.postarea form').action += '?cooldown' + $('.postarea form').action += '?cooldown' if g.REPLY start: -> cooldown.duration = Math.ceil ($.get(g.BOARD+'/cooldown', 0) - Date.now()) / 1000 From 6b84e0ed48ad56e0afd51adbe1018763d7f3bdd8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 23 Aug 2011 06:25:15 +0200 Subject: [PATCH 6/6] Changelog --- changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog b/changelog index 6b4598a74..e22016044 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +GitHub +- mayhem: + bring back auto posting + don't start the cooldown on thread creation +- aeosynth: + show linebreaks as spaces in title & watcher + 11.8.15 - aeosynth: convert qr from hidden iframes to ajax