diff --git a/CHANGELOG.md b/CHANGELOG.md index 042a45f50..2a8eba8dd 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0). +### v1.11.16 + +**v1.11.16.0** *(2015-11-08)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.16.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.16.0/builds/4chan-X-noupdate.crx "Chromium version")] +- Based on v1.11.15.7. +- 4chan X no longer requires local storage to be enabled when using Chromium-based browsers. In Firefox, local storage is still needed to sync settings between tabs, but it is no longer essential. Warnings about local storage being disabled can be turned off by disabling the `Show Support Message` setting. Local storage is still required in userscript engines that do not support the Greasemonkey API. +- The link to pass login window is now optional, controlled by `Pass Link` setting. +- The style changes to the board title have been moved to custom CSS (now on by default) so that users can easily remove them if they wish. +- Refactoring and bug fixes. + ### v1.11.15 **v1.11.15.7** *(2015-11-07)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.15.7/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.15.7/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 41befb035..e2db2bc81 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index b85a1e7c3..144978095 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.11.15.7 +// @version 1.11.16.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -10,8 +10,6 @@ // @include https://boards.4chan.org/* // @include http://sys.4chan.org/* // @include https://sys.4chan.org/* -// @include http://a.4cdn.org/* -// @include https://a.4cdn.org/* // @include http://i.4cdn.org/* // @include https://i.4cdn.org/* // @include http://www.4chan.org/banned diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 2c39d2ccb..04eb0fb69 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.11.15.7 +// @version 1.11.16.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -11,8 +11,6 @@ // @include https://boards.4chan.org/* // @include http://sys.4chan.org/* // @include https://sys.4chan.org/* -// @include http://a.4cdn.org/* -// @include https://a.4cdn.org/* // @include http://i.4cdn.org/* // @include https://i.4cdn.org/* // @include http://www.4chan.org/banned @@ -117,7 +115,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, Notice, PSAHiding, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, err, g, slice = [].slice, 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; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -154,7 +152,7 @@ 'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Show Support Message': [true, 'Warn if your browser or configuration is unsupported and may cause 4chan X to not operate correctly.'], - 'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'], + 'Normalize URL': [true, 'Rewrite the URL of the current page, removing slugs and excess slashes, and changing /res/ to /thread/.'], 'Disable Autoplaying Sounds': [false, 'Prevent sounds on the page from autoplaying.'], 'Disable Native Extension': [true, '4chan X is NOT designed to work with the native extension.'], 'Enable Native Flash Embedding': [true, 'Activate the native extension\'s Flash embedding if the native extension is disabled.'] @@ -250,7 +248,8 @@ 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha.'], - 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'] + 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'], + 'Pass Link': [true, 'Add a 4chan Pass login link to the bottom of the page.'] }, 'Quote Links': { 'Quote Backlinks': [true, 'Add quote backlinks.'], @@ -313,7 +312,7 @@ FappeT: { werk: false }, - 'Custom CSS': false, + 'Custom CSS': true, Index: { 'Index Mode': 'paged', 'Previous Index Mode': 'paged', @@ -345,7 +344,26 @@ backlink: '>>%id', fileInfo: '%l (%p%s, %r%g)', favicon: 'ferongr', - usercss: '', + usercss: "/* Board title rice */\n" + +"div.boardTitle {\n" + +" font-weight: 400 !important;\n" + +"}\n" + +":root.yotsuba div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + +"}\n" + +":root.yotsuba-b div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + +"}\n" + +":root.photon div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + +"}\n" + +":root.tomorrow div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + +"}", hotkeys: { 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'], 'Toggle header': ['Shift+h', 'Toggle the auto-hide option of the header.'], @@ -415,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.15.7', + VERSION: '1.11.16.0', NAMESPACE: '4chan X.', boards: {} }; @@ -942,6 +960,14 @@ } })(); + try { + localStorage.getItem('x'); + $.hasStorage = true; + } catch (_error) { + err = _error; + $.hasStorage = false; + } + $.item = function(key, val) { var item; item = {}; @@ -956,7 +982,7 @@ $.listValues = function() { return GM_listValues(); }; - } else { + } else if ($.hasStorage) { $.getValue = function(key) { return localStorage[key]; }; @@ -970,6 +996,11 @@ } return results; }; + } else { + $.getValue = function() {}; + $.listValues = function() { + return []; + }; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -981,17 +1012,24 @@ GM_setValue(key, val); if (key in $.syncing) { $.oldValue[key] = val; - return localStorage[key] = val; + if ($.hasStorage) { + return localStorage[key] = val; + } } }; $.deleteValue = function(key) { GM_deleteValue(key); if (key in $.syncing) { delete $.oldValue[key]; - return delete localStorage[key]; + if ($.hasStorage) { + return delete localStorage[key]; + } } }; - } else { + if (!$.hasStorage) { + $.cantSync = true; + } + } else if ($.hasStorage) { $.oldValue = {}; $.setValue = function(key, val) { if (key in $.syncing) { @@ -1005,6 +1043,10 @@ } return delete localStorage[key]; }; + } else { + $.setValue = function() {}; + $.deleteValue = function() {}; + $.cantSync = $.cantSet = true; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -1019,7 +1061,7 @@ }); }; $.forceSync = function() {}; - } else { + } else if ($.hasStorage) { $.sync = function(key, cb) { key = g.NAMESPACE + key; $.syncing[key] = cb; @@ -1053,6 +1095,9 @@ return onChange(g.NAMESPACE + key); }; })(); + } else { + $.sync = function() {}; + $.forceSync = function() {}; } $["delete"] = function(keys) { @@ -1143,7 +1188,7 @@ }; Callbacks.prototype.execute = function(node, keys) { - var err, errors, k, len1, name, ref; + var errors, k, len1, name, ref; if (keys == null) { keys = this.keys; } @@ -1891,17 +1936,17 @@ DataBoard.prototype.ajaxClean = function(boardID) { return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) { return function(e1) { - if (e1.target.status === 200) { - if (boardID === 'b' || boardID === 'f' || boardID === 'trash') { - return _this.ajaxCleanParse(boardID, e1.target.response); - } else { - return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { - if (e2.target.status === 200) { - return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); - } - }); - } + var ref; + if ((ref = e1.target.status) !== 200 && ref !== 404) { + return; } + return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { + var ref1; + if ((ref1 = e2.target.status) !== 200 && ref1 !== 404) { + return; + } + return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); + }); }; })(this)); }; @@ -1910,14 +1955,16 @@ var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; board = this.data.boards[boardID]; threads = {}; - for (k = 0, len1 = response1.length; k < len1; k++) { - page = response1[k]; - ref = page.threads; - for (q = 0, len2 = ref.length; q < len2; q++) { - thread = ref[q]; - ID = thread.no; - if (ID in board) { - threads[ID] = board[ID]; + if (response1) { + for (k = 0, len1 = response1.length; k < len1; k++) { + page = response1[k]; + ref = page.threads; + for (q = 0, len2 = ref.length; q < len2; q++) { + thread = ref[q]; + ID = thread.no; + if (ID in board) { + threads[ID] = board[ID]; + } } } } @@ -3756,7 +3803,7 @@ return $.addClass(Index.button, 'fa-spin'); }, load: function(e, state) { - var err, nTimeout, notice, ref, req, timeEl; + var nTimeout, notice, ref, req, timeEl; $.rmClass(Index.button, 'fa-spin'); req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout; if (nTimeout) { @@ -3840,7 +3887,7 @@ }); }, buildThreads: function() { - var err, errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; + var errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; Index.nodes = []; threads = []; posts = []; @@ -3887,7 +3934,7 @@ return $.event('IndexRefresh'); }, buildReplies: function(threadRoots) { - var data, err, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; + var data, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; posts = []; for (k = 0, len1 = threadRoots.length; k < len1; k++) { threadRoot = threadRoots[k]; @@ -4681,7 +4728,7 @@ }; Menu.prototype.insertEntry = function(entry, parent, data) { - var err, k, len1, ref, subEntry, submenu; + var k, len1, ref, subEntry, submenu; if (typeof entry.open === 'function') { try { if (!entry.open(data)) { @@ -5172,7 +5219,7 @@ Filter = { filters: {}, init: function() { - var boards, err, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; + var boards, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Filter'])) { return; } @@ -5811,6 +5858,9 @@ }, catalogSet: function(board) { var hiddenThreads, threadID; + if (!$.hasStorage) { + return; + } hiddenThreads = ThreadHiding.db.get({ boardID: board.ID, defaultValue: {} @@ -5821,8 +5871,11 @@ return localStorage.setItem("4chan-hide-t-" + board, JSON.stringify(hiddenThreads)); }, catalogWatch: function() { + if (!$.hasStorage) { + return; + } this.hiddenThreads = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)) || {}; - return $.ready(function() { + return Main.ready(function() { return new MutationObserver(ThreadHiding.catalogSave).observe($.id('threads'), { attributes: true, subtree: true, @@ -6998,7 +7051,6 @@ } }, open: function() { - var err; if (QR.nodes) { if (QR.nodes.el.hidden) { QR.captcha.setup(); @@ -7608,7 +7660,7 @@ return $.event('QRDialogCreation', null, dialog); }, submit: function(e) { - var captcha, cb, err, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; + var captcha, cb, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; if (e != null) { e.preventDefault(); } @@ -7742,7 +7794,7 @@ return QR.status(); }, response: function() { - var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; + var URL, _, ban, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; req = QR.req; delete QR.req; post = QR.posts[0]; @@ -8559,7 +8611,7 @@ return this.conn.target = iframe; }, setupJS: function() { - return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: (document.documentElement.classList.contains(\'tomorrow\') || document.documentElement.classList.contains(\'spooky\')) ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); + return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); }, afterSetup: function(mutations) { var iframe, k, len1, len2, mutation, node, q, ref, textarea; @@ -8754,6 +8806,31 @@ } }; + PassLink = { + init: function() { + if (!Conf['Pass Link']) { + return; + } + return Main.ready(this.ready); + }, + ready: function() { + var passLink, styleSelector; + if (!(styleSelector = $.id('styleSelector'))) { + return; + } + passLink = $.el('span', { + className: 'brackets-wrap pass-link-container' + }); + $.extend(passLink, { + innerHTML: "4chan Pass" + }); + $.on(passLink.firstElementChild, 'click', function() { + return window.open('//sys.4chan.org/auth', Date.now(), 'width=500,height=280,toolbar=0'); + }); + return $.before(styleSelector.previousSibling, [passLink, $.tn('\u00A0\u00A0')]); + } + }; + PostSuccessful = { init: function() { return $.ready(this.ready); @@ -11327,7 +11404,7 @@ Sauce = { init: function() { - var err, k, len1, link, links, ref, ref1; + var k, len1, link, links, ref, ref1; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Sauce'])) { return; } @@ -15403,7 +15480,22 @@ } }, initReady: function() { - return $.globalEval('if (JSON.parse(localStorage["4chan-settings"] || "{}").disableAll) SWFEmbed.init();'); + if ($.hasStorage) { + return $.global(function() { + if (JSON.parse(localStorage['4chan-settings'] || '{}').disableAll) { + return window.SWFEmbed.init(); + } + }); + } else { + if (g.VIEW === 'thread') { + $.global(function() { + return window.Main.tid = location.pathname.split(/\/+/)[3]; + }); + } + return $.global(function() { + return window.SWFEmbed.init(); + }); + } } }; @@ -16157,6 +16249,28 @@ } }; + NormalizeURL = { + init: function() { + var pathname; + if (!Conf['Normalize URL']) { + return; + } + pathname = location.pathname.split(/\/+/); + switch (g.VIEW) { + case 'thread': + pathname[2] = 'thread'; + pathname = pathname.slice(0, 4); + break; + case 'index': + pathname = pathname.slice(0, 3); + } + pathname = pathname.join('/'); + if (location.pathname !== pathname) { + return history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); + } + } + }; + RelativeDates = { INTERVAL: $.MINUTE / 2, init: function() { @@ -16300,7 +16414,7 @@ "}", init: function() { var match; - if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { + if (!(match = location.search.match(/\bno=(\d+)/))) { return; } Captcha.replace.init(); @@ -16521,12 +16635,20 @@ return Settings.open(e.detail); }); if (Conf['Disable Native Extension']) { - settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; - if (settings.disableAll) { - return; + if ($.hasStorage) { + settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; + if (settings.disableAll) { + return; + } + settings.disableAll = true; + return localStorage.setItem('4chan-settings', JSON.stringify(settings)); + } else { + return $.onExists(doc, 'body', false, function() { + return $.global(function() { + return window.Config.disableAll = true; + }); + }); } - settings.disableAll = true; - return localStorage.setItem('4chan-settings', JSON.stringify(settings)); } }, open: function(openSection) { @@ -16693,8 +16815,10 @@ return $.get('hiddenThreads', {}, function(arg) { var boardID, hiddenThreads; hiddenThreads = arg.hiddenThreads; - for (boardID in hiddenThreads.boards) { - localStorage.removeItem("4chan-hide-t-" + boardID); + if ($.hasStorage) { + for (boardID in hiddenThreads.boards) { + localStorage.removeItem("4chan-hide-t-" + boardID); + } } return $["delete"](['hiddenThreads', 'hiddenPosts']); }); @@ -16738,7 +16862,6 @@ } reader = new FileReader(); reader.onload = function(e) { - var err; try { return Settings.loadSettings(JSON.parse(e.target.result), function(err) { if (err) { @@ -16870,7 +16993,7 @@ } }, upgrade: function(data, version) { - var boardID, changes, compareString, name, record, ref, ref1, ref2, type, uids; + var boardID, changes, compareString, name, record, ref, ref1, ref2, rice, type, uids; changes = {}; compareString = version.replace(/\d+/g, function(x) { return ('0000' + x).slice(-5); @@ -16911,6 +17034,13 @@ } } } + if (compareString < '00001.00011.00016.00000') { + if ((rice = Config['usercss'].match(/\/\* Board title rice \*\/(?:\n.+)*/)[0])) { + if ((data['usercss'] != null) && data['usercss'].indexOf(rice) < 0) { + changes['usercss'] = rice + '\n\n' + data['usercss']; + } + } + } return changes; }, loadSettings: function(data, cb) { @@ -17259,7 +17389,7 @@ Main = { init: function() { - var db, flatten, items, k, key, len1, pathname, ref, ref1, ref2; + var db, flatten, items, k, key, len1, ref; if (d.body && !$('title', d.head)) { return; } @@ -17284,35 +17414,6 @@ }); return; } - g.threads = new SimpleDict(); - g.posts = new SimpleDict(); - pathname = location.pathname.split(/\/+/); - g.BOARD = new Board(pathname[1]); - if ((ref = g.BOARD.ID) === 'z' || ref === 'fk') { - return; - } - g.VIEW = (function() { - switch (pathname[2]) { - case 'res': - case 'thread': - return 'thread'; - case 'catalog': - case 'archive': - case 'post': - return pathname[2]; - default: - return 'index'; - } - })(); - if (g.VIEW === 'catalog' && g.BOARD.ID === 'f') { - return; - } - if (g.VIEW === 'archive' && ((ref1 = g.BOARD.ID) === 'b' || ref1 === 'f' || ref1 === 'trash')) { - return; - } - if (g.VIEW === 'thread') { - g.THREADID = +pathname[3]; - } flatten = function(parent, obj) { var key, val; if (obj instanceof Array) { @@ -17327,9 +17428,9 @@ } }; flatten(null, Config); - ref2 = DataBoard.keys; - for (k = 0, len1 = ref2.length; k < len1; k++) { - db = ref2[k]; + ref = DataBoard.keys; + for (k = 0, len1 = ref.length; k < len1; k++) { + db = ref[k]; Conf[db] = { boards: {} }; @@ -17342,12 +17443,14 @@ items[key] = void 0; } items['previousversion'] = void 0; - $.get(items, function(items) { + return $.get(items, function(items) { return $.asap((function() { return doc = d.documentElement; }), function() { - var ref3, val; - if (items.previousversion == null) { + var ref1, val; + if ($.cantSet) { + + } else if (items.previousversion == null) { Main.ready(function() { $.set('previousversion', g.VERSION); return Settings.open(); @@ -17357,16 +17460,11 @@ } for (key in Conf) { val = Conf[key]; - Conf[key] = (ref3 = items[key]) != null ? ref3 : val; + Conf[key] = (ref1 = items[key]) != null ? ref1 : val; } return Main.initFeatures(); }); }); - return $.asap((function() { - return doc = d.documentElement; - }), function() { - return $.onExists(doc, 'body', false, Main.initStyle); - }); }, upgrade: function(items) { var changes, previousversion; @@ -17387,43 +17485,50 @@ }); }, initFeatures: function() { - var err, feature, k, len1, match, name, pathname, ref, ref1, ref2; - if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org' || ref === 'www.4chan.org') { + var feature, hostname, k, len1, match, name, pathname, ref, ref1, ref2, ref3, search; + hostname = location.hostname, search = location.search; + pathname = location.pathname.split(/\/+/); + if (hostname !== 'www.4chan.org') { + g.BOARD = new Board(pathname[1]); + } + if (hostname === 'boards.4chan.org' || hostname === 'sys.4chan.org' || hostname === 'www.4chan.org') { $.global(function() { document.documentElement.classList.add('js-enabled'); return window.FCX = {}; }); } - switch (location.hostname) { + switch (hostname) { case 'www.4chan.org': Captcha.replace.init(); return; - case 'a.4cdn.org': - return; case 'sys.4chan.org': - Report.init(); - if (g.VIEW === 'post') { + if (pathname[2] === 'imgboard.php') { + if (/\bmode=report\b/.test(search)) { + Report.init(); + } else if ((match = search.match(/\bres=(\d+)/))) { + $.ready(function() { + var ref; + if (Conf['404 Redirect'] && ((ref = $.id('errmsg')) != null ? ref.textContent : void 0) === 'Error: Specified thread does not exist.') { + return Redirect.navigate('thread', { + boardID: g.BOARD.ID, + postID: +match[1] + }); + } + }); + } + } else if (pathname[2] === 'post') { PostSuccessful.init(); } - if (Conf['404 Redirect'] && /\/imgboard\.php$/.test(location.pathname) && (match = location.search.match(/\bres=(\d+)/))) { - $.ready(function() { - var ref1; - if (((ref1 = $.id('errmsg')) != null ? ref1.textContent : void 0) === 'Error: Specified thread does not exist.') { - return Redirect.navigate('thread', { - boardID: g.BOARD.ID, - postID: +match[1] - }); - } - }); - } return; case 'i.4cdn.org': + if (!(pathname[2] && !/s\.jpg$/.test(pathname[2]))) { + return; + } $.asap((function() { return d.readyState !== 'loading'; }), function() { - var pathname, ref1, video; - if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { - pathname = location.pathname.split(/\/+/); + var ref, video; + if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { return Redirect.navigate('file', { boardID: g.BOARD.ID, filename: pathname[pathname.length - 1] @@ -17442,24 +17547,22 @@ }); return; } - if (Conf['Normalize URL']) { - pathname = location.pathname.split(/\/+/); - switch (g.VIEW) { - case 'thread': - pathname[2] = 'thread'; - pathname = pathname.slice(0, 4); - break; - case 'index': - pathname = pathname.slice(0, 3); - } - pathname = pathname.join('/'); - if (location.pathname !== pathname) { - history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); - } + if ((ref = pathname[2]) === 'thread' || ref === 'res') { + g.VIEW = 'thread'; + g.THREADID = +pathname[3]; + } else if ((ref1 = pathname[2]) === 'catalog' || ref1 === 'archive') { + g.VIEW = pathname[2]; + } else if (pathname[2].match(/^\d*$/)) { + g.VIEW = 'index'; + } else { + return; } - ref1 = Main.features; - for (k = 0, len1 = ref1.length; k < len1; k++) { - ref2 = ref1[k], name = ref2[0], feature = ref2[1]; + g.threads = new SimpleDict(); + g.posts = new SimpleDict(); + $.onExists(doc, 'body', false, Main.initStyle); + ref2 = Main.features; + for (k = 0, len1 = ref2.length; k < len1; k++) { + ref3 = ref2[k], name = ref3[0], feature = ref3[1]; try { feature.init(); } catch (_error) { @@ -17474,9 +17577,6 @@ }, initStyle: function() { var keyboard, ref; - if (location.hostname === 'www.4chan.org') { - $.addStyle(Main.cssWWW); - } if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) { return; } @@ -17504,14 +17604,7 @@ return Main.setClass(); }, setClass: function() { - var mainStyleSheet, setStyle, spooky, style, styleSheets; - if ((spooky = $('link[rel="stylesheet"][href^="//s.4cdn.org/css/spooky."]', d.head))) { - spooky.removeAttribute('media'); - if (getComputedStyle(d.body).color === 'rgb(196, 151, 86)') { - $.addClass(doc, 'spooky'); - return; - } - } + var mainStyleSheet, setStyle, style, styleSheets; if (g.VIEW === 'catalog') { $.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-')); return; @@ -17541,7 +17634,7 @@ }); }, initReady: function() { - var err, passLink, ref, ref1, styleSelector; + var ref, ref1, why; if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) { ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() { if (Conf['404 Redirect']) { @@ -17557,32 +17650,20 @@ if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') { return; } - if (styleSelector = $.id('styleSelector')) { - passLink = $.el('a', { - textContent: '4chan Pass', - href: 'javascript:;' - }); - $.on(passLink, 'click', function() { - return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'); - }); - $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]); - } if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { Main.initThread(); } else { $.event('4chanXInitFinished'); } if (Conf['Show Support Message']) { - try { - return localStorage.getItem('4chan-settings'); - } catch (_error) { - err = _error; - return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30); + if ($.cantSync) { + why = $.cantSet ? 'save your settings' : 'synchronize settings between tabs'; + return new Notice('warning', "4chan X needs local storage to " + why + ".\nEnable it on boards.4chan.org in your browser's privacy settings\n(may be listed as part of \"local data\" or \"cookies\")."); } } }, initThread: function() { - var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; + var board, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; if (board = $('.board')) { threads = []; posts = []; @@ -18809,6 +18890,7 @@ " max-height: 200px;\n" + " width: 100%;\n" + " overflow: auto;\n" + +" white-space: pre-line;\n" + "}\n" + "/* Settings */\n" + ":root.fourchan-x body {\n" + @@ -20100,9 +20182,6 @@ ".boardSubtitle[contenteditable=\"true\"] {\n" + " cursor: text !important;\n" + "}\n" + -"div.boardTitle {\n" + -" font-weight: 400 !important;\n" + -"}\n" + "/* Link Title Favicons */\n" + ".linkify.audio {\n" + " background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAitJREFUOE9jYCAWKJWwavr0KyXWb/FIbDtUFFyzJx6nVofE2Xo5nXsj0rqPNSR0nVkR2Hjmgmfd+U9Otdf+m5Vf/6+SfeU/R9ChVVgNYDRtlfJuuPA/rPfe/4QpD/6nznj0P27Kw/9unff/69Xf+69c/+C/SO7N/0z+OAxgMmmRCe++/r9i3ev/KWvf/vdY8PK/bt/9/wrNV3/IN5y/IVt1YqNg4pGTTP4HsbuA2bhZ2qvpyn+xjIObxAp3VwqlrgngLFyryVy5nhPmZJHANS2cwYexG8BmVC/pWn3hP4NZlzWuQDJI3dIiFnUUuwEsQAOcq87jNcC7fHeLUtJxHF4AGmBWeAavAWH1+1rUUk7giAWjOknllON4DXAs2NEiG4/DBQxAF/CFHfrPYI4jDFSLuJVjNrUJhB/B7gIGo1pJRt99GAZYJK7wLJ1z7Xzl4vu/7aqv/GRBj0bjqAX2qb0nJ7mXH17C4HcUxQA+hymWtSue/C5a9up/9Ozn/7Vr7v1nRY7GqMb91T3b3v6vWvPmf/S0p/9ZQk+DDLCBRSOz06Jqk+o7/21nvfqvsebDf7kZL/5zBaxphkezd+OFn7HzXvz3Wvjmv9a8N//5Ek//ZTBpVYUrMG2X5wjcdl68+uI/wa5Lr3hSNjczGFeywOVZ/bbcVGp//F9izfv/Ql03f3P4LC/HSEQquYwMFnUCDJ7dzBhyjGZNQpye89M5gpfnMvtNUyE2h4PUAQBovvT7lyNljwAAAABJRU5ErkJggg==') center left no-repeat!important;\n" + @@ -20482,11 +20561,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + -"}\n" + "/* General */\n" + ":root.yotsuba-b .dialog {\n" + " background-color: #D6DAF0;\n" + @@ -20558,11 +20632,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba-b div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + -"}\n" + "/* General */\n" + ":root.futaba .dialog {\n" + " background-color: #F0E0D6;\n" + @@ -20846,11 +20915,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.tomorrow div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + -"}\n" + "/* General */\n" + ":root.photon .dialog {\n" + " background-color: #DDD;\n" + @@ -20928,133 +20992,8 @@ ":root.photon .watch-thread-link\n" + "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.photon div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + -"}\n" + -"/* General */\n" + -":root.spooky .dialog {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .field:focus,\n" + -":root.spooky .field.focus {\n" + -" border-color: #98E;\n" + -"}\n" + -"/* Header */\n" + -":root.spooky #header-bar.dialog {\n" + -" background-color: rgba(23,21,38,0.98);\n" + -"}\n" + -":root.spooky:not(.fixed) #header-bar, :root.spooky #notifications {\n" + -" font-size: 9pt;\n" + -"}\n" + -":root.spooky #header-bar, :root.spooky #notifications {\n" + -" color: #C49756;\n" + -"}\n" + -":root.spooky #board-list a, :root.spooky #shortcuts a {\n" + -" color: #FE9600;\n" + -"}\n" + -"/* Settings */\n" + -":root.spooky #fourchanx-settings fieldset, :root.spooky .section-main div::before {\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .suboption-list > div:last-of-type {\n" + -" background-color: #171526;\n" + -"}\n" + -"/* Quote */\n" + -":root.spooky .catalog-thread > .comment > span.quote, :root.spooky #arc-list span.quote {\n" + -" color: #634C2C;\n" + -"}\n" + -":root.spooky .backlink.deadlink {\n" + -" color: #FE9600 !important;\n" + -"}\n" + -":root.spooky .inline {\n" + -" border-color: #707070;\n" + -" background-color: rgba(255, 255, 255, .14);\n" + -"}\n" + -"/* QR */\n" + -".spooky #dump-list::-webkit-scrollbar-thumb {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .qr-preview {\n" + -" background-color: rgba(0, 0, 0, .15);\n" + -"}\n" + -":root.spooky #qr .field {\n" + -" background-color: rgb(26, 27, 29);\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr .field:focus,\n" + -":root.spooky #qr .field.focus {\n" + -" border-color: rgb(254, 150, 0) !important;\n" + -" background-color: rgb(30,32,36);\n" + -"}\n" + -":root.spooky .persona button {\n" + -" background: linear-gradient(to bottom, #2E3035, #222427) no-repeat;\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -" outline: none;\n" + -"}\n" + -":root.spooky .persona button::-moz-focus-inner {\n" + -" border: none;\n" + -"}\n" + -":root.spooky .persona button:focus {\n" + -" border-color: rgb(254, 150, 0);\n" + -"}\n" + -":root.spooky #qr.sjis-preview #sjis-toggle,\n" + -":root.spooky #qr.tex-preview #tex-preview-button {\n" + -" background: rgb(26, 27, 29);\n" + -"}\n" + -":root.spooky #qr select,\n" + -":root.spooky #file-n-submit > input,\n" + -":root.spooky #qr-draw-button {\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr-filename {\n" + -" color: rgb(197,200,198);\n" + -"}\n" + -":root.spooky .qr-link {\n" + -" border-color: rgb(8, 6, 23) rgb(8, 6, 23) rgb(0, 0, 8);\n" + -" background: linear-gradient(#262435, #171526) repeat scroll 0% 0% transparent;\n" + -"}\n" + -":root.spooky .qr-link:hover {\n" + -" background: #1A1829;\n" + -"}\n" + -"/* Menu */\n" + -":root.spooky #menu {\n" + -" color: #FE9600;\n" + -"}\n" + -":root.spooky .entry {\n" + -" font-size: 10pt;\n" + -"}\n" + -":root.spooky .focused.entry {\n" + -" background: rgba(255, 255, 255, .33);\n" + -"}\n" + -"/* Unread */\n" + -":root.spooky #unread-line {\n" + -" border-color: rgb(197, 200, 198);\n" + -"}\n" + -"/* Thread Watcher */\n" + -":root.spooky .replies-quoting-you > a, :root.spooky #watcher-link.disabled.replies-quoting-you {\n" + -" color: #F00 !important;\n" + -"}\n" + -"/* Watcher Favicon */\n" + -":root.spooky .watch-thread-link\n" + -"{\n" + -" background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.spooky div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + "}", - cssWWW: "#captcha-cnt {\n" + -" height: auto;\n" + -"}", - features: [['Polyfill', Polyfill], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] }; Main.init(); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 18422d5a3..8e74cd8ad 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 527c56900..8fc25917c 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.15.7 +// @version 1.11.16.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -11,8 +11,6 @@ // @include https://boards.4chan.org/* // @include http://sys.4chan.org/* // @include https://sys.4chan.org/* -// @include http://a.4cdn.org/* -// @include https://a.4cdn.org/* // @include http://i.4cdn.org/* // @include https://i.4cdn.org/* // @include http://www.4chan.org/banned @@ -117,7 +115,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, Notice, PSAHiding, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, err, g, slice = [].slice, 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; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -154,7 +152,7 @@ 'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Show Support Message': [true, 'Warn if your browser or configuration is unsupported and may cause 4chan X to not operate correctly.'], - 'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'], + 'Normalize URL': [true, 'Rewrite the URL of the current page, removing slugs and excess slashes, and changing /res/ to /thread/.'], 'Disable Autoplaying Sounds': [false, 'Prevent sounds on the page from autoplaying.'], 'Disable Native Extension': [true, '4chan X is NOT designed to work with the native extension.'], 'Enable Native Flash Embedding': [true, 'Activate the native extension\'s Flash embedding if the native extension is disabled.'] @@ -250,7 +248,8 @@ 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha.'], - 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'] + 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'], + 'Pass Link': [true, 'Add a 4chan Pass login link to the bottom of the page.'] }, 'Quote Links': { 'Quote Backlinks': [true, 'Add quote backlinks.'], @@ -313,7 +312,7 @@ FappeT: { werk: false }, - 'Custom CSS': false, + 'Custom CSS': true, Index: { 'Index Mode': 'paged', 'Previous Index Mode': 'paged', @@ -345,7 +344,26 @@ backlink: '>>%id', fileInfo: '%l (%p%s, %r%g)', favicon: 'ferongr', - usercss: '', + usercss: "/* Board title rice */\n" + +"div.boardTitle {\n" + +" font-weight: 400 !important;\n" + +"}\n" + +":root.yotsuba div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + +"}\n" + +":root.yotsuba-b div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + +"}\n" + +":root.photon div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + +"}\n" + +":root.tomorrow div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + +"}", hotkeys: { 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'], 'Toggle header': ['Shift+h', 'Toggle the auto-hide option of the header.'], @@ -415,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.15.7', + VERSION: '1.11.16.0', NAMESPACE: '4chan X.', boards: {} }; @@ -942,6 +960,14 @@ } })(); + try { + localStorage.getItem('x'); + $.hasStorage = true; + } catch (_error) { + err = _error; + $.hasStorage = false; + } + $.item = function(key, val) { var item; item = {}; @@ -956,7 +982,7 @@ $.listValues = function() { return GM_listValues(); }; - } else { + } else if ($.hasStorage) { $.getValue = function(key) { return localStorage[key]; }; @@ -970,6 +996,11 @@ } return results; }; + } else { + $.getValue = function() {}; + $.listValues = function() { + return []; + }; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -981,17 +1012,24 @@ GM_setValue(key, val); if (key in $.syncing) { $.oldValue[key] = val; - return localStorage[key] = val; + if ($.hasStorage) { + return localStorage[key] = val; + } } }; $.deleteValue = function(key) { GM_deleteValue(key); if (key in $.syncing) { delete $.oldValue[key]; - return delete localStorage[key]; + if ($.hasStorage) { + return delete localStorage[key]; + } } }; - } else { + if (!$.hasStorage) { + $.cantSync = true; + } + } else if ($.hasStorage) { $.oldValue = {}; $.setValue = function(key, val) { if (key in $.syncing) { @@ -1005,6 +1043,10 @@ } return delete localStorage[key]; }; + } else { + $.setValue = function() {}; + $.deleteValue = function() {}; + $.cantSync = $.cantSet = true; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -1019,7 +1061,7 @@ }); }; $.forceSync = function() {}; - } else { + } else if ($.hasStorage) { $.sync = function(key, cb) { key = g.NAMESPACE + key; $.syncing[key] = cb; @@ -1053,6 +1095,9 @@ return onChange(g.NAMESPACE + key); }; })(); + } else { + $.sync = function() {}; + $.forceSync = function() {}; } $["delete"] = function(keys) { @@ -1143,7 +1188,7 @@ }; Callbacks.prototype.execute = function(node, keys) { - var err, errors, k, len1, name, ref; + var errors, k, len1, name, ref; if (keys == null) { keys = this.keys; } @@ -1891,17 +1936,17 @@ DataBoard.prototype.ajaxClean = function(boardID) { return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) { return function(e1) { - if (e1.target.status === 200) { - if (boardID === 'b' || boardID === 'f' || boardID === 'trash') { - return _this.ajaxCleanParse(boardID, e1.target.response); - } else { - return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { - if (e2.target.status === 200) { - return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); - } - }); - } + var ref; + if ((ref = e1.target.status) !== 200 && ref !== 404) { + return; } + return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { + var ref1; + if ((ref1 = e2.target.status) !== 200 && ref1 !== 404) { + return; + } + return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); + }); }; })(this)); }; @@ -1910,14 +1955,16 @@ var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; board = this.data.boards[boardID]; threads = {}; - for (k = 0, len1 = response1.length; k < len1; k++) { - page = response1[k]; - ref = page.threads; - for (q = 0, len2 = ref.length; q < len2; q++) { - thread = ref[q]; - ID = thread.no; - if (ID in board) { - threads[ID] = board[ID]; + if (response1) { + for (k = 0, len1 = response1.length; k < len1; k++) { + page = response1[k]; + ref = page.threads; + for (q = 0, len2 = ref.length; q < len2; q++) { + thread = ref[q]; + ID = thread.no; + if (ID in board) { + threads[ID] = board[ID]; + } } } } @@ -3756,7 +3803,7 @@ return $.addClass(Index.button, 'fa-spin'); }, load: function(e, state) { - var err, nTimeout, notice, ref, req, timeEl; + var nTimeout, notice, ref, req, timeEl; $.rmClass(Index.button, 'fa-spin'); req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout; if (nTimeout) { @@ -3840,7 +3887,7 @@ }); }, buildThreads: function() { - var err, errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; + var errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; Index.nodes = []; threads = []; posts = []; @@ -3887,7 +3934,7 @@ return $.event('IndexRefresh'); }, buildReplies: function(threadRoots) { - var data, err, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; + var data, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; posts = []; for (k = 0, len1 = threadRoots.length; k < len1; k++) { threadRoot = threadRoots[k]; @@ -4681,7 +4728,7 @@ }; Menu.prototype.insertEntry = function(entry, parent, data) { - var err, k, len1, ref, subEntry, submenu; + var k, len1, ref, subEntry, submenu; if (typeof entry.open === 'function') { try { if (!entry.open(data)) { @@ -5172,7 +5219,7 @@ Filter = { filters: {}, init: function() { - var boards, err, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; + var boards, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Filter'])) { return; } @@ -5811,6 +5858,9 @@ }, catalogSet: function(board) { var hiddenThreads, threadID; + if (!$.hasStorage) { + return; + } hiddenThreads = ThreadHiding.db.get({ boardID: board.ID, defaultValue: {} @@ -5821,8 +5871,11 @@ return localStorage.setItem("4chan-hide-t-" + board, JSON.stringify(hiddenThreads)); }, catalogWatch: function() { + if (!$.hasStorage) { + return; + } this.hiddenThreads = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)) || {}; - return $.ready(function() { + return Main.ready(function() { return new MutationObserver(ThreadHiding.catalogSave).observe($.id('threads'), { attributes: true, subtree: true, @@ -6998,7 +7051,6 @@ } }, open: function() { - var err; if (QR.nodes) { if (QR.nodes.el.hidden) { QR.captcha.setup(); @@ -7608,7 +7660,7 @@ return $.event('QRDialogCreation', null, dialog); }, submit: function(e) { - var captcha, cb, err, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; + var captcha, cb, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; if (e != null) { e.preventDefault(); } @@ -7742,7 +7794,7 @@ return QR.status(); }, response: function() { - var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; + var URL, _, ban, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; req = QR.req; delete QR.req; post = QR.posts[0]; @@ -8559,7 +8611,7 @@ return this.conn.target = iframe; }, setupJS: function() { - return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: (document.documentElement.classList.contains(\'tomorrow\') || document.documentElement.classList.contains(\'spooky\')) ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); + return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); }, afterSetup: function(mutations) { var iframe, k, len1, len2, mutation, node, q, ref, textarea; @@ -8754,6 +8806,31 @@ } }; + PassLink = { + init: function() { + if (!Conf['Pass Link']) { + return; + } + return Main.ready(this.ready); + }, + ready: function() { + var passLink, styleSelector; + if (!(styleSelector = $.id('styleSelector'))) { + return; + } + passLink = $.el('span', { + className: 'brackets-wrap pass-link-container' + }); + $.extend(passLink, { + innerHTML: "4chan Pass" + }); + $.on(passLink.firstElementChild, 'click', function() { + return window.open('//sys.4chan.org/auth', Date.now(), 'width=500,height=280,toolbar=0'); + }); + return $.before(styleSelector.previousSibling, [passLink, $.tn('\u00A0\u00A0')]); + } + }; + PostSuccessful = { init: function() { return $.ready(this.ready); @@ -11327,7 +11404,7 @@ Sauce = { init: function() { - var err, k, len1, link, links, ref, ref1; + var k, len1, link, links, ref, ref1; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Sauce'])) { return; } @@ -15403,7 +15480,22 @@ } }, initReady: function() { - return $.globalEval('if (JSON.parse(localStorage["4chan-settings"] || "{}").disableAll) SWFEmbed.init();'); + if ($.hasStorage) { + return $.global(function() { + if (JSON.parse(localStorage['4chan-settings'] || '{}').disableAll) { + return window.SWFEmbed.init(); + } + }); + } else { + if (g.VIEW === 'thread') { + $.global(function() { + return window.Main.tid = location.pathname.split(/\/+/)[3]; + }); + } + return $.global(function() { + return window.SWFEmbed.init(); + }); + } } }; @@ -16157,6 +16249,28 @@ } }; + NormalizeURL = { + init: function() { + var pathname; + if (!Conf['Normalize URL']) { + return; + } + pathname = location.pathname.split(/\/+/); + switch (g.VIEW) { + case 'thread': + pathname[2] = 'thread'; + pathname = pathname.slice(0, 4); + break; + case 'index': + pathname = pathname.slice(0, 3); + } + pathname = pathname.join('/'); + if (location.pathname !== pathname) { + return history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); + } + } + }; + RelativeDates = { INTERVAL: $.MINUTE / 2, init: function() { @@ -16300,7 +16414,7 @@ "}", init: function() { var match; - if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { + if (!(match = location.search.match(/\bno=(\d+)/))) { return; } Captcha.replace.init(); @@ -16521,12 +16635,20 @@ return Settings.open(e.detail); }); if (Conf['Disable Native Extension']) { - settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; - if (settings.disableAll) { - return; + if ($.hasStorage) { + settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; + if (settings.disableAll) { + return; + } + settings.disableAll = true; + return localStorage.setItem('4chan-settings', JSON.stringify(settings)); + } else { + return $.onExists(doc, 'body', false, function() { + return $.global(function() { + return window.Config.disableAll = true; + }); + }); } - settings.disableAll = true; - return localStorage.setItem('4chan-settings', JSON.stringify(settings)); } }, open: function(openSection) { @@ -16693,8 +16815,10 @@ return $.get('hiddenThreads', {}, function(arg) { var boardID, hiddenThreads; hiddenThreads = arg.hiddenThreads; - for (boardID in hiddenThreads.boards) { - localStorage.removeItem("4chan-hide-t-" + boardID); + if ($.hasStorage) { + for (boardID in hiddenThreads.boards) { + localStorage.removeItem("4chan-hide-t-" + boardID); + } } return $["delete"](['hiddenThreads', 'hiddenPosts']); }); @@ -16738,7 +16862,6 @@ } reader = new FileReader(); reader.onload = function(e) { - var err; try { return Settings.loadSettings(JSON.parse(e.target.result), function(err) { if (err) { @@ -16870,7 +16993,7 @@ } }, upgrade: function(data, version) { - var boardID, changes, compareString, name, record, ref, ref1, ref2, type, uids; + var boardID, changes, compareString, name, record, ref, ref1, ref2, rice, type, uids; changes = {}; compareString = version.replace(/\d+/g, function(x) { return ('0000' + x).slice(-5); @@ -16911,6 +17034,13 @@ } } } + if (compareString < '00001.00011.00016.00000') { + if ((rice = Config['usercss'].match(/\/\* Board title rice \*\/(?:\n.+)*/)[0])) { + if ((data['usercss'] != null) && data['usercss'].indexOf(rice) < 0) { + changes['usercss'] = rice + '\n\n' + data['usercss']; + } + } + } return changes; }, loadSettings: function(data, cb) { @@ -17259,7 +17389,7 @@ Main = { init: function() { - var db, flatten, items, k, key, len1, pathname, ref, ref1, ref2; + var db, flatten, items, k, key, len1, ref; if (d.body && !$('title', d.head)) { return; } @@ -17284,35 +17414,6 @@ }); return; } - g.threads = new SimpleDict(); - g.posts = new SimpleDict(); - pathname = location.pathname.split(/\/+/); - g.BOARD = new Board(pathname[1]); - if ((ref = g.BOARD.ID) === 'z' || ref === 'fk') { - return; - } - g.VIEW = (function() { - switch (pathname[2]) { - case 'res': - case 'thread': - return 'thread'; - case 'catalog': - case 'archive': - case 'post': - return pathname[2]; - default: - return 'index'; - } - })(); - if (g.VIEW === 'catalog' && g.BOARD.ID === 'f') { - return; - } - if (g.VIEW === 'archive' && ((ref1 = g.BOARD.ID) === 'b' || ref1 === 'f' || ref1 === 'trash')) { - return; - } - if (g.VIEW === 'thread') { - g.THREADID = +pathname[3]; - } flatten = function(parent, obj) { var key, val; if (obj instanceof Array) { @@ -17327,9 +17428,9 @@ } }; flatten(null, Config); - ref2 = DataBoard.keys; - for (k = 0, len1 = ref2.length; k < len1; k++) { - db = ref2[k]; + ref = DataBoard.keys; + for (k = 0, len1 = ref.length; k < len1; k++) { + db = ref[k]; Conf[db] = { boards: {} }; @@ -17342,12 +17443,14 @@ items[key] = void 0; } items['previousversion'] = void 0; - $.get(items, function(items) { + return $.get(items, function(items) { return $.asap((function() { return doc = d.documentElement; }), function() { - var ref3, val; - if (items.previousversion == null) { + var ref1, val; + if ($.cantSet) { + + } else if (items.previousversion == null) { Main.ready(function() { $.set('previousversion', g.VERSION); return Settings.open(); @@ -17357,16 +17460,11 @@ } for (key in Conf) { val = Conf[key]; - Conf[key] = (ref3 = items[key]) != null ? ref3 : val; + Conf[key] = (ref1 = items[key]) != null ? ref1 : val; } return Main.initFeatures(); }); }); - return $.asap((function() { - return doc = d.documentElement; - }), function() { - return $.onExists(doc, 'body', false, Main.initStyle); - }); }, upgrade: function(items) { var changes, previousversion; @@ -17387,43 +17485,50 @@ }); }, initFeatures: function() { - var err, feature, k, len1, match, name, pathname, ref, ref1, ref2; - if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org' || ref === 'www.4chan.org') { + var feature, hostname, k, len1, match, name, pathname, ref, ref1, ref2, ref3, search; + hostname = location.hostname, search = location.search; + pathname = location.pathname.split(/\/+/); + if (hostname !== 'www.4chan.org') { + g.BOARD = new Board(pathname[1]); + } + if (hostname === 'boards.4chan.org' || hostname === 'sys.4chan.org' || hostname === 'www.4chan.org') { $.global(function() { document.documentElement.classList.add('js-enabled'); return window.FCX = {}; }); } - switch (location.hostname) { + switch (hostname) { case 'www.4chan.org': Captcha.replace.init(); return; - case 'a.4cdn.org': - return; case 'sys.4chan.org': - Report.init(); - if (g.VIEW === 'post') { + if (pathname[2] === 'imgboard.php') { + if (/\bmode=report\b/.test(search)) { + Report.init(); + } else if ((match = search.match(/\bres=(\d+)/))) { + $.ready(function() { + var ref; + if (Conf['404 Redirect'] && ((ref = $.id('errmsg')) != null ? ref.textContent : void 0) === 'Error: Specified thread does not exist.') { + return Redirect.navigate('thread', { + boardID: g.BOARD.ID, + postID: +match[1] + }); + } + }); + } + } else if (pathname[2] === 'post') { PostSuccessful.init(); } - if (Conf['404 Redirect'] && /\/imgboard\.php$/.test(location.pathname) && (match = location.search.match(/\bres=(\d+)/))) { - $.ready(function() { - var ref1; - if (((ref1 = $.id('errmsg')) != null ? ref1.textContent : void 0) === 'Error: Specified thread does not exist.') { - return Redirect.navigate('thread', { - boardID: g.BOARD.ID, - postID: +match[1] - }); - } - }); - } return; case 'i.4cdn.org': + if (!(pathname[2] && !/s\.jpg$/.test(pathname[2]))) { + return; + } $.asap((function() { return d.readyState !== 'loading'; }), function() { - var pathname, ref1, video; - if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { - pathname = location.pathname.split(/\/+/); + var ref, video; + if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { return Redirect.navigate('file', { boardID: g.BOARD.ID, filename: pathname[pathname.length - 1] @@ -17442,24 +17547,22 @@ }); return; } - if (Conf['Normalize URL']) { - pathname = location.pathname.split(/\/+/); - switch (g.VIEW) { - case 'thread': - pathname[2] = 'thread'; - pathname = pathname.slice(0, 4); - break; - case 'index': - pathname = pathname.slice(0, 3); - } - pathname = pathname.join('/'); - if (location.pathname !== pathname) { - history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); - } + if ((ref = pathname[2]) === 'thread' || ref === 'res') { + g.VIEW = 'thread'; + g.THREADID = +pathname[3]; + } else if ((ref1 = pathname[2]) === 'catalog' || ref1 === 'archive') { + g.VIEW = pathname[2]; + } else if (pathname[2].match(/^\d*$/)) { + g.VIEW = 'index'; + } else { + return; } - ref1 = Main.features; - for (k = 0, len1 = ref1.length; k < len1; k++) { - ref2 = ref1[k], name = ref2[0], feature = ref2[1]; + g.threads = new SimpleDict(); + g.posts = new SimpleDict(); + $.onExists(doc, 'body', false, Main.initStyle); + ref2 = Main.features; + for (k = 0, len1 = ref2.length; k < len1; k++) { + ref3 = ref2[k], name = ref3[0], feature = ref3[1]; try { feature.init(); } catch (_error) { @@ -17474,9 +17577,6 @@ }, initStyle: function() { var keyboard, ref; - if (location.hostname === 'www.4chan.org') { - $.addStyle(Main.cssWWW); - } if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) { return; } @@ -17504,14 +17604,7 @@ return Main.setClass(); }, setClass: function() { - var mainStyleSheet, setStyle, spooky, style, styleSheets; - if ((spooky = $('link[rel="stylesheet"][href^="//s.4cdn.org/css/spooky."]', d.head))) { - spooky.removeAttribute('media'); - if (getComputedStyle(d.body).color === 'rgb(196, 151, 86)') { - $.addClass(doc, 'spooky'); - return; - } - } + var mainStyleSheet, setStyle, style, styleSheets; if (g.VIEW === 'catalog') { $.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-')); return; @@ -17541,7 +17634,7 @@ }); }, initReady: function() { - var err, passLink, ref, ref1, styleSelector; + var ref, ref1, why; if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) { ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() { if (Conf['404 Redirect']) { @@ -17557,32 +17650,20 @@ if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') { return; } - if (styleSelector = $.id('styleSelector')) { - passLink = $.el('a', { - textContent: '4chan Pass', - href: 'javascript:;' - }); - $.on(passLink, 'click', function() { - return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'); - }); - $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]); - } if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { Main.initThread(); } else { $.event('4chanXInitFinished'); } if (Conf['Show Support Message']) { - try { - return localStorage.getItem('4chan-settings'); - } catch (_error) { - err = _error; - return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30); + if ($.cantSync) { + why = $.cantSet ? 'save your settings' : 'synchronize settings between tabs'; + return new Notice('warning', "4chan X needs local storage to " + why + ".\nEnable it on boards.4chan.org in your browser's privacy settings\n(may be listed as part of \"local data\" or \"cookies\")."); } } }, initThread: function() { - var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; + var board, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; if (board = $('.board')) { threads = []; posts = []; @@ -18809,6 +18890,7 @@ " max-height: 200px;\n" + " width: 100%;\n" + " overflow: auto;\n" + +" white-space: pre-line;\n" + "}\n" + "/* Settings */\n" + ":root.fourchan-x body {\n" + @@ -20100,9 +20182,6 @@ ".boardSubtitle[contenteditable=\"true\"] {\n" + " cursor: text !important;\n" + "}\n" + -"div.boardTitle {\n" + -" font-weight: 400 !important;\n" + -"}\n" + "/* Link Title Favicons */\n" + ".linkify.audio {\n" + " background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAitJREFUOE9jYCAWKJWwavr0KyXWb/FIbDtUFFyzJx6nVofE2Xo5nXsj0rqPNSR0nVkR2Hjmgmfd+U9Otdf+m5Vf/6+SfeU/R9ChVVgNYDRtlfJuuPA/rPfe/4QpD/6nznj0P27Kw/9unff/69Xf+69c/+C/SO7N/0z+OAxgMmmRCe++/r9i3ev/KWvf/vdY8PK/bt/9/wrNV3/IN5y/IVt1YqNg4pGTTP4HsbuA2bhZ2qvpyn+xjIObxAp3VwqlrgngLFyryVy5nhPmZJHANS2cwYexG8BmVC/pWn3hP4NZlzWuQDJI3dIiFnUUuwEsQAOcq87jNcC7fHeLUtJxHF4AGmBWeAavAWH1+1rUUk7giAWjOknllON4DXAs2NEiG4/DBQxAF/CFHfrPYI4jDFSLuJVjNrUJhB/B7gIGo1pJRt99GAZYJK7wLJ1z7Xzl4vu/7aqv/GRBj0bjqAX2qb0nJ7mXH17C4HcUxQA+hymWtSue/C5a9up/9Ozn/7Vr7v1nRY7GqMb91T3b3v6vWvPmf/S0p/9ZQk+DDLCBRSOz06Jqk+o7/21nvfqvsebDf7kZL/5zBaxphkezd+OFn7HzXvz3Wvjmv9a8N//5Ek//ZTBpVYUrMG2X5wjcdl68+uI/wa5Lr3hSNjczGFeywOVZ/bbcVGp//F9izfv/Ql03f3P4LC/HSEQquYwMFnUCDJ7dzBhyjGZNQpye89M5gpfnMvtNUyE2h4PUAQBovvT7lyNljwAAAABJRU5ErkJggg==') center left no-repeat!important;\n" + @@ -20482,11 +20561,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + -"}\n" + "/* General */\n" + ":root.yotsuba-b .dialog {\n" + " background-color: #D6DAF0;\n" + @@ -20558,11 +20632,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba-b div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + -"}\n" + "/* General */\n" + ":root.futaba .dialog {\n" + " background-color: #F0E0D6;\n" + @@ -20846,11 +20915,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.tomorrow div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + -"}\n" + "/* General */\n" + ":root.photon .dialog {\n" + " background-color: #DDD;\n" + @@ -20928,133 +20992,8 @@ ":root.photon .watch-thread-link\n" + "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.photon div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + -"}\n" + -"/* General */\n" + -":root.spooky .dialog {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .field:focus,\n" + -":root.spooky .field.focus {\n" + -" border-color: #98E;\n" + -"}\n" + -"/* Header */\n" + -":root.spooky #header-bar.dialog {\n" + -" background-color: rgba(23,21,38,0.98);\n" + -"}\n" + -":root.spooky:not(.fixed) #header-bar, :root.spooky #notifications {\n" + -" font-size: 9pt;\n" + -"}\n" + -":root.spooky #header-bar, :root.spooky #notifications {\n" + -" color: #C49756;\n" + -"}\n" + -":root.spooky #board-list a, :root.spooky #shortcuts a {\n" + -" color: #FE9600;\n" + -"}\n" + -"/* Settings */\n" + -":root.spooky #fourchanx-settings fieldset, :root.spooky .section-main div::before {\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .suboption-list > div:last-of-type {\n" + -" background-color: #171526;\n" + -"}\n" + -"/* Quote */\n" + -":root.spooky .catalog-thread > .comment > span.quote, :root.spooky #arc-list span.quote {\n" + -" color: #634C2C;\n" + -"}\n" + -":root.spooky .backlink.deadlink {\n" + -" color: #FE9600 !important;\n" + -"}\n" + -":root.spooky .inline {\n" + -" border-color: #707070;\n" + -" background-color: rgba(255, 255, 255, .14);\n" + -"}\n" + -"/* QR */\n" + -".spooky #dump-list::-webkit-scrollbar-thumb {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .qr-preview {\n" + -" background-color: rgba(0, 0, 0, .15);\n" + -"}\n" + -":root.spooky #qr .field {\n" + -" background-color: rgb(26, 27, 29);\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr .field:focus,\n" + -":root.spooky #qr .field.focus {\n" + -" border-color: rgb(254, 150, 0) !important;\n" + -" background-color: rgb(30,32,36);\n" + -"}\n" + -":root.spooky .persona button {\n" + -" background: linear-gradient(to bottom, #2E3035, #222427) no-repeat;\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -" outline: none;\n" + -"}\n" + -":root.spooky .persona button::-moz-focus-inner {\n" + -" border: none;\n" + -"}\n" + -":root.spooky .persona button:focus {\n" + -" border-color: rgb(254, 150, 0);\n" + -"}\n" + -":root.spooky #qr.sjis-preview #sjis-toggle,\n" + -":root.spooky #qr.tex-preview #tex-preview-button {\n" + -" background: rgb(26, 27, 29);\n" + -"}\n" + -":root.spooky #qr select,\n" + -":root.spooky #file-n-submit > input,\n" + -":root.spooky #qr-draw-button {\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr-filename {\n" + -" color: rgb(197,200,198);\n" + -"}\n" + -":root.spooky .qr-link {\n" + -" border-color: rgb(8, 6, 23) rgb(8, 6, 23) rgb(0, 0, 8);\n" + -" background: linear-gradient(#262435, #171526) repeat scroll 0% 0% transparent;\n" + -"}\n" + -":root.spooky .qr-link:hover {\n" + -" background: #1A1829;\n" + -"}\n" + -"/* Menu */\n" + -":root.spooky #menu {\n" + -" color: #FE9600;\n" + -"}\n" + -":root.spooky .entry {\n" + -" font-size: 10pt;\n" + -"}\n" + -":root.spooky .focused.entry {\n" + -" background: rgba(255, 255, 255, .33);\n" + -"}\n" + -"/* Unread */\n" + -":root.spooky #unread-line {\n" + -" border-color: rgb(197, 200, 198);\n" + -"}\n" + -"/* Thread Watcher */\n" + -":root.spooky .replies-quoting-you > a, :root.spooky #watcher-link.disabled.replies-quoting-you {\n" + -" color: #F00 !important;\n" + -"}\n" + -"/* Watcher Favicon */\n" + -":root.spooky .watch-thread-link\n" + -"{\n" + -" background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.spooky div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + "}", - cssWWW: "#captcha-cnt {\n" + -" height: auto;\n" + -"}", - features: [['Polyfill', Polyfill], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] }; Main.init(); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 70e0bf40a..2e8e34052 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 33f8e6abf..a6623be25 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.15.7 +// @version 1.11.16.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -10,8 +10,6 @@ // @include https://boards.4chan.org/* // @include http://sys.4chan.org/* // @include https://sys.4chan.org/* -// @include http://a.4cdn.org/* -// @include https://a.4cdn.org/* // @include http://i.4cdn.org/* // @include https://i.4cdn.org/* // @include http://www.4chan.org/banned diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index ffb0c5db7..feeee7347 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.15.7 +// @version 1.11.16.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -11,8 +11,6 @@ // @include https://boards.4chan.org/* // @include http://sys.4chan.org/* // @include https://sys.4chan.org/* -// @include http://a.4cdn.org/* -// @include https://a.4cdn.org/* // @include http://i.4cdn.org/* // @include https://i.4cdn.org/* // @include http://www.4chan.org/banned @@ -117,7 +115,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, Notice, PSAHiding, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, err, g, slice = [].slice, 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; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -154,7 +152,7 @@ 'Remove Spoilers': [false, 'Remove all spoilers in text.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Show Support Message': [true, 'Warn if your browser or configuration is unsupported and may cause 4chan X to not operate correctly.'], - 'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'], + 'Normalize URL': [true, 'Rewrite the URL of the current page, removing slugs and excess slashes, and changing /res/ to /thread/.'], 'Disable Autoplaying Sounds': [false, 'Prevent sounds on the page from autoplaying.'], 'Disable Native Extension': [true, '4chan X is NOT designed to work with the native extension.'], 'Enable Native Flash Embedding': [true, 'Activate the native extension\'s Flash embedding if the native extension is disabled.'] @@ -250,7 +248,8 @@ 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha.'], - 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'] + 'Use Recaptcha v2 in Reports': [false, 'Use the image selection captcha in the report window.'], + 'Pass Link': [true, 'Add a 4chan Pass login link to the bottom of the page.'] }, 'Quote Links': { 'Quote Backlinks': [true, 'Add quote backlinks.'], @@ -313,7 +312,7 @@ FappeT: { werk: false }, - 'Custom CSS': false, + 'Custom CSS': true, Index: { 'Index Mode': 'paged', 'Previous Index Mode': 'paged', @@ -345,7 +344,26 @@ backlink: '>>%id', fileInfo: '%l (%p%s, %r%g)', favicon: 'ferongr', - usercss: '', + usercss: "/* Board title rice */\n" + +"div.boardTitle {\n" + +" font-weight: 400 !important;\n" + +"}\n" + +":root.yotsuba div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + +"}\n" + +":root.yotsuba-b div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + +"}\n" + +":root.photon div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + +"}\n" + +":root.tomorrow div.boardTitle {\n" + +" font-family: sans-serif !important;\n" + +" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + +"}", hotkeys: { 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'], 'Toggle header': ['Shift+h', 'Toggle the auto-hide option of the header.'], @@ -415,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.15.7', + VERSION: '1.11.16.0', NAMESPACE: '4chan X.', boards: {} }; @@ -942,6 +960,14 @@ } })(); + try { + localStorage.getItem('x'); + $.hasStorage = true; + } catch (_error) { + err = _error; + $.hasStorage = false; + } + $.item = function(key, val) { var item; item = {}; @@ -956,7 +982,7 @@ $.listValues = function() { return GM_listValues(); }; - } else { + } else if ($.hasStorage) { $.getValue = function(key) { return localStorage[key]; }; @@ -970,6 +996,11 @@ } return results; }; + } else { + $.getValue = function() {}; + $.listValues = function() { + return []; + }; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -981,17 +1012,24 @@ GM_setValue(key, val); if (key in $.syncing) { $.oldValue[key] = val; - return localStorage[key] = val; + if ($.hasStorage) { + return localStorage[key] = val; + } } }; $.deleteValue = function(key) { GM_deleteValue(key); if (key in $.syncing) { delete $.oldValue[key]; - return delete localStorage[key]; + if ($.hasStorage) { + return delete localStorage[key]; + } } }; - } else { + if (!$.hasStorage) { + $.cantSync = true; + } + } else if ($.hasStorage) { $.oldValue = {}; $.setValue = function(key, val) { if (key in $.syncing) { @@ -1005,6 +1043,10 @@ } return delete localStorage[key]; }; + } else { + $.setValue = function() {}; + $.deleteValue = function() {}; + $.cantSync = $.cantSet = true; } if (typeof GM_addValueChangeListener !== "undefined" && GM_addValueChangeListener !== null) { @@ -1019,7 +1061,7 @@ }); }; $.forceSync = function() {}; - } else { + } else if ($.hasStorage) { $.sync = function(key, cb) { key = g.NAMESPACE + key; $.syncing[key] = cb; @@ -1053,6 +1095,9 @@ return onChange(g.NAMESPACE + key); }; })(); + } else { + $.sync = function() {}; + $.forceSync = function() {}; } $["delete"] = function(keys) { @@ -1143,7 +1188,7 @@ }; Callbacks.prototype.execute = function(node, keys) { - var err, errors, k, len1, name, ref; + var errors, k, len1, name, ref; if (keys == null) { keys = this.keys; } @@ -1891,17 +1936,17 @@ DataBoard.prototype.ajaxClean = function(boardID) { return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) { return function(e1) { - if (e1.target.status === 200) { - if (boardID === 'b' || boardID === 'f' || boardID === 'trash') { - return _this.ajaxCleanParse(boardID, e1.target.response); - } else { - return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { - if (e2.target.status === 200) { - return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); - } - }); - } + var ref; + if ((ref = e1.target.status) !== 200 && ref !== 404) { + return; } + return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) { + var ref1; + if ((ref1 = e2.target.status) !== 200 && ref1 !== 404) { + return; + } + return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response); + }); }; })(this)); }; @@ -1910,14 +1955,16 @@ var ID, board, k, len1, len2, len3, page, q, ref, thread, threads, u; board = this.data.boards[boardID]; threads = {}; - for (k = 0, len1 = response1.length; k < len1; k++) { - page = response1[k]; - ref = page.threads; - for (q = 0, len2 = ref.length; q < len2; q++) { - thread = ref[q]; - ID = thread.no; - if (ID in board) { - threads[ID] = board[ID]; + if (response1) { + for (k = 0, len1 = response1.length; k < len1; k++) { + page = response1[k]; + ref = page.threads; + for (q = 0, len2 = ref.length; q < len2; q++) { + thread = ref[q]; + ID = thread.no; + if (ID in board) { + threads[ID] = board[ID]; + } } } } @@ -3756,7 +3803,7 @@ return $.addClass(Index.button, 'fa-spin'); }, load: function(e, state) { - var err, nTimeout, notice, ref, req, timeEl; + var nTimeout, notice, ref, req, timeEl; $.rmClass(Index.button, 'fa-spin'); req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout; if (nTimeout) { @@ -3840,7 +3887,7 @@ }); }, buildThreads: function() { - var err, errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; + var errors, i, k, len1, posts, ref, thread, threadData, threadRoot, threads; Index.nodes = []; threads = []; posts = []; @@ -3887,7 +3934,7 @@ return $.event('IndexRefresh'); }, buildReplies: function(threadRoots) { - var data, err, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; + var data, errors, i, k, lastReplies, len1, len2, node, nodes, post, posts, q, thread, threadRoot; posts = []; for (k = 0, len1 = threadRoots.length; k < len1; k++) { threadRoot = threadRoots[k]; @@ -4681,7 +4728,7 @@ }; Menu.prototype.insertEntry = function(entry, parent, data) { - var err, k, len1, ref, subEntry, submenu; + var k, len1, ref, subEntry, submenu; if (typeof entry.open === 'function') { try { if (!entry.open(data)) { @@ -5172,7 +5219,7 @@ Filter = { filters: {}, init: function() { - var boards, err, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; + var boards, filter, hl, k, key, len1, line, op, ref, ref1, ref2, ref3, ref4, ref5, regexp, stub, top; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Filter'])) { return; } @@ -5811,6 +5858,9 @@ }, catalogSet: function(board) { var hiddenThreads, threadID; + if (!$.hasStorage) { + return; + } hiddenThreads = ThreadHiding.db.get({ boardID: board.ID, defaultValue: {} @@ -5821,8 +5871,11 @@ return localStorage.setItem("4chan-hide-t-" + board, JSON.stringify(hiddenThreads)); }, catalogWatch: function() { + if (!$.hasStorage) { + return; + } this.hiddenThreads = JSON.parse(localStorage.getItem("4chan-hide-t-" + g.BOARD)) || {}; - return $.ready(function() { + return Main.ready(function() { return new MutationObserver(ThreadHiding.catalogSave).observe($.id('threads'), { attributes: true, subtree: true, @@ -6998,7 +7051,6 @@ } }, open: function() { - var err; if (QR.nodes) { if (QR.nodes.el.hidden) { QR.captcha.setup(); @@ -7608,7 +7660,7 @@ return $.event('QRDialogCreation', null, dialog); }, submit: function(e) { - var captcha, cb, err, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; + var captcha, cb, extra, filetag, formData, options, post, ref, textOnly, thread, threadID; if (e != null) { e.preventDefault(); } @@ -7742,7 +7794,7 @@ return QR.status(); }, response: function() { - var URL, _, ban, err, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; + var URL, _, ban, h1, isReply, lastPostToThread, m, open, post, postID, postsCount, ref, ref1, req, resDoc, seconds, threadID; req = QR.req; delete QR.req; post = QR.posts[0]; @@ -8559,7 +8611,7 @@ return this.conn.target = iframe; }, setupJS: function() { - return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: (document.documentElement.classList.contains(\'tomorrow\') || document.documentElement.classList.contains(\'spooky\')) ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); + return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();'); }, afterSetup: function(mutations) { var iframe, k, len1, len2, mutation, node, q, ref, textarea; @@ -8754,6 +8806,31 @@ } }; + PassLink = { + init: function() { + if (!Conf['Pass Link']) { + return; + } + return Main.ready(this.ready); + }, + ready: function() { + var passLink, styleSelector; + if (!(styleSelector = $.id('styleSelector'))) { + return; + } + passLink = $.el('span', { + className: 'brackets-wrap pass-link-container' + }); + $.extend(passLink, { + innerHTML: "4chan Pass" + }); + $.on(passLink.firstElementChild, 'click', function() { + return window.open('//sys.4chan.org/auth', Date.now(), 'width=500,height=280,toolbar=0'); + }); + return $.before(styleSelector.previousSibling, [passLink, $.tn('\u00A0\u00A0')]); + } + }; + PostSuccessful = { init: function() { return $.ready(this.ready); @@ -11327,7 +11404,7 @@ Sauce = { init: function() { - var err, k, len1, link, links, ref, ref1; + var k, len1, link, links, ref, ref1; if (!(((ref = g.VIEW) === 'index' || ref === 'thread') && Conf['Sauce'])) { return; } @@ -15403,7 +15480,22 @@ } }, initReady: function() { - return $.globalEval('if (JSON.parse(localStorage["4chan-settings"] || "{}").disableAll) SWFEmbed.init();'); + if ($.hasStorage) { + return $.global(function() { + if (JSON.parse(localStorage['4chan-settings'] || '{}').disableAll) { + return window.SWFEmbed.init(); + } + }); + } else { + if (g.VIEW === 'thread') { + $.global(function() { + return window.Main.tid = location.pathname.split(/\/+/)[3]; + }); + } + return $.global(function() { + return window.SWFEmbed.init(); + }); + } } }; @@ -16157,6 +16249,28 @@ } }; + NormalizeURL = { + init: function() { + var pathname; + if (!Conf['Normalize URL']) { + return; + } + pathname = location.pathname.split(/\/+/); + switch (g.VIEW) { + case 'thread': + pathname[2] = 'thread'; + pathname = pathname.slice(0, 4); + break; + case 'index': + pathname = pathname.slice(0, 3); + } + pathname = pathname.join('/'); + if (location.pathname !== pathname) { + return history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); + } + } + }; + RelativeDates = { INTERVAL: $.MINUTE / 2, init: function() { @@ -16300,7 +16414,7 @@ "}", init: function() { var match; - if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { + if (!(match = location.search.match(/\bno=(\d+)/))) { return; } Captcha.replace.init(); @@ -16521,12 +16635,20 @@ return Settings.open(e.detail); }); if (Conf['Disable Native Extension']) { - settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; - if (settings.disableAll) { - return; + if ($.hasStorage) { + settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; + if (settings.disableAll) { + return; + } + settings.disableAll = true; + return localStorage.setItem('4chan-settings', JSON.stringify(settings)); + } else { + return $.onExists(doc, 'body', false, function() { + return $.global(function() { + return window.Config.disableAll = true; + }); + }); } - settings.disableAll = true; - return localStorage.setItem('4chan-settings', JSON.stringify(settings)); } }, open: function(openSection) { @@ -16693,8 +16815,10 @@ return $.get('hiddenThreads', {}, function(arg) { var boardID, hiddenThreads; hiddenThreads = arg.hiddenThreads; - for (boardID in hiddenThreads.boards) { - localStorage.removeItem("4chan-hide-t-" + boardID); + if ($.hasStorage) { + for (boardID in hiddenThreads.boards) { + localStorage.removeItem("4chan-hide-t-" + boardID); + } } return $["delete"](['hiddenThreads', 'hiddenPosts']); }); @@ -16738,7 +16862,6 @@ } reader = new FileReader(); reader.onload = function(e) { - var err; try { return Settings.loadSettings(JSON.parse(e.target.result), function(err) { if (err) { @@ -16870,7 +16993,7 @@ } }, upgrade: function(data, version) { - var boardID, changes, compareString, name, record, ref, ref1, ref2, type, uids; + var boardID, changes, compareString, name, record, ref, ref1, ref2, rice, type, uids; changes = {}; compareString = version.replace(/\d+/g, function(x) { return ('0000' + x).slice(-5); @@ -16911,6 +17034,13 @@ } } } + if (compareString < '00001.00011.00016.00000') { + if ((rice = Config['usercss'].match(/\/\* Board title rice \*\/(?:\n.+)*/)[0])) { + if ((data['usercss'] != null) && data['usercss'].indexOf(rice) < 0) { + changes['usercss'] = rice + '\n\n' + data['usercss']; + } + } + } return changes; }, loadSettings: function(data, cb) { @@ -17259,7 +17389,7 @@ Main = { init: function() { - var db, flatten, items, k, key, len1, pathname, ref, ref1, ref2; + var db, flatten, items, k, key, len1, ref; if (d.body && !$('title', d.head)) { return; } @@ -17284,35 +17414,6 @@ }); return; } - g.threads = new SimpleDict(); - g.posts = new SimpleDict(); - pathname = location.pathname.split(/\/+/); - g.BOARD = new Board(pathname[1]); - if ((ref = g.BOARD.ID) === 'z' || ref === 'fk') { - return; - } - g.VIEW = (function() { - switch (pathname[2]) { - case 'res': - case 'thread': - return 'thread'; - case 'catalog': - case 'archive': - case 'post': - return pathname[2]; - default: - return 'index'; - } - })(); - if (g.VIEW === 'catalog' && g.BOARD.ID === 'f') { - return; - } - if (g.VIEW === 'archive' && ((ref1 = g.BOARD.ID) === 'b' || ref1 === 'f' || ref1 === 'trash')) { - return; - } - if (g.VIEW === 'thread') { - g.THREADID = +pathname[3]; - } flatten = function(parent, obj) { var key, val; if (obj instanceof Array) { @@ -17327,9 +17428,9 @@ } }; flatten(null, Config); - ref2 = DataBoard.keys; - for (k = 0, len1 = ref2.length; k < len1; k++) { - db = ref2[k]; + ref = DataBoard.keys; + for (k = 0, len1 = ref.length; k < len1; k++) { + db = ref[k]; Conf[db] = { boards: {} }; @@ -17342,12 +17443,14 @@ items[key] = void 0; } items['previousversion'] = void 0; - $.get(items, function(items) { + return $.get(items, function(items) { return $.asap((function() { return doc = d.documentElement; }), function() { - var ref3, val; - if (items.previousversion == null) { + var ref1, val; + if ($.cantSet) { + + } else if (items.previousversion == null) { Main.ready(function() { $.set('previousversion', g.VERSION); return Settings.open(); @@ -17357,16 +17460,11 @@ } for (key in Conf) { val = Conf[key]; - Conf[key] = (ref3 = items[key]) != null ? ref3 : val; + Conf[key] = (ref1 = items[key]) != null ? ref1 : val; } return Main.initFeatures(); }); }); - return $.asap((function() { - return doc = d.documentElement; - }), function() { - return $.onExists(doc, 'body', false, Main.initStyle); - }); }, upgrade: function(items) { var changes, previousversion; @@ -17387,43 +17485,50 @@ }); }, initFeatures: function() { - var err, feature, k, len1, match, name, pathname, ref, ref1, ref2; - if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org' || ref === 'www.4chan.org') { + var feature, hostname, k, len1, match, name, pathname, ref, ref1, ref2, ref3, search; + hostname = location.hostname, search = location.search; + pathname = location.pathname.split(/\/+/); + if (hostname !== 'www.4chan.org') { + g.BOARD = new Board(pathname[1]); + } + if (hostname === 'boards.4chan.org' || hostname === 'sys.4chan.org' || hostname === 'www.4chan.org') { $.global(function() { document.documentElement.classList.add('js-enabled'); return window.FCX = {}; }); } - switch (location.hostname) { + switch (hostname) { case 'www.4chan.org': Captcha.replace.init(); return; - case 'a.4cdn.org': - return; case 'sys.4chan.org': - Report.init(); - if (g.VIEW === 'post') { + if (pathname[2] === 'imgboard.php') { + if (/\bmode=report\b/.test(search)) { + Report.init(); + } else if ((match = search.match(/\bres=(\d+)/))) { + $.ready(function() { + var ref; + if (Conf['404 Redirect'] && ((ref = $.id('errmsg')) != null ? ref.textContent : void 0) === 'Error: Specified thread does not exist.') { + return Redirect.navigate('thread', { + boardID: g.BOARD.ID, + postID: +match[1] + }); + } + }); + } + } else if (pathname[2] === 'post') { PostSuccessful.init(); } - if (Conf['404 Redirect'] && /\/imgboard\.php$/.test(location.pathname) && (match = location.search.match(/\bres=(\d+)/))) { - $.ready(function() { - var ref1; - if (((ref1 = $.id('errmsg')) != null ? ref1.textContent : void 0) === 'Error: Specified thread does not exist.') { - return Redirect.navigate('thread', { - boardID: g.BOARD.ID, - postID: +match[1] - }); - } - }); - } return; case 'i.4cdn.org': + if (!(pathname[2] && !/s\.jpg$/.test(pathname[2]))) { + return; + } $.asap((function() { return d.readyState !== 'loading'; }), function() { - var pathname, ref1, video; - if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { - pathname = location.pathname.split(/\/+/); + var ref, video; + if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { return Redirect.navigate('file', { boardID: g.BOARD.ID, filename: pathname[pathname.length - 1] @@ -17442,24 +17547,22 @@ }); return; } - if (Conf['Normalize URL']) { - pathname = location.pathname.split(/\/+/); - switch (g.VIEW) { - case 'thread': - pathname[2] = 'thread'; - pathname = pathname.slice(0, 4); - break; - case 'index': - pathname = pathname.slice(0, 3); - } - pathname = pathname.join('/'); - if (location.pathname !== pathname) { - history.replaceState(history.state, '', location.protocol + "//" + location.host + pathname + location.hash); - } + if ((ref = pathname[2]) === 'thread' || ref === 'res') { + g.VIEW = 'thread'; + g.THREADID = +pathname[3]; + } else if ((ref1 = pathname[2]) === 'catalog' || ref1 === 'archive') { + g.VIEW = pathname[2]; + } else if (pathname[2].match(/^\d*$/)) { + g.VIEW = 'index'; + } else { + return; } - ref1 = Main.features; - for (k = 0, len1 = ref1.length; k < len1; k++) { - ref2 = ref1[k], name = ref2[0], feature = ref2[1]; + g.threads = new SimpleDict(); + g.posts = new SimpleDict(); + $.onExists(doc, 'body', false, Main.initStyle); + ref2 = Main.features; + for (k = 0, len1 = ref2.length; k < len1; k++) { + ref3 = ref2[k], name = ref3[0], feature = ref3[1]; try { feature.init(); } catch (_error) { @@ -17474,9 +17577,6 @@ }, initStyle: function() { var keyboard, ref; - if (location.hostname === 'www.4chan.org') { - $.addStyle(Main.cssWWW); - } if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) { return; } @@ -17504,14 +17604,7 @@ return Main.setClass(); }, setClass: function() { - var mainStyleSheet, setStyle, spooky, style, styleSheets; - if ((spooky = $('link[rel="stylesheet"][href^="//s.4cdn.org/css/spooky."]', d.head))) { - spooky.removeAttribute('media'); - if (getComputedStyle(d.body).color === 'rgb(196, 151, 86)') { - $.addClass(doc, 'spooky'); - return; - } - } + var mainStyleSheet, setStyle, style, styleSheets; if (g.VIEW === 'catalog') { $.addClass(doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace(/_+/g, '-')); return; @@ -17541,7 +17634,7 @@ }); }, initReady: function() { - var err, passLink, ref, ref1, styleSelector; + var ref, ref1, why; if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) { ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() { if (Conf['404 Redirect']) { @@ -17557,32 +17650,20 @@ if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') { return; } - if (styleSelector = $.id('styleSelector')) { - passLink = $.el('a', { - textContent: '4chan Pass', - href: 'javascript:;' - }); - $.on(passLink, 'click', function() { - return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'); - }); - $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]); - } if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) { Main.initThread(); } else { $.event('4chanXInitFinished'); } if (Conf['Show Support Message']) { - try { - return localStorage.getItem('4chan-settings'); - } catch (_error) { - err = _error; - return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30); + if ($.cantSync) { + why = $.cantSet ? 'save your settings' : 'synchronize settings between tabs'; + return new Notice('warning', "4chan X needs local storage to " + why + ".\nEnable it on boards.4chan.org in your browser's privacy settings\n(may be listed as part of \"local data\" or \"cookies\")."); } } }, initThread: function() { - var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; + var board, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads; if (board = $('.board')) { threads = []; posts = []; @@ -18809,6 +18890,7 @@ " max-height: 200px;\n" + " width: 100%;\n" + " overflow: auto;\n" + +" white-space: pre-line;\n" + "}\n" + "/* Settings */\n" + ":root.fourchan-x body {\n" + @@ -20100,9 +20182,6 @@ ".boardSubtitle[contenteditable=\"true\"] {\n" + " cursor: text !important;\n" + "}\n" + -"div.boardTitle {\n" + -" font-weight: 400 !important;\n" + -"}\n" + "/* Link Title Favicons */\n" + ".linkify.audio {\n" + " background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAitJREFUOE9jYCAWKJWwavr0KyXWb/FIbDtUFFyzJx6nVofE2Xo5nXsj0rqPNSR0nVkR2Hjmgmfd+U9Otdf+m5Vf/6+SfeU/R9ChVVgNYDRtlfJuuPA/rPfe/4QpD/6nznj0P27Kw/9unff/69Xf+69c/+C/SO7N/0z+OAxgMmmRCe++/r9i3ev/KWvf/vdY8PK/bt/9/wrNV3/IN5y/IVt1YqNg4pGTTP4HsbuA2bhZ2qvpyn+xjIObxAp3VwqlrgngLFyryVy5nhPmZJHANS2cwYexG8BmVC/pWn3hP4NZlzWuQDJI3dIiFnUUuwEsQAOcq87jNcC7fHeLUtJxHF4AGmBWeAavAWH1+1rUUk7giAWjOknllON4DXAs2NEiG4/DBQxAF/CFHfrPYI4jDFSLuJVjNrUJhB/B7gIGo1pJRt99GAZYJK7wLJ1z7Xzl4vu/7aqv/GRBj0bjqAX2qb0nJ7mXH17C4HcUxQA+hymWtSue/C5a9up/9Ozn/7Vr7v1nRY7GqMb91T3b3v6vWvPmf/S0p/9ZQk+DDLCBRSOz06Jqk+o7/21nvfqvsebDf7kZL/5zBaxphkezd+OFn7HzXvz3Wvjmv9a8N//5Ek//ZTBpVYUrMG2X5wjcdl68+uI/wa5Lr3hSNjczGFeywOVZ/bbcVGp//F9izfv/Ql03f3P4LC/HSEQquYwMFnUCDJ7dzBhyjGZNQpye89M5gpfnMvtNUyE2h4PUAQBovvT7lyNljwAAAABJRU5ErkJggg==') center left no-repeat!important;\n" + @@ -20482,11 +20561,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(100,0,0,0.6);\n" + -"}\n" + "/* General */\n" + ":root.yotsuba-b .dialog {\n" + " background-color: #D6DAF0;\n" + @@ -20558,11 +20632,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.yotsuba-b div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + -"}\n" + "/* General */\n" + ":root.futaba .dialog {\n" + " background-color: #F0E0D6;\n" + @@ -20846,11 +20915,6 @@ "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + "}\n" + -"/* Board Title */\n" + -":root.tomorrow div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(167,170,168,0.6);\n" + -"}\n" + "/* General */\n" + ":root.photon .dialog {\n" + " background-color: #DDD;\n" + @@ -20928,133 +20992,8 @@ ":root.photon .watch-thread-link\n" + "{\n" + " background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.photon div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" + -"}\n" + -"/* General */\n" + -":root.spooky .dialog {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .field:focus,\n" + -":root.spooky .field.focus {\n" + -" border-color: #98E;\n" + -"}\n" + -"/* Header */\n" + -":root.spooky #header-bar.dialog {\n" + -" background-color: rgba(23,21,38,0.98);\n" + -"}\n" + -":root.spooky:not(.fixed) #header-bar, :root.spooky #notifications {\n" + -" font-size: 9pt;\n" + -"}\n" + -":root.spooky #header-bar, :root.spooky #notifications {\n" + -" color: #C49756;\n" + -"}\n" + -":root.spooky #board-list a, :root.spooky #shortcuts a {\n" + -" color: #FE9600;\n" + -"}\n" + -"/* Settings */\n" + -":root.spooky #fourchanx-settings fieldset, :root.spooky .section-main div::before {\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .suboption-list > div:last-of-type {\n" + -" background-color: #171526;\n" + -"}\n" + -"/* Quote */\n" + -":root.spooky .catalog-thread > .comment > span.quote, :root.spooky #arc-list span.quote {\n" + -" color: #634C2C;\n" + -"}\n" + -":root.spooky .backlink.deadlink {\n" + -" color: #FE9600 !important;\n" + -"}\n" + -":root.spooky .inline {\n" + -" border-color: #707070;\n" + -" background-color: rgba(255, 255, 255, .14);\n" + -"}\n" + -"/* QR */\n" + -".spooky #dump-list::-webkit-scrollbar-thumb {\n" + -" background-color: #171526;\n" + -" border-color: #707070;\n" + -"}\n" + -":root.spooky .qr-preview {\n" + -" background-color: rgba(0, 0, 0, .15);\n" + -"}\n" + -":root.spooky #qr .field {\n" + -" background-color: rgb(26, 27, 29);\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr .field:focus,\n" + -":root.spooky #qr .field.focus {\n" + -" border-color: rgb(254, 150, 0) !important;\n" + -" background-color: rgb(30,32,36);\n" + -"}\n" + -":root.spooky .persona button {\n" + -" background: linear-gradient(to bottom, #2E3035, #222427) no-repeat;\n" + -" color: rgb(197,200,198);\n" + -" border-color: rgb(40, 41, 42);\n" + -" outline: none;\n" + -"}\n" + -":root.spooky .persona button::-moz-focus-inner {\n" + -" border: none;\n" + -"}\n" + -":root.spooky .persona button:focus {\n" + -" border-color: rgb(254, 150, 0);\n" + -"}\n" + -":root.spooky #qr.sjis-preview #sjis-toggle,\n" + -":root.spooky #qr.tex-preview #tex-preview-button {\n" + -" background: rgb(26, 27, 29);\n" + -"}\n" + -":root.spooky #qr select,\n" + -":root.spooky #file-n-submit > input,\n" + -":root.spooky #qr-draw-button {\n" + -" border-color: rgb(40, 41, 42);\n" + -"}\n" + -":root.spooky #qr-filename {\n" + -" color: rgb(197,200,198);\n" + -"}\n" + -":root.spooky .qr-link {\n" + -" border-color: rgb(8, 6, 23) rgb(8, 6, 23) rgb(0, 0, 8);\n" + -" background: linear-gradient(#262435, #171526) repeat scroll 0% 0% transparent;\n" + -"}\n" + -":root.spooky .qr-link:hover {\n" + -" background: #1A1829;\n" + -"}\n" + -"/* Menu */\n" + -":root.spooky #menu {\n" + -" color: #FE9600;\n" + -"}\n" + -":root.spooky .entry {\n" + -" font-size: 10pt;\n" + -"}\n" + -":root.spooky .focused.entry {\n" + -" background: rgba(255, 255, 255, .33);\n" + -"}\n" + -"/* Unread */\n" + -":root.spooky #unread-line {\n" + -" border-color: rgb(197, 200, 198);\n" + -"}\n" + -"/* Thread Watcher */\n" + -":root.spooky .replies-quoting-you > a, :root.spooky #watcher-link.disabled.replies-quoting-you {\n" + -" color: #F00 !important;\n" + -"}\n" + -"/* Watcher Favicon */\n" + -":root.spooky .watch-thread-link\n" + -"{\n" + -" background-image: url(\"data:image/svg+xml,\");\n" + -"}\n" + -"/* Board Title */\n" + -":root.spooky div.boardTitle {\n" + -" font-family: sans-serif !important;\n" + -" text-shadow: 1px 1px 1px rgba(105,10,15,0.6);\n" + "}", - cssWWW: "#captcha-cnt {\n" + -" height: auto;\n" + -"}", - features: [['Polyfill', Polyfill], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Replacement', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Oekaki Links', QR.oekaki], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] }; Main.init(); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 9c0d930eb..8f6ff0060 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index d7fd60131..3a4ed91f1 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index acb64d61a..f89e98069 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/version.json b/version.json index 6d1c4247a..bd8acc742 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.11.15.7", - "date": "2015-11-07T21:55:38.769Z" + "version": "1.11.16.0", + "date": "2015-11-09T05:06:57.649Z" }