User:Codeispoetry/monobook.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
![]() | The accompanying .css page for this skin is at User:Codeispoetry/monobook.css. |
// Funktion: importPage()
// zum Einbinden der Module
function importPage(seite, lang) { // all languages support
if(!lang) lang = wgContentLanguage;
// new version
mw.loader.load('http://' + lang + '.wikipedia.org' + wgScriptPath + '/index.php?title=' + seite + '&action=raw&ctype=text/javascript&smaxage=10000');
return false;
}
importPage('Benutzer:D/monobook/api.js', 'de');
var keeplogo = true;
var releasequickbar = true;
var qbfontsize = 75; // Schriftgröße im QuickBar (relativ in Prozent)
var user = wgUserName ; // username wird automatisch übernommen
// get URL parameters (used for page type variables)
var UrlParameters = new Array ();
readparams();
function readparams() {
var asReadInUrlParameters;
var asReadInUrlParameter;
// Get URL parameters
asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
for (i = 0; i < asReadInUrlParameters.length; i++) {
asReadInUrlParameter = asReadInUrlParameters[i].split("=");
UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
}
}
// page type variables: namespaces
var isArticle = (wgNamespaceNumber == 0);
var isArticleTalk = (wgNamespaceNumber == 1);
var isBild = (wgCanonicalNamespace == "Image");
var isCategory = (wgCanonicalNamespace == "Category");
var isTemplate = (wgCanonicalNamespace == "Template");
var isGeneric = false;
if ((!isBild) && (!isCategory) && (!isTemplate))
isGeneric = true;
var isProject = (wgCanonicalNamespace == "Project");
// page type variables: namespace == -1
var isSpecial = (wgCanonicalNamespace == "Special");
var isRestore = (isSpecial && (wgCanonicalSpecialPageName == "Undelete"));
var isContrib = (isSpecial && (wgCanonicalSpecialPageName == "Contributions"));
var isWatchlist = (isSpecial && (wgCanonicalSpecialPageName == "Watchlist"));
// page type variables: namespace == -1
var isTalk = (!isSpecial && isOdd(wgNamespaceNumber));
// page type variables: other stuff
var isPHP = (document.URL.indexOf('index.php') > 0);
var isDiff = UrlParameters['diff'];
var isEdit = ((UrlParameters['action']=='edit') || (UrlParameters['action']=='submit'));
var isHistory = (UrlParameters['action']=='history');
// ------------
// Some stuff
function Init () {
document.getElementById('searchform').target = '_blank'; //search in new page
if (UrlParameters['subject']!=undefined && UrlParameters['text']!=undefined && UrlParameters['wo']!=undefined)
insertText(UrlParameters['text'], eval(UrlParameters['wo']), UrlParameters['subject'], UrlParameters['autoedit']);
mw.util.addPortletLink('p-personal', "http://de.wikipedia.org/wiki/Special:Watchlist", 'de', 'pt-de', 'Watchlist auf Wikipedia-de', '', document.getElementById('pt-userpage'));
ins_li = document.createElement('li');
ins_li.innerHTML = '<a accesskey="q" title="Liste aller Spezialseiten [ctrl-q]" href="/wiki/Special:Specialpages">Spezialseiten</a></li>'
document.getElementById('n-portal').parentNode.insertBefore(ins_li,document.getElementById('n-portal'));
//Eigene Boxen
if (!isSpecial)
{
ins_box = document.createElement('div');
ins_box.className = 'portlet';
ins_box.innerHTML = '<h5>allgemein</h5><div class="pBody"><ul>' +
'<li id="t-en"><a href="http://en.wikipedia.org/wiki/' + wgTitle + '" title="Artikel in en" >Englischer Artikel</a></li>' +
'</ul></div>';
document.getElementById('p-participate').parentNode.insertBefore(ins_box,document.getElementById('p-tb'));
}
if ((isUser || isUserTalk) && wgPageName.indexOf('/')==-1)
{
ins_box = document.createElement('div');
ins_box.className = 'portlet';
ins_box.innerHTML = '<h5>benutzer</h5><div class="pBody"><ul>' +
'<li id="t-contributions"><a href="/wiki/Special:Contributions/' + wgTitle + '" title="Beiträge">Benutzerbeiträge</a></li>' +
'<li id="t-log"><a href="/w/index.php?title=Special:Log&user=' + wgTitle + '">Logbücher</a></li>' +
'<li id="t-emailuser"><a href="/wiki/Special:Emailuser/' + wgTitle + '" title="E-Mail senden">E-Mail senden</a></li>' +
'</ul></div>';
document.getElementById('p-participate').parentNode.insertBefore(ins_box,document.getElementById('p-tb'));
}
}
addOnloadHook(Init);
importScript('User:Codeispoetry/helperFunctions.js');
importPage('User:Codeispoetry/helperFunctions.js', 'de');
importPage('User:Codeispoetry/supportFuncs.js', 'de');
importPage('User:Codeispoetry/checkDupes.js', 'de');
importScript('User:Codeispoetry/filePortlet.js');
importScript('User:Codeispoetry/catPortlet.js');
importPage('User:Codeispoetry/admin.js', 'de');
importPage('User:Codeispoetry/quickbar.js','de');
importPage('User:Codeispoetry/rollback.js','de');
importScript('User:Codeispoetry/addEditAndRevertLinks.js');
importScript('User:Codeispoetry/markAdmins.js')
importScript('MediaWiki:Delete.js'); //[[MediaWiki:Delete.js]]
importScript('MediaWiki:DeleteLinking.js'); //[[MediaWiki:DeleteLinking.js]]
importScript('MediaWiki:Duplicate.js'); //[[MediaWiki:Duplicate.js]]
function fillActionPage() {
if (UrlParameters['wpReason'] > "") {
document.forms[0].wpReason.value = UrlParameters['wpReason'].replace(/\+/g, " ");
if (wgCanonicalNamespace != "Image") {
window.setTimeout(function() { document.getElementById("deleteconfirm").wpConfirmB.click(); }, 100);
} else {
window.setTimeout(function() {
var inputs = document.getElementsByTagName("input");
for (i=0; i<inputs.length; i++) {
if ((inputs[i].getAttribute('type') == 'submit') && ((inputs[i].getAttribute('value') == 'Löschen') || (inputs[i].getAttribute('value') == 'Delete'))) {
inputs[i].click();
}
}
}, 100);
}
}
window.setTimeout(function() { window.close(); }, 500);
}
if (UrlParameters['wpReason'] > "") {
addOnloadHook(fillActionPage);
}
function buildQuickbar() { // DerHexer
if (!deletekeep3) deletekeep3 = '';
if (!duplicate3) duplicate3 = '';
addNewBarSection ('Delete with linking');
w (4,"AdminActions.deletePage('[[Commons:Licensing|Copyright violation]]');","Copyvio");
w (4,"AdminActions.deletePage('User request');","User");
w (4,"AdminActions.deletePage('Spam');","Spam");
w (4,"AdminActions.deletePage('Orphaned talk page');","Orphan-talk");
w (4,"AdminActions.deletePage('Housekeeping');","Housekeeping");
w (4,"var grund = prompt('Löschgrund?'); if (grund) AdminActions.deletePage(grund);","Begründung");
if (deletekeep3) {
addNewBarSection ('Scripts for COM:DR');
w (4,"deleteimage();","delete","","+deleted image");
w (4,"keepimage();","keep","","+kept image");
w (4,"deleteimage(true);","delete_auto","","+autodelete image");
}
if (duplicate3) {
addNewBarSection ('Duplicate');
w (4,"duplicate();","duplicate","","+duplicated images");
}
}
addOnloadHook (function () {createBar(); buildQuickbar(); if (scrpt > '') {
document.write('<script> function _doopt (was) { switch (was) {', scrpt, '}}<\/script>');
scrpt='';
}});
function isEven(myNumber) {
return (myNumber % 2 == 0);
}
function isOdd(myNumber) {
return (! isEven(myNumber));
}
function duplicate() { // DerHexer
var lemma = getLemma();
lemma = lemma.replace(/Image:/, '');
var tables = document.getElementsByTagName("table");
for (i=0; i<tables.length; i++) {
var as = tables[i].getElementsByTagName("a");
for (j=0; j<as.length; j++) {
if (as[j].getAttributeNode("href").childNodes[0].nodeValue == '/wiki/Category:Duplicate') {
var duplicate2 = as[j+1].getAttributeNode("title").childNodes[0].nodeValue.replace(/Image:/, '');
break;
}
}
}
var uri = 'http://commons.wikimedia.org/w/index.php?title=User:CommonsDelinker/commands&action=edit&addarticle=' + lemma + '&duplicate=' + duplicate2;
window.open(uri);
}