From b0b252493f35e2c17c1e66974d4b05590537751d Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 14 Sep 2011 14:22:02 -0700 Subject: [PATCH 01/19] check for script updates --- 4chan_x.user.js | 36 +++++++++++++++++++++++++++--------- latest.js | 1 + script.coffee | 28 +++++++++++++++++++++------- 3 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 latest.js diff --git a/4chan_x.user.js b/4chan_x.user.js index f05d6c6f5..97470a2ea 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -60,7 +60,7 @@ */ (function() { - var $, $$, DAY, Favicon, HOUR, MINUTE, NAMESPACE, Recaptcha, SECOND, Time, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; + var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, VERSION, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; var __slice = Array.prototype.slice; config = { main: { @@ -73,7 +73,8 @@ 'Comment Expansion': [true, 'Expand too long comments'], 'Thread Expansion': [true, 'View all replies'], 'Index Navigation': [true, 'Navigate to previous / next thread'], - 'Reply Navigation': [false, 'Navigate to top / bottom of thread'] + 'Reply Navigation': [false, 'Navigate to top / bottom of thread'], + 'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)'] }, Hiding: { 'Reply Hiding': [true, 'Hide single replies'], @@ -187,6 +188,7 @@ } })(null, config); NAMESPACE = 'AEOS.4chan_x.'; + VERSION = 'master'; SECOND = 1000; MINUTE = 60 * SECOND; HOUR = 60 * MINUTE; @@ -1272,7 +1274,6 @@ init: function() { var iframe; g.callbacks.push(qr.node); - $.bind(window, 'message', qr.message); $.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode); qr.captchaTime = Date.now(); qr.spoiler = $('.postarea label') ? '' : ''; @@ -2832,10 +2833,10 @@ return $.unbind(window, 'click', firstRun.close); } }; - main = { + Main = { init: function() { var callback, canPost, cutoff, form, hiddenThreads, id, lastChecked, now, op, pathname, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5; - $.unbind(window, 'load', main.init); + $.unbind(window, 'load', Main.init); pathname = location.pathname.substring(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; if (temp === 'res') { @@ -2855,6 +2856,7 @@ if (!$('#navtopr')) { return; } + $.bind(window, 'message', Main.message); Favicon.init(); g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {}); tzOffset = (new Date()).getTimezoneOffset() / 60; @@ -2865,6 +2867,12 @@ lastChecked = $.get('lastChecked', 0); now = Date.now(); if (lastChecked < now - 1 * DAY) { + $.set('lastChecked', now); + if (conf['Check for Updates'] && VERSION !== 'master') { + $.add($.el('script', { + src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' + })); + } cutoff = now - 7 * DAY; hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); for (id in hiddenThreads) { @@ -2882,9 +2890,8 @@ } $.set("hiddenThreads/" + g.BOARD + "/", hiddenThreads); $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies); - $.set('lastChecked', now); } - $.addStyle(main.css); + $.addStyle(Main.css); if ((form = $('form[name=post]')) && (canPost = !!$('#recaptcha_response_field'))) { Recaptcha.init(); if (g.REPLY && conf['Auto Watch Reply'] && conf['Thread Watcher']) { @@ -3016,6 +3023,17 @@ return firstRun.init(); } }, + message: function(e) { + var data, origin; + origin = e.origin, data = e.data; + if (origin === 'http://sys.4chan.org') { + return qr.message(data); + } else { + if (data !== VERSION) { + return alert('new version of 4chan x available on github!'); + } + } + }, css: '\ /* dialog styling */\ div.dialog {\ @@ -3226,8 +3244,8 @@ ' }; if (d.body) { - main.init(); + Main.init(); } else { - $.bind(window, 'load', main.init); + $.bind(window, 'load', Main.init); } }).call(this); diff --git a/latest.js b/latest.js new file mode 100644 index 000000000..41c3a21f3 --- /dev/null +++ b/latest.js @@ -0,0 +1 @@ +window.postMessage('master', '*'); diff --git a/script.coffee b/script.coffee index f671b62f2..0a57c3628 100644 --- a/script.coffee +++ b/script.coffee @@ -10,6 +10,7 @@ config = 'Thread Expansion': [true, 'View all replies'] 'Index Navigation': [true, 'Navigate to previous / next thread'] 'Reply Navigation': [false, 'Navigate to top / bottom of thread'] + 'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)'] Hiding: 'Reply Hiding': [true, 'Hide single replies'] 'Thread Hiding': [true, 'Hide entire threads'] @@ -111,6 +112,7 @@ conf = {} ) null, config NAMESPACE = 'AEOS.4chan_x.' +VERSION = 'master' SECOND = 1000 MINUTE = 60*SECOND HOUR = 60*MINUTE @@ -969,7 +971,6 @@ qr = # email reverts init: -> g.callbacks.push qr.node - $.bind window, 'message', qr.message $.bind $('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode qr.captchaTime = Date.now() @@ -2183,9 +2184,9 @@ firstRun = $.rm $ '#overlay' $.unbind window, 'click', firstRun.close -main = +Main = init: -> - $.unbind window, 'load', main.init + $.unbind window, 'load', Main.init pathname = location.pathname.substring(1).split('/') [g.BOARD, temp] = pathname if temp is 'res' @@ -2203,6 +2204,7 @@ main = if not $ '#navtopr' return + $.bind window, 'message', Main.message Favicon.init() g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {} tzOffset = (new Date()).getTimezoneOffset() / 60 @@ -2213,6 +2215,11 @@ main = lastChecked = $.get 'lastChecked', 0 now = Date.now() if lastChecked < now - 1*DAY + $.set 'lastChecked', now + + if conf['Check for Updates'] and VERSION isnt 'master' + $.add $.el 'script', src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' + cutoff = now - 7*DAY hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} @@ -2226,9 +2233,8 @@ main = $.set "hiddenThreads/#{g.BOARD}/", hiddenThreads $.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies - $.set 'lastChecked', now - $.addStyle main.css + $.addStyle Main.css #recaptcha may be blocked, eg by noscript if (form = $ 'form[name=post]') and (canPost = !!$ '#recaptcha_response_field') @@ -2348,6 +2354,14 @@ main = unless $.get 'firstrun' firstRun.init() + message: (e) -> + {origin, data} = e + if origin is 'http://sys.4chan.org' + qr.message data + else + if data isnt VERSION + alert 'new version of 4chan x available on github!' + css: ' /* dialog styling */ div.dialog { @@ -2559,6 +2573,6 @@ main = #XXX Opera will load early if script is saved w/o .user if d.body - main.init() + Main.init() else - $.bind window, 'load', main.init + $.bind window, 'load', Main.init From 8926d5a45e5ad8dd6350dc9e5758ac8f64cbb99f Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 14 Sep 2011 14:24:53 -0700 Subject: [PATCH 02/19] derp --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 97470a2ea..653c3f9c6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2869,7 +2869,7 @@ if (lastChecked < now - 1 * DAY) { $.set('lastChecked', now); if (conf['Check for Updates'] && VERSION !== 'master') { - $.add($.el('script', { + $.add(d.head, $.el('script', { src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' })); } diff --git a/script.coffee b/script.coffee index 0a57c3628..955e18995 100644 --- a/script.coffee +++ b/script.coffee @@ -2218,7 +2218,7 @@ Main = $.set 'lastChecked', now if conf['Check for Updates'] and VERSION isnt 'master' - $.add $.el 'script', src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' + $.add d.head, $.el 'script', src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' cutoff = now - 7*DAY hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} From c3156eaac145315b7037a65fc5a09379240cd581 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 14 Sep 2011 14:31:29 -0700 Subject: [PATCH 03/19] another derp --- 4chan_x.user.js | 5 ++--- script.coffee | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 653c3f9c6..ccfa3e9a6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1376,11 +1376,10 @@ $.bind($('#dummy', qr.el), 'keydown', qr.captchaKeydown); return $.add(d.body, qr.el); }, - message: function(e) { - var data, duration, fileCount; + message: function(data) { + var duration, fileCount; $('iframe[name=iframe]').src = 'about:blank'; fileCount = $('#files', qr.el).childElementCount; - data = e.data; if (data) { data = JSON.parse(data); $.extend($('#error', qr.el), data); diff --git a/script.coffee b/script.coffee index 955e18995..87d7d5385 100644 --- a/script.coffee +++ b/script.coffee @@ -1084,11 +1084,10 @@ qr = $.add d.body, qr.el - message: (e) -> + message: (data) -> $('iframe[name=iframe]').src = 'about:blank' fileCount = $('#files', qr.el).childElementCount - {data} = e if data # error message data = JSON.parse data $.extend $('#error', qr.el), data From 49605c503558c21747df499efbf29ecaaa5b5d50 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 15 Sep 2011 22:23:01 +0200 Subject: [PATCH 04/19] Typo. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index f05d6c6f5..2b3c86f47 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1740,7 +1740,7 @@ html += "
"; } checked = conf['Auto Update'] ? 'checked' : ''; - html += "
"; + html += "
"; dialog = ui.dialog('updater', { bottom: '0', right: '0' diff --git a/script.coffee b/script.coffee index f671b62f2..34704926c 100644 --- a/script.coffee +++ b/script.coffee @@ -1387,7 +1387,7 @@ updater = checked = if conf['Auto Update'] then 'checked' else '' html += " -
+
" From 25a19782303ace40793cc30ac6506b5dcb372036 Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 15 Sep 2011 22:16:20 -0700 Subject: [PATCH 05/19] Revert "another derp" This reverts commit c3156eaac145315b7037a65fc5a09379240cd581. --- 4chan_x.user.js | 5 +++-- script.coffee | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ccfa3e9a6..653c3f9c6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1376,10 +1376,11 @@ $.bind($('#dummy', qr.el), 'keydown', qr.captchaKeydown); return $.add(d.body, qr.el); }, - message: function(data) { - var duration, fileCount; + message: function(e) { + var data, duration, fileCount; $('iframe[name=iframe]').src = 'about:blank'; fileCount = $('#files', qr.el).childElementCount; + data = e.data; if (data) { data = JSON.parse(data); $.extend($('#error', qr.el), data); diff --git a/script.coffee b/script.coffee index 87d7d5385..955e18995 100644 --- a/script.coffee +++ b/script.coffee @@ -1084,10 +1084,11 @@ qr = $.add d.body, qr.el - message: (data) -> + message: (e) -> $('iframe[name=iframe]').src = 'about:blank' fileCount = $('#files', qr.el).childElementCount + {data} = e if data # error message data = JSON.parse data $.extend $('#error', qr.el), data From 61167dc79265bcfe5d7625c850131c30d8826c9a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 16 Sep 2011 18:29:46 +0200 Subject: [PATCH 06/19] Hide inlined quotes within the quote preview. --- 4chan_x.user.js | 2 +- changelog | 2 ++ script.coffee | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 84c7925d8..1938f3528 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3215,7 +3215,7 @@ border: 1px solid;\ padding-bottom: 5px;\ }\ - #qp input {\ + #qp input, #qp .inline {\ display: none;\ }\ .qphl {\ diff --git a/changelog b/changelog index 8b80cbe0a..7613dffb6 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- mayhem + do not display inlined quotes within the quote preview 2.19.3 - mayhem diff --git a/script.coffee b/script.coffee index a118719ae..96ce86b7c 100644 --- a/script.coffee +++ b/script.coffee @@ -2543,7 +2543,7 @@ Main = border: 1px solid; padding-bottom: 5px; } - #qp input { + #qp input, #qp .inline { display: none; } .qphl { From e9343bff56708bdf6e45b1bc4660a08a682a587c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 16 Sep 2011 23:07:37 +0200 Subject: [PATCH 07/19] Fix cross quotes within cross quotes; We need to go deeper; God damn moot --- 4chan_x.user.js | 12 ++++++++---- changelog | 1 + script.coffee | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 1938f3528..5502d2572 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -652,7 +652,7 @@ } }, parse: function(req, pathname, thread, a) { - var body, br, link, next, quote, reply, table, tables, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _results; + var body, br, href, link, next, quote, reply, table, tables, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _results; if (req.status !== 200) { a.textContent = "" + req.status + " " + req.statusText; $.unbind(a, 'click', expandThread.cb.toggle); @@ -672,8 +672,10 @@ _ref2 = $$('a.quotelink', reply); for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { quote = _ref2[_j]; - if (quote.getAttribute('href') === quote.hash) { + if ((href = quote.getAttribute('href')) === quote.hash) { quote.pathname = pathname; + } else if (href !== quote.href) { + quote.href = "res/" + href; } } link = $('a.quotejs', reply); @@ -2289,7 +2291,7 @@ return $.addClass(this, 'inlined'); }, parse: function(req, pathname, id, threadID, inline) { - var body, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; + var body, href, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; if (!inline.parentNode) { return; } @@ -2317,8 +2319,10 @@ _ref2 = $$('a.quotelink', newInline); for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { quote = _ref2[_j]; - if (quote.getAttribute('href') === quote.hash) { + if ((href = quote.getAttribute('href')) === quote.hash) { quote.pathname = pathname; + } else if (!g.REPLY && href !== quote.href) { + quote.href = "res/" + href; } } link = $('a.quotejs', newInline); diff --git a/changelog b/changelog index 7613dffb6..dc615e9b2 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - mayhem do not display inlined quotes within the quote preview + fix cross threads quotes in expanded threads or inlined cross quotes 2.19.3 - mayhem diff --git a/script.coffee b/script.coffee index 96ce86b7c..afbc0161c 100644 --- a/script.coffee +++ b/script.coffee @@ -476,8 +476,10 @@ expandThread = for reply in $$ 'td[id]', body for quote in $$ 'a.quotelink', reply - if quote.getAttribute('href') is quote.hash + if (href = quote.getAttribute('href')) is quote.hash #add pathname to normal quotes quote.pathname = pathname + else if href isnt quote.href #fix x-thread links, not x-board ones + quote.href = "res/#{href}" link = $ 'a.quotejs', reply link.href = "res/#{thread.firstChild.id}##{reply.id}" link.nextSibling.href = "res/#{thread.firstChild.id}#q#{reply.id}" @@ -1786,8 +1788,10 @@ quoteInline = break newInline = quoteInline.table id, html for quote in $$ 'a.quotelink', newInline - if quote.getAttribute('href') is quote.hash + if (href = quote.getAttribute('href')) is quote.hash #add pathname to normal quotes quote.pathname = pathname + else if !g.REPLY and href isnt quote.href #fix x-thread links, not x-board ones + quote.href = "res/#{href}" link = $ 'a.quotejs', newInline link.href = "#{pathname}##{id}" link.nextSibling.href = "#{pathname}#q#{id}" From 716c34aa7c9b857b836c0d6fe295bb56ee2f6d34 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 17 Sep 2011 22:17:05 +0200 Subject: [PATCH 08/19] Save ui position only once. I noticed that Chrome deletes empty localStorage keys when closing it. Dragging the QR to the bottom right would save empty top/right keys, resulting in its position reset when restarting the browser. --- 4chan_x.user.js | 29 +++++++++++++++-------------- script.coffee | 14 +++++++------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5502d2572..366f09911 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -199,23 +199,25 @@ }; ui = { dialog: function(id, position, html) { - var el, left, top, _ref, _ref2; + var el, left, saved, top; el = d.createElement('div'); el.className = 'reply dialog'; el.innerHTML = html; el.id = id; - left = position.left, top = position.top; - left = (_ref = localStorage["" + NAMESPACE + id + "Left"]) != null ? _ref : left; - top = (_ref2 = localStorage["" + NAMESPACE + id + "Top"]) != null ? _ref2 : top; - if (left) { - el.style.left = left; + if (saved = localStorage["" + NAMESPACE + id + ".position"]) { + el.style.cssText = saved; } else { - el.style.right = 0; - } - if (top) { - el.style.top = top; - } else { - el.style.bottom = 0; + left = position.left, top = position.top; + if (left) { + el.style.left = left; + } else { + el.style.right = 0; + } + if (top) { + el.style.top = top; + } else { + el.style.bottom = 0; + } } el.querySelector('div.move').addEventListener('mousedown', ui.dragstart, false); return el; @@ -259,8 +261,7 @@ var el, id; el = ui.el; id = el.id; - localStorage["" + NAMESPACE + id + "Left"] = el.style.left; - localStorage["" + NAMESPACE + id + "Top"] = el.style.top; + localStorage["" + NAMESPACE + id + ".position"] = el.style.cssText; d.removeEventListener('mousemove', ui.drag, false); return d.removeEventListener('mouseup', ui.dragend, false); }, diff --git a/script.coffee b/script.coffee index afbc0161c..e0ce98f59 100644 --- a/script.coffee +++ b/script.coffee @@ -126,11 +126,12 @@ ui = el.className = 'reply dialog' el.innerHTML = html el.id = id - {left, top} = position - left = localStorage["#{NAMESPACE}#{id}Left"] ? left - top = localStorage["#{NAMESPACE}#{id}Top"] ? top - if left then el.style.left = left else el.style.right = 0 - if top then el.style.top = top else el.style.bottom = 0 + if saved = localStorage["#{NAMESPACE}#{id}.position"] + el.style.cssText = saved + else + {left, top} = position + if left then el.style.left = left else el.style.right = 0 + if top then el.style.top = top else el.style.bottom = 0 el.querySelector('div.move').addEventListener 'mousedown', ui.dragstart, false el dragstart: (e) -> @@ -170,8 +171,7 @@ ui = #a = (b = c.b, c).a; {el} = ui {id} = el - localStorage["#{NAMESPACE}#{id}Left"] = el.style.left - localStorage["#{NAMESPACE}#{id}Top"] = el.style.top + localStorage["#{NAMESPACE}#{id}.position"] = el.style.cssText d.removeEventListener 'mousemove', ui.drag, false d.removeEventListener 'mouseup', ui.dragend, false hover: (e) -> From afd9830168b6e2140b418230f13f268599d01b7d Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 17 Sep 2011 22:31:19 +0200 Subject: [PATCH 09/19] Go deeper, shave lines. --- 4chan_x.user.js | 38 ++++++-------------------------------- script.coffee | 15 +++++---------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 366f09911..37c71aea1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -199,26 +199,12 @@ }; ui = { dialog: function(id, position, html) { - var el, left, saved, top; + var el, saved; el = d.createElement('div'); el.className = 'reply dialog'; el.innerHTML = html; el.id = id; - if (saved = localStorage["" + NAMESPACE + id + ".position"]) { - el.style.cssText = saved; - } else { - left = position.left, top = position.top; - if (left) { - el.style.left = left; - } else { - el.style.right = 0; - } - if (top) { - el.style.top = top; - } else { - el.style.bottom = 0; - } - } + el.style.cssText = (saved = localStorage["" + NAMESPACE + id + ".position"]) ? saved : position; el.querySelector('div.move').addEventListener('mousedown', ui.dragstart, false); return el; }, @@ -1363,10 +1349,7 @@ THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; qr.challenge = $('#recaptcha_challenge_field').value; html = " X
Quick Reply
" + qr.spoiler + "
" + ($.get('captchas', []).length) + " captchas
"; - qr.el = ui.dialog('qr', { - top: '0px', - left: '0px' - }, html); + qr.el = ui.dialog('qr', 'top: 0; left: 0;', html); $.bind($('input[name=name]', qr.el), 'mousedown', function(e) { return e.stopPropagation(); }); @@ -1744,10 +1727,7 @@ } checked = conf['Auto Update'] ? 'checked' : ''; html += "
"; - dialog = ui.dialog('updater', { - bottom: '0', - right: '0' - }, html); + dialog = ui.dialog('updater', 'bottom: 0; right: 0;', html); updater.count = $('#count', dialog); updater.timer = $('#timer', dialog); updater.br = $('br[clear]'); @@ -1875,10 +1855,7 @@ init: function() { var favicon, html, input, inputs, _i, _len; html = '
Thread Watcher
'; - watcher.dialog = ui.dialog('watcher', { - top: '50px', - left: '0px' - }, html); + watcher.dialog = ui.dialog('watcher', 'top: 50px; left: 0px;', html); $.add(d.body, watcher.dialog); inputs = $$('.op input'); for (_i = 0, _len = inputs.length; _i < _len; _i++) { @@ -2474,10 +2451,7 @@ threadStats.posts = 1; threadStats.images = $('.op img[md5]') ? 1 : 0; html = "
" + threadStats.posts + " / " + threadStats.images + "
"; - dialog = ui.dialog('stats', { - bottom: '0px', - left: '0px' - }, html); + dialog = ui.dialog('stats', 'bottom: 0; left: 0;', html); dialog.className = 'dialog'; threadStats.postcountEl = $('#postcount', dialog); threadStats.imagecountEl = $('#imagecount', dialog); diff --git a/script.coffee b/script.coffee index e0ce98f59..1698fe712 100644 --- a/script.coffee +++ b/script.coffee @@ -126,12 +126,7 @@ ui = el.className = 'reply dialog' el.innerHTML = html el.id = id - if saved = localStorage["#{NAMESPACE}#{id}.position"] - el.style.cssText = saved - else - {left, top} = position - if left then el.style.left = left else el.style.right = 0 - if top then el.style.top = top else el.style.bottom = 0 + el.style.cssText = if saved = localStorage["#{NAMESPACE}#{id}.position"] then saved else position el.querySelector('div.move').addEventListener 'mousedown', ui.dragstart, false el dragstart: (e) -> @@ -1073,7 +1068,7 @@ qr = " - qr.el = ui.dialog 'qr', top: '0px', left: '0px', html + qr.el = ui.dialog 'qr', 'top: 0; left: 0;', html $.bind $('input[name=name]', qr.el), 'mousedown', (e) -> e.stopPropagation() $.bind $('input[name=upfile]', qr.el), 'change', qr.validateFileSize @@ -1393,7 +1388,7 @@ updater =
" - dialog = ui.dialog 'updater', bottom: '0', right: '0', html + dialog = ui.dialog 'updater', 'bottom: 0; right: 0;', html updater.count = $ '#count', dialog updater.timer = $ '#timer', dialog @@ -1501,7 +1496,7 @@ updater = watcher = init: -> html = '
Thread Watcher
' - watcher.dialog = ui.dialog 'watcher', top: '50px', left: '0px', html + watcher.dialog = ui.dialog 'watcher', 'top: 50px; left: 0px;', html $.add d.body, watcher.dialog #add watch buttons @@ -1885,7 +1880,7 @@ threadStats = threadStats.posts = 1 threadStats.images = if $ '.op img[md5]' then 1 else 0 html = "
#{threadStats.posts} / #{threadStats.images}
" - dialog = ui.dialog 'stats', bottom: '0px', left: '0px', html + dialog = ui.dialog 'stats', 'bottom: 0; left: 0;', html dialog.className = 'dialog' threadStats.postcountEl = $ '#postcount', dialog threadStats.imagecountEl = $ '#imagecount', dialog From bb7b6c1c2b96cc0fa86777c8a65ae8ae203e896b Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 17 Sep 2011 14:35:38 -0700 Subject: [PATCH 10/19] confirm, download --- 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 7dde9710a..2d46abd9e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3008,8 +3008,8 @@ if (origin === 'http://sys.4chan.org') { return qr.message(data); } else { - if (data !== VERSION) { - return alert('new version of 4chan x available on github!'); + if (data !== VERSION && confirm('a newer version of 4chan x is available, would you like to install it now?')) { + return window.location = 'https://github.com/aeosynth/4chan-x/raw/stable/4chan_x.user.js'; } } }, diff --git a/script.coffee b/script.coffee index 3e97e83f3..0e8c459cf 100644 --- a/script.coffee +++ b/script.coffee @@ -2358,8 +2358,8 @@ Main = if origin is 'http://sys.4chan.org' qr.message data else - if data isnt VERSION - alert 'new version of 4chan x available on github!' + if data isnt VERSION and confirm 'a newer version of 4chan x is available, would you like to install it now?' + window.location = 'https://github.com/aeosynth/4chan-x/raw/stable/4chan_x.user.js' css: ' /* dialog styling */ From 3da8f93304ec155a0e66723357eee830a527ceb5 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 17 Sep 2011 14:36:22 -0700 Subject: [PATCH 11/19] cl --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index dc615e9b2..2d1ded0f6 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,8 @@ master - mayhem do not display inlined quotes within the quote preview fix cross threads quotes in expanded threads or inlined cross quotes +- aeosynth + script auto updating 2.19.3 - mayhem From 0acc15cbf9341c3fb907f5247c8588af305d016c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 17 Sep 2011 23:55:02 +0200 Subject: [PATCH 12/19] No one likes the QP red. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 37c71aea1..674d9978d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2339,7 +2339,7 @@ var el, id, qp, quote, replyID, threadID, _i, _len, _ref, _results; qp = ui.el = $.el('div', { id: 'qp', - className: 'replyhl' + className: 'reply' }); $.add(d.body, qp); id = this.hash.slice(1); diff --git a/script.coffee b/script.coffee index 1698fe712..423ce9a4d 100644 --- a/script.coffee +++ b/script.coffee @@ -1809,7 +1809,7 @@ quotePreview = mouseover: (e) -> qp = ui.el = $.el 'div', id: 'qp' - className: 'replyhl' + className: 'reply' $.add d.body, qp id = @hash[1..] From 7d6baf3297ca958cd8a65bae3ef09aaef2e828c9 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 17 Sep 2011 17:40:49 -0700 Subject: [PATCH 13/19] botnet --- 4chan_x.user.js | 2 +- script.coffee | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cedf0e04b..2e5b56af1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2800,7 +2800,7 @@ dialog = $.el('div', { id: 'overlay', className: 'firstrun', - innerHTML: "

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

" + innerHTML: "

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

Welcome to the botnet.

" }); $.add(d.body, dialog); return $.bind(window, 'click', firstRun.close); diff --git a/script.coffee b/script.coffee index 5329ed9f2..33c53e0ae 100644 --- a/script.coffee +++ b/script.coffee @@ -2171,6 +2171,7 @@ firstRun =

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

+

Welcome to the botnet.

" $.add d.body, dialog From dc582245f45f4815d63277f8ff141ce2b363e1a2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Sep 2011 03:05:14 +0200 Subject: [PATCH 14/19] Revert The botnet. This reverts commit 7d6baf3297ca958cd8a65bae3ef09aaef2e828c9. --- 4chan_x.user.js | 2 +- script.coffee | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2e5b56af1..cedf0e04b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2800,7 +2800,7 @@ dialog = $.el('div', { id: 'overlay', className: 'firstrun', - innerHTML: "

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

Welcome to the botnet.

" + innerHTML: "

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

" }); $.add(d.body, dialog); return $.bind(window, 'click', firstRun.close); diff --git a/script.coffee b/script.coffee index 33c53e0ae..5329ed9f2 100644 --- a/script.coffee +++ b/script.coffee @@ -2171,7 +2171,6 @@ firstRun =

Click the 4chan X buttons for options; they are at the top and bottom of the page.

Updater options are in the updater dialog in replies at the bottom-right corner of the window.

If you don't see the buttons, try disabling your userstyles.

-

Welcome to the botnet.

" $.add d.body, dialog From 0e76ea9eac05cdd82bc13625e849eab5fab19452 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Sep 2011 03:24:38 +0200 Subject: [PATCH 15/19] changelog --- changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog b/changelog index 2d1ded0f6..90b69d2e2 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,7 @@ master - mayhem do not display inlined quotes within the quote preview fix cross threads quotes in expanded threads or inlined cross quotes + default post styling for quote previews - aeosynth script auto updating From e9a68b85b20c205a6f817e02bd90a953201d1791 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Sep 2011 03:31:57 +0200 Subject: [PATCH 16/19] Remove updater from the master branch --- 4chan_x.user.js | 15 ++------------- latest.js | 1 - script.coffee | 8 -------- 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 latest.js diff --git a/4chan_x.user.js b/4chan_x.user.js index cedf0e04b..0c8bd5a0d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -60,7 +60,7 @@ */ (function() { - var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, VERSION, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; + var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; var __slice = Array.prototype.slice; config = { main: { @@ -73,8 +73,7 @@ 'Comment Expansion': [true, 'Expand too long comments'], 'Thread Expansion': [true, 'View all replies'], 'Index Navigation': [true, 'Navigate to previous / next thread'], - 'Reply Navigation': [false, 'Navigate to top / bottom of thread'], - 'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)'] + 'Reply Navigation': [false, 'Navigate to top / bottom of thread'] }, Hiding: { 'Reply Hiding': [true, 'Hide single replies'], @@ -188,7 +187,6 @@ } })(null, config); NAMESPACE = 'AEOS.4chan_x.'; - VERSION = 'master'; SECOND = 1000; MINUTE = 60 * SECOND; HOUR = 60 * MINUTE; @@ -2847,11 +2845,6 @@ now = Date.now(); if (lastChecked < now - 1 * DAY) { $.set('lastChecked', now); - if (conf['Check for Updates'] && VERSION !== 'master') { - $.add(d.head, $.el('script', { - src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' - })); - } cutoff = now - 7 * DAY; hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); for (id in hiddenThreads) { @@ -3007,10 +3000,6 @@ origin = e.origin, data = e.data; if (origin === 'http://sys.4chan.org') { return qr.message(data); - } else { - if (data !== VERSION && confirm('a newer version of 4chan x is available, would you like to install it now?')) { - return window.location = 'https://github.com/aeosynth/4chan-x/raw/stable/4chan_x.user.js'; - } } }, css: '\ diff --git a/latest.js b/latest.js deleted file mode 100644 index 41c3a21f3..000000000 --- a/latest.js +++ /dev/null @@ -1 +0,0 @@ -window.postMessage('master', '*'); diff --git a/script.coffee b/script.coffee index 5329ed9f2..e8ef9168c 100644 --- a/script.coffee +++ b/script.coffee @@ -10,7 +10,6 @@ config = 'Thread Expansion': [true, 'View all replies'] 'Index Navigation': [true, 'Navigate to previous / next thread'] 'Reply Navigation': [false, 'Navigate to top / bottom of thread'] - 'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)'] Hiding: 'Reply Hiding': [true, 'Hide single replies'] 'Thread Hiding': [true, 'Hide entire threads'] @@ -112,7 +111,6 @@ conf = {} ) null, config NAMESPACE = 'AEOS.4chan_x.' -VERSION = 'master' SECOND = 1000 MINUTE = 60*SECOND HOUR = 60*MINUTE @@ -2216,9 +2214,6 @@ Main = if lastChecked < now - 1*DAY $.set 'lastChecked', now - if conf['Check for Updates'] and VERSION isnt 'master' - $.add d.head, $.el 'script', src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js' - cutoff = now - 7*DAY hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {} @@ -2357,9 +2352,6 @@ Main = {origin, data} = e if origin is 'http://sys.4chan.org' qr.message data - else - if data isnt VERSION and confirm 'a newer version of 4chan x is available, would you like to install it now?' - window.location = 'https://github.com/aeosynth/4chan-x/raw/stable/4chan_x.user.js' css: ' /* dialog styling */ From cca5983e308ca0866754afc9d8bb648f59bc2cfc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 18 Sep 2011 03:32:37 +0200 Subject: [PATCH 17/19] 2.19.4 changelog --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index 90b69d2e2..ab7a0519e 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.19.4 - mayhem do not display inlined quotes within the quote preview fix cross threads quotes in expanded threads or inlined cross quotes From bd281042bc5b747c118cd0db3d2b0cc18f8ad62c Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 17 Sep 2011 19:23:27 -0700 Subject: [PATCH 18/19] wtf happened to the scriptish issues --- script.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.coffee b/script.coffee index e8ef9168c..79d18afc2 100644 --- a/script.coffee +++ b/script.coffee @@ -86,7 +86,7 @@ config = # XXX chrome can't into `{log} = console` if console? # XXX scriptish - console.log.apply is not a function - # https://github.com/scriptish/scriptish/issues/499 + # https://github.com/scriptish/scriptish/issues/3 log = (arg) -> console.log arg From 6eed88f22442d6a6e63dbe8f4d36308453ab0f3b Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 17 Sep 2011 19:42:59 -0700 Subject: [PATCH 19/19] raw.github.com --- 4chan_x.user.js | 2 +- Cakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 0c8bd5a0d..4e8e73e83 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -6,7 +6,7 @@ // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* // @include http://sys.4chan.org/* -// @icon https://github.com/aeosynth/4chan-x/raw/gh-pages/favicon.png +// @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png // ==/UserScript== /* LICENSE diff --git a/Cakefile b/Cakefile index b59ac74d5..6d5ac1eac 100644 --- a/Cakefile +++ b/Cakefile @@ -11,7 +11,7 @@ HEADER = """ // @license MIT; http://en.wikipedia.org/wiki/Mit_license // @include http://boards.4chan.org/* // @include http://sys.4chan.org/* -// @icon https://github.com/aeosynth/4chan-x/raw/gh-pages/favicon.png +// @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png // ==/UserScript== /* LICENSE