User:Beleg Tâl/TranscludedIn.js

/* SCRIPT THATS ADDS ONE OR MORE TABS, IN NAMESPACE PAGE, THAT POINT TO THE TEXTS THAT TRASCLUDE THAT PAGE * * Instructions to install in your Wikisource subdomain: * * in your MediaWiki:Common.js, add (and translate in your language) the following lines: mw.loader.load('//en.wikisource.org/w/index.php?title=User:Beleg Tâl/TranscludedIn.js&action=raw&ctype=text/javascript');

function api_embeddedin(eititle,einamespace) { eititle = eititle || mw.config.get('wgPageName'); einamespace = einamespace || '0'; var api_url=["/w/api.php?action=query", "format=json", "list=embeddedin", "einamespace="+einamespace, "eititle="+eititle].join("&"); var result=JSON.parse($.ajax({url:api_url,async:false}).responseText); return result.query.embeddedin; } function embeddedin_run { if (mw.config.get('wgCanonicalNamespace')=="Page") { var linkedNs0=api_embeddedin; for (var i=0;i ' + ''; if (linkedNs0.length > 1) html += ' '+(i+1)+' '; html += ' '; $(html).appendTo($("#p-namespaces ul")); }   var linkedNs0=api_embeddedin(null,114); for (var i=0;i ' + ''; if (linkedNs0.length > 1) html += ' '+(i+1)+' '; html += ' '; $(html).appendTo($("#p-namespaces ul")); } } }

$(document).ready(embeddedin_run);