From 995729b60041fc16b0076b492aeb73e0e6fdc76f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 15:15:34 +0200 Subject: [PATCH 1/5] Fix #1032. --- CHANGELOG.md | 2 ++ src/features.coffee | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed9212e6..d173b098e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Fix resurrecting dead quotelinks on HTTP. + ### 3.0.6 - *2013-04-14* - Fix regression concerning thread selection when quoting on the index. diff --git a/src/features.coffee b/src/features.coffee index e90adbabf..f06441bca 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -2057,9 +2057,9 @@ Redirect = post: (boardID, postID) -> switch boardID when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg' - "//archive.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" + "https://archive.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" when 'u' - "//nsfw.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" + "https://nsfw.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" when 'c', 'int', 'out', 'po' "//archive.thedarkcave.org/_/api/chan/post/?board=#{boardID}&num=#{postID}" # for fuuka-based archives: From 1ec6be21a20e6db4761985de231f49151d1346e6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 16:39:24 +0200 Subject: [PATCH 2/5] Silly prinny. --- src/features.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/features.coffee b/src/features.coffee index f06441bca..8d846cbd8 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -2055,6 +2055,8 @@ Redirect = when 'c' "//archive.nyafuu.org/#{boardID}/full_image/#{filename}" post: (boardID, postID) -> + # XXX foolz had HSTS set for 120 days, which broke XHR+CORS+Redirection when on HTTP. + # Remove necessary HTTPS procotol in September 2013. switch boardID when 'a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg' "https://archive.foolz.us/_/api/chan/post/?board=#{boardID}&num=#{postID}" From f753ed1db60afa2bd4ce12a8522808ba944f495a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 19:03:31 +0200 Subject: [PATCH 3/5] Fix releasing not reloading pkg, thus breaking on build-crx. --- Gruntfile.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 577bbe493..d73545ddd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,13 +1,18 @@ module.exports = function(grunt) { var pkg = grunt.file.readJSON('package.json'); + var concatOptions = { + process: { + data: pkg + } + }; // Project configuration. grunt.initConfig({ pkg: pkg, concat: { coffee: { - options: { process: { data: pkg } }, + options: concatOptions, src: [ 'src/config.coffee', 'src/globals.coffee', @@ -23,7 +28,7 @@ module.exports = function(grunt) { dest: 'tmp/script.coffee' }, crx: { - options: { process: { data: pkg } }, + options: concatOptions, files: { 'builds/crx/manifest.json': 'src/manifest.json', 'builds/crx/script.js': [ @@ -33,7 +38,7 @@ module.exports = function(grunt) { } }, userjs: { - options: { process: { data: pkg } }, + options: concatOptions, src: [ 'src/metadata.js', 'src/banner.js', @@ -42,7 +47,7 @@ module.exports = function(grunt) { dest: 'builds/<%= pkg.name %>.js' }, userscript: { - options: { process: { data: pkg } }, + options: concatOptions, files: { 'builds/<%= pkg.name %>.meta.js': 'src/metadata.js', 'builds/<%= pkg.name %>.user.js': [ @@ -160,12 +165,18 @@ module.exports = function(grunt) { ]); grunt.registerTask('release', ['exec:commit', 'exec:push', 'build-crx', 'compress:crx']); - grunt.registerTask('patch', ['bump', 'updcl:3', 'release']); - grunt.registerTask('minor', ['bump:minor', 'updcl:2', 'release']); - grunt.registerTask('major', ['bump:major', 'updcl:1', 'release']); - grunt.registerTask('updcl', 'Update the changelog', function(i) { + grunt.registerTask('patch', ['bump', 'reloadPkg', 'updcl:3', 'release']); + grunt.registerTask('minor', ['bump:minor', 'reloadPkg', 'updcl:2', 'release']); + grunt.registerTask('major', ['bump:major', 'reloadPkg', 'updcl:1', 'release']); + + grunt.registerTask('reloadPkg', 'Reload the package', function() { // Update the `pkg` object with the new version. pkg = grunt.file.readJSON('package.json'); + concatOptions.process.data = pkg; + grunt.log.ok('pkg reloaded.'); + }); + + grunt.registerTask('updcl', 'Update the changelog', function(i) { // i is the number of #s for markdown. var version = new Array(+i + 1).join('#') + ' ' + pkg.version + ' - *' + grunt.template.today('yyyy-mm-dd') + '*'; grunt.file.write('CHANGELOG.md', version + '\n\n' + grunt.file.read('CHANGELOG.md')); From 0ff0b14d272d5ac9da8648f608d8ac9bc65996f8 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 20:16:33 +0200 Subject: [PATCH 4/5] Add $.rmAll. Up to 60 000 times faster than innerHTML = null! (wtf) Crazy stuff. --- lib/$.coffee | 5 +++++ src/features.coffee | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 5de9784a0..aa98a652a 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -102,6 +102,11 @@ $.extend $, (el) -> el.remove() else (el) -> el.parentNode?.removeChild el + rmAll: (el) -> + # jsperf.com/emptify-element + while node = el.firstChild + $.rm node + return tn: (s) -> d.createTextNode s nodes: (nodes) -> diff --git a/src/features.coffee b/src/features.coffee index 8d846cbd8..358390607 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -86,7 +86,7 @@ Header = generateBoardList: (text) -> list = $ '#custom-board-list', Header.bar - list.innerHTML = null + $.rmAll list return unless text as = $$('#full-board-list a', Header.bar)[0...-2] # ignore the Settings and Home links nodes = text.match(/[\w@]+(-(all|title|full|index|catalog|text:"[^"]+"))*|[^\w@]+/g).map (t) -> @@ -358,7 +358,7 @@ Settings = $.rmClass selected, 'tab-selected' $.addClass $(".tab-#{@hyphenatedTitle}", Settings.dialog), 'tab-selected' section = $ 'section', Settings.dialog - section.innerHTML = null + $.rmAll section section.className = "section-#{@hyphenatedTitle}" @open section, g section.scrollTop = 0 @@ -444,7 +444,7 @@ Settings = return # XXX Firefox won't let us download automatically. p = $ '.imp-exp-result', Settings.dialog - p.innerHTML = null + $.rmAll p $.add p, a import: -> @nextElementSibling.click() @@ -566,7 +566,7 @@ Settings = selectFilter: -> div = @nextElementSibling if (name = @value) isnt 'guide' - div.innerHTML = null + $.rmAll div ta = $.el 'textarea', name: name className: 'field' @@ -2452,10 +2452,10 @@ Get = # Get rid of the side arrows. {nodes} = clone - nodes.root.innerHTML = null + $.rmAll nodes.root $.add nodes.root, nodes.post - root.innerHTML = null + $.rmAll root $.add root, nodes.root fetchedPost: (req, boardID, threadID, postID, root, context) -> # In case of multiple callbacks for the same request, @@ -4276,7 +4276,7 @@ ThreadWatcher = $.add div, [x, $.tn(' '), link] nodes.push div - ThreadWatcher.dialog.innerHTML = '' + $.rmAll ThreadWatcher.dialog $.add ThreadWatcher.dialog, nodes watched = watched[g.BOARD] or {} From 0bccde09dd958b6ed44d59bced88a8536c10f259 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 14 Apr 2013 22:04:50 +0200 Subject: [PATCH 5/5] Close #1024 --- lib/$.coffee | 4 ++-- src/features.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index aa98a652a..454e2c62b 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -102,9 +102,9 @@ $.extend $, (el) -> el.remove() else (el) -> el.parentNode?.removeChild el - rmAll: (el) -> + rmAll: (root) -> # jsperf.com/emptify-element - while node = el.firstChild + while node = root.firstChild $.rm node return tn: (s) -> diff --git a/src/features.coffee b/src/features.coffee index 358390607..d409ece64 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -2077,9 +2077,9 @@ Redirect = Redirect.path '//archive.thedarkcave.org', 'foolfuuka', data when 'ck', 'fa', 'lit', 's4s' Redirect.path '//fuuka.warosu.org', 'fuuka', data - when 'diy', 'sci' + when 'diy', 'g', 'sci' Redirect.path '//archive.installgentoo.net', 'fuuka', data - when 'cgl', 'g', 'mu', 'w' + when 'cgl', 'mu', 'w' Redirect.path '//rbt.asia', 'fuuka', data when 'an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x' Redirect.path 'http://archive.heinessen.com', 'fuuka', data