User:Platonides/monobook.js

From Wikimedia Commons, the free media repository
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.
/*** Start of [[User:Platonides/antiXSS.js]] ***/

/* This must be substed on [[Special:Mypage/monobook.js|your monobook]] to work.

<nowiki>{{subst:</nowiki>User:Platonides/antiXSS.js<nowiki>}}</nowiki>
*/

//Detects XSS from bad urls, using your scripts.

//Guard from outside attacks:
if (getParamValue('fakeaction') || getParamValue('script')) {
  //Some of these 'compromised' parameters were set (i.e. it's not null)
  if (document.referrer.length > 0) { //Length 0 is if you typed it on the url bar
      if (document.referrer.indexOf(wgServer) != 0) {
         //Previous url doesn't start with this server
         //ALERT ALERT ALERT
         alert("Posible XSS injection detected. JavaScripts stopped");
         throw("Stopped to avoid XSS injection");
      }
   }
}

//Guard from local URLs:
importScript("User:Platonides/antilocalXSS.js");
/*** End of [[User:Platonides/antiXSS.js]] ***/

//Irc links
mw.loader.load("//es.wikipedia.org/w/index.php?title=Usuario:Platonides/irc_links.js&action=raw&ctype=text/javascript&dontcountme=s");

//Fast delete
mw.loader.load("//es.wikipedia.org/w/index.php?title=Usuario:Platonides/deleteReason.js&action=raw&ctype=text/javascript&dontcountme=s");


importScript("MediaWiki:Quick-delete.js"); //[[MediaWiki talk:Quick-delete.js]]

//<nowiki>

var tab_wikipedia = "en";
//Desactivar plantillas
mwCustomEditButtons[mwCustomEditButtons.length] =
        {"imageFile": '//upload.wikimedia.org/wikipedia/commons/2/21/Button_invalid_template.png',
         "speedTip": 'Desactiva plantilla',
         "tagOpen": '<s><nowiki>',
         "tagClose": '<\/nowiki><\/s>',
         "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] =
        {"imageFile": '//upload.wikimedia.org/wikipedia/commons/archive/7/79/20061003122938%21Button_reflink.png',
         "speedTip": 'Please link images',
         "tagOpen": '{{Please link images}}',
         "tagClose": '\n\n~~~~',
         "sampleText": ""};
hookEvent("load", function() {
    if (document.getElementById('toolbar')) {
        var image = document.createElement("img");
    image.className = "mw-toolbar-editbutton";
    image.src = '//upload.wikimedia.org/wikipedia/commons/thumb/5/52/Flickr_wordmark.svg/40px-Flickr_wordmark.svg.png';
    image.border = 0;
    image.alt = 'Flickr review';
    image.title = 'Flickr review';
    image.style.cursor = "pointer";
    image.onclick = function() {
                var Name = 'Flickr';
                re = new RegExp('{{User:FlickreviewR/reviewed-error.*}}',"g");
                var newtext = document.getElementById("wpTextbox1").value.replace(re,"");
                if ( document.getElementById("wpTextbox1").value != newtext ) {
                   document.getElementById("wpTextbox1").value = newtext;
                   insertTags("", '\n{{flickrreview|' + mw.config.get('wgUserName') + '|{{subst:CURRENTDAY}} {{SUBST:CURRENTMONTH}} {{subst:CURRENTYEAR}}}}', "");
                }
                var matches = document.getElementById("wpTextbox1").value.match(/\n?{{(([^{]+)[Rr]eview)}}/);
                if ( matches ) {
                    Name = matches[2];
                    site = document.getElementById("wpTextbox1").value.match(/\|[Ss]ource=(.*)/);
                    site = site ? '|site=' + site[1] : '|site= ' ;
                    if ( Name == 'Flickr' ) site = '';
                    document.getElementById("wpTextbox1").value = document.getElementById("wpTextbox1").value.replace(matches[0], "\n{{" + matches[1] + site + "|user=" + mw.config.get('wgUserName') + "|date={{subst:#time: Y-m-d }}}}");
                }
                document.getElementById("wpSummary").value += Name + " reviewed";
        return false;
    };

    document.getElementById('toolbar').appendChild(image);
     }
});

//For copying the image name
//hookEvent("load", function() {document.getElementById('content').getElementsByTagName('h1')[0].innerHTML=document.getElementById('content').getElementsByTagName('h1')[0].firstChild.data.replace(RegExp(' ',"g"), '<span style="color:white">_</span>')});

var botones = "";
//Reemplazar
mw.loader.load("//es.wikipedia.org/w/index.php?title=Usuario:Platonides/reemplazar.js&action=raw&ctype=text/javascript");

importScript("User:Platonides/addbutton2toolbar.js");

importScript('User:Platonides/PD-Meyers.js');

importScript("User:Platonides/addText2List.js");

importScript("MediaWiki:Gadget-ImageBoxes.js");
importScript("MediaWiki:ResizeGalleries.js");
//importScript("MediaWiki:UserMessages.js");
importScript("MediaWiki:HotCat.js");
importScript('MediaWiki:Gadget-ThumbnailPurger.js');
importScript('MediaWiki:Check-usage.js');
importScript('MediaWiki:MyLangNotify.js');
importScript('User:Magnus_Manske/category_intersection.js');
importScript('User:Platonides/LookFlickr.js');

/*
var disable_counter = 0;

document.write('<script type="text/javascript" src="/w/index.php?title=User:Platonides/PageCounter.js&action=raw&ctype=text/javascript"><\/script>');
*/

//Ejemplo de añadir botón:
//hookEvent("load", function() { AddButtonToolbar("//commons.wikimedia.org/skins-1.5/common/images/button_math.png", "hola", function() { alert("Hola"); return false; }); } );

hookEvent("load", function() { AddButtonToolbar("//upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Stop_hand.svg/23px-Stop_hand.svg.png", "Yo lo disputo", function() { document.getElementById('wpTextbox1').value +="\n\n{{User:Platonides/disputed}}"; document.getElementById('wpSummary').value = 'Disputed'; return false; }); } );

/*
hookEvent("load", function() { AddButtonToolbar("http://upload.wikimedia.org/wikipedia/commons/thumb/6/65/MaskAgamemnon.png/23px-MaskAgamemnon.png", "ΦΕΚ: Β 1491 20051027", function() {
EditReplace("{{copyvio}}\nUnder Ministerial Decision of the Hellenic Republic (ΦΕΚ: Β 1491 20051027) all the royalties and copyright to this picture reside within the Archaeological Receipts Fund (TAP) of the Greek Ministry of Culture. You should attribute this copyright at all times, and specify the name and location of the monument and archaeological site or museum. You should also have applied for and have acquired license of use.", "{{Commons:Deletion requests/ΦΕΚ: Β 1491 20051027/tag}}"); 
*/

hookEvent("load", function() { if (document.getElementById('wpConfirmB'))
   document.getElementById('wpConfirmB').parentNode.innerHTML = document.getElementById('wpConfirmB').parentNode.innerHTML.replace(">", " accesskey='s'>"); } );

hookEvent("load", function() { if (wgTitle.match("De Lieder Sprüche Württembergs .*.png") && (wgAction == "delete")) { document.getElementById('wpReason').value = "Uploaded as jpg because of thumbnail issue" } } );

hookEvent("load", function() { if (wgNamespaceNumber == 6) { mw.util.addPortletLink( 'p-tb', 'http://commons.wikimedia.org/w/api.php?format=xml&action=query&prop=imageinfo&iiprop=url|timestamp|user|comment|url|size|sha1|mime|metadata|bitdepth&iilimit=100&titles=' + wgPageName, "API"); } } );

importScript ('MediaWiki:Gadget-ImageAnnotator.js');
importScript ('User:Platonides/Notifier.js');
importScript ('User:Platonides/rotateImage.js');

//</nowiki>
//[[User:Platonides/PageCounter.js]]