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,7 +1005,9 @@
$.remove(dialog); $.remove(dialog);
} }
} }
qr.cooldown(true); if ($.config('Cooldown')) {
qr.cooldown(true);
}
} }
Recaptcha.reload(); Recaptcha.reload();
return $('iframe[name=iframe]').src = 'about:blank'; return $('iframe[name=iframe]').src = 'about:blank';
@ -1025,17 +1031,19 @@
$.remove(span); $.remove(span);
} }
} }
if (qr.cooldown()) { if ($.config('Cooldown')) {
e.preventDefault(); if (qr.cooldown()) {
alert('Stop posting so often!'); e.preventDefault();
if (isQR) { alert('Stop posting so often!');
span = $.el('span', { if (isQR) {
className: 'error', span = $.el('span', {
textContent: 'Stop posting so often!' className: 'error',
}); textContent: 'Stop posting so often!'
$.append(this.parentNode, span); });
$.append(this.parentNode, span);
}
return;
} }
return;
} }
recaptcha = $('input[name=recaptcha_response_field]', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) { if (recaptcha.value) {
@ -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);
qr.cooldown(); if ($.config('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,7 +758,8 @@ qr =
qr.refresh dialog qr.refresh dialog
else else
$.remove dialog $.remove dialog
qr.cooldown true if $.config 'Cooldown'
qr.cooldown true
Recaptcha.reload() Recaptcha.reload()
$('iframe[name=iframe]').src = 'about:blank' $('iframe[name=iframe]').src = 'about:blank'
@ -772,18 +777,19 @@ qr =
if span = @nextSibling if span = @nextSibling
$.remove span $.remove span
# check if we've posted on this board in another tab if $.config 'Cooldown'
if qr.cooldown() # check if we've posted on this board in another tab
e.preventDefault() if qr.cooldown()
alert 'Stop posting so often!' e.preventDefault()
alert 'Stop posting so often!'
if isQR if isQR
span = $.el 'span', span = $.el 'span',
className: 'error' className: 'error'
textContent: 'Stop posting so often!' textContent: 'Stop posting so often!'
$.append @parentNode, span $.append @parentNode, span
return return
recaptcha = $('input[name=recaptcha_response_field]', this) recaptcha = $('input[name=recaptcha_response_field]', this)
if recaptcha.value if recaptcha.value
@ -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
qr.cooldown()
#major features #major features
if $.config 'Cooldown'
qr.cooldown()
if $.config 'Image Expansion' if $.config 'Image Expansion'
imgExpand.init() imgExpand.init()