diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d4d8d6c6..d68c152bf 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ 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.10.12 + +**v1.10.12.0** *(2015-05-04)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.12.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.12.0/builds/4chan-X-noupdate.crx "Chromium version")] +- Based on v1.10.11.12. +- Fix files dropped on captcha causing navigation to the file. +- Fix size of report window when Javascript is disabled. +- QR character count now handles surrogate pairs correctly and turns red when the limit of 2000 is reached. +- Add `;sandbox` option to sauce links to open links without scripts or popups. Re-add swfchan. + ### v1.10.11 **v1.10.11.12** *(2015-05-03)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.11.12/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.11.12/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 5b425e20b..bd85a6eef 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 410c79df6..54adf97df 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.11.12 +// @version 1.10.12.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 1d43f3943..f4b035c13 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.11.12 +// @version 1.10.12.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -292,7 +292,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -396,7 +396,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.11.12', + VERSION: '1.10.12.0', NAMESPACE: '4chan X.', boards: {} }; @@ -430,6 +430,10 @@ return html; }; + E.url = function(content) { + return "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + }; + $ = function(selector, root) { if (root == null) { root = d.body; @@ -6710,7 +6714,6 @@ if (g.VIEW === 'archive') { return; } - $.globalEval('document.documentElement.classList.add("js-enabled");'); noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'); this.captcha = Captcha[noscript ? 'noscript' : 'v2']; $.on(d, '4chanXInitFinished', this.initReady); @@ -6783,6 +6786,8 @@ $.on(d, 'dragover', QR.dragOver); $.on(d, 'drop', QR.dropFile); $.on(d, 'dragstart dragend', QR.drag); + $.on(d, 'dragenter', QR.dragEnter); + $.on(d, 'dragleave', QR.dragLeave); $.on(d, 'IndexRefresh', QR.generatePostableThreadsList); $.on(d, 'ThreadUpdate', QR.statusCheck); if (!Conf['Persistent QR']) { @@ -7063,10 +7068,10 @@ characterCount: function() { var count, counter; counter = QR.nodes.charCount; - count = QR.nodes.com.textLength; + count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; counter.textContent = count; counter.hidden = count < 1000; - return (count > 1500 ? $.addClass : $.rmClass)(counter, 'warning'); + return (count > 2000 ? $.addClass : $.rmClass)(counter, 'warning'); }, getFile: function() { var ref; @@ -7092,6 +7097,8 @@ return e.dataTransfer.dropEffect = 'copy'; }, dropFile: function(e) { + delete QR.dragTarget; + $.rmClass(doc, 'dragging'); if (!e.dataTransfer.files.length) { return; } @@ -7099,6 +7106,16 @@ QR.open(); return QR.handleFiles(e.dataTransfer.files); }, + dragEnter: function(e) { + QR.dragTarget = e.target; + return $.addClass(doc, 'dragging'); + }, + dragLeave: function(e) { + if (QR.dragTarget === e.target) { + delete QR.dragTarget; + return $.rmClass(doc, 'dragging'); + } + }, paste: function(e) { var blob, files, item, k, len1, ref; if (!e.clipboardData.items) { @@ -10590,19 +10607,24 @@ cb: this.node }); }, + sandbox: function(url) { + return E.url({ + innerHTML: "[sb] " + E(url) + "" + }); + }, createSauceLink: function(link, post) { - var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip; + var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip, url; if (!(link = link.trim())) { return null; } parts = {}; - ref = link.split(/;(?=(?:text|boards|types):)/); + ref = link.split(/;(?=(?:text|boards|types|sandbox):?)/); for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { part = ref[i]; if (i === 0) { parts['url'] = part; } else { - m = part.match(/^(\w*):(.*)$/); + m = part.match(/^(\w*):?(.*)$/); parts[m[1]] = m[2]; } } @@ -10644,8 +10666,12 @@ if (!(!parts['types'] || indexOf.call(parts['types'].split(','), ext) >= 0)) { return null; } + url = parts['url']; + if (parts['sandbox'] != null) { + url = Sauce.sandbox(url); + } a = Sauce.link.cloneNode(true); - a.href = parts['url']; + a.href = url; a.textContent = parts['text']; if (/^javascript:/i.test(parts['url'])) { a.removeAttribute('target'); @@ -11082,7 +11108,7 @@ content = { innerHTML: "" + E(a.dataset.uid) + "" }; - el.src = "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + el.src = E.url(content); return el; }, title: { @@ -15383,6 +15409,7 @@ }; Report = { + css: ':root:not(.js-enabled) #g-recaptcha {\n height: auto;\n}', init: function() { var match; if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { @@ -15392,21 +15419,28 @@ return $.ready(this.ready); }, ready: function() { - new MutationObserver(Report.resize).observe(d.body, { - childList: true, - attributes: true, - subtree: true - }); + $.addStyle(Report.css); if (Conf['Archive Report']) { - return Report.archive(); + Report.archive(); + } + if ($.hasClass(doc, 'js-enabled')) { + return new MutationObserver(function() { + return Report.fit('.gc-bubbleDefault'); + }).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + } else { + return Report.fit('body'); } }, - resize: function() { - var bubble, dy; - if (!(bubble = $('.gc-bubbleDefault'))) { + fit: function(selector) { + var dy, el; + if (!(el = $(selector, doc))) { return; } - dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8; if (dy > 0) { return window.resizeBy(0, dy); } @@ -15944,7 +15978,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); @@ -16316,7 +16350,10 @@ }); }, initFeatures: function() { - var err, feature, k, len1, name, pathname, ref, ref1; + var err, feature, k, len1, name, pathname, ref, ref1, ref2; + if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org') { + $.globalEval('document.documentElement.classList.add("js-enabled");'); + } switch (location.hostname) { case 'a.4cdn.org': return; @@ -16330,8 +16367,8 @@ $.asap((function() { return d.readyState !== 'loading'; }), function() { - var URL, pathname, ref, video; - if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { + var URL, pathname, ref1, video; + if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { Redirect.init(); pathname = location.pathname.split('/'); URL = Redirect.to('file', { @@ -16360,9 +16397,9 @@ history.replaceState(null, '', pathname.slice(0, 4).join('/') + location.hash); } } - ref = Main.features; - for (k = 0, len1 = ref.length; k < len1; k++) { - ref1 = ref[k], name = ref1[0], feature = ref1[1]; + ref1 = Main.features; + for (k = 0, len1 = ref1.length; k < len1; k++) { + ref2 = ref1[k], name = ref2[0], feature = ref2[1]; try { feature.init(); } catch (_error) { @@ -18351,13 +18388,6 @@ " float: right;\n" + " padding: 0 3px;\n" + "}\n" + -"#qr .warning {\n" + -" min-height: 1.6em;\n" + -" vertical-align: middle;\n" + -" padding: 0 1px;\n" + -" border-width: 1px;\n" + -" border-style: solid;\n" + -"}\n" + ".qr-link-container {\n" + " text-align: center;\n" + "}\n" + @@ -18467,6 +18497,10 @@ ".goog-bubble-content iframe {\n" + " position: static !important;\n" + "}\n" + +"/* Prevent dragging files into captcha */\n" + +":root.dragging iframe {\n" + +" pointer-events: none;\n" + +"}\n" + "/* File Input, Submit Button */\n" + "#file-n-submit {\n" + " display: -webkit-flex;\n" + @@ -18671,6 +18705,9 @@ " right: 1px;\n" + " pointer-events: none;\n" + "}\n" + +"#char-count.warning {\n" + +" color: red;\n" + +"}\n" + "/* Menu */\n" + ".menu-button:not(.fa-bars) {\n" + " display: inline-block;\n" + diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 8e173c173..bca42921d 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 8c379153e..e1f6e86dd 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.11.12 +// @version 1.10.12.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -291,7 +291,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -395,7 +395,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.11.12', + VERSION: '1.10.12.0', NAMESPACE: '4chan X.', boards: {} }; @@ -429,6 +429,10 @@ return html; }; + E.url = function(content) { + return "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + }; + $ = function(selector, root) { if (root == null) { root = d.body; @@ -6709,7 +6713,6 @@ if (g.VIEW === 'archive') { return; } - $.globalEval('document.documentElement.classList.add("js-enabled");'); noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'); this.captcha = Captcha[noscript ? 'noscript' : 'v2']; $.on(d, '4chanXInitFinished', this.initReady); @@ -6782,6 +6785,8 @@ $.on(d, 'dragover', QR.dragOver); $.on(d, 'drop', QR.dropFile); $.on(d, 'dragstart dragend', QR.drag); + $.on(d, 'dragenter', QR.dragEnter); + $.on(d, 'dragleave', QR.dragLeave); $.on(d, 'IndexRefresh', QR.generatePostableThreadsList); $.on(d, 'ThreadUpdate', QR.statusCheck); if (!Conf['Persistent QR']) { @@ -7062,10 +7067,10 @@ characterCount: function() { var count, counter; counter = QR.nodes.charCount; - count = QR.nodes.com.textLength; + count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; counter.textContent = count; counter.hidden = count < 1000; - return (count > 1500 ? $.addClass : $.rmClass)(counter, 'warning'); + return (count > 2000 ? $.addClass : $.rmClass)(counter, 'warning'); }, getFile: function() { var ref; @@ -7091,6 +7096,8 @@ return e.dataTransfer.dropEffect = 'copy'; }, dropFile: function(e) { + delete QR.dragTarget; + $.rmClass(doc, 'dragging'); if (!e.dataTransfer.files.length) { return; } @@ -7098,6 +7105,16 @@ QR.open(); return QR.handleFiles(e.dataTransfer.files); }, + dragEnter: function(e) { + QR.dragTarget = e.target; + return $.addClass(doc, 'dragging'); + }, + dragLeave: function(e) { + if (QR.dragTarget === e.target) { + delete QR.dragTarget; + return $.rmClass(doc, 'dragging'); + } + }, paste: function(e) { var blob, files, item, k, len1, ref; if (!e.clipboardData.items) { @@ -10589,19 +10606,24 @@ cb: this.node }); }, + sandbox: function(url) { + return E.url({ + innerHTML: "[sb] " + E(url) + "" + }); + }, createSauceLink: function(link, post) { - var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip; + var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip, url; if (!(link = link.trim())) { return null; } parts = {}; - ref = link.split(/;(?=(?:text|boards|types):)/); + ref = link.split(/;(?=(?:text|boards|types|sandbox):?)/); for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { part = ref[i]; if (i === 0) { parts['url'] = part; } else { - m = part.match(/^(\w*):(.*)$/); + m = part.match(/^(\w*):?(.*)$/); parts[m[1]] = m[2]; } } @@ -10643,8 +10665,12 @@ if (!(!parts['types'] || indexOf.call(parts['types'].split(','), ext) >= 0)) { return null; } + url = parts['url']; + if (parts['sandbox'] != null) { + url = Sauce.sandbox(url); + } a = Sauce.link.cloneNode(true); - a.href = parts['url']; + a.href = url; a.textContent = parts['text']; if (/^javascript:/i.test(parts['url'])) { a.removeAttribute('target'); @@ -11081,7 +11107,7 @@ content = { innerHTML: "" + E(a.dataset.uid) + "" }; - el.src = "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + el.src = E.url(content); return el; }, title: { @@ -15382,6 +15408,7 @@ }; Report = { + css: ':root:not(.js-enabled) #g-recaptcha {\n height: auto;\n}', init: function() { var match; if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { @@ -15391,21 +15418,28 @@ return $.ready(this.ready); }, ready: function() { - new MutationObserver(Report.resize).observe(d.body, { - childList: true, - attributes: true, - subtree: true - }); + $.addStyle(Report.css); if (Conf['Archive Report']) { - return Report.archive(); + Report.archive(); + } + if ($.hasClass(doc, 'js-enabled')) { + return new MutationObserver(function() { + return Report.fit('.gc-bubbleDefault'); + }).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + } else { + return Report.fit('body'); } }, - resize: function() { - var bubble, dy; - if (!(bubble = $('.gc-bubbleDefault'))) { + fit: function(selector) { + var dy, el; + if (!(el = $(selector, doc))) { return; } - dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8; if (dy > 0) { return window.resizeBy(0, dy); } @@ -15943,7 +15977,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); @@ -16315,7 +16349,10 @@ }); }, initFeatures: function() { - var err, feature, k, len1, name, pathname, ref, ref1; + var err, feature, k, len1, name, pathname, ref, ref1, ref2; + if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org') { + $.globalEval('document.documentElement.classList.add("js-enabled");'); + } switch (location.hostname) { case 'a.4cdn.org': return; @@ -16329,8 +16366,8 @@ $.asap((function() { return d.readyState !== 'loading'; }), function() { - var URL, pathname, ref, video; - if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { + var URL, pathname, ref1, video; + if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { Redirect.init(); pathname = location.pathname.split('/'); URL = Redirect.to('file', { @@ -16359,9 +16396,9 @@ history.replaceState(null, '', pathname.slice(0, 4).join('/') + location.hash); } } - ref = Main.features; - for (k = 0, len1 = ref.length; k < len1; k++) { - ref1 = ref[k], name = ref1[0], feature = ref1[1]; + ref1 = Main.features; + for (k = 0, len1 = ref1.length; k < len1; k++) { + ref2 = ref1[k], name = ref2[0], feature = ref2[1]; try { feature.init(); } catch (_error) { @@ -18350,13 +18387,6 @@ " float: right;\n" + " padding: 0 3px;\n" + "}\n" + -"#qr .warning {\n" + -" min-height: 1.6em;\n" + -" vertical-align: middle;\n" + -" padding: 0 1px;\n" + -" border-width: 1px;\n" + -" border-style: solid;\n" + -"}\n" + ".qr-link-container {\n" + " text-align: center;\n" + "}\n" + @@ -18466,6 +18496,10 @@ ".goog-bubble-content iframe {\n" + " position: static !important;\n" + "}\n" + +"/* Prevent dragging files into captcha */\n" + +":root.dragging iframe {\n" + +" pointer-events: none;\n" + +"}\n" + "/* File Input, Submit Button */\n" + "#file-n-submit {\n" + " display: -webkit-flex;\n" + @@ -18670,6 +18704,9 @@ " right: 1px;\n" + " pointer-events: none;\n" + "}\n" + +"#char-count.warning {\n" + +" color: red;\n" + +"}\n" + "/* Menu */\n" + ".menu-button:not(.fa-bars) {\n" + " display: inline-block;\n" + diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 21922fbee..772b1be6b 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 0c7e4e380..10b8b54e7 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.10.11.12 +// @version 1.10.12.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index d3a62db69..676bd884e 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.11.12 +// @version 1.10.12.0 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -292,7 +292,7 @@ filesize: '', MD5: '' }, - sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", + sauces: "https://www.google.com/searchbyimage?image_url=%IMG\nhttp://iqdb.org/?url=%IMG\nhttp://eye.swfchan.com/search/?q=%name;types:swf;sandbox\n#//tineye.com/search?url=%IMG\n#https://www.yandex.com/images/search?rpt=imageview&img_url=%IMG\n#//saucenao.com/search.php?url=%IMG\n#http://3d.iqdb.org/?url=%IMG\n#http://regex.info/exif.cgi?imgurl=%URL\n# uploaders:\n#//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur\n# \"View Same\" in archives:\n#https://archive.moe/_/search/image/%MD5/;text:View same on archive.moe\n#https://archive.moe/%board/search/image/%MD5/;text:View same on archive.moe/%board/;boards:a,biz,c,co,diy,fit,gd,h,i,jp,k,m,mlp,po,qa,r9k,s4s,sci,tg,u,v,vg,vp,vr,wsg\n#https://rbt.asia/%board/image/%MD5;text:View same on RBT /%board/;boards:cgl,g,mu,qa,w", FappeT: { werk: false }, @@ -396,7 +396,7 @@ doc = d.documentElement; g = { - VERSION: '1.10.11.12', + VERSION: '1.10.12.0', NAMESPACE: '4chan X.', boards: {} }; @@ -430,6 +430,10 @@ return html; }; + E.url = function(content) { + return "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + }; + $ = function(selector, root) { if (root == null) { root = d.body; @@ -6710,7 +6714,6 @@ if (g.VIEW === 'archive') { return; } - $.globalEval('document.documentElement.classList.add("js-enabled");'); noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'); this.captcha = Captcha[noscript ? 'noscript' : 'v2']; $.on(d, '4chanXInitFinished', this.initReady); @@ -6783,6 +6786,8 @@ $.on(d, 'dragover', QR.dragOver); $.on(d, 'drop', QR.dropFile); $.on(d, 'dragstart dragend', QR.drag); + $.on(d, 'dragenter', QR.dragEnter); + $.on(d, 'dragleave', QR.dragLeave); $.on(d, 'IndexRefresh', QR.generatePostableThreadsList); $.on(d, 'ThreadUpdate', QR.statusCheck); if (!Conf['Persistent QR']) { @@ -7063,10 +7068,10 @@ characterCount: function() { var count, counter; counter = QR.nodes.charCount; - count = QR.nodes.com.textLength; + count = QR.nodes.com.value.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; counter.textContent = count; counter.hidden = count < 1000; - return (count > 1500 ? $.addClass : $.rmClass)(counter, 'warning'); + return (count > 2000 ? $.addClass : $.rmClass)(counter, 'warning'); }, getFile: function() { var ref; @@ -7092,6 +7097,8 @@ return e.dataTransfer.dropEffect = 'copy'; }, dropFile: function(e) { + delete QR.dragTarget; + $.rmClass(doc, 'dragging'); if (!e.dataTransfer.files.length) { return; } @@ -7099,6 +7106,16 @@ QR.open(); return QR.handleFiles(e.dataTransfer.files); }, + dragEnter: function(e) { + QR.dragTarget = e.target; + return $.addClass(doc, 'dragging'); + }, + dragLeave: function(e) { + if (QR.dragTarget === e.target) { + delete QR.dragTarget; + return $.rmClass(doc, 'dragging'); + } + }, paste: function(e) { var blob, files, item, k, len1, ref; if (!e.clipboardData.items) { @@ -10590,19 +10607,24 @@ cb: this.node }); }, + sandbox: function(url) { + return E.url({ + innerHTML: "[sb] " + E(url) + "" + }); + }, createSauceLink: function(link, post) { - var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip; + var a, ext, i, k, key, len1, m, part, parts, ref, ref1, ref2, skip, url; if (!(link = link.trim())) { return null; } parts = {}; - ref = link.split(/;(?=(?:text|boards|types):)/); + ref = link.split(/;(?=(?:text|boards|types|sandbox):?)/); for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { part = ref[i]; if (i === 0) { parts['url'] = part; } else { - m = part.match(/^(\w*):(.*)$/); + m = part.match(/^(\w*):?(.*)$/); parts[m[1]] = m[2]; } } @@ -10644,8 +10666,12 @@ if (!(!parts['types'] || indexOf.call(parts['types'].split(','), ext) >= 0)) { return null; } + url = parts['url']; + if (parts['sandbox'] != null) { + url = Sauce.sandbox(url); + } a = Sauce.link.cloneNode(true); - a.href = parts['url']; + a.href = url; a.textContent = parts['text']; if (/^javascript:/i.test(parts['url'])) { a.removeAttribute('target'); @@ -11082,7 +11108,7 @@ content = { innerHTML: "" + E(a.dataset.uid) + "" }; - el.src = "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); + el.src = E.url(content); return el; }, title: { @@ -15383,6 +15409,7 @@ }; Report = { + css: ':root:not(.js-enabled) #g-recaptcha {\n height: auto;\n}', init: function() { var match; if (!(/\bmode=report\b/.test(location.search) && (match = location.search.match(/\bno=(\d+)/)))) { @@ -15392,21 +15419,28 @@ return $.ready(this.ready); }, ready: function() { - new MutationObserver(Report.resize).observe(d.body, { - childList: true, - attributes: true, - subtree: true - }); + $.addStyle(Report.css); if (Conf['Archive Report']) { - return Report.archive(); + Report.archive(); + } + if ($.hasClass(doc, 'js-enabled')) { + return new MutationObserver(function() { + return Report.fit('.gc-bubbleDefault'); + }).observe(d.body, { + childList: true, + attributes: true, + subtree: true + }); + } else { + return Report.fit('body'); } }, - resize: function() { - var bubble, dy; - if (!(bubble = $('.gc-bubbleDefault'))) { + fit: function(selector) { + var dy, el; + if (!(el = $(selector, doc))) { return; } - dy = bubble.getBoundingClientRect().bottom - doc.clientHeight; + dy = el.getBoundingClientRect().bottom - doc.clientHeight + 8; if (dy > 0) { return window.resizeBy(0, dy); } @@ -15944,7 +15978,7 @@ sauce: function(section) { var ta; $.extend(section, { - innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
" + innerHTML: "
Sauce is disabled.
Lines starting with a # will be ignored.
You can specify a display text by appending ;text:[text] to the URL.
You can specify the applicable boards by appending ;boards:[board1],[board2].
You can specify the applicable file types by appending ;types:[extension1],[extension2].
You can open links with scripts and popups disabled by appending ;sandbox.
" }); $('.warning', section).hidden = Conf['Sauce']; ta = $('textarea', section); @@ -16316,7 +16350,10 @@ }); }, initFeatures: function() { - var err, feature, k, len1, name, pathname, ref, ref1; + var err, feature, k, len1, name, pathname, ref, ref1, ref2; + if ((ref = location.hostname) === 'boards.4chan.org' || ref === 'sys.4chan.org') { + $.globalEval('document.documentElement.classList.add("js-enabled");'); + } switch (location.hostname) { case 'a.4cdn.org': return; @@ -16330,8 +16367,8 @@ $.asap((function() { return d.readyState !== 'loading'; }), function() { - var URL, pathname, ref, video; - if (Conf['404 Redirect'] && ((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found')) { + var URL, pathname, ref1, video; + if (Conf['404 Redirect'] && ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found')) { Redirect.init(); pathname = location.pathname.split('/'); URL = Redirect.to('file', { @@ -16360,9 +16397,9 @@ history.replaceState(null, '', pathname.slice(0, 4).join('/') + location.hash); } } - ref = Main.features; - for (k = 0, len1 = ref.length; k < len1; k++) { - ref1 = ref[k], name = ref1[0], feature = ref1[1]; + ref1 = Main.features; + for (k = 0, len1 = ref1.length; k < len1; k++) { + ref2 = ref1[k], name = ref2[0], feature = ref2[1]; try { feature.init(); } catch (_error) { @@ -18351,13 +18388,6 @@ " float: right;\n" + " padding: 0 3px;\n" + "}\n" + -"#qr .warning {\n" + -" min-height: 1.6em;\n" + -" vertical-align: middle;\n" + -" padding: 0 1px;\n" + -" border-width: 1px;\n" + -" border-style: solid;\n" + -"}\n" + ".qr-link-container {\n" + " text-align: center;\n" + "}\n" + @@ -18467,6 +18497,10 @@ ".goog-bubble-content iframe {\n" + " position: static !important;\n" + "}\n" + +"/* Prevent dragging files into captcha */\n" + +":root.dragging iframe {\n" + +" pointer-events: none;\n" + +"}\n" + "/* File Input, Submit Button */\n" + "#file-n-submit {\n" + " display: -webkit-flex;\n" + @@ -18671,6 +18705,9 @@ " right: 1px;\n" + " pointer-events: none;\n" + "}\n" + +"#char-count.warning {\n" + +" color: red;\n" + +"}\n" + "/* Menu */\n" + ".menu-button:not(.fa-bars) {\n" + " display: inline-block;\n" + diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 0ddd42b31..1a70080a8 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 fd2c4d035..2d2c9f410 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 b01f13bfe..3702a9382 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index cf705b475..6773d6b53 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.11.12", - "date": "2015-05-03T22:48:31.015Z", + "version": "1.10.12.0", + "date": "2015-05-05T03:30:07.989Z", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/",