Merge branch 'master' into dev

This commit is contained in:
James Campos 2011-05-04 00:04:29 -07:00
commit 6358f40635
4 changed files with 70 additions and 28 deletions

View File

@ -2,7 +2,7 @@
// @name 4chan x // @name 4chan x
// @namespace aeosynth // @namespace aeosynth
// @description Adds various features. // @description Adds various features.
// @version 2.2.0 // @version 2.2.2
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @include http://boards.4chan.org/* // @include http://boards.4chan.org/*
@ -73,6 +73,7 @@
'Anonymize': [false, 'Make everybody anonymous'], 'Anonymize': [false, 'Make everybody anonymous'],
'Auto Watch': [true, 'Automatically watch threads that you start'], 'Auto Watch': [true, 'Automatically watch threads that you start'],
'Comment Expansion': [true, 'Expand too long comments'], 'Comment Expansion': [true, 'Expand too long comments'],
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'],
'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'],
'Image Expansion': [true, 'Expand images'], 'Image Expansion': [true, 'Expand images'],
'Image Hover': [false, 'Show full image on mouseover'], 'Image Hover': [false, 'Show full image on mouseover'],
@ -387,10 +388,12 @@
if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) {
$.extend($, { $.extend($, {
deleteValue: function(name) { deleteValue: function(name) {
name = NAMESPACE + name;
return GM_deleteValue(name); return GM_deleteValue(name);
}, },
getValue: function(name, defaultValue) { getValue: function(name, defaultValue) {
var value; var value;
name = NAMESPACE + name;
if (value = GM_getValue(name)) { if (value = GM_getValue(name)) {
return JSON.parse(value); return JSON.parse(value);
} else { } else {
@ -401,6 +404,7 @@
return GM_openInTab(url); return GM_openInTab(url);
}, },
setValue: function(name, value) { setValue: function(name, value) {
name = NAMESPACE + name;
return GM_setValue(name, JSON.stringify(value)); return GM_setValue(name, JSON.stringify(value));
} }
}); });
@ -1001,8 +1005,10 @@
$.remove(dialog); $.remove(dialog);
} }
} }
if ($.config('Cooldown')) {
qr.cooldown(true); qr.cooldown(true);
} }
}
Recaptcha.reload(); Recaptcha.reload();
return $('iframe[name=iframe]').src = 'about:blank'; return $('iframe[name=iframe]').src = 'about:blank';
}, },
@ -1025,6 +1031,7 @@
$.remove(span); $.remove(span);
} }
} }
if ($.config('Cooldown')) {
if (qr.cooldown()) { if (qr.cooldown()) {
e.preventDefault(); e.preventDefault();
alert('Stop posting so often!'); alert('Stop posting so often!');
@ -1037,6 +1044,7 @@
} }
return; return;
} }
}
recaptcha = $('input[name=recaptcha_response_field]', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) { if (recaptcha.value) {
qr.sage = $('input[name=email]', form).value === 'sage'; qr.sage = $('input[name=email]', form).value === 'sage';
@ -1201,7 +1209,9 @@
init: function() { init: function() {
var node; var node;
node = $('form[name=delform] > *:not([id])'); node = $('form[name=delform] > *:not([id])');
return threading.thread(node); $.bind(d, 'DOMNodeInserted', threading.stopPropagation);
threading.thread(node);
return $.unbind(d, 'DOMNodeInserted', threading.stopPropagation);
}, },
thread: function(node) { thread: function(node) {
var div, op; var div, op;
@ -1228,6 +1238,9 @@
if (!(node.align || node.nodeName === 'CENTER')) { if (!(node.align || node.nodeName === 'CENTER')) {
return threading.thread(node); return threading.thread(node);
} }
},
stopPropagation: function(e) {
return e.stopPropagation();
} }
}; };
threadHiding = { threadHiding = {
@ -2121,7 +2134,9 @@
$.addStyle(main.css); $.addStyle(main.css);
Recaptcha.init(); Recaptcha.init();
$.bind($('form[name=post]'), 'submit', qr.cb.submit); $.bind($('form[name=post]'), 'submit', qr.cb.submit);
if ($.config('Cooldown')) {
qr.cooldown(); qr.cooldown();
}
if ($.config('Image Expansion')) { if ($.config('Image Expansion')) {
imgExpand.init(); imgExpand.init();
} }

View File

@ -1,3 +1,14 @@
2.2.2
- hopefully fix upgrading issues
2.2.1
- mayhem:
fix op image expansion bug
fix op comment expansion
- fix /b/ackwash multiple links bug
- make cooldown timer optional, disabled by default
2.2.0 2.2.0
- mayhem: - mayhem:
- don't select text when moving dialogs - don't select text when moving dialogs

2
header
View File

@ -2,7 +2,7 @@
// @name 4chan x // @name 4chan x
// @namespace aeosynth // @namespace aeosynth
// @description Adds various features. // @description Adds various features.
// @version 2.2.0 // @version 2.2.2
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @include http://boards.4chan.org/* // @include http://boards.4chan.org/*

View File

@ -16,6 +16,7 @@ config =
'Anonymize': [false, 'Make everybody anonymous'] 'Anonymize': [false, 'Make everybody anonymous']
'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch': [true, 'Automatically watch threads that you start']
'Comment Expansion': [true, 'Expand too long comments'] 'Comment Expansion': [true, 'Expand too long comments']
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)']
'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Auto-Gif': [false, 'Animate gif thumbnails']
'Image Expansion': [true, 'Expand images'] 'Image Expansion': [true, 'Expand images']
'Image Hover': [false, 'Show full image on mouseover'] 'Image Hover': [false, 'Show full image on mouseover']
@ -263,8 +264,10 @@ $.extend $,
if GM_deleteValue? if GM_deleteValue?
$.extend $, $.extend $,
deleteValue: (name) -> deleteValue: (name) ->
name = NAMESPACE + name
GM_deleteValue name GM_deleteValue name
getValue: (name, defaultValue) -> getValue: (name, defaultValue) ->
name = NAMESPACE + name
if value = GM_getValue name if value = GM_getValue name
JSON.parse value JSON.parse value
else else
@ -272,6 +275,7 @@ if GM_deleteValue?
openInTab: (url) -> openInTab: (url) ->
GM_openInTab url GM_openInTab url
setValue: (name, value) -> setValue: (name, value) ->
name = NAMESPACE + name
GM_setValue name, JSON.stringify value GM_setValue name, JSON.stringify value
else else
$.extend $, $.extend $,
@ -754,6 +758,7 @@ qr =
qr.refresh dialog qr.refresh dialog
else else
$.remove dialog $.remove dialog
if $.config 'Cooldown'
qr.cooldown true qr.cooldown true
Recaptcha.reload() Recaptcha.reload()
@ -772,6 +777,7 @@ qr =
if span = @nextSibling if span = @nextSibling
$.remove span $.remove span
if $.config 'Cooldown'
# check if we've posted on this board in another tab # check if we've posted on this board in another tab
if qr.cooldown() if qr.cooldown()
e.preventDefault() e.preventDefault()
@ -930,7 +936,11 @@ threading =
init: -> init: ->
# don't thread image controls # don't thread image controls
node = $ 'form[name=delform] > *:not([id])' node = $ 'form[name=delform] > *:not([id])'
# don't confuse other scripts *cough*/b/ackwash*cough*
# gotta have a named function to unbind.
$.bind d, 'DOMNodeInserted', threading.stopPropagation
threading.thread node threading.thread node
$.unbind d, 'DOMNodeInserted', threading.stopPropagation
thread: (node) -> thread: (node) ->
op = $.el 'div', op = $.el 'div',
@ -957,6 +967,9 @@ threading =
unless node.align or node.nodeName is 'CENTER' unless node.align or node.nodeName is 'CENTER'
threading.thread node threading.thread node
stopPropagation: (e) ->
e.stopPropagation()
threadHiding = threadHiding =
init: -> init: ->
hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {} hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {}
@ -1217,6 +1230,8 @@ watcher =
watch: (thread) -> watch: (thread) ->
favicon = $ 'img.favicon', thread favicon = $ 'img.favicon', thread
#this happens if we try to auto-watch an already watched thread.
return if favicon.src is Favicon.default return if favicon.src is Favicon.default
favicon.src = Favicon.default favicon.src = Favicon.default
@ -1633,9 +1648,10 @@ main =
$.bind $('form[name=post]'), 'submit', qr.cb.submit $.bind $('form[name=post]'), 'submit', qr.cb.submit
#major features
if $.config 'Cooldown'
qr.cooldown() qr.cooldown()
#major features
if $.config 'Image Expansion' if $.config 'Image Expansion'
imgExpand.init() imgExpand.init()