/* ******** wikitools.js ******** */
//
// Usage:
// Just put the following line
// mw.loader.load('user:cepheiden/wikitools.js');
// without the beginning "// " to your ] or ]
//
// Description:
// * add an new entry in the pull-down menu for a fast access to the wikiblame tool
// * add an new entry in the pull-down menu for a fast access to the article traffic tool
// * add an new entry in the pull-down menu for a fast access to the contributors tool
// * add an new entry in the pull-down menu for a fast access to the templatetiger tool
// * add an new entry in the pull-down menu for a fast access to languagetool
// * add an new entry in the pull-down menu for a fast access to the article info page
//
// Authors:
// * Cepheiden (de-Wiki)
//
// Dual-licensed under the terms of the GFDL v1.2 or the GPL v2.
function openinnewwindow(URL) {
alert(URL);
newDocument= window.open(URL, '_blank');
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// In all namespaces
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (wgNamespaceNumber>=0) {
addOnloadHook(function () {
var item_id = "ca-separator";
var item_title = '---------';
mw.util.addPortletLink('p-cactions', '', item_title, item_id);
});
// Wikiblame
addOnloadHook(function () {
var item_id = "ca-wikiblame";
var item_title = 'WikiBlame';
var item_tooltip = 'Search for the origin of a text fragment';
if(wgUserLanguage=='de'){
item_title = 'WikiBlame';
item_tooltip = 'Suche nach dem Ursprung eines Textfragments.';
}
var url = 'http://wikipedia.ramselehof.de/wikiblame.php?user_lang=de&lang='+wgContentLanguage+'&project='+wgNoticeProject+'&article='+wgPageName+'&skipversions=0&ignorefirst=0&limit=500&order=desc&searchmethod=int';
var portletLink = mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
// Bind click handler
//$( portletLink ).click( function ( e ) {
// e.preventDefault();
// // doSomeStuff();
// alert( 'It works!' );
// //newDocument= window.open(url, '_blank');
//});
// Article traffic
addOnloadHook(function () {
var item_id = "ca-traffic";
var item_title = 'Article traffic';
var item_tooltip = 'Article traffic statistics for '+wgPageName;
if(wgUserLanguage=='de'){
item_title = 'Aufrufstatistik';
item_tooltip = 'Aufrufstatistik für '+wgPageName;
}
currentDate= new Date();
currentYear= currentDate.getFullYear();
currentMonth= currentDate.getMonth()+1;
if(currentMonth<10) currentMonth= "0" + currentMonth;
var url = 'http://stats.grok.se/'+wgContentLanguage+'/latest60/'+wgPageName;
//mw.util.addPortletLink('p-cactions', 'javascript:openinnewwindow('+url+')', item_title, item_id, item_tooltip);
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
// Contributors
addOnloadHook(function () {
var item_id = "ca-contributors";
var item_title = 'Contributors';
var item_tooltip = 'Contributors of the article '+wgPageName;
if(wgUserLanguage=='de'){
item_title = 'Bearbeiter';
item_tooltip = 'Bearbeiter des Artikels '+wgPageName;
}
var url = 'http://toolserver.org/~daniel/WikiSense/Contributors.php?wikilang='+wgContentLanguage+'&wikifam=.wikipedia.org&page='+wgPageName+'&since=&until=&order=-rev_timestamp&max=100&format=html';
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
// languagetool
addOnloadHook(function () {
var item_id = "ca-languagetool";
var item_title = 'LanguageTool';
var item_tooltip = 'LanguageTool analysis of the article '+wgPageName;
if(wgUserLanguage=='de'){
item_title = 'LanguageTool';
item_tooltip = 'LanguageTool-Analayse des Artikels '+wgPageName;
}
var url = "http://community.languagetool.org/wikiCheck/pageCheck?lang=de&url=" + encodeURIComponent("https://de.wikipedia.orghttps://wiki95.com/de/"+wgTitle);
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
// Anzahl der Beobachter
addOnloadHook(function () {
var item_id = "ca-watchers";
var item_title = 'ºº';
var item_tooltip = 'Watchers of the article '+wgPageName;
if(wgUserLanguage=='de'){
item_title = 'ºº';
item_tooltip = 'Anzahl der Beobachter des Artikels '+wgPageName;
}
// OLD var url = "//toolserver.org/~mzmcbride/cgi-bin/watcher.py?db=dewiki_p&titles=" + wgPageName;
var url = "//de.wikipedia.org/w/index.php?action=info&title=" + wgPageName + "#mw-pageinfo-watchers";
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Vorlagen
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TemplateTiger-Parameterauswertung
if (wgNamespaceNumber == 10) {
addOnloadHook(function () {
var item_id = "ca-templatetiger";
var item_title = 'TemplateTiger';
var item_tooltip = 'TemplateTiger';
if(wgUserLanguage=='de'){
item_title = 'TemplateTiger';
item_tooltip = 'TemplateTiger-Parameterauswertung';
}
//var url = "//toolserver.org/~kolossos/templatetiger/template-parameter.php?lang=dewiki&template=" + encodeURIComponent(wgTitle);
var url = "//tools.wmflabs.org/templatetiger/template-parameter.php?lang=dewiki&template=" + encodeURIComponent(wgTitle);
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Dateien
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Frühere Einbindung eines Bildes anhand nachfolgender Edits des Uploaders erraten
if (wgNamespaceNumber == 6) {
addOnloadHook(function () {
var item_id = "ca-afterupload";
var item_title = '?';
var item_tooltip = 'Find previous use of '+wgPageName;
if(wgUserLanguage=='de'){
item_title = '?';
item_tooltip = 'Frühere Verwendung von '+wgPageName + 'erraten';
}
var url = "//toolserver.org/~revolus/afterUpload/?lang=de&project=de.wikipedia.org&image=" + encodeURIComponent(wgTitle);
mw.util.addPortletLink('p-cactions', url, item_title, item_id, item_tooltip);
});
}