Custom Interwiki Head

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

Custom Interwiki Head

by 7happy77happy7 09 Nov 2020 15:41

.custom-interwiki {
background: #fff;
box-shadow: 2px 2px 5px #aaa;
}
.custom-interwiki p {
margin: 0;
padding: 0;
}
.custom-interwiki iframe {
transition: height .35s;
}

[[%%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);
}
});
}

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