Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bookmarklet:
- javascript:(function(){if(!a)var a={};a.a=document.getElementsByClassName("comments");for(var b=0;b<a.a.length;b++)try{if(a.b=a.a[b].getElementsByClassName("smallcopy")[0],a.b.parentNode.removeChild(a.b),a.a[b].parentNode.removeChild(a.a[b].nextElementSibling.nextElementSibling),a.a[b].parentNode.removeChild(a.a[b].nextElementSibling),a.c=a.a[b].getElementsByTagName("a"),a.e=[],a.c.length>0){for(var c=0;c<a.c.length;c++)a.d=document.createElement("a"),a.d.setAttribute("href",a.c[c].getAttribute("href")),a.d.innerHTML=a.c[c].innerHTML,a.e.push(a.d),a.d=document.createElement("p"),a.d.innerHTML="<small>("+a.c[c].getAttribute("href")+")</small><br />",a.e.push(a.d);a.a[b].innerHTML="";for(var d in a.e)a.a[b].appendChild(a.e[d])}else a.a[b].parentNode.removeChild(a.a[b]),b--}catch(a){console.log(a);continue}a=null})();
- Source:
- javascript:(function(){
- if (!allLink) {var allLink = {}};
- // Get a list of all the comment divs
- allLink.comments = document.getElementsByClassName('comments');
- for (var id = 0; id < allLink.comments.length; id++) {
- try {
- // Remove the by line
- allLink.byLine = allLink.comments[id].getElementsByClassName('smallcopy')[0];
- allLink.byLine.parentNode.removeChild(allLink.byLine);
- // Remove the two <br> tags that follow each comment
- allLink.comments[id].parentNode.removeChild(allLink.comments[id].nextElementSibling.nextElementSibling);
- allLink.comments[id].parentNode.removeChild(allLink.comments[id].nextElementSibling);
- // Get any links in the comment
- allLink.links = allLink.comments[id].getElementsByTagName('a');
- allLink.replacement = [];
- // If there are links
- if (allLink.links.length > 0) {
- // Create duplicate links
- for (var i = 0; i < allLink.links.length; i++) {
- // Link with original text
- allLink.newElement = document.createElement('a');
- allLink.newElement.setAttribute('href', allLink.links[i].getAttribute('href'));
- allLink.newElement.innerHTML = allLink.links[i].innerHTML;
- allLink.replacement.push(allLink.newElement);
- // Subtitle with link url
- allLink.newElement = document.createElement('p');
- allLink.newElement.innerHTML = "<small>(" + allLink.links[i].getAttribute('href') + ")</small><br />"
- allLink.replacement.push(allLink.newElement);
- }
- // Clear the comment
- allLink.comments[id].innerHTML = '';
- // Add the duplicate links
- for (var j in allLink.replacement) {
- allLink.comments[id].appendChild(allLink.replacement[j]);
- }
- // If there are no links
- } else {
- // Remove the comment entirely
- allLink.comments[id].parentNode.removeChild(allLink.comments[id]);
- id--;
- }
- } catch (e) {
- console.log(e);
- continue;
- }
- };
- allLink = null;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement