Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @match http://*.diary.ru/*
- // @run-at document-start
- // ==/UserScript==
- var linksWithCrappyTag = document.getElementsByTagName("a");
- for (var ix in linksWithCrappyTag) {
- var link = linksWithCrappyTag[ix];
- if (!link || !link.href || link.href.substr(-7) != "2895465") {
- continue;
- }
- while (link) {
- if (link.className == "paragraph") {
- break;
- }
- link = link.parentNode;
- }
- link.style.display = "none";
- var showContentLink = document.createElement("div");
- showContentLink.className = "paragraph link-inserted";
- showContentLink.style.textDecoration = "underline";
- showContentLink.style.cursor = "pointer";
- showContentLink.appendChild(document.createTextNode("Achtung, crap inside! Click here to show it."));
- showContentLink.onclick = function() {
- var chNodes = this.parentNode.childNodes;
- for (var chIx in chNodes) {
- var chNode = chNodes[chIx];
- if (!chNode) {
- continue;
- }
- if (chNode.className == "paragraph") {
- chNode.style.display = "block";
- } else if (chNode.className == "paragraph link-inserted") {
- chNode.style.display = "none";
- }
- }
- };
- link.parentNode.insertBefore(showContentLink, link);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement