summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-14 16:01:52 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-14 16:01:52 +1100
commit61f1d0865ea0113e53f8c3921863f04a8503df8d (patch)
tree7163257ed5b9b5bfac52b288717275564ed321c6
parenta2d29860e6773b181e1c0670e2458e43321e2cd2 (diff)
forced anon
-rw-r--r--js/forced-anon.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/js/forced-anon.js b/js/forced-anon.js
new file mode 100644
index 00000000..a7e43062
--- /dev/null
+++ b/js/forced-anon.js
@@ -0,0 +1,66 @@
+$(document).ready(function(){
+ var 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('');
+ }
+ });
+ };
+
+ var disable_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(old_info[id]) {
+ if($(this).children('a.email').length != 0)
+ var p = $(this).children('a.email');
+ else
+ var p = $(this);
+
+ p.children('span.name').text(old_info[id]['name']);
+ if(p.children('span.trip').length != 0)
+ p.children('span.trip').text(old_info[id]['trip']);
+ }
+ }
+ });
+ };
+
+ old_info = {};
+ forced_anon = localStorage['forcedanon'] ? true : false;
+
+ $('hr:first').before('<div id="forced-anon" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
+ $('div#forced-anon a').text('Forced anonymity (' + (forced_anon ? 'enabled' : 'disabled') + ')');
+
+ $('div#forced-anon a').click(function() {
+ forced_anon = !forced_anon;
+
+ if(forced_anon) {
+ $('div#forced-anon a').text('Forced anonymity (enabled)');
+ localStorage.forcedanon = true;
+ enable_fa();
+ } else {
+ $('div#forced-anon a').text('Forced anonymity (disabled)');
+ delete localStorage.forcedanon;
+ disable_fa();
+ }
+
+ return false;
+ });
+
+ if(forced_anon)
+ enable_fa();
+
+});
+