diff --git a/CHANGELOG.md b/CHANGELOG.md index c25b720df..3baf8e05f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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.10 + +**v1.11.10.0** *(2015-08-20)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.10.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.10.0/builds/4chan-X-noupdate.crx "Chromium version")] +- Based on v1.11.9.2. +- Support [port of Greasemonkey 3 to Pale Moon](https://github.com/janekptacijarabaci/greasemonkey/releases/latest). +- Fix bug causing updateless versions of userscript to check for and install updates. + ### v1.11.9 **v1.11.9.4** *(2015-08-22)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.9.4/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.9.4/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 053a1e713..c91cac904 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -304,6 +304,7 @@ module.exports = (grunt) -> GM_xmlhttpRequest: true GM_info: true cloneInto: true + unsafeWindow: true chrome: true script: 'tmp-<%= pkg.type %>/*.js' diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index fcd923118..1cba614b6 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 b14da23b1..104f4874c 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.9.4 +// @version 1.11.10.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 4d6b50029..ef284456d 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.9.4 +// @version 1.11.10.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.9.4', + VERSION: '1.11.10.0', NAMESPACE: '4chan X.', boards: {} }; @@ -802,6 +802,46 @@ })); }; + (function() { + var clone, err, ref, unsafeConstructors; + if (!(/PaleMoon\//.test(navigator.userAgent) && +(typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.version) != null ? ref.split('.')[0] : void 0 : void 0) >= 2 && typeof cloneInto === 'undefined')) { + return; + } + try { + return new CustomEvent('x', { + detail: {} + }); + } catch (_error) { + err = _error; + unsafeConstructors = { + Object: unsafeWindow.Object, + Array: unsafeWindow.Array + }; + clone = function(obj) { + var constructor, key, obj2, val; + if ((obj != null) && typeof obj === 'object' && (constructor = unsafeConstructors[obj.constructor.name])) { + obj2 = new constructor(); + for (key in obj) { + val = obj[key]; + obj2[key] = clone(val); + } + return obj2; + } else { + return obj; + } + }; + return $.event = function(event, detail, root) { + if (root == null) { + root = d; + } + return root.dispatchEvent(new CustomEvent(event, { + bubbles: true, + detail: clone(detail) + })); + }; + } + })(); + $.open = typeof GM_openInTab !== "undefined" && GM_openInTab !== null ? GM_openInTab : function(url) { return window.open(url, '_blank'); }; @@ -7100,7 +7140,7 @@ return status.disabled = disabled || false; }, quote: function(e) { - var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, y, z; + var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, w, y; if (e != null) { e.preventDefault(); } @@ -7145,13 +7185,13 @@ $.replace(node, [$.tn('[code]')].concat(slice.call(node.childNodes), [$.tn('[/code]')])); } ref4 = $$('.linkify[data-original]', frag); - for (y = 0, len5 = ref4.length; y < len5; y++) { - node = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + node = ref4[w]; $.replace(node, $.tn(node.dataset.original)); } ref5 = $$('.embedder', frag); - for (z = 0, len6 = ref5.length; z < len6; z++) { - node = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + node = ref5[y]; if (((ref6 = node.previousSibling) != null ? ref6.nodeValue : void 0) === ' ') { $.rm(node.previousSibling); } @@ -7814,7 +7854,7 @@ initNoscript: function() { this.noscript = true; this.images = $$('.fbc-payload-imageselect > input'); - if (this.images.length !== 9) { + if (!this.images.length) { return; } $.addStyle(this.cssNoscript); @@ -7830,7 +7870,7 @@ img = ref[k]; img.tabIndex = 0; } - if (this.images.length === 9) { + if (this.images.length) { return this.addTooltips(this.images); } }, @@ -7878,36 +7918,36 @@ } }, keybinds: function(e) { - var dx, i, key, last, n, reload, verify, w, x; + var dx, i, key, reload, verify, x; if (!(this.images && doc.contains(this.images[0]))) { return; } - n = this.images.length; - w = Math.round(Math.sqrt(n)); - last = n + w - 1; reload = $('#recaptcha-reload-button, .fbc-button-reload'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); x = this.images.indexOf(d.activeElement); if (x < 0) { - x = d.activeElement === verify ? last : n; + x = d.activeElement === verify ? 11 : 9; } key = Keybinds.keyCode(e); - if (!this.noscript && key === 'Space' && x < n) { + if (!this.noscript && key === 'Space' && x < 9) { this.images[x].click(); - } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { + } else if ((i = this.imageKeys.indexOf(key)) >= 0) { this.images[i % 9].click(); verify.focus(); } else if (dx = { - 'Up': n, - 'Down': w, - 'Left': last, + 'Up': 9, + 'Down': 3, + 'Left': 11, 'Right': 1 }[key]) { - x = (x + dx) % (n + w); - if ((n < x && x < last)) { - x = dx === last ? n : last; + x = (x + dx) % 12; + if (x === 10) { + x = dx === 11 ? 9 : 11; } - (this.images[x] || (x === n ? reload : void 0) || (x === last ? verify : void 0)).focus(); + (this.images[x] || { + 9: reload, + 11: verify + }[x]).focus(); } else { return; } @@ -14376,7 +14416,7 @@ } return Redirect.data = o; }, - archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"4ch.archive.horse","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], + archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"archive.desustorage.org","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], to: function(dest, data) { var archive; archive = (dest === 'search' || dest === 'board' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; @@ -16783,7 +16823,7 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var aa, applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, warning, withCredentials, y, z; + var applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, w, warning, withCredentials, y, z; $.extend(section, { innerHTML: "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Captcha Language
Choose from list of language codes. Leave blank to autoselect.
Custom Board Navigation
New lines will be converted into spaces.

In the following examples for /g/, g can be changed to a different board ID (a, b, etc...), the current board (current), or the Twitter link (@).
Board link: g
Archive link: g-archive
Internal archive link: g-expired
Title link: g-title
Board link (Replace with title when on that board): g-replace
Full text link: g-full
Custom text link: g-text:"Install Gentoo"
Index-only link: g-index
Catalog-only link: g-catalog
External link: external-text:"Google","http://www.google.com"
Combinations are possible: g-index-text:"Technology Index"
Full board list toggle: toggle-all

[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:"Piracy"]
will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
if you are on /g/.
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Literal %: %%
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (4chan filename)
Filename: %n (truncated), %N (untruncated), %t (4chan filename)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Tag: %g
Literal %: %%
Quick Reply Personas

One item per line.
Items will be added in the relevant input's auto-completion list.
Password items will always be used, since there is no password input.
Lines starting with a # will be ignored.

Unread Favicon is disabled.
Thread Updater is disabled.
Interval: seconds
Custom Cooldown Time
Seconds:
" }); @@ -16862,8 +16902,8 @@ for (boardID in archBoards) { o = archBoards[boardID]; ref4 = ['thread', 'post', 'file']; - for (y = 0, len5 = ref4.length; y < len5; y++) { - item = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + item = ref4[w]; i = o[item][0].length ? 1 : 0; o[item][i].push('disabled'); o[item] = o[item][0].concat(o[item][1]); @@ -16872,8 +16912,8 @@ rows = []; boardOptions = []; ref5 = Object.keys(archBoards).sort(); - for (z = 0, len6 = ref5.length; z < len6; z++) { - boardID = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + boardID = ref5[y]; row = $.el('tr', { className: "board-" + boardID }); @@ -16885,8 +16925,8 @@ })); o = archBoards[boardID]; ref6 = ['thread', 'post', 'file']; - for (aa = 0, len7 = ref6.length; aa < len7; aa++) { - item = ref6[aa]; + for (z = 0, len7 = ref6.length; z < len7; z++) { + item = ref6[z]; $.add(row, Settings.addArchiveCell(boardID, o, item)); } rows.push(row); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 3aa0184e5..2afbcb422 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 e25404e73..5ff4a56bc 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.9.4 +// @version 1.11.10.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.9.4', + VERSION: '1.11.10.0', NAMESPACE: '4chan X.', boards: {} }; @@ -802,6 +802,46 @@ })); }; + (function() { + var clone, err, ref, unsafeConstructors; + if (!(/PaleMoon\//.test(navigator.userAgent) && +(typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.version) != null ? ref.split('.')[0] : void 0 : void 0) >= 2 && typeof cloneInto === 'undefined')) { + return; + } + try { + return new CustomEvent('x', { + detail: {} + }); + } catch (_error) { + err = _error; + unsafeConstructors = { + Object: unsafeWindow.Object, + Array: unsafeWindow.Array + }; + clone = function(obj) { + var constructor, key, obj2, val; + if ((obj != null) && typeof obj === 'object' && (constructor = unsafeConstructors[obj.constructor.name])) { + obj2 = new constructor(); + for (key in obj) { + val = obj[key]; + obj2[key] = clone(val); + } + return obj2; + } else { + return obj; + } + }; + return $.event = function(event, detail, root) { + if (root == null) { + root = d; + } + return root.dispatchEvent(new CustomEvent(event, { + bubbles: true, + detail: clone(detail) + })); + }; + } + })(); + $.open = typeof GM_openInTab !== "undefined" && GM_openInTab !== null ? GM_openInTab : function(url) { return window.open(url, '_blank'); }; @@ -7100,7 +7140,7 @@ return status.disabled = disabled || false; }, quote: function(e) { - var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, y, z; + var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, w, y; if (e != null) { e.preventDefault(); } @@ -7145,13 +7185,13 @@ $.replace(node, [$.tn('[code]')].concat(slice.call(node.childNodes), [$.tn('[/code]')])); } ref4 = $$('.linkify[data-original]', frag); - for (y = 0, len5 = ref4.length; y < len5; y++) { - node = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + node = ref4[w]; $.replace(node, $.tn(node.dataset.original)); } ref5 = $$('.embedder', frag); - for (z = 0, len6 = ref5.length; z < len6; z++) { - node = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + node = ref5[y]; if (((ref6 = node.previousSibling) != null ? ref6.nodeValue : void 0) === ' ') { $.rm(node.previousSibling); } @@ -7814,7 +7854,7 @@ initNoscript: function() { this.noscript = true; this.images = $$('.fbc-payload-imageselect > input'); - if (this.images.length !== 9) { + if (!this.images.length) { return; } $.addStyle(this.cssNoscript); @@ -7830,7 +7870,7 @@ img = ref[k]; img.tabIndex = 0; } - if (this.images.length === 9) { + if (this.images.length) { return this.addTooltips(this.images); } }, @@ -7878,36 +7918,36 @@ } }, keybinds: function(e) { - var dx, i, key, last, n, reload, verify, w, x; + var dx, i, key, reload, verify, x; if (!(this.images && doc.contains(this.images[0]))) { return; } - n = this.images.length; - w = Math.round(Math.sqrt(n)); - last = n + w - 1; reload = $('#recaptcha-reload-button, .fbc-button-reload'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); x = this.images.indexOf(d.activeElement); if (x < 0) { - x = d.activeElement === verify ? last : n; + x = d.activeElement === verify ? 11 : 9; } key = Keybinds.keyCode(e); - if (!this.noscript && key === 'Space' && x < n) { + if (!this.noscript && key === 'Space' && x < 9) { this.images[x].click(); - } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { + } else if ((i = this.imageKeys.indexOf(key)) >= 0) { this.images[i % 9].click(); verify.focus(); } else if (dx = { - 'Up': n, - 'Down': w, - 'Left': last, + 'Up': 9, + 'Down': 3, + 'Left': 11, 'Right': 1 }[key]) { - x = (x + dx) % (n + w); - if ((n < x && x < last)) { - x = dx === last ? n : last; + x = (x + dx) % 12; + if (x === 10) { + x = dx === 11 ? 9 : 11; } - (this.images[x] || (x === n ? reload : void 0) || (x === last ? verify : void 0)).focus(); + (this.images[x] || { + 9: reload, + 11: verify + }[x]).focus(); } else { return; } @@ -14376,7 +14416,7 @@ } return Redirect.data = o; }, - archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"4ch.archive.horse","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], + archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"archive.desustorage.org","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], to: function(dest, data) { var archive; archive = (dest === 'search' || dest === 'board' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; @@ -16783,7 +16823,7 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var aa, applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, warning, withCredentials, y, z; + var applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, w, warning, withCredentials, y, z; $.extend(section, { innerHTML: "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Captcha Language
Choose from list of language codes. Leave blank to autoselect.
Custom Board Navigation
New lines will be converted into spaces.

In the following examples for /g/, g can be changed to a different board ID (a, b, etc...), the current board (current), or the Twitter link (@).
Board link: g
Archive link: g-archive
Internal archive link: g-expired
Title link: g-title
Board link (Replace with title when on that board): g-replace
Full text link: g-full
Custom text link: g-text:"Install Gentoo"
Index-only link: g-index
Catalog-only link: g-catalog
External link: external-text:"Google","http://www.google.com"
Combinations are possible: g-index-text:"Technology Index"
Full board list toggle: toggle-all

[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:"Piracy"]
will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
if you are on /g/.
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Literal %: %%
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (4chan filename)
Filename: %n (truncated), %N (untruncated), %t (4chan filename)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Tag: %g
Literal %: %%
Quick Reply Personas

One item per line.
Items will be added in the relevant input's auto-completion list.
Password items will always be used, since there is no password input.
Lines starting with a # will be ignored.

Unread Favicon is disabled.
Thread Updater is disabled.
Interval: seconds
Custom Cooldown Time
Seconds:
" }); @@ -16862,8 +16902,8 @@ for (boardID in archBoards) { o = archBoards[boardID]; ref4 = ['thread', 'post', 'file']; - for (y = 0, len5 = ref4.length; y < len5; y++) { - item = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + item = ref4[w]; i = o[item][0].length ? 1 : 0; o[item][i].push('disabled'); o[item] = o[item][0].concat(o[item][1]); @@ -16872,8 +16912,8 @@ rows = []; boardOptions = []; ref5 = Object.keys(archBoards).sort(); - for (z = 0, len6 = ref5.length; z < len6; z++) { - boardID = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + boardID = ref5[y]; row = $.el('tr', { className: "board-" + boardID }); @@ -16885,8 +16925,8 @@ })); o = archBoards[boardID]; ref6 = ['thread', 'post', 'file']; - for (aa = 0, len7 = ref6.length; aa < len7; aa++) { - item = ref6[aa]; + for (z = 0, len7 = ref6.length; z < len7; z++) { + item = ref6[z]; $.add(row, Settings.addArchiveCell(boardID, o, item)); } rows.push(row); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 759726721..4398907f5 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 a254e633a..67a50436c 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.9.4 +// @version 1.11.10.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 9a42f3b0f..6e1bf8862 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.9.4 +// @version 1.11.10.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -412,7 +412,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.9.4', + VERSION: '1.11.10.0', NAMESPACE: '4chan X.', boards: {} }; @@ -802,6 +802,46 @@ })); }; + (function() { + var clone, err, ref, unsafeConstructors; + if (!(/PaleMoon\//.test(navigator.userAgent) && +(typeof GM_info !== "undefined" && GM_info !== null ? (ref = GM_info.version) != null ? ref.split('.')[0] : void 0 : void 0) >= 2 && typeof cloneInto === 'undefined')) { + return; + } + try { + return new CustomEvent('x', { + detail: {} + }); + } catch (_error) { + err = _error; + unsafeConstructors = { + Object: unsafeWindow.Object, + Array: unsafeWindow.Array + }; + clone = function(obj) { + var constructor, key, obj2, val; + if ((obj != null) && typeof obj === 'object' && (constructor = unsafeConstructors[obj.constructor.name])) { + obj2 = new constructor(); + for (key in obj) { + val = obj[key]; + obj2[key] = clone(val); + } + return obj2; + } else { + return obj; + } + }; + return $.event = function(event, detail, root) { + if (root == null) { + root = d; + } + return root.dispatchEvent(new CustomEvent(event, { + bubbles: true, + detail: clone(detail) + })); + }; + } + })(); + $.open = typeof GM_openInTab !== "undefined" && GM_openInTab !== null ? GM_openInTab : function(url) { return window.open(url, '_blank'); }; @@ -7100,7 +7140,7 @@ return status.disabled = disabled || false; }, quote: function(e) { - var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, y, z; + var ancestor, caretPos, com, frag, index, insideCode, k, len1, len2, len3, len4, len5, len6, node, post, q, range, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, sel, text, thread, u, v, w, y; if (e != null) { e.preventDefault(); } @@ -7145,13 +7185,13 @@ $.replace(node, [$.tn('[code]')].concat(slice.call(node.childNodes), [$.tn('[/code]')])); } ref4 = $$('.linkify[data-original]', frag); - for (y = 0, len5 = ref4.length; y < len5; y++) { - node = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + node = ref4[w]; $.replace(node, $.tn(node.dataset.original)); } ref5 = $$('.embedder', frag); - for (z = 0, len6 = ref5.length; z < len6; z++) { - node = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + node = ref5[y]; if (((ref6 = node.previousSibling) != null ? ref6.nodeValue : void 0) === ' ') { $.rm(node.previousSibling); } @@ -7814,7 +7854,7 @@ initNoscript: function() { this.noscript = true; this.images = $$('.fbc-payload-imageselect > input'); - if (this.images.length !== 9) { + if (!this.images.length) { return; } $.addStyle(this.cssNoscript); @@ -7830,7 +7870,7 @@ img = ref[k]; img.tabIndex = 0; } - if (this.images.length === 9) { + if (this.images.length) { return this.addTooltips(this.images); } }, @@ -7878,36 +7918,36 @@ } }, keybinds: function(e) { - var dx, i, key, last, n, reload, verify, w, x; + var dx, i, key, reload, verify, x; if (!(this.images && doc.contains(this.images[0]))) { return; } - n = this.images.length; - w = Math.round(Math.sqrt(n)); - last = n + w - 1; reload = $('#recaptcha-reload-button, .fbc-button-reload'); verify = $('#recaptcha-verify-button, .fbc-button-verify > input'); x = this.images.indexOf(d.activeElement); if (x < 0) { - x = d.activeElement === verify ? last : n; + x = d.activeElement === verify ? 11 : 9; } key = Keybinds.keyCode(e); - if (!this.noscript && key === 'Space' && x < n) { + if (!this.noscript && key === 'Space' && x < 9) { this.images[x].click(); - } else if (n === 9 && (i = this.imageKeys.indexOf(key)) >= 0) { + } else if ((i = this.imageKeys.indexOf(key)) >= 0) { this.images[i % 9].click(); verify.focus(); } else if (dx = { - 'Up': n, - 'Down': w, - 'Left': last, + 'Up': 9, + 'Down': 3, + 'Left': 11, 'Right': 1 }[key]) { - x = (x + dx) % (n + w); - if ((n < x && x < last)) { - x = dx === last ? n : last; + x = (x + dx) % 12; + if (x === 10) { + x = dx === 11 ? 9 : 11; } - (this.images[x] || (x === n ? reload : void 0) || (x === last ? verify : void 0)).focus(); + (this.images[x] || { + 9: reload, + 11: verify + }[x]).focus(); } else { return; } @@ -14376,7 +14416,7 @@ } return Redirect.data = o; }, - archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"4ch.archive.horse","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], + archives: [{"uid":0,"name":"Moe","domain":"archive.moe","http":false,"https":true,"software":"foolfuuka","boards":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","tv","u","v","vg","vp","vr","wsg"],"files":["a","an","biz","c","co","diy","fit","gd","gif","h","i","int","jp","k","m","mlp","out","po","qa","r9k","s4s","sci","tg","u","v","vg","vp","vr","wsg"]},{"uid":3,"name":"4plebs Archive","domain":"archive.4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"],"files":["adv","f","hr","o","pol","s4s","tg","trv","tv","x"]},{"uid":4,"name":"Nyafuu Archive","domain":"archive.nyafuu.org","http":true,"https":true,"software":"foolfuuka","boards":["c","e","w","wg"],"files":["c","e","w","wg"]},{"uid":5,"name":"Love is Over","domain":"archive.loveisover.me","http":true,"https":true,"software":"foolfuuka","boards":["c","d","e","i","lgbt","t","u"],"files":["c","d","e","i","lgbt","t","u"]},{"uid":8,"name":"Rebecca Black Tech","domain":"rbt.asia","http":false,"https":true,"software":"fuuka","boards":["cgl","g","mu","qa","w"],"files":["cgl","g","mu","qa","w"]},{"uid":10,"name":"warosu","domain":"warosu.org","http":false,"https":true,"software":"fuuka","boards":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"],"files":["3","biz","cgl","ck","diy","fa","g","ic","jp","lit","sci","tg","vr"]},{"uid":15,"name":"fgts","domain":"fgts.jp","http":true,"https":true,"software":"foolfuuka","boards":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"],"files":["asp","b","cm","h","hc","hm","n","p","qa","r","s","soc","toy","y"]},{"uid":22,"name":"not4plebs","domain":"totally.not4plebs.org","http":true,"https":true,"software":"foolfuuka","boards":["sp"],"files":["sp"]},{"uid":23,"name":"DesuStorage","domain":"archive.desustorage.org","http":false,"https":true,"software":"foolfuuka","boards":["mlp","qa"],"files":["mlp","qa"]},{"uid":24,"name":"fireden.net","domain":"boards.fireden.net","http":false,"https":true,"software":"foolfuuka","boards":["cm","ic","vg","y"],"files":["cm","ic","vg","y"]}], to: function(dest, data) { var archive; archive = (dest === 'search' || dest === 'board' ? Redirect.data.thread : Redirect.data[dest])[data.boardID]; @@ -16783,7 +16823,7 @@ return $.on(ta, 'change', $.cb.value); }, advanced: function(section) { - var aa, applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, warning, withCredentials, y, z; + var applyCSS, archBoards, boardID, boardOptions, boardSelect, boards, customCSS, files, i, input, inputs, interval, item, items, k, len1, len2, len3, len4, len5, len6, len7, name, o, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, row, rows, software, ta, table, u, v, w, warning, withCredentials, y, z; $.extend(section, { innerHTML: "
Archiver
404 Redirect is disabled.
Thread redirectionPost fetchingFile redirection
Captcha Language
Choose from list of language codes. Leave blank to autoselect.
Custom Board Navigation
New lines will be converted into spaces.

In the following examples for /g/, g can be changed to a different board ID (a, b, etc...), the current board (current), or the Twitter link (@).
Board link: g
Archive link: g-archive
Internal archive link: g-expired
Title link: g-title
Board link (Replace with title when on that board): g-replace
Full text link: g-full
Custom text link: g-text:"Install Gentoo"
Index-only link: g-index
Catalog-only link: g-catalog
External link: external-text:"Google","http://www.google.com"
Combinations are possible: g-index-text:"Technology Index"
Full board list toggle: toggle-all

[ toggle-all ] [current-title] [g-title / a-title / jp-title] [x / wsg / h] [t-text:"Piracy"]
will give you
[ + ] [Technology] [Technology / Anime & Manga / Otaku Culture] [x / wsg / h] [Piracy]
if you are on /g/.
Time Formatting is disabled.
:
Supported format specifiers:
Day: %a, %A, %d, %e
Month: %m, %b, %B
Year: %y, %Y
Hour: %k, %H, %l, %I, %p, %P
Minute: %M
Second: %S
Literal %: %%
Quote Backlinks formatting is disabled.
:
File Info Formatting is disabled.
:
Link: %l (truncated), %L (untruncated), %T (4chan filename)
Filename: %n (truncated), %N (untruncated), %t (4chan filename)
Spoiler indicator: %p
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
Resolution: %r (Displays 'PDF' for PDF files)
Tag: %g
Literal %: %%
Quick Reply Personas

One item per line.
Items will be added in the relevant input's auto-completion list.
Password items will always be used, since there is no password input.
Lines starting with a # will be ignored.

Unread Favicon is disabled.
Thread Updater is disabled.
Interval: seconds
Custom Cooldown Time
Seconds:
" }); @@ -16862,8 +16902,8 @@ for (boardID in archBoards) { o = archBoards[boardID]; ref4 = ['thread', 'post', 'file']; - for (y = 0, len5 = ref4.length; y < len5; y++) { - item = ref4[y]; + for (w = 0, len5 = ref4.length; w < len5; w++) { + item = ref4[w]; i = o[item][0].length ? 1 : 0; o[item][i].push('disabled'); o[item] = o[item][0].concat(o[item][1]); @@ -16872,8 +16912,8 @@ rows = []; boardOptions = []; ref5 = Object.keys(archBoards).sort(); - for (z = 0, len6 = ref5.length; z < len6; z++) { - boardID = ref5[z]; + for (y = 0, len6 = ref5.length; y < len6; y++) { + boardID = ref5[y]; row = $.el('tr', { className: "board-" + boardID }); @@ -16885,8 +16925,8 @@ })); o = archBoards[boardID]; ref6 = ['thread', 'post', 'file']; - for (aa = 0, len7 = ref6.length; aa < len7; aa++) { - item = ref6[aa]; + for (z = 0, len7 = ref6.length; z < len7; z++) { + item = ref6[z]; $.add(row, Settings.addArchiveCell(boardID, o, item)); } rows.push(row); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index e7793a3ac..1cccc12b6 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 50ced9bc0..0b9f01013 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 3754ecd90..adafd7c2e 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index 6ed3c5a26..8e12b092a 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "meta": { "name": "4chan X", "fork": "ccd0", - "version": "1.11.9.4", - "date": "2015-08-22T09:17:38.413Z", + "version": "1.11.10.0", + "date": "2015-08-20T08:34:03.582Z", "page": "https://www.4chan-x.net/", "downloads": "https://www.4chan-x.net/builds/", "oldVersions": "https://raw.githubusercontent.com/ccd0/4chan-x/", diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index 7896c412c..2dcc822e9 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -224,6 +224,28 @@ $.event = (event, detail, root=d) -> <% } %> root.dispatchEvent new CustomEvent event, {bubbles: true, detail} +<% if (type === 'userscript') { %> +# XXX Make $.event work in Pale Moon with GM 3.x (no cloneInto function). +do -> + return unless /PaleMoon\//.test(navigator.userAgent) and +GM_info?.version?.split('.')[0] >= 2 and typeof cloneInto is 'undefined' + + try + new CustomEvent 'x', detail: {} + catch err + unsafeConstructors = + Object: unsafeWindow.Object + Array: unsafeWindow.Array + clone = (obj) -> + if obj? and typeof obj is 'object' and (constructor = unsafeConstructors[obj.constructor.name]) + obj2 = new constructor() + obj2[key] = clone val for key, val of obj + obj2 + else + obj + $.event = (event, detail, root=d) -> + root.dispatchEvent new CustomEvent event, {bubbles: true, detail: clone detail} +<% } %> + $.open = <% if (type === 'userscript') { %> if GM_openInTab?