/*
* addLogsLink
*
* adds a 'logs for this page' link to the navigation bar
* if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
*
* übernommen 1.6.2006 von
* siehe auch ]
*
* ] : Originalversion
* ] 01.06.2006 : Adaptierung für de.wikipedia, Zusatzlog für User:
* ] 02.06.2006 : optional Benutzerbeiträge für User:
* ] 10.07.2006 : für User: zusätzlich noch Stats und Stimmrechtcheck
* ] 23.08.2006 : Browse-Button
* ] 25.08.2006 : angepasst für commons
* ] 28.09.2006 : wg-Variablen statt RegExps
* ] 18.10.2006 : optional: Browsen im Userspace via Prefixindex
* ] 15.01.2007 : umgestellt auf addPortletLink aus wikibits.js
* ] 05.03.2007 : plus Link auf Toolserver-Tool für erstellte Artikel
* ] 16.04.2007 : plus Link auf Toolserver-Tool für gelöschte Edits
* ] 08.05.2007 : Stimmrecht/Schiedsgericht
* ] 18.07.2007 : interner Parameter für verschiedene Editcounter
* ] 08.08.2007 : User:Gallery eingefügt
* ] 06.12.2007 : DaB.-Usercounter statt Interiot-Usercounter (besser wäre: beide)
* ] 04.01.2008 : Yet another edit counter (Interiot wieder Default)
* ] 03.09.2009 : Yet another edit counter (Soxred, now Default)
* ] 02.01.2010 : BrowseDel-Button
* ] 29.01.2015 : Toolserver-Skripte rausgeworfen
*/
// <nowiki>
function addLogsLink() {
// Variables that should be defined in your monobook
if (typeof(pagelogtext) == 'undefined')
pagelogtext = "Page:Log";
if (typeof(userlogtext1) == 'undefined')
userlogtext1 = "User:Log:1";
if (typeof(userlogtext2) == 'undefined')
userlogtext2 = "User:Log:2";
if (typeof(addusercontriblink) == 'undefined')
addusercontriblink = true;
if (typeof(usercontribtext) == 'undefined')
usercontribtext = "User:Contribs";
if (typeof(userdeledittext ) == 'undefined')
userdeledittext = "User:DelEdits";
if (typeof(userstatstext) == 'undefined')
userstatstext = "User:Stats";
if (typeof(usergallerytext) == 'undefined')
usergallerytext = "User:Gallery";
if (typeof(userstimmrechttext) == 'undefined')
userstimmrechttext = "User:Stimmrecht";
if (typeof(adduserarticlelink) == 'undefined')
adduserarticlelink = true;
if (typeof(userarticletext) == 'undefined')
userarticletext = "User:Articles";
if (typeof(addbrowselink) == 'undefined')
addbrowselink = true;
if (typeof(browseuserprefix) == 'undefined')
browseuserprefix = true;
if (typeof(browsetext ) == 'undefined')
browsetext = "Browse";
if (typeof(addbrowsedellink) == 'undefined')
addbrowsedellink = false;
if (typeof(browsedeltext ) == 'undefined')
browsedeltext = "BrowseDel";
if (typeof(addiusagelink) == 'undefined')
addiusagelink = false;
if (typeof(imgusagetext) == 'undefined')
imgusagetext = "IMG:C-Usage";
if (typeof(adminflag) == 'undefined')
adminflag = false;
if (typeof(userstatstype) == 'undefined')
userstatstype = "xt";
if (typeof(userarticletype) == 'undefined')
userarticletype = "x";
// -----------------------------------------------------------------------------
// Language support
// -----------------------------------------------------------------------------
var wikiLanguageType = mw.config.get('wgContentLanguage');
if ( mw.config.get('wgServer') == "//commons.wikimedia.org" )
wikiLanguageType = 'commons';
var urlstub = mw.config.get('wgServer') + mw.config.get( 'wgScriptPath' ) + "/index.php?title=Special%3A";
var contribstub = mw.config.get('wgServer') + "https://wikines.com/de/Special:Contributions/";
var nsprefixuser = "User";
switch (wikiLanguageType) {
case 'de':
case 'bar':
nsprefixuser = "Benutzer";
break;
case 'fr':
nsprefixuser = "Utilisateur";
break;
case 'es':
nsprefixuser = "Usuario";
break;
case 'it':
nsprefixuser = "Utente";
break;
case 'pt':
nsprefixuser = "Usu%C3%A1rio";
break;
}
var logstub = urlstub + "Log";
var allpstub = urlstub + "Allpages";
var prefistub = urlstub + "Prefixindex";
var undelstub = urlstub + "Undelete";
// get page title
pagetitle = mw.config.get('wgPageName');
spagetitle = mw.config.get('wgTitle');
// do real spaces; fix for lemmas with '&'
ptitle = pagetitle.split('_').join(' ').split('&').join('%26');
sptitle = spagetitle.split('_').join(' ').split('&').join('%26');
// if this is userspace: get the user
if (( mw.config.get('wgNamespaceNumber') == 2 ) || ( mw.config.get('wgNamespaceNumber') == 3 )) {
// thankfully, usernames may not contain '/'
uservisited = sptitle.split('/');
}
// get tabs portlet
tabs = "p-tb";
// if this is a user, show the logs for the user (in addition to the page log)
if (( mw.config.get('wgNamespaceNumber') == 2 ) || ( mw.config.get('wgNamespaceNumber') == 3 )) {
url = logstub + "&user=" + uservisited;
mw.util.addPortletLink(tabs, url, userlogtext1, "t-u1logs");
url = logstub + "&page=" + nsprefixuser + ":" + uservisited;
mw.util.addPortletLink(tabs, url, userlogtext2, "t-u2logs");
if (addusercontriblink) {
// Link auf Contribs
if (document.getElementById("t-contributions"))
document.getElementById("t-contributions").getElementsByTagName("a").innerHTML = usercontribtext;
else {
url = contribstub + uservisited;
mw.util.addPortletLink(tabs, url, usercontribtext, "t-contributions");
}
if (adminflag == true) {
// Link auf Deleted Edits
url = urlstub + "DeletedContributions&limit=500&target=" + uservisited;
mw.util.addPortletLink(tabs, url, userdeledittext, "t-userdeledits");
}
// defaulting removed tools to new ones
if ((userstatstype == "dab") ||
(userstatstype == "interiot") ||
(userstatstype == "kate") ||
(userstatstype == "misza") ||
(userstatstype == "soxred") ||
(userstatstype == "soxredp") ||
(userstatstype == "soxredquick") ||
(userstatstype == "tparis") ||
(userstatstype == "wannabe_kate") ||
(userstatstype == "yaec")) {
userstatstype = "xt";
}
if ((userarticletype == "escaladix") ||
(userarticletype == "soxred") ||
(userarticletype == "tparis")) {
userarticletype = "x";
}
// Link auf Userstatistik
if (userstatstype == "super") {
url = "//tools.wmflabs.org/supercount/index.php?user=" + uservisited
+ "&project=" + wikiLanguageType + "." + ((wikiLanguageType == 'commons') ? "wikimedia" : "wikipedia" ) + ".org&toplimit=50";
}
else if (userstatstype == "quick") {
url = "//tools.wmflabs.org/magnustools/quick_counter.php?user=" + uservisited
+ "&project=" + wikiLanguageType + "." + ((wikiLanguageType == 'commons') ? "wikimedia" : "wikipedia" );
}
else if (userstatstype == "x") {
url = "//tools.wmflabs.org/xtools/pcount/index.php?name=" + uservisited
+ "&lang=" + wikiLanguageType + "&wiki=" + ((wikiLanguageType == 'commons') ? "wikimedia" : "wikipedia" );
}
else if (userstatstype == "xt") {
url = "//tools.wmflabs.org/xtools-ec/index.php?user=" + uservisited
+ "&project=" + wikiLanguageType + "." + ((wikiLanguageType == 'commons') ? "wikimedia" : "wikipedia" ) + ".org";
}
mw.util.addPortletLink(tabs, url, userstatstext, "t-userstats");
// Link auf Bildergalerie
url = "http://toolserver.org/~daniel/WikiSense/Gallery.php?wikilang=" + wikiLanguageType + "&wikifam=.wikipedia.org"
+ "&format=html&img_user_text=" + uservisited + "&order=-img_timestamp";
mw.util.addPortletLink(tabs, url, usergallerytext, "t-usergallery");
// no idea whether the "stimmberechtigung" tool works for databases other than dewiki_p
if (wikiLanguageType == 'de') {
url = "//tools.wmflabs.org/stimmberechtigung/?user=" + uservisited +
"&day=" + Tag + "&mon=" + Monat + "&year=" + Jahr +
"&hour=" + jetzt.getHours() + "&min=" + jetzt.getMinutes();
mw.util.addPortletLink(tabs, url, userstimmrechttext, "t-stimmrecht");
}
}
// Link auf User-Neuanlagen
if (adduserarticlelink) {
if (userarticletype == "x") {
url = "//tools.wmflabs.org/xtools/pages/index.php?name=" + uservisited
+ "&lang=" + wikiLanguageType + "&wiki=" + ((wikiLanguageType == 'commons') ? "wikimedia" : "wikipedia" ) + "&namespace=0&redirects=noredirects&getall=1";
}
mw.util.addPortletLink(tabs, url, userarticletext, "t-userarticles");
}
}
// show the page log (always)
if ( mw.config.get('wgCanonicalNamespace') != "Special" ) {
url = logstub + "&page=" + ptitle;
mw.util.addPortletLink(tabs, url, pagelogtext, "t-logs");
}
// if this is a media file, show usage stats
if (addiusagelink) {
if ( mw.config.get('wgCanonicalNamespace') == "File" ) {
url = "http://toolserver.org/~daniel/WikiSense/CheckUsage.php?i=" + sptitle + "&w=_100000#end";
mw.util.addPortletLink(tabs, url, imgusagetext, "t-imgusage");
}
}
// show the browse button (conditional)
if (addbrowselink) {
if ( mw.config.get('wgCanonicalNamespace') != "Special") {
if ((browseuserprefix) && (( mw.config.get('wgNamespaceNumber') == 2 ) || ( mw.config.get('wgNamespaceNumber') == 3 )))
url = prefistub + "&prefix=" + uservisited + "/&namespace=" + mw.config.get('wgNamespaceNumber');
else
url = allpstub + "&from=" + sptitle + "&namespace=" + mw.config.get('wgNamespaceNumber');
mw.util.addPortletLink(tabs, url, browsetext, "t-browse");
}
}
// show the browse-del button (conditional)
if ((addbrowsedellink) && (adminflag)) {
if ( mw.config.get('wgCanonicalNamespace') != "Special" ) {
url = undelstub + "&prefix=" + ptitle ;
mw.util.addPortletLink(tabs, url, browsedeltext, "t-browsedel");
}
}
}
$(document).ready(addLogsLink);
// </nowiki>