1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Added email obfuscation and dynamic menu entry

This commit is contained in:
sam
2012-05-08 17:52:17 +07:00
parent 5240bf5614
commit 230b762bf4
4 changed files with 65 additions and 13 deletions

View File

@ -234,12 +234,23 @@ zerobin = {
},
/** Return an link object with the URL as href so you can extract host,
protocol, hash, etc*/
parseUrl: function(url){
var a = document.createElement('a');
a.href = url
return a
},
protocol, hash, etc.
This function use a closure to store a <div> parent for the <a>
because IE requires the link be processed by it's HTML parser
for the URL to be parsed. */
parseUrl: (function(){
var div = document.createElement('div');
div.innerHTML = "<a></a>";
return function(url){
div.firstChild.href = url;
div.innerHTML = div.innerHTML;
return div.firstChild;
};
})(),
getPasteId: function(url){
loc = url ? zerobin.parseUrl(url) : window.location
@ -631,5 +642,17 @@ $(".close").on('click', function(e){
});
/* Parse obfuscaded emails and make them usable */
$('.email-link').each(function(i, elem){
var $obfuscatedEmail = $(this);
var address = $obfuscatedEmail.attr('title').replace('__AT__', '@');
var text = $obfuscatedEmail.text().replace('__AT__', '@');
var $plainTextEmail = $('<a href="mailto:' + address + '">'+ text +'</a>');
$obfuscatedEmail.replaceWith($plainTextEmail);
});
}); /* End of "document ready" jquery callback */