Friday, March 1, 2013

Wiktionary - Recent changes [en]: User:Stratoprutser/404 native.js

Wiktionary - Recent changes [en]
Track the most recent changes to the wiki in this feed. // via fulltextrssfeed.com
  /**   *  User-script to display interlanguage-links on 404-pages and redlinks   *  See [[Wiktionary:Beer_parlour/2013/February#Yahoo_Pipe_for_404s]]   */     jQuery;     myStringArray  = ["fr", "en", "lt", "tr", "zh", "ru", "vi", "io", "pl", "fi", "pt", "hu", "no", "el", "ta", "it", "de", "sv", "ko", "nl", "lo", "kn", "ja", "ku", "ar", "es", "ro", "et", "ml", "id", "te", "gl", "bg", "uk", "ca", "vo", "li", "is", "fa", "sr", "af", "cs", "scn", "th", "sw", "fy", "simple", "br", "oc", "he", "sl", "hy", "hr", "sq", "tt", "la", "zh-min-nan", "da", "ast", "tk", "wa", "ur", "hsb", "kk", "ky", "wo", "eo", "ang", "hi", "ga", "gn", "az", "ia", "co", "sk", "ka", "ne", "csb", "st", "ms", "tl", "mr", "nds", "kl", "lv", "eu", "sd", "ug", "ti", "cy", "mk", "ps", "an", "sh", "my", "bn", "gu", "km", "mg", "ts", "qu", "bs", "fo", "am", "rw", "chr", "su", "om", "mn", "nah", "ie", "yi", "iu", "be", "gd", "tg", "si", "nn", "zu", "ss", "kw", "pa", "dv", "gv", "mt", "tpi", "sg", "roa-rup", "mi", "jv", "uz", "ik", "so", "ha", "sa", "ay", "na", "jbo", "tn", "sm", "as", "lb", "ks", "fj", "ln", "za", "mo", "pi", "ba", "xh", "mh", "bh", "sn", "or", "ak", "yo", "bi", "rn", "av", "bm", "ab", "to", "aa", "dz", "tw", "als", "bo", "rm", "sc", "ch", "cr", "tokipona"];     languages  = ["fr", "en", "lt", "tr"];     var microbubble = window.microbubble || {};  jQuery.fn.getPipe = function () {     var len = languages.length  for (var i=0; i<len; ++i) {    if (i in languages) {      var language = languages[i];          var pipeFeed = new microbubble.PipeFeed(this, language);          pipeFeed.parse();    }  }     };     /**   *  PipeFeed Class   *  Returns interwikis   */          microbubble.PipeFeed = function (htmlElement, language) {          htmlElement.html('<ul id="feed-results-' + language + '">' + language + '</ul>');          var listElement = $("#feed-results-" + language);             return {                  parse: function (word) {                          $.getJSON("http://" + language + ".wiktionary.org/w/api.php?format=json&action=query&titles=" + wgTitle + "&prop=langlinks",                             function (json) {                                  parseFeed(json, language);                          });                  }          };     function parseFeed(json, language)  {          var seen = {}; /* preventing double interwikis */          if (json.count > 0)          {                  $(json.value.items).each(                  function ()                  {                          var itemDetail = createInterwiki(this);                          if (seen[itemDetail])                                  $(this).remove();                          else                          {                                  seen[itemDetail] = true;                                  $(listElement).append(itemDetail + language);                          }                  });          }          else          {                  /* -htmlElement.html('<ul><li class="interwiki">No interwikis found</li></ul>\n'); */                  -htmlElement.append(language);          }  }             function createInterwiki(item)          {                  return '<li class="interwiki-' + item.content + '"><a href="//' + item.content + '.wiktionary.org/wiki/' + wgTitle + '" title="' + wgTitle + '" lang="' + item.content + '" hreflang="' + item.content + '">' + item.content + '</a></li>\n';          }     };     if (wgArticleId==0 && wgCanonicalSpecialPageName==false)   {          $('#mw-panel').append('<div class="portal persistent" role="navigation" id="p-lang">\n<h3 tabindex="3">In other languages</h3>\n<div class="body" style="display: block;" id="interwikis"></div></div>');          $("#interwikis").html("<em>loading interwikis...</em>");          $("#interwikis").getPipe();  }  

User:Stratoprutser/404 native.js
Mar 1st 2013, 22:45

Line 42: Line 42:
 

};

 

};

   

function parseFeed(json, language) {

+

function parseFeed(json, language)

var seen = {}; /* preventing double interwikis */

+

{

if (json.count > 0) {

+

var seen = {}; /* preventing double interwikis */

$(json.value.items).each(function () {

+

if (json.count > 0)

var itemDetail = createInterwiki(this);

+

{

//if (seen[itemDetail]) $(this).remove();

+

$(json.value.items).each(

//else {

+

function ()

seen[itemDetail] = true;

+

{

$(listElement).append(itemDetail);

+

var itemDetail = createInterwiki(this);

// }

+

if (seen[itemDetail])

});

+

$(this).remove();

} else {

+

else

/* -htmlElement.html('<ul><li class="interwiki">No interwikis found</li></ul>\n'); */

+

{

htmlElement.append(language);

+

seen[itemDetail] = true;

  +

$(listElement).append(itemDetail + language);

  +

}

  +

});

 

}

 

}

}

+

else

  +

{

  +

/* -htmlElement.html('<ul><li class="interwiki">No interwikis found</li></ul>\n'); */

  +

-htmlElement.append(language);

  +

}

  +

}

   
 

function createInterwiki(item)

 

function createInterwiki(item)

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions