diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c66a154..8b040211a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ The links to individual versions below are to copies of the script with the upda ### v1.10.6 +**v1.10.6.2** *(2015-03-22)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.6.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.6.2/builds/4chan-X-noupdate.crx "Chromium version")] +- Fix conflict with 4chan imgur thumbnail script, hopefully correctly this time. +- Add `Remove Original Link` suboption (default: off) to `File Info Formatting` to remove rather than hide the original link in the file info. +- Minor unread line bugfix. + **v1.10.6.1** *(2015-03-22)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.6.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.6.1/builds/4chan-X-noupdate.crx "Chromium version")] - Fix conflict with 4chan imgur thumbnail script. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 222b38040..abd9065af 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 78bb5e0bc..524187daf 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.10.6.1 +// @version 1.10.6.2 // @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 7c9850fdf..bd0977dac 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.10.6.1 +// @version 1.10.6.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -134,6 +134,7 @@ 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'File Info Formatting': [true, 'Reformat the file information.'], + 'Remove Original Link': [false, 'Remove the original file link rather than hiding it. May cause incompatibilities with other scripts.', 1], 'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'], @@ -395,7 +396,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.6.1', + VERSION: '1.10.6.2', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1344,25 +1345,26 @@ }; Post.prototype.parseFile = function() { - var fileEl, fileText, info, link, ref, size, thumb, unit; - if (!((fileEl = $('.file', this.nodes.post)) && !$('.fileDeletedRes', fileEl))) { + var fileEl, fileText, info, link, ref, ref1, size, thumb, unit; + if (!(fileEl = $('.file', this.nodes.post))) { + return; + } + if (!(link = $('.fileText > a', fileEl))) { + return; + } + if (!(info = (ref = link.nextSibling) != null ? ref.textContent.match(/\(([\d.]+ [KMG]?B).*\)/) : void 0)) { return; } fileText = fileEl.firstElementChild; - link = $('a', fileText); - if (link.host !== 'i.4cdn.org') { - return; - } - info = link.nextSibling.textContent; this.file = { text: fileText, link: link, URL: link.href, name: fileText.title || link.title || link.textContent, - size: info.match(/[\d.]+\s\w+/)[0], + size: info[1], isImage: /(jpg|png|gif)$/i.test(link.href), isVideo: /webm$/i.test(link.href), - dimensions: (ref = info.match(/\d+x\d+/)) != null ? ref[0] : void 0 + dimensions: (ref1 = info[0].match(/\d+x\d+/)) != null ? ref1[0] : void 0 }; size = +this.file.size.match(/[\d.]+/)[0]; unit = ['B', 'KB', 'MB', 'GB'].indexOf(this.file.size.match(/\w+$/)[0]); @@ -13405,7 +13407,7 @@ if (!Conf['Unread Line']) { return; } - if (d.hidden || (force === true)) { + if (Unread.hr.hidden || d.hidden || (force === true)) { if (Unread.linePosition = Unread.positionPrev()) { $.after(Unread.linePosition.data.nodes.root, Unread.hr); } else { @@ -14282,17 +14284,29 @@ }); }, node: function() { - var info; + var info, nextSibling, parentNode, wrapper; if (!this.file || this.isClone) { return; } - this.file.link.hidden = true; - this.file.link.previousSibling.nodeValue = this.file.link.nextSibling.nodeValue = ''; info = $.el('span', { className: 'file-info' }); - $.after(this.file.link.nextSibling, info); - return FileInfo.format(Conf['fileInfo'], this, info); + FileInfo.format(Conf['fileInfo'], this, info); + if (Conf['Remove Original Link'] && !(this.board.ID === 'f' && Conf['Enable Native Flash Embedding'])) { + parentNode = this.file.link.parentNode; + $.rmAll(parentNode); + return $.add(parentNode, info); + } else { + this.file.link.previousSibling.nodeValue = ''; + this.file.link.hidden = true; + nextSibling = this.file.link.nextSibling; + wrapper = $.el('span', { + hidden: true + }); + $.replace(nextSibling, wrapper); + $.add(wrapper, nextSibling); + return $.after(wrapper, info); + } }, format: function(formatString, post, outputNode) { var output; diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index a3f244886..8d89a327a 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 f67268c9f..d6aec40c4 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.10.6.1 +// @version 1.10.6.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -133,6 +133,7 @@ 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'File Info Formatting': [true, 'Reformat the file information.'], + 'Remove Original Link': [false, 'Remove the original file link rather than hiding it. May cause incompatibilities with other scripts.', 1], 'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'], @@ -394,7 +395,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.6.1', + VERSION: '1.10.6.2', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1343,25 +1344,26 @@ }; Post.prototype.parseFile = function() { - var fileEl, fileText, info, link, ref, size, thumb, unit; - if (!((fileEl = $('.file', this.nodes.post)) && !$('.fileDeletedRes', fileEl))) { + var fileEl, fileText, info, link, ref, ref1, size, thumb, unit; + if (!(fileEl = $('.file', this.nodes.post))) { + return; + } + if (!(link = $('.fileText > a', fileEl))) { + return; + } + if (!(info = (ref = link.nextSibling) != null ? ref.textContent.match(/\(([\d.]+ [KMG]?B).*\)/) : void 0)) { return; } fileText = fileEl.firstElementChild; - link = $('a', fileText); - if (link.host !== 'i.4cdn.org') { - return; - } - info = link.nextSibling.textContent; this.file = { text: fileText, link: link, URL: link.href, name: fileText.title || link.title || link.textContent, - size: info.match(/[\d.]+\s\w+/)[0], + size: info[1], isImage: /(jpg|png|gif)$/i.test(link.href), isVideo: /webm$/i.test(link.href), - dimensions: (ref = info.match(/\d+x\d+/)) != null ? ref[0] : void 0 + dimensions: (ref1 = info[0].match(/\d+x\d+/)) != null ? ref1[0] : void 0 }; size = +this.file.size.match(/[\d.]+/)[0]; unit = ['B', 'KB', 'MB', 'GB'].indexOf(this.file.size.match(/\w+$/)[0]); @@ -13404,7 +13406,7 @@ if (!Conf['Unread Line']) { return; } - if (d.hidden || (force === true)) { + if (Unread.hr.hidden || d.hidden || (force === true)) { if (Unread.linePosition = Unread.positionPrev()) { $.after(Unread.linePosition.data.nodes.root, Unread.hr); } else { @@ -14281,17 +14283,29 @@ }); }, node: function() { - var info; + var info, nextSibling, parentNode, wrapper; if (!this.file || this.isClone) { return; } - this.file.link.hidden = true; - this.file.link.previousSibling.nodeValue = this.file.link.nextSibling.nodeValue = ''; info = $.el('span', { className: 'file-info' }); - $.after(this.file.link.nextSibling, info); - return FileInfo.format(Conf['fileInfo'], this, info); + FileInfo.format(Conf['fileInfo'], this, info); + if (Conf['Remove Original Link'] && !(this.board.ID === 'f' && Conf['Enable Native Flash Embedding'])) { + parentNode = this.file.link.parentNode; + $.rmAll(parentNode); + return $.add(parentNode, info); + } else { + this.file.link.previousSibling.nodeValue = ''; + this.file.link.hidden = true; + nextSibling = this.file.link.nextSibling; + wrapper = $.el('span', { + hidden: true + }); + $.replace(nextSibling, wrapper); + $.add(wrapper, nextSibling); + return $.after(wrapper, info); + } }, format: function(formatString, post, outputNode) { var output; diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 496610150..e48902821 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 4826201a1..0298418a3 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.10.6.1 +// @version 1.10.6.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 0210c422c..cc2dd892b 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.10.6.1 +// @version 1.10.6.2 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -134,6 +134,7 @@ 'Relative Date Title': [true, 'Show Relative Post Date only when hovering over dates.', 1], 'Comment Expansion': [true, 'Expand comments that are too long to display on the index. Not applicable with JSON Navigation.'], 'File Info Formatting': [true, 'Reformat the file information.'], + 'Remove Original Link': [false, 'Remove the original file link rather than hiding it. May cause incompatibilities with other scripts.', 1], 'Thread Expansion': [true, 'Add buttons to expand threads.'], 'Index Navigation': [false, 'Add buttons to navigate between threads.'], 'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'], @@ -395,7 +396,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.6.1', + VERSION: '1.10.6.2', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -1344,25 +1345,26 @@ }; Post.prototype.parseFile = function() { - var fileEl, fileText, info, link, ref, size, thumb, unit; - if (!((fileEl = $('.file', this.nodes.post)) && !$('.fileDeletedRes', fileEl))) { + var fileEl, fileText, info, link, ref, ref1, size, thumb, unit; + if (!(fileEl = $('.file', this.nodes.post))) { + return; + } + if (!(link = $('.fileText > a', fileEl))) { + return; + } + if (!(info = (ref = link.nextSibling) != null ? ref.textContent.match(/\(([\d.]+ [KMG]?B).*\)/) : void 0)) { return; } fileText = fileEl.firstElementChild; - link = $('a', fileText); - if (link.host !== 'i.4cdn.org') { - return; - } - info = link.nextSibling.textContent; this.file = { text: fileText, link: link, URL: link.href, name: fileText.title || link.title || link.textContent, - size: info.match(/[\d.]+\s\w+/)[0], + size: info[1], isImage: /(jpg|png|gif)$/i.test(link.href), isVideo: /webm$/i.test(link.href), - dimensions: (ref = info.match(/\d+x\d+/)) != null ? ref[0] : void 0 + dimensions: (ref1 = info[0].match(/\d+x\d+/)) != null ? ref1[0] : void 0 }; size = +this.file.size.match(/[\d.]+/)[0]; unit = ['B', 'KB', 'MB', 'GB'].indexOf(this.file.size.match(/\w+$/)[0]); @@ -13405,7 +13407,7 @@ if (!Conf['Unread Line']) { return; } - if (d.hidden || (force === true)) { + if (Unread.hr.hidden || d.hidden || (force === true)) { if (Unread.linePosition = Unread.positionPrev()) { $.after(Unread.linePosition.data.nodes.root, Unread.hr); } else { @@ -14282,17 +14284,29 @@ }); }, node: function() { - var info; + var info, nextSibling, parentNode, wrapper; if (!this.file || this.isClone) { return; } - this.file.link.hidden = true; - this.file.link.previousSibling.nodeValue = this.file.link.nextSibling.nodeValue = ''; info = $.el('span', { className: 'file-info' }); - $.after(this.file.link.nextSibling, info); - return FileInfo.format(Conf['fileInfo'], this, info); + FileInfo.format(Conf['fileInfo'], this, info); + if (Conf['Remove Original Link'] && !(this.board.ID === 'f' && Conf['Enable Native Flash Embedding'])) { + parentNode = this.file.link.parentNode; + $.rmAll(parentNode); + return $.add(parentNode, info); + } else { + this.file.link.previousSibling.nodeValue = ''; + this.file.link.hidden = true; + nextSibling = this.file.link.nextSibling; + wrapper = $.el('span', { + hidden: true + }); + $.replace(nextSibling, wrapper); + $.add(wrapper, nextSibling); + return $.after(wrapper, info); + } }, format: function(formatString, post, outputNode) { var output; diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 889b09c43..9c949fd81 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 d41e582f3..52a3bb267 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 6840b92ed..d1f7cc394 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index bf97dea81..3d0b1e09f 100755 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", - "version": "1.10.6.1", - "date": "2015-03-22T23:41:08.690Z", + "version": "1.10.6.2", + "date": "2015-03-23T06:43:31.843Z", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",