« MediaWiki:Common.js » : différence entre les versions

aucun résumé des modifications
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
/* Any JavaScript here will be loaded for all users on every page load. */
function DeluxeBar() {
 
  /* <nowiki> nowiki pour ne pas interprêter les caractères spéciaux de MediaWiki */
var isViewingMainPage = (/^MediaWiki(\/.+)? - MediaWiki$/.test(document.title));
  if (document.createTextNode) {
if (isViewingMainPage) {
        var toolbar = document.getElementById("toolbar");  
  document.write('<style type="text/css">/*<![CDATA[*/ #lastmod, #siteSub, h1.firstHeading { display: none !important; } #content { padding-top: 1em; }/*]]>*/</style>');
        if (!toolbar) return;
}
 
/* Force preview for anons */
/* by Marc Mongenet, 2006, fr.wikipedia */
 
function forcePreview() {
  if (wgUserName != null || wgAction != "edit") return;
  saveButton = document.getElementById("wpSave");
  if (!saveButton) return;
  saveButton.disabled = true;
  saveButton.value = "Save page (use preview first)";
  saveButton.style.fontWeight = "normal";
  document.getElementById("wpPreview").style.fontWeight = "bold";
}
addOnloadHook(forcePreview);
 
/* End of forcePreview */
 
/** includePage ************
* force the loading of another JavaScript file
*
* Maintainer: [[Commons:User:Dschwen]]
*/
   
   
function includePage( name )
        ///// zone personnalisable ////
{
        var messages = new Array()
  document.write('<script type="text/javascript" src="' + wgScript + '?title='
        var images = new Array()
  + name
        var commentaires = new Array() 
  + '&action=raw&ctype=text/javascript"><\/script>'
   
);
        //messages.push("texte dans la boîte d'édition");
}
        //commentaires.push("titre du résumé");
/* End of includePage */
        //images.push("http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png (image");
 
 
        messages.push("{{subst:Bienvenue}}-~~~~");
/* Including extra .js pages */  
        commentaires.push("Bienvenue !");
 
        images.push("http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png");
// switches for scripts
// TODO: migrate to JSConfig
        ////////////////////////////////
// var load_extratabs = true;
var load_edittools = true;
        for (var i=0;i<messages.length;i++) {
 
                var img = document.createElement("img");
// extra drop down menu on editing for adding special characters
                img.setAttribute("src", images[i]);
includePage( 'MediaWiki:Edittools.js' );
   
 
                var ref = document.createElement("a");
/* End of extra pages */
                ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" +
 
                                "javascript:changeSummary(\"" + commentaires[i] + "\");" );
var button = {
                ref.appendChild(img);  
        "imageFile": "images/citation.jpg",  //image to be shown on the button (may be a full URL too), 22x22 pixels
        "speedTip": "bloc de citation",   //text shown in a tooltip when hovering the mouse over the button
                toolbar.appendChild(ref);
        "tagOpen": "<blockquote>",       //the text to use to mark the beginning of the block
        }
        "tagClose": "</blockquote>",      //the text to use to mark the end of the block (if any)
  }
        "sampleText": "bloc de citation"  //the sample text to place inside the block
  /* </nowiki> fin nowiki */
};
}
mwCustomEditButtons.push(button);
14 365

modifications