User:Lilyu/Editbar2.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.
//<nowiki> 


/*function calldate()
{
      m = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
      today = new Date();
      year = today.getYear() + 1900;

return m[today.getMonth()]+' '+year;
}*/

/*
//pour les ajouts au moment du loading. (fonctionel mais vide)
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) 
{
   
} //end of ajouts
*/
 


/******************************************************************************************************/

/* remove buttons */
 
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) 
{

    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'advanced'});
    });

   /* $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'characters'});
    });*/

    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'Edittools'});
    });

    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'help'});
    });

    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main','group': 'format'});
    });
    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main','group': 'insert', 'tool': 'link'});
    });
    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main','group': 'insert', 'tool': 'reference'});
    });
    $( function() 
    {
       $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'main','group': 'insert', 'tool': 'file'});
    });

}

//****************************************************************
//****************************************************************
//****************************************************************

if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {

     //quand le document est ready	 
     $( document ).ready( function() 
     {


//****************************************************************
//group shortcut : bouton signature, nowiki et redirect
        // To add a group to an existing toolbar section:
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                        {
			   'section': 'main',
                           'groups': { 'shortcut': { 'type': 'toolbar',  } }
		        } );
        //Nowiki 
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'shortcut',
                        'tools': {
                                'Nowiki-bouton': {
                                        label: 'Nowiki',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/8/87/Vector_toolbar_no_wiki_formatting_button.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "<nowiki>",
                                                        post: "</nowiki>"
                                                } }} }} ); } );

        //Redirection
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'shortcut',
                        'tools': {
                                'Redirection-bouton': {
                                        label: 'Redirection',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/4/47/Button_redir.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "#REDIRECT [[",
                                                        post: "]]"
                                                } }} }} ); } );

//****************************************************************
//group list : Tool de type select (liste sélectionable)
        // To add a group to an existing toolbar section:
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                        {
			   'section': 'main',
                           'groups': { 'list': { 'type': 'toolbar',  } }
		        } );
var Laius = '\n\:See [[Commons\:Reusing content outside Wikimedia]]'
+ '\n\:Wikimedia Commons hosts all the free images for the different language versions of Wikipedia, and some other projects. All images published on Wikimedia Commons are either published with a free license or in the Public Domain... except really few exceptions that are copyrighted by the Wikimedia Foundation ( like logos for Wikipedia, Commons etc )'
+ '\n\:For example, this image \: [[\:File\:\'37 coupe.jpg]] has a description section with basic informations like \: what is depicted, when the photo was taken, who is the author. Under it, a second section "Licensing" provide indications on under which license this photo is published. Here, [http\:\/\/creativecommons.org\/licenses\/by\/3.0/deed.en Creative Commons Attribution 3.0 Unported].'
+ '\n\:If you wish to use it or to modify it with photoshop for your own website, you have to tell who is the author, and provide a link to the license like this \: '
+ '\n\:<small>by Trekphiler, published with [http\:\/\/creativecommons.org\/licenses\/by\/3.0\/deed.en Creative Commons Paternité 3.0 Unported licence]<\/small>.'
+ '\n\:If you are going to publish it in a book, you have to add, for example at the end of the book \: <small>by Trekphiler, published with <nowiki>Creative Commons Attribution 3.0 Unported license http\:\/\/creativecommons.org\/licenses/by\/3.0\/deed.en<\/nowiki><\/small>'
+ '\n\:No further agreement from author is required, no financial compensation needs to be provided.'
+ '\n\:Just be sure to check the license on the description page of an image, and to be sure to be on Commons \: wikipedias locally host some copyrighted images used for educational purpose, and those materials are not free.';

        //Modèles
        $( function() 
        {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                {
                        'section': 'main',
                        'group': 'list',
                        'tools': 
                        {
                                'Modèles': 
                                 {
                                        label: 'Modèles',
                                        type: 'select',
                                        list: 
                                        {
                                               //\[\[Category:Images by Lilyu]]
                                               'ImagesbyLilyu-bouton': {
                                                   label: '\[\[Category:Images by Lilyu]]',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\[\[Category:Images by Lilyu]]",
                                                           ownline: false }}
                                                },

                                               //\[\[Category:French Wikipedia humor]]
                                               'WPfrHumour-bouton': {
                                                   label: '\[\[Category:French Wikipedia humor]]',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\[\[Category:French Wikipedia humor]]",
                                                           ownline: false}}
                                                 },

                                               //{{RetouchedPicture}}
                                               'Retouched-bouton': {
                                                   label: '\{\{RetouchedPicture}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\{\{RetouchedPicture|",
                                                           post: "}}",
                                                           ownline: false}}
                                                 },


 /*                                            //Boite déroulante
                                               'Boite-bouton': {
                                                   label: '\{\{Boite déroulante}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\{\{Boîte déroulante début|titre=Discussion}}",
                                                           post: "\{\{Boîte déroulante fin}}",
                                                           ownline: false}}
                                                 },
*/

                                               //Space
                                               'Space-bouton': {
                                                   label: 'Space',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "<br style=\"clear:both;\">",
                                                           ownline: false}}
                                                 },
                                                
                                               //bloc gris de citation
                                               'Bloc-bouton': {
                                                   label: '\{\{Bloc}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\{\{User:Lilyu/Bloc|1=",
                                                           post: "}}",
                                                           ownline: false}}
                                                 },

                                               //explication réutilisation
                                               'ReUse-bouton': {
                                                   label: 'ReUse',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: Laius}}
                                                 },

                                               //legal warning
                                               'Lawyer-bouton': {
                                                   label: 'Avocat',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: '<small>But i\'m not a lawyer, this is just my opinion, please contact a lawyer for legal informations</small>'}}
                                                 },


                           }}} 
                   } );
          } );


/********************************/
/********************************/
//Tool de type select (liste sélectionable)

        //Copyvio
        $( function() 
        {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                {
                        'section': 'main',
                        'group': 'list',
                        'tools': 
                        {
                                'Copyvio': 
                                 {
                                        label: 'Copyvio',
                                        type: 'select',
                                        list: 
                                        {
                                               //demande de permission
                                               'NPD-bouton': {
                                                   label: '\{\{npd}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\{\{subst",
                                                           post: ":npd}}",
                                                           ownline: false }}
                                                },

                                               //pas de source
                                               'NSD-bouton': {
                                                   label: '\{\{nsd}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                           pre: "\{\{subst",
                                                           post: ":nsd}}",
                                                           ownline: false}}
                                                 },

                                               //Copyvio
                                               'Copyvio-bouton': {
                                                   label: '\{\{Copyvio}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                                  pre: "\{\{Copyvio|",
                                                                  post: "}}",
                                                           ownline: false}}
                                                 },

                                               //Copyvio avec URL
                                               'CopyvioURL-bouton': {
                                                   label: '\{\{copyvio|1=url}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                                  pre: "\{\{copyvio|1=",
                                                                  post: " | }}",
                                                           ownline: false}}
                                                 },

                                               //Speedy
                                               'Speedy-bouton': {
                                                   label: '\{\{Speedy}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                                  pre: "\{\{Speedy|",
                                                                  post: "}}",
                                                           ownline: false}}
                                                 },

                                               //Duplicate
                                               'Duplicate-bouton': {
                                                   label: '\{\{Duplicate}}',
                                                   action: {
                                                       type: 'encapsulate',
                                                       options: {
                                                                  pre: "\{\{Duplicate|",
                                                                  post: "}}",
                                                           ownline: false}}
                                                 },


                           }}} 
                   } );
          } );




//****************************************************************
//group description : edition de page de description d'image

        // To add a group to an existing toolbar section:
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                        {
			   'section': 'main',
                           'groups': { 'description': { 'type': 'toolbar',  } }
		        } );
        
        //Description
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'description',
                        'tools': {
                                'Description-bouton': {
                                        label: 'Description',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/d/d7/Lilyu_Custom_Button_Desc.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "==\{\{int:filedesc}}=="
                                                } }} }} ); } );

        //Licence
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'description',
                        'tools': {
                                'Licence-titre-bouton': {
                                        label: 'Licence',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/0/07/Lilyu_Custom_Button_Lisc.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "==\{\{int:license}}=="
                                                } }} }} ); } );

        //WTFPL
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'description',
                        'tools': {
                                'WTF-bouton': {
                                        label: 'WTFPL',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/4/44/Lilyu_Custom_Button_WTF.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "\{\{self|WTFPL}}"
                                                } }} }} ); } );

//****************************************************************
//group smileys
        // To add a group to an existing toolbar section:
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                        {
			   'section': 'main',
                           'groups': { 'smiley': { 'type': 'toolbar',  } }
		        } );

        //Pony
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Pony-bouton': {
                                        label: 'Pony',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/8/87/Lilyu_-_pony.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|pony|40}}",
                                                } }} }} ); } );

       //Happy
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Happy-bouton': {
                                        label: 'Happy',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/3/31/Lilyu_-_happy.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|:D}}",
                                                } }} }} ); } );

       //Smile
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Smile-bouton': {
                                        label: 'Smile',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/9/9e/Lilyu_-_smile.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|:)}}",
                                                } }} }} ); } );



        //Arf
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Arf-bouton': {
                                        label: 'Arf',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/4/42/Lilyu_-_arf.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|arf}}",
                                                } }} }} ); } );


        //Sad
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Sad-bouton': {
                                        label: 'Sad',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/f/fc/Lilyu_-_sad.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|sad}}",
                                                } }} }} ); } );


        //What
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'What-bouton': {
                                        label: 'What',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/a/ab/Lilyu_-_what.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|what|40}}",
                                                } }} }} ); } );


        //Grr
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Grr-bouton': {
                                        label: 'Grr',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/0/02/Lilyu_-_grr.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|grr}}",
                                                } }} }} ); } );



        //Siffle
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Siffle-bouton': {
                                        label: 'Siffle',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/6/60/Lilyu_-_siffle.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|siffle|40}}",
                                                } }} }} ); } );

        //Evil
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Evil-bouton': {
                                        label: 'Evil',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/2/2f/Evil_lilyu.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{{Lilyu|evil}}",
                                                } }} }} ); } );

        //Cookie
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'smiley',
                        'tools': {
                                'Cookie-bouton': {
                                        label: 'Cookie',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/e/e5/Crystal_Project_cookie.png',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "{\{subst:Cookie}}",
                                                } }} }} ); } );


//****************************************************************
//group extra
        // To add a group to an existing toolbar section:
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', 
                        {
			   'section': 'main',
                           'groups': { 'extra': { 'type': 'toolbar',  } }
		        } );

       //en shanghai
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'extra',
                        'tools': {
                                'en-bouton': {
                                        label: 'en shanghai',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/2/27/Button_Icon_Black.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "[[:en:Shanghai Museum|Shanghai Museum]]",
                                                } }} }} ); } );

       //fr shanghai
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'extra',
                        'tools': {
                                'fr-bouton': {
                                        label: 'fr shanghai',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/3/3f/Button_Icon_Blue.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "[[:fr:Musée de Shanghai|Musée de Shanghai]]",
                                                } }} }} ); } );

       //en
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'extra',
                        'tools': {
                                'en2-bouton': {
                                        label: 'en',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/2/22/Lilyu_Custom_Button_en.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "[[:en:",
                                                        post: "|]]",
                                                } }} }} ); } );

        //fr
        $( function() {
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                        'section': 'main',
                        'group': 'extra',
                        'tools': {
                                'fr2-bouton': {
                                        label: 'fr',
                                        type: 'button',
                                        icon: 'http://upload.wikimedia.org/wikipedia/commons/e/e2/Lilyu_Custom_Button_fr.svg',
                                        action: {
                                                type: 'encapsulate',
                                                options: {
                                                        pre: "[[:fr:",
                                                        post: "|]]",
                                                } }} }} ); } );  
                                                       
                                                                  
     } ); //fin document ready
}//fin fonction

//</nowiki>