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

2
header
View File

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

View File

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