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:
@ -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 */
|
||||
|
||||
|
Reference in New Issue
Block a user