summaryrefslogtreecommitdiff
path: root/js/forced-anon.js
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-18 23:55:01 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-18 23:55:01 +1100
commit21a1152ebead57c60c76c341d4f8ec8bc737949b (patch)
treed4fbc7268872167d1377f67427773f48ecfcaf0a /js/forced-anon.js
parent8208d7151bc952462c9220304877525dcc398cea (diff)
custom event for new posts, so auto-reload.js etc will work with forced-anon.js and post-hover.js
Diffstat (limited to 'js/forced-anon.js')
-rw-r--r--js/forced-anon.js42
1 files changed, 24 insertions, 18 deletions
diff --git a/js/forced-anon.js b/js/forced-anon.js
index 0f7f1c70..9b9df1eb 100644
--- a/js/forced-anon.js
+++ b/js/forced-anon.js
@@ -11,24 +11,26 @@
*
*/
-$(document).ready(function(){
- enable_fa = function() {
- $('p.intro label').each(function() {
- if($(this).children('a.capcode').length == 0) {
- var id = $(this).parent().children('a.post_no:eq(1)').text();
-
- if($(this).children('a.email').length != 0)
- var p = $(this).children('a.email');
- else
- var p = $(this);
-
- old_info[id] = {'name': p.children('span.name').text(), 'trip': p.children('span.trip').text()};
-
- p.children('span.name').text('Anonymous');
- if(p.children('span.trip').length != 0)
- p.children('span.trip').text('');
- }
- });
+$(document).ready(function() {
+ var force_anon = function() {
+ if($(this).children('a.capcode').length == 0) {
+ var id = $(this).parent().children('a.post_no:eq(1)').text();
+
+ if($(this).children('a.email').length != 0)
+ var p = $(this).children('a.email');
+ else
+ var p = $(this);
+
+ old_info[id] = {'name': p.children('span.name').text(), 'trip': p.children('span.trip').text()};
+
+ p.children('span.name').text('Anonymous');
+ if(p.children('span.trip').length != 0)
+ p.children('span.trip').text('');
+ }
+ };
+
+ var enable_fa = function() {
+ $('p.intro label').each(force_anon);
};
var disable_fa = function() {
@@ -75,5 +77,9 @@ $(document).ready(function(){
if(forced_anon)
enable_fa();
+ $(document).bind('new_post', function(e, post) {
+ if(forced_anon)
+ $(post).find('p.intro label').each(force_anon);
+ });
});