diff --git a/4chan_x.user.js b/4chan_x.user.js index bb8e48d38..35a910a13 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -102,7 +102,8 @@ 'Image Expansion': [true, 'Expand images'], 'Image Hover': [false, 'Show full image on mouseover'], 'Sauce': [true, 'Add sauce to images'], - 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] + 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], + 'Expand From Current': [false, 'Expand images from current position to thread end.'] }, Monitoring: { 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'], @@ -119,6 +120,7 @@ 'Cooldown': [true, 'Prevent "flood detected" errors.'], 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'], + 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'], 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'], 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'], @@ -136,15 +138,15 @@ } }, filter: { - name: '', - tripcode: '', - email: '', - subject: '', - comment: '', - filename: '', - dimensions: '', - filesize: '', - md5: '' + name: ['# Filter any namefags:', '#/^(?!Anonymous$)/'].join('\n'), + tripcode: ['# Filter any tripfags', '#/^!/'].join('\n'), + email: ['# Filter any e-mails that are not `sage` on /a/ and /jp/:', '#/^(?!sage$)/;boards:a,jp'].join('\n'), + subject: ['# Filter Generals on /v/:', '#/general/i;boards:v;op:only'].join('\n'), + comment: ['# Filter Stallman copypasta on /g/:', '#/what you\'re refer+ing to as linux/i;boards:g'].join('\n'), + filename: [''].join('\n'), + dimensions: ['# Highlight potential wallpapers:', '#/1920x1080/;op:yes;highlight;top:no;boards:w,wg'].join('\n'), + filesize: [''].join('\n'), + md5: [''].join('\n') }, sauces: ['http://iqdb.org/?url=$1', 'http://www.google.com/searchbyimage?image_url=$1', '#http://tineye.com/search?url=$1', '#http://saucenao.com/search.php?db=999&url=$1', '#http://3d.iqdb.org/?url=$1', '#http://regex.info/exif.cgi?imgurl=$2', '# uploaders:', '#http://imgur.com/upload?url=$2', '#http://omploader.org/upload?url1=$2', '# "View Same" in archives:', '#http://archive.foolz.us/a/image/$3/', '#http://archive.installgentoo.net/g/image/$3'].join('\n'), time: '%m/%d/%y(%a)%H:%M', @@ -171,7 +173,7 @@ expandThread: ['e', 'Expand thread'], watch: ['w', 'Watch thread'], hide: ['x', 'Hide thread'], - expandImages: ['m', 'Expand selected image'], + expandImage: ['m', 'Expand selected image'], expandAllImages: ['M', 'Expand all images'], update: ['u', 'Update now'], unreadCountTo0: ['z', 'Reset unread status'] @@ -537,7 +539,7 @@ filter = { filters: {}, init: function() { - var boards, filter, hl, key, op, regexp, _i, _len, _ref, _ref2, _ref3, _ref4; + var boards, filter, hl, key, op, regexp, top, _i, _len, _ref, _ref2, _ref3, _ref4, _ref5; for (key in config.filter) { this.filters[key] = []; _ref = conf[key].split('\n'); @@ -556,23 +558,34 @@ alert(e.message); continue; } - op = ((_ref3 = filter.match(/op:(yes|no|only)/)) != null ? _ref3[1].toLowerCase() : void 0) || 'no'; + op = ((_ref3 = filter.match(/[^t]op:(yes|no|only)/)) != null ? _ref3[1].toLowerCase() : void 0) || 'no'; if (hl = /highlight/.test(filter)) { hl = ((_ref4 = filter.match(/highlight:(\w+)/)) != null ? _ref4[1].toLowerCase() : void 0) || 'filter_highlight'; + top = ((_ref5 = filter.match(/top:(yes|no)/)) != null ? _ref5[1].toLowerCase() : void 0) || 'yes'; + top = top === 'yes'; } - this.filters[key].push(this.createFilter(regexp, op, hl)); + this.filters[key].push(this.createFilter(regexp, op, hl, top)); } if (!this.filters[key].length) delete this.filters[key]; } if (Object.keys(this.filters).length) return g.callbacks.push(this.node); }, - createFilter: function(regexp, op, hl) { + createFilter: function(regexp, op, hl, top) { return function(root, value, isOP) { + var firstThread, thisThread; if (isOP && op === 'no' || !isOP && op === 'only') return false; if (!regexp.test(value)) return false; if (hl) { $.addClass(root, hl); - } else if (isOP) { + if (isOP && top && !g.REPLY) { + thisThread = root.parentNode; + if (firstThread = $('div[class=op]')) { + $.before(firstThread.parentNode, [thisThread, thisThread.nextElementSibling]); + } + } + return false; + } + if (isOP) { if (!g.REPLY) threadHiding.hideHide(root.parentNode); } else { replyHiding.hideHide(root.previousSibling); @@ -622,7 +635,7 @@ }, comment: function(root) { return ($.el('a', { - innerHTML: $('blockquote', root).innerHTML.replace(/
/g, '\n') + innerHTML: root.lastChild.innerHTML.replace(/
/g, '\n') })).textContent; }, filename: function(root) { @@ -964,7 +977,7 @@ case conf.expandThread: expandThread.toggle(thread); break; - case conf.expandImages: + case conf.expandImage: keybinds.img(thread); break; case conf.nextThread: @@ -1871,7 +1884,7 @@ return qr.message.send(post); }, response: function(html) { - var b, doc, err, node, persona, postNumber, reply, thread, _, _ref; + var b, doc, err, node, open, persona, postNumber, reply, thread, _, _ref; doc = $.el('a', { innerHTML: html }); @@ -1919,6 +1932,10 @@ } else { qr.cooldown.auto = qr.replies.length > 1; qr.cooldown.set(/sage/i.test(reply.email) ? 60 : 30); + if (conf['Open Reply in New Tab'] && !g.REPLY && !qr.cooldown.auto) { + open = GM_openInTab || window.open; + open("http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "#" + postNumber, "_blank"); + } } if (conf['Persistent QR'] || qr.cooldown.auto) { reply.rm(); @@ -2103,7 +2120,7 @@ \
\
Sauce is disabled.
\ -
Lines starting with a # will be ignored.
\ + Lines starting with a # will be ignored.\