User:Stratoprutser/404 native.js

/** * User-script to display interlanguage-links on 404-pages and redlinks * See Beer_parlour/2013/February * testword: danim */

jQuery; languages = ["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", "xh", "mh", "bh", "sn", "or", "ak", "yo", "bi", "rn", "av", "bm", "ab", "to", "aa", "dz", "tw", "als", "bo", "rm", "sc", "ch", "cr"];

//languages = ["fr", "en", "lt", "tr", "zh"];

var microbubble = window.microbubble || {};

jQuery.fn.getPipe = function {	var len = languages.length var seen= {}; this.append(''); var listElement = $("#feed-results"); for (var i = 0; i < len; ++i) {		var language = languages[i]; $.ajax(		{			url: 'http://' + language + '.wiktionary.org/w/api.php?format=json&action=query&titles=' + wgTitle + '&prop=langlinks&meta=siteinfo&callback=?',			dataType: 'jsonp',			success: function(data)			{				for (var pageid in data.query.pages)				{					// if only current wt has it (no interwiki links)					if (data.query.pages[pageid].pageid && !(seen[data.query.general.lang]))					{						var itemDetail = createInterwiki(data.query.general.lang);						$(listElement).append(itemDetail);						seen[data.query.general.lang] = true;					}

for (var id in data.query.pages[pageid].langlinks) {						if (!(seen[data.query.pages[pageid].langlinks[id].lang])) {							var itemDetail = createInterwiki(data.query.pages[pageid].langlinks[id].lang);													seen[data.query.pages[pageid].langlinks[id].lang] = true; $(listElement).append(itemDetail); }					}				}	 		}		}); 		// alert (JSON.stringify(seen)+i+" "+len);	} };

function createInterwiki(item) {	item == "aa" ? title = "Afaraf" : item == "ab" ? title = "Аҧсуа" : item == "ae" ? title = "avesta" : item == "af" ? title = "Afrikaans" : item == "ak" ? title = "Akan" : item == "am" ? title = "አማርኛ" : item == "an" ? title = "aragonés" : item == "ar" ? title = "العربية" : item == "as" ? title = "অসমীয়া" : item == "av" ? title = "авар мацӀ" : item == "ay" ? title = "aymar aru" : item == "az" ? title = "azərbaycan dili" : item == "ba" ? title = "башҡорт теле" : item == "be" ? title = "Беларуская" : item == "bg" ? title = "български език" : item == "bh" ? title = "भोजपुरी" : item == "bi" ? title = "Bislama" : item == "bm" ? title = "bamanankan" : item == "bn" ? title = "বাংলা" : item == "bo" ? title = "བོད་ཡིག" : item == "br" ? title = "brezhoneg" : item == "bs" ? title = "bosanski jezik" : item == "ca" ? title = "Català" : item == "ce" ? title = "нохчийн мотт" : item == "ch" ? title = "Chamoru" : item == "co" ? title = "corsu" : item == "cr" ? title = "ᓀᐦᐃᔭᐍᐏᐣ" : item == "cs" ? title = "česky" : item == "cu" ? title = "ѩзыкъ словѣньскъ" : item == "cv" ? title = "чӑваш чӗлхи" : item == "cy" ? title = "Cymraeg" : item == "da" ? title = "dansk" : item == "de" ? title = "Deutsch" : item == "dv" ? title = "ދިވެހި" : item == "dz" ? title = "རྫོང་ཁ" : item == "ee" ? title = "Eʋegbe" : item == "el" ? title = "Ελληνικά" : item == "en" ? title = "English" : item == "eo" ? title = "Esperanto" : item == "es" ? title = "español" : item == "et" ? title = "eesti" : item == "eu" ? title = "euskara" : item == "fa" ? title = "فارسی" : item == "ff" ? title = "Fulfulde" : item == "fi" ? title = "suomi" : item == "fj" ? title = "vosa Vakaviti" : item == "fo" ? title = "føroyskt" : item == "fr" ? title = "français" : item == "fy" ? title = "Frysk" : item == "ga" ? title = "Gaeilge" : item == "gd" ? title = "Gàidhlig" : item == "gl" ? title = "Galego" : item == "gn" ? title = "Avañe'ẽ" : item == "gu" ? title = "ગુજરાતી" : item == "gv" ? title = "Gaelg" : item == "ha" ? title = "Hausa" : item == "he" ? title = "עברית" : item == "hi" ? title = "हिन्दी" : item == "ho" ? title = "Hiri Motu" : item == "hr" ? title = "hrvatski" : item == "ht" ? title = "Kreyòl ayisyen" : item == "hu" ? title = "Magyar" : item == "hy" ? title = "Հայերեն" : item == "hz" ? title = "Otjiherero" : item == "ia" ? title = "Interlingua" : item == "id" ? title = "Bahasa Indonesia" : item == "ie" ? title = "Interlingue" : item == "ig" ? title = "Igbo" : item == "ii" ? title = "ꆇꉙ" : item == "ik" ? title = "Iñupiaq" : item == "io" ? title = "Ido" : item == "is" ? title = "Íslenska" : item == "it" ? title = "Italiano" : item == "iu" ? title = "ᐃᓄᒃᑎᑐᑦ" : item == "ja" ? title = "日本語 (にほんご／にっぽんご)" : item == "jv" ? title = "basa Jawa" : item == "ka" ? title = "ქართული" : item == "kg" ? title = "KiKongo" : item == "ki" ? title = "Gĩkũyũ" : item == "kj" ? title = "Kuanyama" : item == "kk" ? title = "Қазақ тілі" : item == "kl" ? title = "kalaallisut" : item == "km" ? title = "ភាសាខ្មែរ" : item == "kn" ? title = "ಕನ್ನಡ" : item == "ko" ? title = "한국어" : item == "kr" ? title = "Kanuri" : item == "ks" ? title = "कश्मीरी" : item == "ku" ? title = "Kurdî" : item == "kv" ? title = "коми кыв" : item == "kw" ? title = "Kernewek" : item == "ky" ? title = "кыргыз тили" : item == "la" ? title = "latine" : item == "lb" ? title = "Lëtzebuergesch" : item == "lg" ? title = "Luganda" : item == "li" ? title = "Limburgs" : item == "ln" ? title = "Lingála" : item == "lo" ? title = "ພາສາລາວ" : item == "lt" ? title = "lietuvių kalba" : item == "lu" ? title = "Kiluba" : item == "lv" ? title = "latviešu valoda" : item == "mg" ? title = "Malagasy fiteny" : item == "mh" ? title = "Kajin M̧ajeļ" : item == "mi" ? title = "te reo Māori" : item == "mk" ? title = "македонски јазик" : item == "ml" ? title = "മലയാളം" : item == "mn" ? title = "Монгол" : item == "mr" ? title = "मराठी" : item == "ms" ? title = "bahasa Melayu" : item == "mt" ? title = "Malti" : item == "my" ? title = "ဗမာစာ" : item == "na" ? title = "Ekakairũ Naoero" : item == "nb" ? title = "Norsk bokmål" : item == "nd" ? title = "isiNdebele" : item == "ne" ? title = "नेपाली" : item == "ng" ? title = "Owambo" : item == "nl" ? title = "Nederlands" : item == "nn" ? title = "Norsk nynorsk" : item == "no" ? title = "Norsk" : item == "nr" ? title = "isiNdebele" : item == "nv" ? title = "Diné bizaad" : item == "ny" ? title = "chiCheŵa" : item == "oc" ? title = "Occitan" : item == "oj" ? title = "ᐊᓂᔑᓈᐯᒧᐎᓐ" : item == "om" ? title = "Afaan Oromoo" : item == "or" ? title = "ଓଡ଼ିଆ" : item == "os" ? title = "Ирон æвзаг" : item == "pa" ? title = "ਪੰਜਾਬੀ" : item == "pi" ? title = "पाऴि" : item == "pl" ? title = "polski" : item == "ps" ? title = "پښتو" : item == "pt" ? title = "Português" : item == "qu" ? title = "Runa Simi" : item == "rm" ? title = "rumantsch grischun" : item == "rn" ? title = "kiRundi" : item == "ro" ? title = "română" : item == "ru" ? title = "Русский язык" : item == "rw" ? title = "Ikinyarwanda" : item == "sa" ? title = "संस्कृतम्" : item == "sc" ? title = "sardu" : item == "sd" ? title = "सिन्धी" : item == "se" ? title = "Davvisámegiella" : item == "sg" ? title = "yângâ tî sängö" : item == "si" ? title = "සිංහල" : item == "sk" ? title = "slovenčina" : item == "sl" ? title = "slovenščina" : item == "sm" ? title = "gagana fa'a Samoa" : item == "sn" ? title = "chiShona" : item == "so" ? title = "Soomaaliga" : item == "sq" ? title = "Shqip" : item == "sr" ? title = "српски језик" : item == "ss" ? title = "SiSwati" : item == "st" ? title = "Sesotho" : item == "su" ? title = "Basa Sunda" : item == "sv" ? title = "svenska" : item == "sw" ? title = "Kiswahili" : item == "ta" ? title = "தமிழ்" : item == "te" ? title = "తెలుగు" : item == "tg" ? title = "тоҷикӣ" : item == "th" ? title = "ไทย" : item == "ti" ? title = "ትግርኛ" : item == "tk" ? title = "Türkmen" : item == "tl" ? title = "Wikang Tagalog" : item == "tn" ? title = "Setswana" : item == "to" ? title = "faka Tonga" : item == "tr" ? title = "Türkçe" : item == "ts" ? title = "Xitsonga" : item == "tt" ? title = "татарча" : item == "tw" ? title = "Twi" : item == "ty" ? title = "Reo Mā`ohi" : item == "ug" ? title = "Uyƣurqə" : item == "uk" ? title = "українська" : item == "ur" ? title = "اردو" : item == "uz" ? title = "O'zbek" : item == "ve" ? title = "Tshivenḓa" : item == "vi" ? title = "Tiếng Việt" : item == "vo" ? title = "Volapük" : item == "wa" ? title = "Walon" : item == "wo" ? title = "Wollof" : item == "xh" ? title = "isiXhosa" : item == "yi" ? title = "ייִדיש" : item == "yo" ? title = "Yorùbá" : item == "za" ? title = "Saɯ cueŋƅ" : item == "zh" ? title = "中文" : item == "zu" ? title = "isiZulu" : title=item; return '' + title + '\n'; }

// start parsing if (wgArticleId==0 && wgCanonicalSpecialPageName==false) {       $('#mw-panel').append(' \n In other languages \n  '); $("#interwikis").html("loading interwikis... "); $("#interwikis").getPipe; $('div.loading_iw').replaceWith(' New heading '); }