merge master

This commit is contained in:
James Campos 2012-02-20 21:38:41 -08:00
commit 84fe810c6b
3 changed files with 119 additions and 66 deletions

View File

@ -99,7 +99,6 @@
Imaging: {
'Image Auto-Gif': [false, 'Animate gif thumbnails'],
'Image Expansion': [true, 'Expand images'],
'Expand From Current': [true, 'Expand images from current position to thread end'],
'Image Hover': [false, 'Show full image on mouseover'],
'Sauce': [true, 'Add sauce to images'],
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
@ -119,6 +118,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 +136,15 @@
}
},
filter: {
name: '',
tripcode: '',
email: '',
subject: '',
comment: '',
filename: '',
dimensions: '',
filesize: '',
md5: ''
name: [''].join('\n'),
tripcode: [''].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;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',
@ -169,7 +169,7 @@
expandThread: ['e', 'Expand thread'],
watch: ['w', 'Watch thread'],
hide: ['x', 'Hide thread'],
expandImage: ['m', 'Expand selected image'],
expandImages: ['m', 'Expand selected image'],
expandAllImages: ['M', 'Expand all images'],
update: ['u', 'Update now'],
unreadCountTo0: ['z', 'Reset unread status']
@ -535,7 +535,7 @@
filter = {
filters: {},
init: function() {
var boards, filter, hl, key, op, regexp, _i, _len, _ref, _ref2, _ref3;
var boards, filter, hl, key, op, regexp, _i, _len, _ref, _ref2, _ref3, _ref4;
for (key in config.filter) {
this.filters[key] = [];
_ref = conf[key].split('\n');
@ -555,7 +555,9 @@
continue;
}
op = ((_ref3 = filter.match(/op:(yes|no|only)/)) != null ? _ref3[1].toLowerCase() : void 0) || 'no';
hl = /highlight/.test(filter);
if (hl = /highlight/.test(filter)) {
hl = ((_ref4 = filter.match(/highlight:(\w+)/)) != null ? _ref4[1].toLowerCase() : void 0) || 'filter_highlight';
}
this.filters[key].push(this.createFilter(regexp, op, hl));
}
if (!this.filters[key].length) delete this.filters[key];
@ -564,12 +566,19 @@
},
createFilter: function(regexp, op, hl) {
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, 'filter_highlight');
$.addClass(root, hl);
if (isOP && !g.REPLY) {
thisThread = root.parentNode;
if (firstThread = $('div[class=op]')) {
$.before(firstThread.parentNode, [thisThread, thisThread.nextElementSibling]);
}
}
} else if (isOP) {
threadHiding.hideHide(root.parentNode);
if (!g.REPLY) threadHiding.hideHide(root.parentNode);
} else {
replyHiding.hideHide(root.previousSibling);
}
@ -960,7 +969,7 @@
case conf.expandThread:
expandThread.toggle(thread);
break;
case conf.expandImage:
case conf.expandImages:
keybinds.img(thread);
break;
case conf.nextThread:
@ -1867,7 +1876,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
});
@ -1915,6 +1924,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();
@ -2099,7 +2112,7 @@
<input type=radio name=tab hidden id=sauces_tab>\
<div>\
<div class=warning><code>Sauce</code> is disabled.</div>\
<div>Lines starting with a <code>#</code> will be ignored.</div>\
Lines starting with a <code>#</code> will be ignored.\
<ul>These variables will be replaced by the corresponding url:\
<li>$1: Thumbnail.</li>\
<li>$2: Full image.</li>\
@ -2111,7 +2124,13 @@
<div>\
<div class=warning><code>Filter</code> is disabled.</div>\
Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br>\
Lines starting with a <code>#</code> will be ignored.<br>\
For example, <code>/weeaboo/i</code> will filter posts containing `weeaboo` case-insensitive.\
<ul>You can use these settings with each regular expression, separate them with semicolons:\
<li>Per boards, separate them with commas. It is global if not specified.<br>For example: <code>boards:a,jp;</code>.</li>\
<li>Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.</li>\
<li>Highlight instead of hiding. Highlighted OPs will have their threads put on top of board pages. You can specify a class name to use with a userstyle.<br>For example: <code>highlight;</code> or <code>hightlight:wallpaper;</code>.</li>\
</ul>\
<p>Name:<br><textarea name=name></textarea></p>\
<p>Tripcode:<br><textarea name=tripcode></textarea></p>\
<p>E-mail:<br><textarea name=email></textarea></p>\
@ -3416,25 +3435,18 @@
return imgExpand.toggle(this);
},
all: function() {
var i, thumb, thumbs, _i, _j, _len, _len2, _len3, _ref;
var thumb, _i, _j, _len, _len2, _ref, _ref2;
imgExpand.on = this.checked;
if (imgExpand.on) {
thumbs = $$('img[md5]');
if (conf['Expand From Current']) {
for (i = 0, _len = thumbs.length; i < _len; i++) {
thumb = thumbs[i];
if (thumb.getBoundingClientRect().top > 0) break;
}
thumbs = thumbs.slice(i);
}
for (_i = 0, _len2 = thumbs.length; _i < _len2; _i++) {
thumb = thumbs[_i];
_ref = $$('img[md5]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
thumb = _ref[_i];
imgExpand.expand(thumb);
}
} else {
_ref = $$('img[md5][hidden]');
for (_j = 0, _len3 = _ref.length; _j < _len3; _j++) {
thumb = _ref[_j];
_ref2 = $$('img[md5][hidden]');
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
thumb = _ref2[_j];
imgExpand.contract(thumb);
}
}
@ -3584,6 +3596,10 @@
return;
}
$.ready(options.init);
if (conf['Quick Reply'] && conf['Hide Original Post Form']) {
Main.css += 'form[name=post] { display: none; }';
}
Main.addStyle();
now = Date.now();
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
$.ready(function() {
@ -3627,10 +3643,6 @@
quoteIndicators.init();
}
if (conf['Fix XXX\'d Post Numbers']) unxify.init();
if (conf['Quick Reply'] && conf['Hide Original Post Form']) {
Main.css += 'form[name=post] { display: none; }';
}
Main.addStyle();
return $.ready(Main.ready);
},
ready: function() {

View File

@ -1,9 +1,16 @@
master
- aeosynth / ahodesuka
expand images from current position
- ahodesuka
Add Open Reply in New Tab option for replies made from the main board (not dumping).
- Mayhem
The Filter now has per filter settings:
- Filter the OP only along its thread, replies only, or both.
- Per boards, or global.
- Highlight, or hide. Highlighted OPs will have their threads put on top of the board page.
New filter group: Image dimensions.
Fix posting on Safari.
Fix rare case where the QR would not accept images.
Fix rare case where the QR would not accept certain image types.
2.26.4
- Mayhem
@ -98,7 +105,7 @@ master
see https://github.com/MayhemYDG/4chan-x/issues/136
2.24.4
- ahokadesuka
- ahodesuka
Scroll back up when unexpanding images.
- e000
Prevent absurd cooldown durations.

View File

@ -21,7 +21,6 @@ config =
Imaging:
'Image Auto-Gif': [false, 'Animate gif thumbnails']
'Image Expansion': [true, 'Expand images']
'Expand From Current': [true, 'Expand images from current position to thread end']
'Image Hover': [false, 'Show full image on mouseover']
'Sauce': [true, 'Add sauce to images']
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
@ -39,6 +38,7 @@ config =
'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.']
@ -53,15 +53,37 @@ config =
'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes']
'Forward Hiding': [true, 'Hide original posts of inlined backlinks']
filter:
name: ''
tripcode: ''
email: ''
subject: ''
comment: ''
filename: ''
dimensions: ''
filesize: ''
md5: ''
name: [
''
].join '\n'
tripcode: [
''
].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;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'
@ -98,7 +120,7 @@ config =
expandThread: ['e', 'Expand thread']
watch: ['w', 'Watch thread']
hide: ['x', 'Hide thread']
expandImage: ['m', 'Expand selected image']
expandImages: ['m', 'Expand selected image']
expandAllImages: ['M', 'Expand all images']
update: ['u', 'Update now']
unreadCountTo0: ['z', 'Reset unread status']
@ -442,8 +464,10 @@ filter =
op = filter.match(/op:(yes|no|only)/)?[1].toLowerCase() or 'no'
# Highlight the post, or hide it.
# If not specified, the highlight class will be filter_highlight.
# Defaults to post hiding.
hl = /highlight/.test filter
if hl = /highlight/.test filter
hl = filter.match(/highlight:(\w+)/)?[1].toLowerCase() or 'filter_highlight'
@filters[key].push @createFilter regexp, op, hl
@ -461,9 +485,16 @@ filter =
unless regexp.test value
return false
if hl
$.addClass root, 'filter_highlight'
$.addClass root, hl
if isOP and not g.REPLY
# Put the highlighted OPs' threads on top of the board pages...
thisThread = root.parentNode
# ...before the first non highlighted thread.
if firstThread = $ 'div[class=op]'
$.before firstThread.parentNode, [thisThread, thisThread.nextElementSibling]
else if isOP
threadHiding.hideHide root.parentNode
unless g.REPLY
threadHiding.hideHide root.parentNode
else
replyHiding.hideHide root.previousSibling
true
@ -758,7 +789,7 @@ keybinds =
keybinds.open thread
when conf.expandThread
expandThread.toggle thread
when conf.expandImage
when conf.expandImages
keybinds.img thread
when conf.nextThread
return if g.REPLY
@ -1518,6 +1549,9 @@ qr =
# Enable auto-posting if we have stuff to post, disable it otherwise.
qr.cooldown.auto = qr.replies.length > 1
qr.cooldown.set if /sage/i.test reply.email then 60 else 30
if conf['Open Reply in New Tab'] && !g.REPLY && !qr.cooldown.auto
open = GM_openInTab or window.open
open "http://boards.4chan.org/#{g.BOARD}/res/#{thread}##{postNumber}", "_blank"
if conf['Persistent QR'] or qr.cooldown.auto
reply.rm()
@ -1670,7 +1704,7 @@ options =
<input type=radio name=tab hidden id=sauces_tab>
<div>
<div class=warning><code>Sauce</code> is disabled.</div>
<div>Lines starting with a <code>#</code> will be ignored.</div>
Lines starting with a <code>#</code> will be ignored.
<ul>These variables will be replaced by the corresponding url:
<li>$1: Thumbnail.</li>
<li>$2: Full image.</li>
@ -1682,7 +1716,13 @@ options =
<div>
<div class=warning><code>Filter</code> is disabled.</div>
Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br>
Lines starting with a <code>#</code> will be ignored.<br>
For example, <code>/weeaboo/i</code> will filter posts containing `weeaboo` case-insensitive.
<ul>You can use these settings with each regular expression, separate them with semicolons:
<li>Per boards, separate them with commas. It is global if not specified.<br>For example: <code>boards:a,jp;</code>.</li>
<li>Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.</li>
<li>Highlight instead of hiding. Highlighted OPs will have their threads put on top of board pages. You can specify a class name to use with a userstyle.<br>For example: <code>highlight;</code> or <code>hightlight:wallpaper;</code>.</li>
</ul>
<p>Name:<br><textarea name=name></textarea></p>
<p>Tripcode:<br><textarea name=tripcode></textarea></p>
<p>E-mail:<br><textarea name=email></textarea></p>
@ -2727,13 +2767,7 @@ imgExpand =
all: ->
imgExpand.on = @checked
if imgExpand.on #expand
thumbs = $$ 'img[md5]'
if conf['Expand From Current']
for thumb, i in thumbs
if thumb.getBoundingClientRect().top > 0
break
thumbs = thumbs[i...]
for thumb in thumbs
for thumb in $$ 'img[md5]'
imgExpand.expand thumb
else #contract
for thumb in $$ 'img[md5][hidden]'
@ -2855,6 +2889,11 @@ Main =
$.ready options.init
if conf['Quick Reply'] and conf['Hide Original Post Form']
Main.css += 'form[name=post] { display: none; }'
Main.addStyle()
now = Date.now()
if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR
$.ready -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
@ -2925,11 +2964,6 @@ Main =
if conf['Fix XXX\'d Post Numbers']
unxify.init()
if conf['Quick Reply'] and conf['Hide Original Post Form']
Main.css += 'form[name=post] { display: none; }'
Main.addStyle()
$.ready Main.ready
ready: ->