diff --git a/Gruntfile.coffee b/Gruntfile.coffee index b4532d1a2..74bb4e669 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1,18 +1,18 @@ module.exports = (grunt) -> - pkg = grunt.file.readJSON 'package.json' concatOptions = - process: - data: pkg - + process: Object.create(null, data: + get: -> grunt.config 'pkg' + enumerable: true + ) shellOptions = - stdout: true - stderr: true + stdout: true + stderr: true failOnError: true # Project configuration. grunt.initConfig - pkg: pkg + pkg: grunt.file.readJSON 'package.json' concat: coffee: options: concatOptions @@ -38,12 +38,6 @@ module.exports = (grunt) -> ] dest: 'tmp-<%= pkg.type %>/script.coffee' - meta: - options: concatOptions - files: - 'LICENSE': 'src/General/meta/banner.js', - 'latest.js': 'src/General/meta/latest.js' - crx: options: concatOptions files: @@ -51,26 +45,28 @@ module.exports = (grunt) -> 'builds/crx/script.js': [ 'src/General/meta/botproc.js' 'src/General/meta/banner.js' + 'src/General/meta/usestrict.js' 'tmp-<%= pkg.type %>/script.js' ] - userscript: options: concatOptions files: 'builds/<%= pkg.name %>.meta.js': 'src/General/meta/metadata.js' 'builds/<%= pkg.name %>.user.js': [ - 'src/General/meta/botproc.js' 'src/General/meta/metadata.js' 'src/General/meta/banner.js' + 'src/General/meta/usestrict.js' 'tmp-<%= pkg.type %>/script.js' ] - copy: crx: - src: 'src/General/img/*.png' - dest: 'builds/crx/' + src: 'src/General/img/*.png' + dest: 'builds/crx/' expand: true flatten: true + nex: + src: 'builds/<%= pkg.name %>.zip' + dest: 'builds/<%= pkg.name %>.nex' coffee: script: @@ -79,25 +75,32 @@ module.exports = (grunt) -> concurrent: build: [ - 'concat:meta' 'build-crx' 'build-userscript' ] + bump: + options: + updateConfigs: [ + 'pkg' + ] + commit: false + createTag: false + push: false + shell: commit: options: shellOptions command: [ - 'git checkout <%= pkg.meta.mainBranch %>', - 'git commit -am "Release <%= pkg.meta.name %> v<%= pkg.version %>."', - 'git tag -a <%= pkg.version %> -m "<%= pkg.meta.name %> v<%= pkg.version %>."', - 'git tag -af stable -m "<%= pkg.meta.name %> v<%= pkg.version %>."' - ].join(' && ') - stdout: true + 'git checkout <%= pkg.meta.mainBranch %>' + 'git commit -am "Release <%= pkg.meta.name %> v<%= pkg.version %>."' + 'git tag -a <%= pkg.version %> -m "<%= pkg.meta.name %> v<%= pkg.version %>."' + 'git tag -af stable-v3 -m "<%= pkg.meta.name %> v<%= pkg.version %>."' + ].join ' && ' push: options: shellOptions - command: 'git push origin --tags -f && git push origin --all' + command: 'git push origin --tags -f && git push origin --all' watch: all: @@ -113,34 +116,28 @@ module.exports = (grunt) -> compress: crx: options: - archive: 'builds/4chan-X-Chrome.zip' + archive: 'builds/<%= pkg.name %>.zip' level: 9 pretty: true - expand: true - cwd: 'builds/crx/' - src: '**' - + expand: true + flatten: true + src: 'builds/crx/*' + dest: '/' clean: - builds: 'builds' - tmpcrx: 'tmp-crx' + builds: 'builds' + tmpcrx: 'tmp-crx' tmpuserscript: 'tmp-userscript' - grunt.loadNpmTasks 'grunt-bump' - grunt.loadNpmTasks 'grunt-concurrent' - grunt.loadNpmTasks 'grunt-contrib-clean' - grunt.loadNpmTasks 'grunt-contrib-coffee' - grunt.loadNpmTasks 'grunt-contrib-compress' - grunt.loadNpmTasks 'grunt-contrib-concat' - grunt.loadNpmTasks 'grunt-contrib-copy' - grunt.loadNpmTasks 'grunt-contrib-watch' - grunt.loadNpmTasks 'grunt-shell' + require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks grunt.registerTask 'default', [ 'build' ] grunt.registerTask 'set-build', 'Set the build type variable', (type) -> - pkg.type = type; + pkg = grunt.config 'pkg' + pkg.type = type + grunt.config 'pkg', pkg grunt.log.ok 'pkg.type = %s', type grunt.registerTask 'build', [ @@ -165,40 +162,36 @@ module.exports = (grunt) -> ] grunt.registerTask 'release', [ - 'default' - 'compress:crx' 'shell:commit' 'shell:push' + 'build-crx' + 'compress:crx' + 'copy:nex' ] - - grunt.registerTask 'patch', [ - 'bump-only' - 'reloadPkg' + grunt.registerTask 'patch', [ + 'bump' 'updcl:3' + 'release' ] - grunt.registerTask 'minor', [ - 'bump-only:minor' - 'reloadPkg' + grunt.registerTask 'minor', [ + 'bump:minor' 'updcl:2' + 'release' ] - grunt.registerTask 'major', [ - 'bump-only:major' - 'reloadPkg' + grunt.registerTask 'major', [ + 'bump:major' 'updcl:1' + 'release' ] - grunt.registerTask 'reloadPkg', 'Reload the package', -> - # Update the `pkg` object with the new version. - pkg = grunt.file.readJSON('package.json') - grunt.config.data.pkg = concatOptions.process.data = pkg - grunt.log.ok('pkg reloaded.') + grunt.registerTask 'updcl', 'Update the changelog', (headerLevel) -> + headerPrefix = new Array(+headerLevel + 1).join '#' + {version} = grunt.config 'pkg' + today = grunt.template.today 'yyyy-mm-dd' + changelog = grunt.file.read 'CHANGELOG.md' + + grunt.file.write 'CHANGELOG.md', "#{headerPrefix} #{version} - *#{today}*\n\n#{changelog}" + grunt.log.ok "Changelog updated for v#{version}." - grunt.registerTask 'updcl', 'Update the changelog', (i) -> - # i is the number of #s for markdown. - version = [] - version.length = +i + 1 - version = version.join('#') + ' v' + pkg.version + '\n*' + grunt.template.today('yyyy-mm-dd') + '*\n' - grunt.file.write 'CHANGELOG.md', version + '\n' + grunt.file.read('CHANGELOG.md') - grunt.log.ok 'Changelog updated for v' + pkg.version + '.' \ No newline at end of file diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index df7c57ba6..d82d9b6d6 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,4 +1,3 @@ -// Generated by CoffeeScript // ==UserScript== // @name 4chan X // @version 1.2.25 @@ -108,6 +107,8 @@ * license: http://userscripts.org/scripts/review/1352 * */ +'use strict'; + (function() { var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g, __slice = [].slice, @@ -674,9 +675,7 @@ })); }; - $.open = function(URL) { - return GM_openInTab(URL); - }; + $.open = GM_openInTab; $.debounce = function(wait, fn) { var args, exec, lastCall, that, timeout; @@ -7945,6 +7944,9 @@ } }), saveLastReadPost: $.debounce(2 * $.SECOND, function() { + if (Unread.thread.isDead) { + return; + } return Unread.db.set({ boardID: Unread.thread.board.ID, threadID: Unread.thread.ID, @@ -7982,9 +7984,11 @@ }; Redirect = { - thread: {}, - post: {}, - file: {}, + data: { + thread: {}, + post: {}, + file: {} + }, init: function() { var archive, boardID, boards, data, id, name, type, _i, _len, _ref, _ref1, _ref2; @@ -7998,7 +8002,7 @@ if (!boards.contains(boardID)) { continue; } - Redirect[type][boardID] = archive; + Redirect.data[type][boardID] = archive; } } } @@ -8008,126 +8012,118 @@ _ref2 = archive.boards; for (_i = 0, _len = _ref2.length; _i < _len; _i++) { boardID = _ref2[_i]; - if (!(boardID in Redirect.thread)) { - Redirect.thread[boardID] = archive; + if (!(boardID in Redirect.data.thread)) { + Redirect.data.thread[boardID] = archive; } - if (!(boardID in Redirect.post || archive.software !== 'foolfuuka')) { - Redirect.post[boardID] = archive; + if (!(boardID in Redirect.data.post || archive.software !== 'foolfuuka')) { + Redirect.data.post[boardID] = archive; } - if (!(boardID in Redirect.file || !archive.files.contains(boardID))) { - Redirect.file[boardID] = archive; + if (!(boardID in Redirect.data.file || !archive.files.contains(boardID))) { + Redirect.data.file[boardID] = archive; } } } }, archives: { - 'Foolz': { - 'domain': 'archive.foolz.us', - 'http': false, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'], - 'files': ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] - }, - 'NSFW Foolz': { - 'domain': 'nsfw.foolz.us', - 'http': false, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['u'], - 'files': ['u'] - }, - 'The Dark Cave': { - 'domain': 'archive.thedarkcave.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['c', 'int', 'out', 'po'], - 'files': ['c', 'po'] - }, '4plebs': { - 'domain': 'archive.4plebs.org', - 'http': true, - 'software': 'foolfuuka', - 'boards': ['hr', 'tg', 'tv', 'x'], - 'files': ['hr', 'tg', 'tv', 'x'] + domain: 'archive.4plebs.org', + http: true, + software: 'foolfuuka', + boards: ['hr', 'tg', 'tv', 'x'], + files: ['hr', 'tg', 'tv', 'x'] }, - 'Nyafuu': { - 'domain': 'archive.nyafuu.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['c', 'w', 'wg'], - 'files': ['c', 'w', 'wg'] + 'fap archive': { + domain: 'fuuka.worldathleticproject.org', + http: true, + https: false, + software: 'foolfuuka', + boards: ['b', 'e', 'h', 'hc', 'p', 's', 'u'], + files: ['b', 'e', 'h', 'hc', 'p', 's', 'u'] + }, + 'Foolz': { + domain: 'archive.foolz.us', + http: false, + https: true, + software: 'foolfuuka', + boards: ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'], + files: ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] }, 'Foolz a Shit': { - 'domain': 'archive.foolzashit.com', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'], - 'files': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] + domain: 'archive.foolzashit.com', + http: true, + https: true, + software: 'foolfuuka', + boards: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'], + files: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] }, - 'World Athletic Project': { - 'domain': 'fuuka.worldathleticproject.org', - 'http': true, - 'https': false, - 'software': 'foolfuuka', - 'boards': ['e', 'h', 'hc', 'p', 's', 'u'], - 'files': ['e', 'h', 'hc', 'p', 's', 'u'] - }, - 'Install Gentoo': { - 'domain': 'archive.installgentoo.net', - 'http': false, - 'https': true, - 'software': 'fuuka', - 'boards': ['diy', 'g', 'sci'], - 'files': [] - }, - 'warosu': { - 'domain': 'fuuka.warosu.org', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] - }, - 'Rebecca Black Tech': { - 'domain': 'rbt.asia', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['cgl', 'g', 'mu', 'w'], - 'files': ['cgl', 'g', 'mu', 'w'] + 'Foolz Beta': { + domain: 'beta.foolz.us', + http: true, + https: true, + software: 'foolfuuka', + boards: ['a', 'co', 'gd', 'h', 'jp', 'm', 'mlp', 'q', 'sp', 'tg', 'tv', 'u', 'v', 'vg', 'vp', 'vr', 'wsg'], + files: ['a', 'gd', 'h', 'jp', 'm', 'q', 'tg', 'u', 'vg', 'vp', 'vr', 'wsg'] }, 'Heinessen': { - 'domain': 'archive.heinessen.com', - 'http': true, - 'software': 'fuuka', - 'boards': ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'], - 'files': ['an', 'k', 'toy'] + domain: 'archive.heinessen.com', + http: true, + software: 'fuuka', + boards: ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'], + files: ['an', 'k', 'toy'] + }, + 'Install Gentoo': { + domain: 'archive.installgentoo.net', + http: false, + https: true, + software: 'fuuka', + boards: ['diy', 'g', 'sci'], + files: [] + }, + 'NSFW Foolz': { + domain: 'nsfw.foolz.us', + http: false, + https: true, + software: 'foolfuuka', + boards: ['u'], + files: ['u'] + }, + 'Nyafuu': { + domain: 'archive.nyafuu.org', + http: true, + https: true, + software: 'foolfuuka', + boards: ['c', 'w', 'wg'], + files: ['c', 'w', 'wg'] + }, + 'Rebecca Black Tech': { + domain: 'rbt.asia', + http: true, + https: true, + software: 'fuuka', + boards: ['cgl', 'g', 'mu', 'w'], + files: ['cgl', 'g', 'mu', 'w'] + }, + 'The Dark Cave': { + domain: 'archive.thedarkcave.org', + http: true, + https: true, + software: 'foolfuuka', + boards: ['c', 'int', 'out', 'po'], + files: ['c', 'po'] }, 'warosu': { - 'domain': 'fuuka.warosu.org', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'vr'] - }, - 'worldathleticproject': { - 'domain': 'fuuka.worldathleticproject.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['e', 'h', 'p', 's', 'u'], - 'files': ['e', 'h', 'p', 's', 'u'] + domain: 'fuuka.warosu.org', + http: true, + https: true, + software: 'fuuka', + boards: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], + files: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] } }, to: function(dest, data) { var archive; - archive = (dest === 'search' ? Redirect.thread : Redirect[dest])[data.boardID]; + archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; if (!archive) { return ''; } diff --git a/builds/crx/script.js b/builds/crx/script.js index 9141f49a9..fbb0c45b9 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -89,6 +89,8 @@ * license: http://userscripts.org/scripts/review/1352 * */ +'use strict'; + (function() { var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, @@ -7923,6 +7925,9 @@ } }), saveLastReadPost: $.debounce(2 * $.SECOND, function() { + if (Unread.thread.isDead) { + return; + } return Unread.db.set({ boardID: Unread.thread.board.ID, threadID: Unread.thread.ID, @@ -7965,9 +7970,11 @@ }; Redirect = { - thread: {}, - post: {}, - file: {}, + data: { + thread: {}, + post: {}, + file: {} + }, init: function() { var archive, boardID, boards, data, id, name, type, _i, _len, _ref, _ref1, _ref2; @@ -7981,7 +7988,7 @@ if (!boards.contains(boardID)) { continue; } - Redirect[type][boardID] = archive; + Redirect.data[type][boardID] = archive; } } } @@ -7991,126 +7998,118 @@ _ref2 = archive.boards; for (_i = 0, _len = _ref2.length; _i < _len; _i++) { boardID = _ref2[_i]; - if (!(boardID in Redirect.thread)) { - Redirect.thread[boardID] = archive; + if (!(boardID in Redirect.data.thread)) { + Redirect.data.thread[boardID] = archive; } - if (!(boardID in Redirect.post || archive.software !== 'foolfuuka')) { - Redirect.post[boardID] = archive; + if (!(boardID in Redirect.data.post || archive.software !== 'foolfuuka')) { + Redirect.data.post[boardID] = archive; } - if (!(boardID in Redirect.file || !archive.files.contains(boardID))) { - Redirect.file[boardID] = archive; + if (!(boardID in Redirect.data.file || !archive.files.contains(boardID))) { + Redirect.data.file[boardID] = archive; } } } }, archives: { - 'Foolz': { - 'domain': 'archive.foolz.us', - 'http': false, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'], - 'files': ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] - }, - 'NSFW Foolz': { - 'domain': 'nsfw.foolz.us', - 'http': false, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['u'], - 'files': ['u'] - }, - 'The Dark Cave': { - 'domain': 'archive.thedarkcave.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['c', 'int', 'out', 'po'], - 'files': ['c', 'po'] - }, '4plebs': { - 'domain': 'archive.4plebs.org', - 'http': true, - 'software': 'foolfuuka', - 'boards': ['hr', 'tg', 'tv', 'x'], - 'files': ['hr', 'tg', 'tv', 'x'] + domain: 'archive.4plebs.org', + http: true, + software: 'foolfuuka', + boards: ['hr', 'tg', 'tv', 'x'], + files: ['hr', 'tg', 'tv', 'x'] }, - 'Nyafuu': { - 'domain': 'archive.nyafuu.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['c', 'w', 'wg'], - 'files': ['c', 'w', 'wg'] + 'fap archive': { + domain: 'fuuka.worldathleticproject.org', + http: true, + https: false, + software: 'foolfuuka', + boards: ['b', 'e', 'h', 'hc', 'p', 's', 'u'], + files: ['b', 'e', 'h', 'hc', 'p', 's', 'u'] + }, + 'Foolz': { + domain: 'archive.foolz.us', + http: false, + https: true, + software: 'foolfuuka', + boards: ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'], + files: ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] }, 'Foolz a Shit': { - 'domain': 'archive.foolzashit.com', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'], - 'files': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] + domain: 'archive.foolzashit.com', + http: true, + https: true, + software: 'foolfuuka', + boards: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'], + files: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] }, - 'World Athletic Project': { - 'domain': 'fuuka.worldathleticproject.org', - 'http': true, - 'https': false, - 'software': 'foolfuuka', - 'boards': ['e', 'h', 'hc', 'p', 's', 'u'], - 'files': ['e', 'h', 'hc', 'p', 's', 'u'] - }, - 'Install Gentoo': { - 'domain': 'archive.installgentoo.net', - 'http': false, - 'https': true, - 'software': 'fuuka', - 'boards': ['diy', 'g', 'sci'], - 'files': [] - }, - 'warosu': { - 'domain': 'fuuka.warosu.org', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] - }, - 'Rebecca Black Tech': { - 'domain': 'rbt.asia', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['cgl', 'g', 'mu', 'w'], - 'files': ['cgl', 'g', 'mu', 'w'] + 'Foolz Beta': { + domain: 'beta.foolz.us', + http: true, + https: true, + software: 'foolfuuka', + boards: ['a', 'co', 'gd', 'h', 'jp', 'm', 'mlp', 'q', 'sp', 'tg', 'tv', 'u', 'v', 'vg', 'vp', 'vr', 'wsg'], + files: ['a', 'gd', 'h', 'jp', 'm', 'q', 'tg', 'u', 'vg', 'vp', 'vr', 'wsg'] }, 'Heinessen': { - 'domain': 'archive.heinessen.com', - 'http': true, - 'software': 'fuuka', - 'boards': ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'], - 'files': ['an', 'k', 'toy'] + domain: 'archive.heinessen.com', + http: true, + software: 'fuuka', + boards: ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'], + files: ['an', 'k', 'toy'] + }, + 'Install Gentoo': { + domain: 'archive.installgentoo.net', + http: false, + https: true, + software: 'fuuka', + boards: ['diy', 'g', 'sci'], + files: [] + }, + 'NSFW Foolz': { + domain: 'nsfw.foolz.us', + http: false, + https: true, + software: 'foolfuuka', + boards: ['u'], + files: ['u'] + }, + 'Nyafuu': { + domain: 'archive.nyafuu.org', + http: true, + https: true, + software: 'foolfuuka', + boards: ['c', 'w', 'wg'], + files: ['c', 'w', 'wg'] + }, + 'Rebecca Black Tech': { + domain: 'rbt.asia', + http: true, + https: true, + software: 'fuuka', + boards: ['cgl', 'g', 'mu', 'w'], + files: ['cgl', 'g', 'mu', 'w'] + }, + 'The Dark Cave': { + domain: 'archive.thedarkcave.org', + http: true, + https: true, + software: 'foolfuuka', + boards: ['c', 'int', 'out', 'po'], + files: ['c', 'po'] }, 'warosu': { - 'domain': 'fuuka.warosu.org', - 'http': true, - 'https': true, - 'software': 'fuuka', - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'vr'] - }, - 'worldathleticproject': { - 'domain': 'fuuka.worldathleticproject.org', - 'http': true, - 'https': true, - 'software': 'foolfuuka', - 'boards': ['e', 'h', 'p', 's', 'u'], - 'files': ['e', 'h', 'p', 's', 'u'] + domain: 'fuuka.warosu.org', + http: true, + https: true, + software: 'fuuka', + boards: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'], + files: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] } }, to: function(dest, data) { var archive; - archive = (dest === 'search' ? Redirect.thread : Redirect[dest])[data.boardID]; + archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; if (!archive) { return ''; } @@ -10331,7 +10330,6 @@ if ((_ref = $('link[href*=mobile]', d.head)) != null) { _ref.disabled = true; } - $.addClass(doc, 'webkit'); $.addClass(doc, 'blink'); $.addClass(doc, 'fourchan-x'); $.addClass(doc, g.VIEW); diff --git a/json/archives.json b/json/archives.json new file mode 100644 index 000000000..15c52e369 --- /dev/null +++ b/json/archives.json @@ -0,0 +1,109 @@ +[{ + "uid": 0, + "name": "Foolz", + "domain": "archive.foolz.us", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], + "files": ["a", "gd", "jp", "m", "q", "tg", "vg", "vp", "vr", "wsg"] +}, { + "uid": 1, + "name": "NSFW Foolz", + "domain": "nsfw.foolz.us", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["u"], + "files": ["u"] +}, { + "uid": 2, + "name": "The Dark Cave", + "domain": "archive.thedarkcave.org", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["c", "int", "out", "po"], + "files": ["c", "po"] +}, { + "uid": 3, + "name": "4plebs", + "domain": "archive.4plebs.org", + "http": true, + "https": false, + "software": "foolfuuka", + "boards": ["hr", "tg", "tv", "x"], + "files": ["hr", "tg", "tv", "x"] +}, { + "uid": 4, + "name": "Nyafuu", + "domain": "archive.nyafuu.org", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["c", "w", "wg"], + "files": ["c", "w", "wg"] +}, { + "uid": 11, + "name": "Foolz a Shit", + "domain": "archive.foolzashit.com", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["adv", "asp", "cm", "e", "i", "lgbt", "n", "o", "p", "pol", "s", "s4s", "t", "trv", "y"], + "files": ["adv", "asp", "cm", "e", "i", "lgbt", "n", "o", "p", "s", "s4s", "t", "trv", "y"] +}, { + "uid": 12, + "name": "fap archive", + "domain": "fuuka.worldathleticproject.org", + "http": true, + "https": false, + "software": "foolfuuka", + "boards": ["b", "e", "h", "hc", "p", "s", "u"], + "files": ["b", "e", "h", "hc", "p", "s", "u"] +}, { + "uid": 7, + "name": "Install Gentoo", + "domain": "archive.installgentoo.net", + "http": false, + "https": true, + "software": "fuuka", + "boards": ["diy", "g", "sci"], + "files": [] +}, { + "uid": 8, + "name": "Rebecca Black Tech", + "domain": "rbt.asia", + "http": true, + "https": true, + "software": "fuuka", + "boards": ["cgl", "g", "mu", "w"], + "files": ["cgl", "g", "mu", "w"] +}, { + "uid": 9, + "name": "Heinessen", + "domain": "archive.heinessen.com", + "http": true, + "https": false, + "software": "fuuka", + "boards": ["an", "fit", "k", "mlp", "r9k", "toy"], + "files": ["an", "fit", "k", "r9k", "toy"] +}, { + "uid": 10, + "name": "warosu", + "domain": "fuuka.warosu.org", + "http": true, + "https": true, + "software": "fuuka", + "boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"], + "files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"] +}, { + "uid": 13, + "name": "Foolz Beta", + "domain": "beta.foolz.us", + "http": true, + "https": true, + "software": "foolfuuka", + "boards": ["a", "co", "gd", "h", "jp", "m", "mlp", "q", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"], + "files": ["a", "gd", "h", "jp", "m", "q", "tg", "u", "vg", "vp", "vr", "wsg"] +}] diff --git a/package.json b/package.json index 5e9f98831..49e729ff9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-watch": "~0.5.0", - "grunt-shell": "~0.3.1" + "grunt-shell": "~0.3.1", + "matchdep": "~0.1.2" }, "repository": { "type": "git", diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 8f8e03e28..156d0d567 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -1,7 +1,8 @@ Redirect = - thread: {} - post: {} - file: {} + data: + thread: {} + post: {} + file: {} init: -> for boardID, data of Conf['selectedArchives'] @@ -9,122 +10,114 @@ Redirect = if archive = Redirect.archives[id] boards = archive[type] or archive['boards'] continue unless boards.contains boardID - Redirect[type][boardID] = archive + Redirect.data[type][boardID] = archive for name, archive of Redirect.archives for boardID in archive.boards - unless boardID of Redirect.thread - Redirect.thread[boardID] = archive - unless boardID of Redirect.post or archive.software isnt 'foolfuuka' - Redirect.post[boardID] = archive - unless boardID of Redirect.file or !archive.files.contains boardID - Redirect.file[boardID] = archive + unless boardID of Redirect.data.thread + Redirect.data.thread[boardID] = archive + unless boardID of Redirect.data.post or archive.software isnt 'foolfuuka' + Redirect.data.post[boardID] = archive + unless boardID of Redirect.data.file or !archive.files.contains boardID + Redirect.data.file[boardID] = archive return archives: - 'Foolz': - 'domain': 'archive.foolz.us' - 'http': false - 'https': true - 'software': 'foolfuuka' - 'boards': ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'] - 'files': ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] - - 'NSFW Foolz': - 'domain': 'nsfw.foolz.us' - 'http': false - 'https': true - 'software': 'foolfuuka' - 'boards': ['u'] - 'files': ['u'] - - 'The Dark Cave': - 'domain': 'archive.thedarkcave.org' - 'http': true - 'https': true - 'software': 'foolfuuka' - 'boards': ['c', 'int', 'out', 'po'] - 'files': ['c', 'po'] - '4plebs': - 'domain': 'archive.4plebs.org' - 'http': true - 'software': 'foolfuuka' - 'boards': ['hr', 'tg', 'tv', 'x'] - 'files': ['hr', 'tg', 'tv', 'x'] + domain: 'archive.4plebs.org' + http: true + software: 'foolfuuka' + boards: ['hr', 'tg', 'tv', 'x'] + files: ['hr', 'tg', 'tv', 'x'] - 'Nyafuu': - 'domain': 'archive.nyafuu.org' - 'http': true - 'https': true - 'software': 'foolfuuka' - 'boards': ['c', 'w', 'wg'] - 'files': ['c', 'w', 'wg'] + 'fap archive': + domain: 'fuuka.worldathleticproject.org' + http: true + https: false + software: 'foolfuuka' + boards: ['b', 'e', 'h', 'hc', 'p', 's', 'u'] + files: ['b', 'e', 'h', 'hc', 'p', 's', 'u'] + + 'Foolz': + domain: 'archive.foolz.us' + http: false + https: true + software: 'foolfuuka' + boards: ['a', 'co', 'gd', 'jp', 'm', 'q', 'sp', 'tg', 'tv', 'v', 'vg', 'vp', 'vr', 'wsg'] + files: ['a', 'gd', 'jp', 'm', 'q', 'tg', 'vg', 'vp', 'vr', 'wsg'] 'Foolz a Shit': - 'domain': 'archive.foolzashit.com' - 'http': true - 'https': true - 'software': 'foolfuuka' - 'boards': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] - 'files': ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] + domain: 'archive.foolzashit.com' + http: true + https: true + software: 'foolfuuka' + boards: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] + files: ['adv', 'asp', 'cm', 'i', 'lgbt', 'n', 'o', 'p', 's4s', 't', 'trv'] - 'World Athletic Project': - 'domain': 'fuuka.worldathleticproject.org' - 'http': true - 'https': false - 'software': 'foolfuuka' - 'boards': ['e', 'h', 'hc', 'p', 's', 'u'] - 'files': ['e', 'h', 'hc', 'p', 's', 'u'] - - 'Install Gentoo': - 'domain': 'archive.installgentoo.net' - 'http': false - 'https': true - 'software': 'fuuka' - 'boards': ['diy', 'g', 'sci'] - 'files': [] - - 'warosu': - 'domain': 'fuuka.warosu.org' - 'http': true - 'https': true - 'software': 'fuuka' - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] - - 'Rebecca Black Tech': - 'domain': 'rbt.asia' - 'http': true - 'https': true - 'software': 'fuuka' - 'boards': ['cgl', 'g', 'mu', 'w'] - 'files': ['cgl', 'g', 'mu', 'w'] + 'Foolz Beta': + domain: 'beta.foolz.us' + http: true + https: true, + software: 'foolfuuka' + boards: ['a', 'co', 'gd', 'h', 'jp', 'm', 'mlp', 'q', 'sp', 'tg', 'tv', 'u', 'v', 'vg', 'vp', 'vr', 'wsg'], + files: ['a', 'gd', 'h', 'jp', 'm', 'q', 'tg', 'u', 'vg', 'vp', 'vr', 'wsg'] 'Heinessen': - 'domain': 'archive.heinessen.com' - 'http': true - 'software': 'fuuka' - 'boards': ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'] - 'files': ['an', 'k', 'toy'] + domain: 'archive.heinessen.com' + http: true + software: 'fuuka' + boards: ['an', 'fit', 'k', 'mlp', 'r9k', 'toy'] + files: ['an', 'k', 'toy'] + + 'Install Gentoo': + domain: 'archive.installgentoo.net' + http: false + https: true + software: 'fuuka' + boards: ['diy', 'g', 'sci'] + files: [] + + 'NSFW Foolz': + domain: 'nsfw.foolz.us' + http: false + https: true + software: 'foolfuuka' + boards: ['u'] + files: ['u'] + + 'Nyafuu': + domain: 'archive.nyafuu.org' + http: true + https: true + software: 'foolfuuka' + boards: ['c', 'w', 'wg'] + files: ['c', 'w', 'wg'] + + 'Rebecca Black Tech': + domain: 'rbt.asia' + http: true + https: true + software: 'fuuka' + boards: ['cgl', 'g', 'mu', 'w'] + files: ['cgl', 'g', 'mu', 'w'] + + 'The Dark Cave': + domain: 'archive.thedarkcave.org' + http: true + https: true + software: 'foolfuuka' + boards: ['c', 'int', 'out', 'po'] + files: ['c', 'po'] 'warosu': - 'domain': 'fuuka.warosu.org' - 'http': true - 'https': true - 'software': 'fuuka' - 'boards': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] - 'files': ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'vr'] - - 'worldathleticproject': - 'domain': 'fuuka.worldathleticproject.org' - 'http': true - 'https': true - 'software': 'foolfuuka' - 'boards': ['e', 'h', 'p', 's', 'u'] - 'files': ['e', 'h', 'p', 's', 'u'] + domain: 'fuuka.warosu.org' + http: true + https: true + software: 'fuuka' + boards: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] + files: ['3', 'cgl', 'ck', 'fa', 'ic', 'jp', 'lit', 'q', 'tg', 'vr'] to: (dest, data) -> - archive = (if dest is 'search' then Redirect.thread else Redirect[dest])[data.boardID] + archive = (if dest is 'search' then Redirect.data.thread else Redirect.data[dest])[data.boardID] return '' unless archive Redirect[dest] archive, data diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 4116ec1c7..71611a95c 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -139,7 +139,6 @@ Main = # disable the mobile layout $('link[href*=mobile]', d.head)?.disabled = true <% if (type === 'crx') { %> - $.addClass doc, 'webkit' $.addClass doc, 'blink' <% } else { %> $.addClass doc, 'gecko' diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index a04926155..8cf3f31b6 100644 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -219,11 +219,11 @@ $.off = (el, events, handler) -> $.event = (event, detail, root=d) -> root.dispatchEvent new CustomEvent event, {bubbles: true, detail} -$.open = (URL) -> +$.open = <% if (type === 'userscript') { %> - GM_openInTab URL + GM_openInTab <% } else { %> - window.open URL, '_blank' + (URL) -> window.open URL, '_blank' <% } %> $.debounce = (wait, fn) -> diff --git a/src/General/meta/usestrict.js b/src/General/meta/usestrict.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/src/General/meta/usestrict.js @@ -0,0 +1 @@ +'use strict'; diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index dd2b5347b..8263c835a 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -136,6 +136,7 @@ Unread = Unread.update() if e saveLastReadPost: $.debounce 2 * $.SECOND, -> + return if Unread.thread.isDead Unread.db.set boardID: Unread.thread.board.ID threadID: Unread.thread.ID