From 7a8ce2958e9cd5d8720170214e2b699648d311dd Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 10 Sep 2012 20:43:15 +0200 Subject: [PATCH 01/17] Update foolz urls. --- 4chan_x.user.js | 6 +++--- script.coffee | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b33a029ec..35c5f69a3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -167,7 +167,7 @@ filesize: [''].join('\n'), md5: [''].join('\n') }, - sauces: ['http://iqdb.org/?url=$1', 'http://www.google.com/searchbyimage?image_url=$1', '#http://tineye.com/search?url=$1', '#http://saucenao.com/search.php?db=999&url=$1', '#http://3d.iqdb.org/?url=$1', '#http://regex.info/exif.cgi?imgurl=$2', '# uploaders:', '#http://imgur.com/upload?url=$2;text:Upload to imgur', '#http://omploader.org/upload?url1=$2;text:Upload to omploader', '# "View Same" in archives:', '#http://archive.foolz.us/search/image/$3/;text:View same on foolz', '#http://archive.foolz.us/$4/search/image/$3/;text:View same on foolz /$4/', '#https://archive.installgentoo.net/$4/image/$3;text:View same on installgentoo /$4/'].join('\n'), + sauces: ['http://iqdb.org/?url=$1', 'http://www.google.com/searchbyimage?image_url=$1', '#http://tineye.com/search?url=$1', '#http://saucenao.com/search.php?db=999&url=$1', '#http://3d.iqdb.org/?url=$1', '#http://regex.info/exif.cgi?imgurl=$2', '# uploaders:', '#http://imgur.com/upload?url=$2;text:Upload to imgur', '#http://omploader.org/upload?url1=$2;text:Upload to omploader', '# "View Same" in archives:', '#http://archive.foolz.us/_/search/image/$3/;text:View same on foolz', '#http://archive.foolz.us/$4/search/image/$3/;text:View same on foolz /$4/', '#https://archive.installgentoo.net/$4/image/$3;text:View same on installgentoo /$4/'].join('\n'), time: '%m/%d/%y(%a)%H:%M', backlink: '>>%id', fileInfo: '%l (%p%s, %r)', @@ -4562,10 +4562,10 @@ case 'wsg': case 'dev': case 'foolz': - return "//archive.foolz.us/api/chan/post/board/" + board + "/num/" + postID + "/format/json"; + return "//archive.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; case 'u': case 'kuku': - return "//nsfw.foolz.us/api/chan/post/board/" + board + "/num/" + postID + "/format/json"; + return "//nsfw.foolz.us/_/api/chan/post/?board=" + board + "&num=" + postID; } }, thread: function(board, threadID, postID) { diff --git a/script.coffee b/script.coffee index 4d80584e1..c234b30d0 100644 --- a/script.coffee +++ b/script.coffee @@ -118,7 +118,7 @@ Config = '#http://imgur.com/upload?url=$2;text:Upload to imgur' '#http://omploader.org/upload?url1=$2;text:Upload to omploader' '# "View Same" in archives:' - '#http://archive.foolz.us/search/image/$3/;text:View same on foolz' + '#http://archive.foolz.us/_/search/image/$3/;text:View same on foolz' '#http://archive.foolz.us/$4/search/image/$3/;text:View same on foolz /$4/' '#https://archive.installgentoo.net/$4/image/$3;text:View same on installgentoo /$4/' ].join '\n' @@ -3610,9 +3610,9 @@ Redirect = post: (board, postID) -> switch board when 'a', 'co', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'wsg', 'dev', 'foolz' - "//archive.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" + "//archive.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" when 'u', 'kuku' - "//nsfw.foolz.us/api/chan/post/board/#{board}/num/#{postID}/format/json" + "//nsfw.foolz.us/_/api/chan/post/?board=#{board}&num=#{postID}" thread: (board, threadID, postID) -> # keep the number only if the location.hash was sent f.e. postID = postID.match(/\d+/)[0] if postID From 5f537f040509f7fbf54d3da28e5e3625ef9311c1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 16:30:37 +0200 Subject: [PATCH 02/17] Tiny spoiler range fix. --- 4chan_x.user.js | 2 +- script.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e68bc5037..3699c1c35 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3534,7 +3534,7 @@ } posts = JSON.parse(req.response).posts; if (spoilerRange = posts[0].custom_spoiler) { - Build.spoilerRange[g.BOARD] = spoilerRange; + Build.spoilerRange[board] = spoilerRange; } postID = +postID; for (_i = 0, _len = posts.length; _i < _len; _i++) { diff --git a/script.coffee b/script.coffee index 334cfbc75..a5ed4a2a2 100644 --- a/script.coffee +++ b/script.coffee @@ -2763,9 +2763,9 @@ Get = "Error #{req.status}: #{req.statusText}." return - posts = JSON.parse(req.response).posts + posts = JSON.parse(req.response).posts if spoilerRange = posts[0].custom_spoiler - Build.spoilerRange[g.BOARD] = spoilerRange + Build.spoilerRange[board] = spoilerRange postID = +postID for post in posts break if post.no is postID # we found it! From 5a26f3883d3cad8ddd5a895a29ca6f2a0bb04cbe Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 18:33:25 +0200 Subject: [PATCH 03/17] Fix subject selector in Get.title. Fix filename filtering in case of spoiler image. --- 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 3699c1c35..4259f7993 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -749,7 +749,7 @@ var img; img = post.img; if (img) { - return img.alt; + return img.alt.replace('Spoiler Image, ', ''); } return false; }, @@ -3679,7 +3679,7 @@ title: function(thread) { var el, op, span; op = $('.op', thread); - el = $('.subject', op); + el = $('.postInfo .subject', op); if (!el.textContent) { el = $('blockquote', op); if (!el.textContent) { diff --git a/script.coffee b/script.coffee index a5ed4a2a2..23dbf8f37 100644 --- a/script.coffee +++ b/script.coffee @@ -587,7 +587,7 @@ Filter = filesize: (post) -> {img} = post if img - return img.alt + return img.alt.replace 'Spoiler Image, ', '' false md5: (post) -> {img} = post @@ -2890,7 +2890,7 @@ Get = root title: (thread) -> op = $ '.op', thread - el = $ '.subject', op + el = $ '.postInfo .subject', op unless el.textContent el = $ 'blockquote', op unless el.textContent From bbcb738b416996f069805dec31529b58f6ceb9cc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 18:52:11 +0200 Subject: [PATCH 04/17] Fix emails in fetched posts from foolz. --- 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 78027292d..749ac166f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3614,7 +3614,7 @@ })(), tripcode: data.trip, uniqueID: data.poster_hash, - email: encodeURIComponent(data.email), + email: data.email ? encodeURIComponent(data.email) : '', subject: data.title_processed, flagCode: data.poster_country, flagName: data.poster_country_name_processed, diff --git a/script.coffee b/script.coffee index b4fc2563d..39a89d553 100644 --- a/script.coffee +++ b/script.coffee @@ -2839,7 +2839,7 @@ Get = when 'D' then 'developer' tripcode: data.trip uniqueID: data.poster_hash - email: encodeURIComponent data.email + email: if data.email then encodeURIComponent data.email else '' subject: data.title_processed flagCode: data.poster_country flagName: data.poster_country_name_processed From 236c4c8a0cb2a413fd228fae0723ca8dcc1737ff Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 20:06:56 +0200 Subject: [PATCH 05/17] 304 is suddenly treated as an error by Opera. Use onloadend instead of onload. --- 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 749ac166f..503d19404 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3074,7 +3074,7 @@ } url = "//api.4chan.org/" + g.BOARD + "/res/" + g.THREAD_ID + ".json"; return Updater.request = $.ajax(url, { - onload: Updater.cb.load + onloadend: Updater.cb.load }, { headers: { 'If-Modified-Since': Updater.lastModified diff --git a/script.coffee b/script.coffee index 39a89d553..0537e23d0 100644 --- a/script.coffee +++ b/script.coffee @@ -2456,7 +2456,7 @@ Updater = # XXX is fooling the cache still necessary? # url = "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json?{Date.now()}" url = "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json" - Updater.request = $.ajax url, onload: Updater.cb.load, + Updater.request = $.ajax url, onloadend: Updater.cb.load, headers: 'If-Modified-Since': Updater.lastModified Watcher = From fbe14718d61ff2de75391f3af94970659735cae5 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 20:29:42 +0200 Subject: [PATCH 06/17] Don't strike-through deadlinks that are not quotelinks. --- 4chan_x.user.js | 3 +++ script.coffee | 3 +++ 2 files changed, 6 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index 503d19404..98e040864 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5794,6 +5794,9 @@ body.unscroll {\ .quotelink.deadlink {\ text-decoration: underline !important;\ }\ +.deadlink:not(.quotelink) {\ + text-decoration: none !important;\ +}\ .inlined {\ opacity: .5;\ }\ diff --git a/script.coffee b/script.coffee index 0537e23d0..0828bcc4b 100644 --- a/script.coffee +++ b/script.coffee @@ -4723,6 +4723,9 @@ body.unscroll { .quotelink.deadlink { text-decoration: underline !important; } +.deadlink:not(.quotelink) { + text-decoration: none !important; +} .inlined { opacity: .5; } From a7c5f7eceef2c61f60552c76a9c60dab6ddabe38 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Sep 2012 23:40:25 +0200 Subject: [PATCH 07/17] Fix prettifying. --- 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 98e040864..381d1852e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -5223,7 +5223,7 @@ nodes.push(Main.preParse(node)); } Main.node(nodes, true); - Main.hasCodeTags = !!$('script[src="//static.4chan.org/js/prettify/prettify.js"]'); + Main.hasCodeTags = !!$('script[src^="//static.4chan.org/js/prettify/prettify"]'); if (MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver) { observer = new MutationObserver(Main.observer); observer.observe(board, { diff --git a/script.coffee b/script.coffee index 0828bcc4b..9f00df223 100644 --- a/script.coffee +++ b/script.coffee @@ -4189,7 +4189,7 @@ Main = Main.node nodes, true # Execute these scripts on inserted posts, not page init. - Main.hasCodeTags = !! $ 'script[src="//static.4chan.org/js/prettify/prettify.js"]' + Main.hasCodeTags = !! $ 'script[src^="//static.4chan.org/js/prettify/prettify"]' if MutationObserver = window.MutationObserver or window.WebKitMutationObserver or window.OMutationObserver observer = new MutationObserver Main.observer From fe47faebdce8c6812d66d9f502571666f9902e07 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 12 Sep 2012 00:04:58 +0200 Subject: [PATCH 08/17] rm comment --- script.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/script.coffee b/script.coffee index 9f00df223..6944b3de9 100644 --- a/script.coffee +++ b/script.coffee @@ -2452,9 +2452,6 @@ Updater = update: -> Updater.set 'timer', 0 Updater.request?.abort() - # Fool the cache. - # XXX is fooling the cache still necessary? - # url = "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json?{Date.now()}" url = "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json" Updater.request = $.ajax url, onloadend: Updater.cb.load, headers: 'If-Modified-Since': Updater.lastModified From aa8a81fdcdf5f50bc1d0e212ae81c93f9b61f3fd Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 12 Sep 2012 01:59:22 +0200 Subject: [PATCH 09/17] trim text selection when quoting. --- 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 381d1852e..b6ea9ad0d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1868,9 +1868,9 @@ id = this.previousSibling.hash.slice(2); text = ">>" + id + "\n"; sel = window.getSelection(); - if ((s = sel.toString()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) { + if ((s = sel.toString().trim()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) { if ($.engine === 'presto') { - s = d.getSelection(); + s = d.getSelection().trim(); } s = s.replace(/\n/g, '\n>'); text += ">" + s + "\n"; diff --git a/script.coffee b/script.coffee index 6944b3de9..c2d415bf3 100644 --- a/script.coffee +++ b/script.coffee @@ -1434,9 +1434,9 @@ QR = text = ">>#{id}\n" sel = window.getSelection() - if (s = sel.toString()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0] + if (s = sel.toString().trim()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0] # XXX Opera needs d.getSelection() to retain linebreaks from the selected text - s = d.getSelection() if $.engine is 'presto' + s = d.getSelection().trim() if $.engine is 'presto' s = s.replace /\n/g, '\n>' text += ">#{s}\n" From f14730e6326ecc10e0e1bfe008722c05fc805191 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 12 Sep 2012 17:32:50 +0200 Subject: [PATCH 10/17] Don't reset the counter when aborting (during connection issues mostly). --- 4chan_x.user.js | 8 +++++--- script.coffee | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index b6ea9ad0d..517810ac4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3067,10 +3067,12 @@ } }, update: function() { - var url, _ref; + var request, url; Updater.set('timer', 0); - if ((_ref = Updater.request) != null) { - _ref.abort(); + request = Updater.request; + if (request) { + request.onloadend = null; + request.abort(); } url = "//api.4chan.org/" + g.BOARD + "/res/" + g.THREAD_ID + ".json"; return Updater.request = $.ajax(url, { diff --git a/script.coffee b/script.coffee index c2d415bf3..dcd054683 100644 --- a/script.coffee +++ b/script.coffee @@ -2451,7 +2451,11 @@ Updater = update: -> Updater.set 'timer', 0 - Updater.request?.abort() + {request} = Updater + if request + # Don't reset the counter when aborting. + request.onloadend = null + request.abort() url = "//api.4chan.org/#{g.BOARD}/res/#{g.THREAD_ID}.json" Updater.request = $.ajax url, onloadend: Updater.cb.load, headers: 'If-Modified-Since': Updater.lastModified From bcde8426c7c89ba7d48526ee18bac85a2de83b38 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 12 Sep 2012 17:37:24 +0200 Subject: [PATCH 11/17] Add "Connection error, or you are banned" back." --- 4chan_x.user.js | 6 +++++- script.coffee | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 517810ac4..cc1e7bf5c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2456,7 +2456,11 @@ }, onerror: function() { QR.status(); - return QR.error('Connection error with sys.4chan.org.'); + return QR.error($.el('a', { + href: '//www.4chan.org/banned', + target: '_blank', + textContent: 'Connection error, or you are banned.' + })); } }; opts = { diff --git a/script.coffee b/script.coffee index dcd054683..60b11aa6d 100644 --- a/script.coffee +++ b/script.coffee @@ -1909,7 +1909,10 @@ QR = # Connection error, or # CORS disabled error on www.4chan.org/banned QR.status() - QR.error 'Connection error with sys.4chan.org.' + QR.error $.el 'a', + href: '//www.4chan.org/banned', + target: '_blank', + textContent: 'Connection error, or you are banned.' opts = form: $.formData post upCallbacks: From 0c1a0ecad76cbe61a13420259e7b938b093edcba Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 12 Sep 2012 17:38:46 +0200 Subject: [PATCH 12/17] Release 2.35.0. --- 4chan_x.user.js | 6 +++--- Cakefile | 2 +- changelog | 2 ++ latest.js | 2 +- script.coffee | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cc1e7bf5c..08991e0c5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan x -// @version 2.34.10 +// @version 2.35.0 // @namespace aeosynth // @description Adds various features. // @copyright 2009-2011 James Campos @@ -27,7 +27,7 @@ * Copyright (c) 2009-2011 James Campos * Copyright (c) 2012 Nicolas Stepien * http://mayhemydg.github.com/4chan-x/ - * 4chan X 2.34.10 + * 4chan X 2.35.0 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -5351,7 +5351,7 @@ return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); }, namespace: '4chan_x.', - version: '2.34.10', + version: '2.35.0', callbacks: [], css: '\ /* dialog styling */\ diff --git a/Cakefile b/Cakefile index 156919d1f..87bbe497e 100644 --- a/Cakefile +++ b/Cakefile @@ -2,7 +2,7 @@ {exec} = require 'child_process' fs = require 'fs' -VERSION = '2.34.10' +VERSION = '2.35.0' HEADER = """ // ==UserScript== diff --git a/changelog b/changelog index 225d6385e..a2fbb7d48 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master + +2.35.0 - Mayhem Use 4chan's API to fetch posts for: - Thread Updater. diff --git a/latest.js b/latest.js index d90eff7b7..48fe59683 100644 --- a/latest.js +++ b/latest.js @@ -1 +1 @@ -postMessage({version:'2.34.10'},'*') \ No newline at end of file +postMessage({version:'2.35.0'},'*') \ No newline at end of file diff --git a/script.coffee b/script.coffee index 60b11aa6d..e5f32121f 100644 --- a/script.coffee +++ b/script.coffee @@ -4278,7 +4278,7 @@ Main = $.globalEval "(#{code})()".replace '_id_', bq.id namespace: '4chan_x.' - version: '2.34.10' + version: '2.35.0' callbacks: [] css: ' /* dialog styling */ From 0c2907db8569495fbf21eb51bc103605cd393b5d Mon Sep 17 00:00:00 2001 From: woxxy Date: Wed, 12 Sep 2012 18:20:57 +0200 Subject: [PATCH 13/17] Updating media object from foolfuuka --- script.coffee | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/script.coffee b/script.coffee index e5f32121f..c7f892ead 100644 --- a/script.coffee +++ b/script.coffee @@ -2851,19 +2851,19 @@ Get = dateUTC: data.timestamp comment: comment # file - if data.media_filename + if data.media.media_filename o.file = - name: data.media_filename_processed - timestamp: data.media_orig - url: data.media_link or data.remote_media_link - height: data.media_h - width: data.media_w - MD5: data.media_hash - size: data.media_size - turl: data.thumb_link or "//thumbs.4chan.org/#{board}/thumb/#{data.preview_orig}" - theight: data.preview_h - twidth: data.preview_w - isSpoiler: data.spoiler is '1' + name: data.media.media_filename_processed + timestamp: data.media.media_orig + url: data.media.media_link or data.media.remote_media_link + height: data.media.media_h + width: data.media.media_w + MD5: data.media.media_hash + size: data.media.media_size + turl: data.media.thumb_link or "//thumbs.4chan.org/#{board}/thumb/#{data.media.preview_orig}" + theight: data.media.preview_h + twidth: data.media.preview_w + isSpoiler: data.media.spoiler is '1' $.replace root.firstChild, Get.cleanPost Build.post o, true cb() if cb From e2fe8fb168e3d5d3266667c510cc922d93f0f345 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Sep 2012 01:02:38 +0200 Subject: [PATCH 14/17] compile --- 4chan_x.user.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 08991e0c5..ed3a2529e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3628,19 +3628,19 @@ dateUTC: data.timestamp, comment: comment }; - if (data.media_filename) { + if (data.media.media_filename) { o.file = { - name: data.media_filename_processed, - timestamp: data.media_orig, - url: data.media_link || data.remote_media_link, - height: data.media_h, - width: data.media_w, - MD5: data.media_hash, - size: data.media_size, - turl: data.thumb_link || ("//thumbs.4chan.org/" + board + "/thumb/" + data.preview_orig), - theight: data.preview_h, - twidth: data.preview_w, - isSpoiler: data.spoiler === '1' + name: data.media.media_filename_processed, + timestamp: data.media.media_orig, + url: data.media.media_link || data.media.remote_media_link, + height: data.media.media_h, + width: data.media.media_w, + MD5: data.media.media_hash, + size: data.media.media_size, + turl: data.media.thumb_link || ("//thumbs.4chan.org/" + board + "/thumb/" + data.media.preview_orig), + theight: data.media.preview_h, + twidth: data.media.preview_w, + isSpoiler: data.media.spoiler === '1' }; } $.replace(root.firstChild, Get.cleanPost(Build.post(o, true))); From 6c92cbc13beefef9580e2d21d42517e03d31fb87 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Sep 2012 01:04:29 +0200 Subject: [PATCH 15/17] " -> " in emails. --- 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 ed3a2529e..108abf825 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3720,7 +3720,7 @@ capcode: data.capcode, tripcode: data.trip, uniqueID: data.id, - email: data.email ? encodeURIComponent(data.email) : '', + email: data.email ? encodeURIComponent(data.email.replace(/"/g, '"')) : '', subject: data.sub, flagCode: data.country, flagName: data.country_name, diff --git a/script.coffee b/script.coffee index c7f892ead..37bd92065 100644 --- a/script.coffee +++ b/script.coffee @@ -2924,7 +2924,7 @@ Build = capcode: data.capcode tripcode: data.trip uniqueID: data.id - email: if data.email then encodeURIComponent data.email else '' + email: if data.email then encodeURIComponent data.email.replace /"/g, '"' else '' subject: data.sub flagCode: data.country flagName: data.country_name From 0e40b115a331922d46cced6104540387d245646c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Sep 2012 01:05:33 +0200 Subject: [PATCH 16/17] ## Moderator -> ## Mod --- 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 108abf825..90dd26b25 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3776,7 +3776,7 @@ break; case 'mod': capcodeClass = " capcodeMod"; - capcodeStart = " ## Moderator"; + capcodeStart = " ## Mod"; capcode = (" "; break; case 'developer': diff --git a/script.coffee b/script.coffee index 37bd92065..f17f59756 100644 --- a/script.coffee +++ b/script.coffee @@ -2997,7 +2997,7 @@ Build = when 'mod' capcodeClass = " capcodeMod" capcodeStart = " ## Moderator" + "title='Highlight posts by Moderators'>## Mod" capcode = " " From db3a3fbc2bbadea8dd1027c5cd20d464859a0478 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 13 Sep 2012 01:35:21 +0200 Subject: [PATCH 17/17] We don't need DOMNodeInserted to add the main stylesheet anymore. --- 4chan_x.user.js | 12 ++---------- script.coffee | 12 +++--------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 90dd26b25..462cae0d8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -406,7 +406,7 @@ style = $.el('style', { textContent: css }); - $.add(d.head, style); + $.add(d.head || d.documentElement, style); return style; }, x: function(path, root) { @@ -5044,7 +5044,7 @@ if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) { Main.css += '#postForm { display: none; }'; } - Main.addStyle(); + $.addStyle(Main.css); now = Date.now(); if (Conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * $.HOUR) { $.ready(function() { @@ -5253,14 +5253,6 @@ Conf[parent] = obj; } }, - addStyle: function() { - $.off(d, 'DOMNodeInserted', Main.addStyle); - if (d.head) { - return $.addStyle(Main.css); - } else { - return $.on(d, 'DOMNodeInserted', Main.addStyle); - } - }, message: function(e) { var version; version = e.data.version; diff --git a/script.coffee b/script.coffee index f17f59756..8c012aa78 100644 --- a/script.coffee +++ b/script.coffee @@ -315,7 +315,8 @@ $.extend $, addStyle: (css) -> style = $.el 'style', textContent: css - $.add d.head, style + # XXX Only Chrome has no d.head on document-start. + $.add d.head or d.documentElement, style style x: (path, root=d.body) -> # XPathResult.ANY_UNORDERED_NODE_TYPE is 8 @@ -4031,7 +4032,7 @@ Main = if Conf['Quick Reply'] and Conf['Hide Original Post Form'] Main.css += '#postForm { display: none; }' - Main.addStyle() + $.addStyle Main.css now = Date.now() if Conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*$.HOUR @@ -4214,13 +4215,6 @@ Main = Conf[parent] = obj return - addStyle: -> - $.off d, 'DOMNodeInserted', Main.addStyle - if d.head - $.addStyle Main.css - else # XXX fox - $.on d, 'DOMNodeInserted', Main.addStyle - message: (e) -> {version} = e.data if version and version isnt Main.version and confirm 'An updated version of 4chan X is available, would you like to install it now?'