Merge branch 'master' of git://github.com/MayhemYDG/4chan-x into filesize

This commit is contained in:
ahodesuka 2012-02-21 19:15:38 -06:00
commit abea2d7c83
5 changed files with 36 additions and 15 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan x // @name 4chan x
// @version 2.27.0 // @version 2.27.1
// @namespace aeosynth // @namespace aeosynth
// @description Adds various features. // @description Adds various features.
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
@ -20,7 +20,7 @@
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com> * Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com> * Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
* http://mayhemydg.github.com/4chan-x/ * http://mayhemydg.github.com/4chan-x/
* 4chan X 2.27.0 * 4chan X 2.27.1
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@ -209,7 +209,7 @@
NAMESPACE = '4chan_x.'; NAMESPACE = '4chan_x.';
VERSION = '2.27.0'; VERSION = '2.27.1';
SECOND = 1000; SECOND = 1000;
@ -553,7 +553,11 @@
continue; continue;
} }
try { try {
regexp = RegExp(regexp[1], regexp[2]); if (key === 'md5') {
regexp = regexp[1];
} else {
regexp = RegExp(regexp[1], regexp[2]);
}
} catch (e) { } catch (e) {
alert(e.message); alert(e.message);
continue; continue;
@ -574,7 +578,11 @@
return function(root, value, isOP) { return function(root, value, isOP) {
var firstThread, thisThread; var firstThread, thisThread;
if (isOP && op === 'no' || !isOP && op === 'only') return false; if (isOP && op === 'no' || !isOP && op === 'only') return false;
if (!regexp.test(value)) return false; if (typeof regexp === 'string') {
if (regexp !== value) return false;
} else if (!regexp.test(value)) {
return false;
}
if (hl) { if (hl) {
$.addClass(root, hl); $.addClass(root, hl);
if (isOP && top && !g.REPLY) { if (isOP && top && !g.REPLY) {
@ -588,7 +596,7 @@
if (isOP) { if (isOP) {
if (!g.REPLY) threadHiding.hideHide(root.parentNode); if (!g.REPLY) threadHiding.hideHide(root.parentNode);
} else { } else {
replyHiding.hideHide(root.previousSibling); replyHiding.hideHide(root);
} }
return true; return true;
}; };
@ -2159,7 +2167,7 @@
<p>Filename:<br><textarea name=filename></textarea></p>\ <p>Filename:<br><textarea name=filename></textarea></p>\
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>\ <p>Image dimensions:<br><textarea name=dimensions></textarea></p>\
<p>Filesize:<br><textarea name=filesize></textarea></p>\ <p>Filesize:<br><textarea name=filesize></textarea></p>\
<p>Image MD5:<br><textarea name=md5></textarea></p>\ <p>Image MD5 (uses exact string matching, not regular expressions):<br><textarea name=md5></textarea></p>\
</div>\ </div>\
<input type=radio name=tab hidden id=rice_tab>\ <input type=radio name=tab hidden id=rice_tab>\
<div>\ <div>\

View File

@ -2,7 +2,7 @@
{exec} = require 'child_process' {exec} = require 'child_process'
fs = require 'fs' fs = require 'fs'
VERSION = '2.27.0' VERSION = '2.27.1'
HEADER = """ HEADER = """
// ==UserScript== // ==UserScript==

View File

@ -1,5 +1,10 @@
master master
2.27.1
- Mayhem
Fix stubs with the new filter.
The MD5 will now check for exact string matching, it will not use regular expressions.
2.27.0 2.27.0
- aeosynth / ahodesuka - aeosynth / ahodesuka
new option: expand images from current position new option: expand images from current position

View File

@ -1 +1 @@
postMessage({version:'2.27.0'},'*'); postMessage({version:'2.27.1'},'*');

View File

@ -156,7 +156,7 @@ conf = {}
) null, config ) null, config
NAMESPACE = '4chan_x.' NAMESPACE = '4chan_x.'
VERSION = '2.27.0' VERSION = '2.27.1'
SECOND = 1000 SECOND = 1000
MINUTE = 60*SECOND MINUTE = 60*SECOND
HOUR = 60*MINUTE HOUR = 60*MINUTE
@ -458,8 +458,12 @@ filter =
continue continue
try try
# Please, don't write silly regular expressions. if key is 'md5'
regexp = RegExp regexp[1], regexp[2] # MD5 filter will use strings instead of regular expressions.
regexp = regexp[1]
else
# Please, don't write silly regular expressions.
regexp = RegExp regexp[1], regexp[2]
catch e catch e
# I warned you, bro. # I warned you, bro.
alert e.message alert e.message
@ -492,7 +496,11 @@ filter =
(root, value, isOP) -> (root, value, isOP) ->
if isOP and op is 'no' or !isOP and op is 'only' if isOP and op is 'no' or !isOP and op is 'only'
return false return false
unless regexp.test value if typeof regexp is 'string'
# MD5 checking
if regexp isnt value
return false
else unless regexp.test value
return false return false
if hl if hl
$.addClass root, hl $.addClass root, hl
@ -508,7 +516,7 @@ filter =
unless g.REPLY unless g.REPLY
threadHiding.hideHide root.parentNode threadHiding.hideHide root.parentNode
else else
replyHiding.hideHide root.previousSibling replyHiding.hideHide root
true true
node: (root) -> node: (root) ->
@ -1754,7 +1762,7 @@ options =
<p>Filename:<br><textarea name=filename></textarea></p> <p>Filename:<br><textarea name=filename></textarea></p>
<p>Image dimensions:<br><textarea name=dimensions></textarea></p> <p>Image dimensions:<br><textarea name=dimensions></textarea></p>
<p>Filesize:<br><textarea name=filesize></textarea></p> <p>Filesize:<br><textarea name=filesize></textarea></p>
<p>Image MD5:<br><textarea name=md5></textarea></p> <p>Image MD5 (uses exact string matching, not regular expressions):<br><textarea name=md5></textarea></p>
</div> </div>
<input type=radio name=tab hidden id=rice_tab> <input type=radio name=tab hidden id=rice_tab>
<div> <div>