பயனர்:Shrikarsan/Cache.js

கட்டற்ற கலைக்களஞ்சியமான விக்கிப்பீடியாவில் இருந்து.

குறிப்பு - சேமித்த பின்னர், நீங்கள் செய்த மாற்றங்களைக் காண்பதற்கு உங்கள் உலவியின் இடைமாற்று அகற்றப்பட வேண்டும்.

  • மொஸில்லா பயர்பாக்ஸ் / சபாரி: Shift+Reload, அல்லது Ctrl-F5 அல்லது Ctrl-R (⌘-R Mac ல்)
  • கூகிள் குரோம் Ctrl-Shift-R அழுத்தவும். (⌘-Shift-R Mac ல்) ;
  • இண்டர்நெட் எக்ஸ்ப்ளோரர்: Ctrl-Refresh அல்லது Ctrl-F5 ஐ அழுத்தவும்.
  • ஒபேரா: Tools → Preferences இல் இடைமாற்றை அகற்றவும்;
function addcache() {
 
    if (typeof no_external_cache !== "undefined" && no_external_cache) {
        return;
    }
 
 
    var links  = document.getElementsByClassName('external');
 
 
    for (var i = 0, l = links.length; i < l; i++) {
        var current_link = links[i];
        var path = current_link.href;
        if (path.indexOf("http://wikiwix.com/cache/") > -1 || 
            path.indexOf("http://web.archive.org/web/") > -1 || 
            path.indexOf("archive.is") > -1 || 
            path.indexOf("wikipedia.org") > -1 || 
            path.indexOf("wikimedia") > -1 || 
            path.indexOf("wikisource.org") > -1 || 
            path.indexOf("wiktionary.org") > -1 || 
            path.indexOf("wikiversity.org") > -1 || 
            path.indexOf("wikinews.org") > -1 || 
            path.indexOf("wikiquote.org") > -1 || 
            path.indexOf("wikibooks.org") > -1 || 
            path.indexOf("wikispecies.org") > -1 ||
            path.indexOf("toolserver.org") > -1){ 
            continue;
        }
        var element_parent = current_link.parentNode;
        if (hasClass(element_parent, "noarchive")) {
            continue;
        }
        //normally, plain links should be internal, so we should skip them 
        if (hasClass(element_parent, "plainlinks")) {
            continue;
        }
        var page_title = getTextContent(current_link);
        var last = document.createElement("small");
        last.className = "cachelinks";
        last.appendChild(document.createTextNode("\u00a0("));
 
        var link = document.createElement("a");
        link.setAttribute("href", "http://archive.is/" + path.replace(/%/g, "%25").replace(/&/g, "%26"));
        link.setAttribute("title", "Arhiva paginii " + page_title);
 
        var picture = document.createElement("img");
        picture.setAttribute("src", "//upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Nuvola_mimetypes_java_jar.png/15px-Nuvola_mimetypes_java_jar.png");
        picture.setAttribute("alt", "Versiunea arhivată");
        link.appendChild(picture);
 
        last.appendChild(link);
        last.appendChild(document.createTextNode(")"));
 
        element_parent.insertBefore(last, current_link.nextSibling);
    }
}
 
// If we're on an article page, run addcache
if ((wgNamespaceNumber === 0 || wgNamespaceNumber === 1) && wgAction == "view") {
    $( addcache );
}
 
//special test page
if (wgPageName == "Wikipedia:Arhivă_legături_externe/Teste") {
    $( addcache );
}
 
// Retrieves the actual text content of a node and its descendant nodes
// Copyright Harmen Christophe, http://openweb.eu.org/articles/validation_avancee, CC
function getTextContent(oNode) {
  if(!oNode) return null;
  if (typeof(oNode.textContent)!="undefined") {return oNode.textContent;}
  switch (oNode.nodeType) {
    case 3: // TEXT_NODE
    case 4: // CDATA_SECTION_NODE
      return oNode.nodeValue;
      break;
    case 7: // PROCESSING_INSTRUCTION_NODE
    case 8: // COMMENT_NODE
      if (getTextContent.caller!=getTextContent) {
        return oNode.nodeValue;
      }
      break;
    case 9: // DOCUMENT_NODE
    case 10: // DOCUMENT_TYPE_NODE
    case 12: // NOTATION_NODE
      return null;
      break;
  }
  var _textContent = "";
  oNode = oNode.firstChild;
  while (oNode) {
    _textContent += getTextContent(oNode);
    oNode = oNode.nextSibling;
  }
  return _textContent;
}
"https://ta.wikipedia.org/w/index.php?title=பயனர்:Shrikarsan/Cache.js&oldid=1617312" இலிருந்து மீள்விக்கப்பட்டது