Add Anonymizer. Close #776
This commit is contained in:
parent
f1bc29ca7d
commit
4a2a750d62
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var $, $$, AutoGIF, Board, Build, Clone, Conf, Config, FileInfo, Get, ImageHover, Main, Post, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, RevealSpoilers, Sauce, Thread, ThreadUpdater, Time, UI, d, g,
|
||||
var $, $$, Anonymize, AutoGIF, Board, Build, Clone, Conf, Config, FileInfo, Get, ImageHover, Main, Post, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, RevealSpoilers, Sauce, Thread, ThreadUpdater, Time, UI, d, g,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
@ -170,6 +170,22 @@
|
||||
imageFit: 'fit width'
|
||||
};
|
||||
|
||||
if (!/^(boards|images|sys)\.4chan\.org$/.test(location.hostname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Conf = {};
|
||||
|
||||
d = document;
|
||||
|
||||
g = {
|
||||
VERSION: '3.0.0',
|
||||
NAMESPACE: "4chan_X_Alpha.",
|
||||
boards: {},
|
||||
threads: {},
|
||||
posts: {}
|
||||
};
|
||||
|
||||
UI = (function() {
|
||||
var dialog, drag, dragend, dragstart, hover, hoverend, hoverstart, touchend, touchmove;
|
||||
dialog = function(id, position, html) {
|
||||
@ -656,22 +672,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (!/^(boards|images|sys)\.4chan\.org$/.test(location.hostname)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Conf = {};
|
||||
|
||||
d = document;
|
||||
|
||||
g = {
|
||||
VERSION: '3.0.0',
|
||||
NAMESPACE: "4chan_X_Alpha.",
|
||||
boards: {},
|
||||
threads: {},
|
||||
posts: {}
|
||||
};
|
||||
|
||||
Redirect = {
|
||||
image: function(board, filename) {
|
||||
switch (board) {
|
||||
@ -1560,6 +1560,37 @@
|
||||
}
|
||||
};
|
||||
|
||||
Anonymize = {
|
||||
init: function() {
|
||||
return Post.prototype.callbacks.push({
|
||||
name: 'Anonymize',
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
var email, name, tripcode, _ref;
|
||||
if (this.info.capcode || this.isClone) {
|
||||
return;
|
||||
}
|
||||
_ref = this.nodes, name = _ref.name, tripcode = _ref.tripcode, email = _ref.email;
|
||||
if (this.info.name !== 'Anonymous') {
|
||||
name.textContent = 'Anonymous';
|
||||
}
|
||||
if (tripcode) {
|
||||
$.rm(tripcode);
|
||||
delete this.nodes.tripcode;
|
||||
}
|
||||
if (this.info.email) {
|
||||
if (/sage/i.test(this.info.email)) {
|
||||
return email.href = 'mailto:sage';
|
||||
} else {
|
||||
$.replace(email, name);
|
||||
return delete this.nodes.email;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Time = {
|
||||
init: function() {
|
||||
this.funk = this.createFunc(Conf['time']);
|
||||
@ -2647,6 +2678,13 @@
|
||||
$.log(err, 'Indicate Cross-thread Quotes');
|
||||
}
|
||||
}
|
||||
if (Conf['Anonymize']) {
|
||||
try {
|
||||
Anonymize.init();
|
||||
} catch (e) {
|
||||
$.log(err, 'Anonymize');
|
||||
}
|
||||
}
|
||||
if (Conf['Time Formatting']) {
|
||||
try {
|
||||
Time.init();
|
||||
|
||||
2
grunt.js
2
grunt.js
@ -16,9 +16,9 @@ module.exports = function(grunt) {
|
||||
coffee: {
|
||||
src: [
|
||||
'<file_template:src/config.coffee>',
|
||||
'<file_template:src/globals.coffee>',
|
||||
'<file_template:lib/ui.coffee>',
|
||||
'<file_template:lib/$.coffee>',
|
||||
'<file_template:src/globals.coffee>',
|
||||
'<file_template:src/features.coffee>',
|
||||
'<file_template:src/main.coffee>'
|
||||
],
|
||||
|
||||
@ -846,6 +846,26 @@ QuoteCT =
|
||||
$.add quote, $.tn QuoteCT.text
|
||||
return
|
||||
|
||||
Anonymize =
|
||||
init: ->
|
||||
Post::callbacks.push
|
||||
name: 'Anonymize'
|
||||
cb: @node
|
||||
node: ->
|
||||
return if @info.capcode or @isClone
|
||||
{name, tripcode, email} = @nodes
|
||||
if @info.name isnt 'Anonymous'
|
||||
name.textContent = 'Anonymous'
|
||||
if tripcode
|
||||
$.rm tripcode
|
||||
delete @nodes.tripcode
|
||||
if @info.email
|
||||
if /sage/i.test @info.email
|
||||
email.href = 'mailto:sage'
|
||||
else
|
||||
$.replace email, name
|
||||
delete @nodes.email
|
||||
|
||||
Time =
|
||||
init: ->
|
||||
@funk = @createFunc Conf['time']
|
||||
|
||||
@ -362,6 +362,13 @@ Main =
|
||||
# XXX handle error
|
||||
$.log err, 'Indicate Cross-thread Quotes'
|
||||
|
||||
if Conf['Anonymize']
|
||||
try
|
||||
Anonymize.init()
|
||||
catch e
|
||||
# XXX handle error
|
||||
$.log err, 'Anonymize'
|
||||
|
||||
if Conf['Time Formatting']
|
||||
try
|
||||
Time.init()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user