Ci Inc Head

[[div class="custom-interwiki"]]

Ci Inc Head

by 7happy77happy7 09 Nov 2020 16:07

[[div class="custom-interwiki"]]

The ListPages module does not work recursively.

[[%%content{0}%%html]]
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script>
var Interwiki = {};
Interwiki.default = '%%fullname%%';
Interwiki.query = null;
Interwiki.init = function(callback) {
var data = this.data, lang = Object.keys(data), query = (this.query||this.default).replace(new RegExp('^(' + lang.map(function(l) {return data[l].category;}).filter(function(v) {return v!=='';}).join('|') + ')'),''), prog = 0;
var result = lang.map(function(v,i,a){
try {
var xhr = new XMLHttpRequest(), info = data[v];
xhr.onreadystatechange = function(){
if(xhr.readyState==4){
if(xhr.status!=200) return;
prog++,prog==a.length&&callback(
result.map(function(r,i) {
return JSON.parse(r.responseText).pages.filter(function(p) {
return p.unix_name==(data[lang[i]].category+query);
});
}).map(function(v,i) {
return {res: v.length?v[0]:null, info: data[lang[i]]};
})
)
}
};
xhr.open('GET', '/quickmodule.php?module=PageLookupQModule&s=' + info.id + '&q=' + info.category + query);
xhr.send();
return xhr;
}catch(e) {
console.log(e);
}
});
}

[[%%content{0}%%html]]
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script>
var Interwiki = {};
Interwiki.default = '%%fullname%%';
Interwiki.query = null;
Interwiki.init = function(callback) {
var data = this.data, lang = Object.keys(data), query = (this.query||this.default).replace(new RegExp('^(' + lang.map(function(l) {return data[l].category;}).filter(function(v) {return v!=='';}).join('|') + ')'),''), prog = 0;
var result = lang.map(function(v,i,a){
try {
var xhr = new XMLHttpRequest(), info = data[v];
xhr.onreadystatechange = function(){
if(xhr.readyState==4){
if(xhr.status!=200) return;
prog++,prog==a.length&&callback(
result.map(function(r,i) {
return JSON.parse(r.responseText).pages.filter(function(p) {
return p.unix_name==(data[lang[i]].category+query);
});
}).map(function(v,i) {
return {res: v.length?v[0]:null, info: data[lang[i]]};
})
)
}
};
xhr.open('GET', '/quickmodule.php?module=PageLookupQModule&s=' + info.id + '&q=' + info.category + query);
xhr.send();
return xhr;
}catch(e) {
console.log(e);
}
});
}

Interwiki.data = {"en": {title: "English",name: "English",head: "Languages",url: "http://www.scp-wiki.net/",id: 66711,category: ""},"int": {title: "English",name: "International",head: "Languages",url: "http://scp-int.wikidot.com/",id: 1427610,category: ""},"cn": {title: "Chinese",name: "中文",head: "其他语言",url: "http://scp-wiki-cn.wikidot.com/",id: 530812,category: ""},"fr": {title: "French",name: "Français",head: "Dans d’autres langues",url: "http://fondationscp.wikidot.com/",id: 464696,category: ""},"de": {title: "German",name: "Deutsch",head: "In anderen Sprachen",url: "http://scp-wiki-de.wikidot.com/",id: 1269857,category: ""},"it": {title: "Italian",name: "Italiano",head: "In altre lingue",url: "http://fondazionescp.wikidot.com/",id: 530167,category: ""},"jp": {title: "Japanese",name: "日本語",head: "他言語版",url: "http://ja.scp-wiki.net/",id: 578002,category: ""},"ko": {title: "Korean",name: "한국어",head: "다른 언어",url: "http://ko.scp-wiki.net/",id: 486864,category: ""},"pl": {title: "Polish",name: "Polski",head: "W innych językach",url: "http://scp-wiki.net.pl/",id: 647733,category: ""},"ptbr": {title: "Portuguese",name: "Português",head: "Em outros idiomas",url: "http://scp-pt-br.wikidot.com/",id: 783633,category: ""},"ru": {title: "Russian",name: "Русский",head: "На других языках",url: "http://scpfoundation.net/",id: 169125,category: ""},"es": {title: "Spanish",name: "Español",head: "En otros idiomas",url: "http://lafundacionscp.wikidot.com/",id: 560484,category: ""},"th": {title: "Thai",name: "ภาษาไทย",head: "ภาษาอื่น",url: "http://scp-th.wikidot.com/",id: 547203,category: ""},"ua": {title: "Ukrainian",name: "Українська",head: "Іншими мовами",url: "http://scp-ukrainian.wikidot.com/",id: 1398197,category: ""},"cs": {title: "Czech",name: "Čeština",head: "V jiných jazycích",url: "http://scp-cs.wikidot.com/",id: 2060442,category: ""},"zhtr": {title: "Traditional Chinese",name: "繁體中文",head: "他國語言版本",url: "http://scp-zh-tr.wikidot.com/",id: 3947998,category: "",sp: "unofficial"},"nd": {title: "Danish, Faroese, Norwegian, Swedish",name: "Nordic",head: "På andre sprog/Onnur mál/På andre språk/Språk",url: "http://scp-nd.wikidot.com/",id: 1590804,category: "",sp: "unofficial"},"tr": {title: "Turkish",name: "Türkçe",head: "Diğer diller",url: "http://scpvakfi.wikidot.com/",id: 1431627,category: "",sp: "unofficial"},"vn": {title: "Vietnamese",name: "Tiếng Việt",head: "Ngôn ngữ khác",url: "http://scp-vn.wikidot.com/",id: 836589,category: "",sp: "unofficial"},"el": {title: "Greek",name: "Ελληνικά",head: "Άλλες γλώσσες",url: "http://scp-un.wikidot.com/",id: 2509180,category: "el:",sp: "uli"},"eo": {title: "Esperanto",name: "Esperanto",head: "En aliaj lingvoj",url: "http://scp-un.wikidot.com/",id: 2509180,category: "eo:",sp: "uli"},"hu": {title: "Hungarian",name: "Magyar",head: "Más nyelveken",url: "http://scp-un.wikidot.com/",id: 2509180,category: "hu:",sp: "uli"},"id": {title: "Indonesian",name: "Bahasa Indonesia",head: "Bahasa lain",url: "http://scp-un.wikidot.com/",id: 2509180,category: "id:",sp: "uli"},"io": {title: "Ido",name: "Ido",head: "Altra lingui",url: "http://scp-un.wikidot.com/",id: 2509180,category: "io:",sp: "uli"},"is": {title: "Icelandic",name: "Íslenska",head: "Á öðrum tungumálum",url: "http://scp-un.wikidot.com/",id: 2509180,category: "is:",sp: "uli"},"lt": {title: "Lithuanian",name: "Lietuvių",head: "Kitomis kalbomis",url: "http://scp-un.wikidot.com/",id: 2509180,category: "lt:",sp: "uli"},"lv": {title: "Latvian",name: "Latviešu",head: "Citās valodās",url: "http://scp-un.wikidot.com/",id: 2509180,category: "lv:",sp: "uli"},"nl": {title: "Dutch",name: "Nederlands",head: "In andere talen",url: "http://scp-un.wikidot.com/",id: 2509180,category: "nl:",sp: "uli"},"sl": {title: "Slovenian",name: "Slovenščina",head: "V drugih jezikih",url: "http://scp-un.wikidot.com/",id: 2509180,category: "sl:",sp: "uli"},"sr": {title: "Serbian",name: "Српски / Srpski",head: "На другим језицима",url: "http://scp-un.wikidot.com/",id: 2509180,category: "sr:",sp: "uli"},"yue": {title: "Cantonese",name: "粵語",head: "第啲語言",url: "http://scp-un.wikidot.com/",id: 2509180,category: "yue:",sp: "uli"},"simple": {title: "Simple English",name: "Simple English",head: "Languages",url: "http://scp-un.wikidot.com/",id: 2509180,category: "simple:",sp: "uli"},"za": {title: "Zhuang",name: "Cuengh",head: "其他语言",url: "http://scp-un.wikidot.com/",id: 2509180,category: "za:",sp: "uli"}};

</script>
</head>
<body>
<div class="iw"><div class="head"><input type="text" id="que" spellcheck="false" autocomplete="off" /></div><div id="wrap"></div></div>
<script>
var wrap = document.querySelector('#wrap'), que = document.querySelector('#que');
search();

que.value = Interwiki.default;
que.onkeyup = function(e) {
e.key=='Enter' && search(e.target.value);
}
function search(q=null) {
que.disabled = 1;
Interwiki.query = q;
Interwiki.init(function(ary) {
wrap.innerHTML = '';
ary.filter(function(v) {return v.res}).forEach(function(a) {
var l = document.createElement('a'),
s1 = document.createElement('span'),
s2 = document.createElement('span');
l.appendChild(s1), l.appendChild(s2), wrap.appendChild(l);
l.title = a.info.title;
s1.classList.add('lang'), s2.classList.add('title');
l.href = a.info.url + a.res.unix_name;
l.target = '_parent';
s1.innerHTML = a.info.name;
s2.innerHTML = a.res.title;
})
que.disabled = 0;
})
}

</script>
<style>

/* STYLE */
body {
font-family: sans-serif;
font-size: .8em;
padding: .5em!important;
-webkit-text-size-adjust: 110%;
}
.iw {
padding: 1em .5em;
}
a {
color: #b01;
text-decoration: none;
}

#que, #que[disabled] {
background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%2354595d%22%20fill-rule%3D%22evenodd%22%20d%3D%22M16.474%2015.44c1.147-1.375%201.835-3.21%201.835-5.16a7.98%207.98%200%200%200-8.03-8.03%207.98%207.98%200%200%200-8.03%208.03%207.98%207.98%200%200%200%208.03%208.03c1.72%200%203.21-.46%204.47-1.378l4.473%204.474c.46.46%201.262.46%201.836%200l.69-.688-5.278-5.277zm-11.93-5.16c0-3.21%202.524-5.735%205.735-5.735%203.21%200%205.732%202.524%205.732%205.735%200%203.212-2.524%205.736-5.736%205.736-3.212%200-5.736-2.638-5.736-5.736z%22%2F%3E%3C%2Fsvg%3E");
background-position: left 6px center;
background-repeat: no-repeat;
background-size: 18px;
border: none;
color: #54595d;
display: block;
font-size: 16px;
height: 2rem;
outline: none!important;
padding: .5em 0 .5em 30px;
transition: all .2s ease-in;
width: calc(100% - 30px);
}
#que:focus {
box-shadow: 2px 2px 5px #aaa;
color: #b01;
}

#wrap {
display: flex;
flex-wrap: wrap;
}
#wrap > a {
background: #fff;
border-left: 3px solid#b01;
box-shadow: 0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2), 2px 0px 0px 2px rgba(188,188,188,0.25);
color: #777;
display: block;
flex-grow: 1;
font-weight: bold;
margin: .5em;
min-width: 12em;
overflow: hidden;
padding: .5em;
position: relative;
text-shadow: 0px 1px 1px rgba(255,255,255,0.5);
width: 34%;
}
a > span {
display: inline-block;
}
a > .lang {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
a > .title {
background: #b01;
color: #fff;
display: block;
font-size: 1.25em;
height: 100%;
opacity: 0;
pointer-events: none;
position: absolute;
right: -100%;
text-align: right;
text-overflow: ellipsis;
text-shadow: none;
transition: all .35s ease-in;
overflow: hidden;
white-space: nowrap;
top: 0;
width: 100%;
}
a:hover > .title {
opacity: 1;
right: 0;
}

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License