diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3aef3d6..d289f987e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x). +### v1.11.1 + +**v1.11.1.0** *(2015-06-22)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.1.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.1.0/builds/4chan-X-noupdate.crx "Chromium version")] +- Based on v1.11.0.9. +- Add partial support for Midori and other browsers whose userscript engines don't implement the Greasemonkey API. Some features will not work in these browsers. + ## v1.11.0 **v1.11.0.9** *(2015-06-21)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.9/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.9/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index bd52d825e..d8f3962a6 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 8a3a66685..9d1836079 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.0.9 +// @version 1.11.1.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 624570623..20cd12e5c 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.0.9 +// @version 1.11.1.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -402,7 +402,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.0.9', + VERSION: '1.11.1.0', NAMESPACE: '4chan X.', boards: {} }; @@ -784,7 +784,9 @@ })); }; - $.open = GM_openInTab; + $.open = typeof GM_openInTab !== "undefined" && GM_openInTab !== null ? GM_openInTab : function(url) { + return window.open(url, '_blank'); + }; $.debounce = function(wait, fn) { var args, exec, lastCall, that, timeout; @@ -871,10 +873,55 @@ $.oldValue = {}; + if (typeof GM_getValue !== "undefined" && GM_getValue !== null) { + $.getValue = GM_getValue; + $.setValue = function(key, val) { + GM_setValue(key, val); + if (key in $.syncing) { + $.oldValue[key] = val; + return localStorage[key] = val; + } + }; + $.deleteValue = function(key) { + GM_deleteValue(key); + if (key in $.syncing) { + delete $.oldValue[key]; + return delete localStorage[key]; + } + }; + $.listValues = GM_listValues; + } else { + $.getValue = function(key) { + return localStorage[key]; + }; + $.setValue = function(key, val) { + if (key in $.syncing) { + $.oldValue[key] = val; + } + return localStorage[key] = val; + }; + $.deleteValue = function(key) { + if (key in $.syncing) { + delete $.oldValue[key]; + } + return delete localStorage[key]; + }; + $.listValues = function() { + var key, results; + results = []; + for (key in localStorage) { + if (key.slice(0, g.NAMESPACE.length) === g.NAMESPACE) { + results.push(key); + } + } + return results; + }; + } + $.sync = function(key, cb) { key = g.NAMESPACE + key; $.syncing[key] = cb; - return $.oldValue[key] = GM_getValue(key); + return $.oldValue[key] = $.getValue(key); }; (function() { @@ -884,7 +931,7 @@ if (!(cb = $.syncing[key])) { return; } - newValue = GM_getValue(key); + newValue = $.getValue(key); if (newValue === $.oldValue[key]) { return; } @@ -913,12 +960,7 @@ } for (k = 0, len1 = keys.length; k < len1; k++) { key = keys[k]; - key = g.NAMESPACE + key; - GM_deleteValue(key); - if (key in $.syncing) { - delete $.oldValue[key]; - localStorage.removeItem(key); - } + $.deleteValue(g.NAMESPACE + key); } }; @@ -932,7 +974,7 @@ } return $.queueTask(function() { for (key in items) { - if (val = GM_getValue(g.NAMESPACE + key)) { + if (val = $.getValue(g.NAMESPACE + key)) { items[key] = JSON.parse(val); } } @@ -940,31 +982,19 @@ }); }; - $.set = (function() { - var set; - set = function(key, val) { - key = g.NAMESPACE + key; - val = JSON.stringify(val); - GM_setValue(key, val); - if (key in $.syncing) { - $.oldValue[key] = val; - return localStorage.setItem(key, val); + $.set = function(keys, val, cb) { + var key, value; + if (typeof keys === 'string') { + $.setValue(g.NAMESPACE + keys, JSON.stringify(val)); + } else { + for (key in keys) { + value = keys[key]; + $.setValue(g.NAMESPACE + key, JSON.stringify(value)); } - }; - return function(keys, val, cb) { - var key, value; - if (typeof keys === 'string') { - set(keys, val); - } else { - for (key in keys) { - value = keys[key]; - set(key, value); - } - cb = val; - } - return typeof cb === "function" ? cb() : void 0; - }; - })(); + cb = val; + } + return typeof cb === "function" ? cb() : void 0; + }; $.clear = function(cb) { var a, board, boards, id; @@ -1001,7 +1031,7 @@ return results; })()); try { - $["delete"](GM_listValues().map(function(key) { + $["delete"]($.listValues().map(function(key) { return key.replace(g.NAMESPACE, ''); })); } catch (_error) {} @@ -3128,7 +3158,7 @@ $.asap((function() { return $('.board > .thread > .postContainer', doc) || d.readyState !== 'loading'; }), function() { - var board, el, len3, len4, ref6, ref7, ref8, threadRoot, topNavPos, u, w; + var board, el, len3, len4, ref6, ref7, ref8, threadRoot, topNavPos, u, v; if (!Main.isThisPageLegit()) { return; } @@ -3145,8 +3175,8 @@ $.event('PostsInserted'); d.implementation.createDocument(null, null, null).appendChild(board); ref7 = $$('.navLinks'); - for (w = 0, len4 = ref7.length; w < len4; w++) { - el = ref7[w]; + for (v = 0, len4 = ref7.length; v < len4; v++) { + el = ref7[v]; $.rm(el); } if ((ref8 = $.id('search-box')) != null) { @@ -4213,7 +4243,7 @@ return Build.postFromObject(data, board.ID); }, catalogThread: function(thread) { - var br, cc, comment, data, exif, fileCount, gifIcon, href, imgClass, k, len1, len2, len3, len4, pageCount, postCount, pp, q, quote, ref, ref1, ref2, ref3, ref4, root, spoilerRange, src, staticPath, u, w; + var br, cc, comment, data, exif, fileCount, gifIcon, href, imgClass, k, len1, len2, len3, len4, pageCount, postCount, pp, q, quote, ref, ref1, ref2, ref3, ref4, root, spoilerRange, src, staticPath, u, v; staticPath = Build.staticPath, gifIcon = Build.gifIcon; data = Index.liveThreadData[Index.liveThreadIDs.indexOf(thread.ID)]; if (data.spoiler && !Conf['Reveal Spoiler Thumbnails']) { @@ -4271,8 +4301,8 @@ $.replace(pp, cc); } ref3 = $$('br', root.lastElementChild); - for (w = 0, len4 = ref3.length; w < len4; w++) { - br = ref3[w]; + for (v = 0, len4 = ref3.length; v < len4; v++) { + br = ref3[v]; if (((ref4 = br.previousSibling) != null ? ref4.nodeName : void 0) === 'BR') { $.rm(br); } @@ -6962,7 +6992,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, w, 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(); } @@ -7002,18 +7032,18 @@ $.replace(node, [$.tn('[spoiler]')].concat(slice.call(node.childNodes), [$.tn('[/spoiler]')])); } ref3 = $$('.prettyprint', frag); - for (w = 0, len4 = ref3.length; w < len4; w++) { - node = ref3[w]; + for (v = 0, len4 = ref3.length; v < len4; v++) { + node = ref3[v]; $.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); } @@ -12838,7 +12868,7 @@ return new Notice('info', "The thread is " + change + ".", 30); }, parse: function(req) { - var ID, OP, board, deletedFiles, deletedPosts, files, firstPost, index, ipCountEl, k, lastPost, len1, len2, len3, len4, newPosts, node, post, postObject, postObjects, posts, q, ref, ref1, ref2, ref3, ref4, ref5, scroll, thread, u, unreadCount, w; + var ID, OP, board, deletedFiles, deletedPosts, files, firstPost, index, ipCountEl, k, lastPost, len1, len2, len3, len4, newPosts, node, post, postObject, postObjects, posts, q, ref, ref1, ref2, ref3, ref4, ref5, scroll, thread, u, unreadCount, v; postObjects = req.response.posts; OP = postObjects[0]; thread = ThreadUpdater.thread; @@ -12920,8 +12950,8 @@ } scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25; firstPost = null; - for (w = 0, len4 = posts.length; w < len4; w++) { - post = posts[w]; + for (v = 0, len4 = posts.length; v < len4; v++) { + post = posts[v]; if (!QuoteThreading.insert(post)) { firstPost || (firstPost = post.nodes.root); $.add(ThreadUpdater.root, post.nodes.root); @@ -16463,7 +16493,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, w, 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: "