working on
parent
99217b4af2
commit
b2c7ce8546
|
@ -1 +1,4 @@
|
||||||
/*~
|
/*~
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
|
@ -86,35 +86,32 @@ uku7JUXcVpt08DFSceCEX9unCuMcT72rAQlLpdZir876
|
||||||
var author = $(messageTag).find('.sign a[itemprop="creator"]').text();
|
var author = $(messageTag).find('.sign a[itemprop="creator"]').text();
|
||||||
|
|
||||||
if (msg && msg.length && author.trim() != '') {
|
if (msg && msg.length && author.trim() != '') {
|
||||||
var encryptedRegexp = /(\[ENCRYPTED\][\s\S]+\[\/ENCRYPTED\])+?/mi;
|
var encryptedRegexp = /\[ENCRYPTED\]([\s\S]+)\[\/ENCRYPTED\]/mi;
|
||||||
var encryptedMsgRegexp = /\[ENCRYPTED\]([\s\S]+)\[\/ENCRYPTED\]/mi;
|
var encryptedRegexpMy = /\[ENCORIGIN\]([\s\S]+)\[\/ENCORIGIN\]/mi;
|
||||||
|
var regexp;
|
||||||
|
|
||||||
Array.prototype.forEach.call(msg, function(p) {
|
Array.prototype.forEach.call(msg, function(p) {
|
||||||
var msg = p.innerText;
|
var msg = p.innerText;
|
||||||
if (msg.trim() != '' && encryptedRegexp.test(msg)) {
|
for (var i=0; i<2; i++) {
|
||||||
|
if (i == 0) {
|
||||||
var result = msg.match(encryptedRegexp);
|
regexp = encryptedRegexp;
|
||||||
if (result && result.length >= 1) {
|
} else {
|
||||||
|
regexp = encryptedRegexpMy;
|
||||||
for (var i=1; i<result.length; i++) {
|
}
|
||||||
var encBlock = result[i];
|
if (msg.trim() != '' && regexp.test(msg)) {
|
||||||
|
var result = msg.match(regexp);
|
||||||
if (encBlock && encryptedMsgRegexp.test(encBlock)) {
|
if (result && result.length >= 1) {
|
||||||
var resultMsg = encBlock.match(encryptedMsgRegexp);
|
var encMsg = result[1];
|
||||||
|
var decrypt = new JSEncrypt.JSEncrypt();
|
||||||
if (resultMsg && resultMsg.length) {
|
decrypt.setPrivateKey(privateKey);
|
||||||
var decrypt = new JSEncrypt.JSEncrypt();
|
var decryptedMsg = decrypt.decrypt(encMsg);
|
||||||
decrypt.setPrivateKey(privateKey);
|
if (i == 0) {
|
||||||
|
msg = msg.replace(encBlock, '[DECRYPTED]'+decryptedMsg+'[/DECRYTED]');
|
||||||
var decryptedMsg = decrypt.decrypt(resultMsg[1]);
|
} else {
|
||||||
msg = msg.replace(encBlock, '[DECRYPTED]'+decryptedMsg+'[/DECRYTED]');
|
msg = msg.replace(encBlock, '[ORIGIN]'+decryptedMsg+'[/ORIGIN]');
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.innerText = msg;
|
p.innerText = msg;
|
||||||
});
|
});
|
||||||
|
@ -157,7 +154,7 @@ uku7JUXcVpt08DFSceCEX9unCuMcT72rAQlLpdZir876
|
||||||
|
|
||||||
var encryptedMsg = encrypt.encrypt(msg);
|
var encryptedMsg = encrypt.encrypt(msg);
|
||||||
var encryptedMsgMy = encryptMy.encrypt(msg);
|
var encryptedMsgMy = encryptMy.encrypt(msg);
|
||||||
insertText(textarea, '[ENCRYPTED]' + encryptedMsg + '[/ENCRYPTED]' + '[ENCRYPTED]' + encryptedMsgMy + '[/ENCRYPTED]');
|
insertText(textarea, '[ENCRYPTED]' + encryptedMsg + '[/ENCRYPTED]' + '[ENCORIGIN]' + encryptedMsgMy + '[/ENCORIGIN]');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue