User:Pyb/common.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.
importScript('User:Magnus Manske/sdc_tool.js') ;

 
/**********************
 * auteur : Zaran
 * http://fr.wikisource.org/wiki/MediaWiki:Gadget-TogglePanel.js
 **********************/
 
function SetCookie(name,value) {
	document.cookie = name + "=" + escape(value);
}
 
function GetCookie(name) {
	var i =0;
	while (i < document.cookie.length) {
		if (document.cookie.substr(i,name.length) == name) {
			var valend = document.cookie.indexOf(";",i+name.length+1);
                        if (valend == -1) {
                                valend = document.cookie.length;
                        }
                        return unescape(document.cookie.substring(i+name.length+1,valend));
                }
                i = document.cookie.indexOf(" ", i) + 1;
                if (i === 0) break;
        }
}
 
function showPanel(animated) {
  var skin = mw.config.get('skin');
  var content = $('#content');
  if ( skin == 'vector' ) {
    if ( animated) {
      content.animate({'margin-left':content.data('margin')},function(){$("#mw-panel").show();});
      $("#left-navigation").animate({'left': content.data('margin')});
    }
    else {
      content.css('margin-left', content.data('margin') );
      $("#mw-panel").show();
      $("#left-navigation").css('left', content.data('margin') );
    }
  }
  else if ( skin == 'monobook' ) {
    if ( animated) {
      content.animate({'margin-left':content.data('margin')}, function() {content.css('z-index', '2');});
    }
    else {
      content.css('margin-left', content.data('margin') );
      content.css('z-index', '2');
    }
  }
}
 
function hidePanel(animated) {
  var skin = mw.config.get('skin');
  var content = $('#content');
  if ( skin == 'vector' ) {
    $("#mw-panel").hide();
    if ( animated ) {
      content.animate({'margin-left':'0px'});
      $("#left-navigation").animate({'left':'0px'});
    }
    else {
      content.css('margin-left', '0px');
      $("#left-navigation").css('left', '0px');
    }
  }
  else if ( skin == 'monobook' ) {
    content.css('z-index', '4');
    if ( animated ) {
      content.animate({'margin-left':'0px'});
    }
    else {
      content.css('margin-left', '0px');
    }
  }
}
 
function hidePanelCookie(animated) {
  hidePanel(animated);
  $("#panel-collapse").find("a").text("Afficher");
  $("#panel-collapse").find("a").unbind("click");
  $("#panel-collapse").find("a").click( function( e ) {
    e.preventDefault();
    showPanelCookie(true);
  });
  SetCookie("hidepanel", "true");
}
 
function showPanelCookie(animated) {
  showPanel(animated);
  $("#panel-collapse").find("a").text("Masquer");
  $("#panel-collapse").find("a").unbind("click");
  $("#panel-collapse").find("a").click( function( e ) {
    e.preventDefault();
    hidePanelCookie(true);
  });
  SetCookie("hidepanel", "false");
}
 
jQuery( function ( $ ) {
  var content = $('#content');
  content.data('margin', content.css('margin-left'));
  var collapseLink = mw.util.addPortletLink( "p-personal" , "#" , "Masquer", "panel-collapse", "Afficher/Masquer le menu latéral", "", "#pt-userpage");
  var hide = GetCookie("hidepanel");
  if ( hide == "true") {
    hidePanelCookie(false);
  }
  else {
    $("#panel-collapse").find("a").click( function( e ) {
      e.preventDefault();
      hidePanelCookie(true);
    });
  }
});

/**********************
 * Add listing buttons in edit toolbar
 * d
 **********************/
 

var customizeToolbar = function() {
$( function() {
             if ( typeof $.fn.wikiEditor != 'undefined' ) {
                   $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
                          'section': 'main',
                          'group': 'insert',
                          'tool': 'reference'
                   });
             }
        });
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'groups': {
                'listings': {
                        'label': 'PL' // or use labelMsg for a localized label, see above
                }
        }
} );        
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Catégorie', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/9/98/Italian_traffic_signs_-_icona_cimitero.svg/22px-Italian_traffic_signs_-_icona_cimitero.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '<onlyinclude>{{Category definition: Object\n',
// <nowiki>
                                        post: '|image            = Père-Lachaise - Division 27 - Unidentified 01.jpg\n|type             = tomb\n|artist           = \n|title            = {{tomb of|XXX}}\n|description      = \n|date             = \n|dimensions       = \n|medium           = \n|inscriptions     = \n|object history   = \n|references       = \n|notes            = \n|gallery          = {{institution:Cimetière du Père-Lachaise}}\n|location         = {{Père-Lachaise location |division=27 |line=1 |street=chemin du Dragon |left= |right= |Moiroux= |Salomon= |concession=}}\n|wikidata         = \n|strict           = no \n}}</onlyinclude>\n\n{{DEFAULTSORT:Unidentified}}\n[[Category:Graves in the Père-Lachaise Cemetery]]\n[[Category:Père-Lachaise Cemetery - Division 27]]\n[[Category:Chemin du Dragon (Père-Lachaise)]]' // text to be inserted
// </nowiki>
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'épitaphe', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/5/54/Pencil_font_awesome.svg/22px-Pencil_font_awesome.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{inscription|',
                                        post: '|side=recto|language=fr|medium=engraving}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Photo', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/d1/Camera_font_awesome.svg/22px-Camera_font_awesome.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '== {{int:filedesc}} ==\n{{Object photo\n',
// <nowiki>
                                        post: '|object      = Grave of (Père-Lachaise, division 75)\n|detail      = \n|description = \n|source      = {{own}}\n|author      = [[User:Pyb|Pierre-Yves Beaudouin]]\n|date        = 2014-05-11\n|other fields= {{Credit line |Author = Pierre-Yves Beaudouin |Other = Wikimedia Commons |License = CC-BY-SA-4.0}}\n}}\n\n== {{int:license-header}} ==\n{{self|cc-by-sa-4.0}}\n{{Wikimedia France - Atget}}\n{{L\'été des régions|year=2018}}\n\n[[Category:Files by User:Pyb]]\n[[Category:August 2018 in Paris]]\n[[Category:Grave of (Père-Lachaise, division 11)]]\n' // text to be inserted
// </nowiki>
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Individu', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/22px-Gnome-stock_person.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{DEFAULTSORT:Blanchard, Sophie}}\n',
// <nowiki>
                                        post: '[[Category:People by name]]\n[[Category:1778 births]]\n[[Category:1819 deaths]]\n[[Category:Burials at the Père-Lachaise Cemetery]]' // text to be inserted
// </nowiki>
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Moiroux', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/4/40/Commons-emblem-question-book-red.svg/22px-Commons-emblem-question-book-red.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{cite book |author=Jules Moiroux |title=Le cimetière du Père-Lachaise |date=1908 |page=999 |url=http://gallica.bnf.fr/ark:/12148/bpt6k6423517n/f999}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Jouin', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '////upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Commons-emblem-question_book_orange.svg/22px-Commons-emblem-question_book_orange.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{cite journal|author=Henry Jouin|journal=Nouvelles archives de l\'art français|title=La sculpture dans les cimetières de Paris|date=1897|page=999|volume=13|url=http://www.archive.org/stream/archivesdelartfr13sociuoft#page/999/mode/2up}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Bauer', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Commons-emblem-question_book_yellow.svg/22px-Commons-emblem-question_book_yellow.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{cite book |author=Paul Bauer |publisher=Mémoire et Documents |title=Deux siècles d\'histoire au Père Lachaise |date=2006 |page=999 |isbn=978-2914611480}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Bauer 2', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Commons-emblem-question_book_yellow.svg/22px-Commons-emblem-question_book_yellow.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{cite book |author=Paul Bauer |publisher=Histoires & Guide |title=Le Père-Lachaise : Monuments d\'hier et figures d\'aujourd\'hui |date=2015 |page=999 |isbn=978-2-9538453-1-0}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Gabrielli', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Commons-emblem-question_book_yellow.svg/22px-Commons-emblem-question_book_yellow.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{cite book|author=Domenico Gabrielli|publisher=Les éditions de l\'amateur|title=Dictionnaire historique du Père-Lachaise|date=2002|page=37|isbn=978-2859173463}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'Salomon', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Gnome-emblem-important.svg/22px-Gnome-emblem-important.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        // pre: '',
                                        post: '{{fr|Sépulture ou ancienne concession XXX indiquée par Salomon en 1855.}}' // text to be inserted
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'GPS', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Gnome-emblem-web.svg/22px-Gnome-emblem-web.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{Object location|',
                                        post: '|type:landmark_region:FR-75}}'
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'RJ', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Gnome-applications-office.svg/22px-Gnome-applications-office.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '[http://archives.paris.fr/r/216/cimetieres/ Registre journalier d\'inhumation, xxxx, n°xxxx, page xxxx]',
                                        //post: ''
                                }
                        }
                }
        }
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'listings',
        'tools': {
                'listings': {
                        label: 'PM', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Gnome-applications-office.svg/22px-Gnome-applications-office.svg.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: '{{Artwork|wikidata=',
                                        post: '|strict=no}}'
                                }
                        }
                }
        }
} ); 
};
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
        mw.loader.using( 'user.options', function () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor', function () {
                                $(document).ready( customizeToolbar );
                        } );
                }
        } );
}

// </nowiki>
// <nowiki>

//vFCProfil/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFC_Profiles = {
// <nowiki>
"Père Lachaise Pyb":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"Add metadata","mdReplacePermission":false,"mdRRegEx1":true,"mdRVar1":true,"mdMatchText1":"/[\\s\\S]*/","mdReplaceText1":"%PAGENAME%","mdRRegEx2":true,"mdRVar2":true,"mdMatchText2":"/Père-Lachaise - Division (.+) - (.+) (\\d+).jpg$/","mdReplaceText2":"== {{int:filedesc}} ==\n{{Object photo\n|object      = Grave of $2 (Père-Lachaise, division $1)\n|detail      = \n|description = \n|source      = {{own}}\n|author      = [[User:Pyb|Pierre-Yves Beaudouin]]\n|date        = ----azertyuiop%DateTimeOriginal%----poiuytreza\n|other fields= {{Credit line |Author = Pierre-Yves Beaudouin |Other = Wikimedia Commons |License = CC-BY-SA-4.0}}\n}}\n\n== {{int:license-header}} ==\n{{self|cc-by-sa-4.0}}\n\n[[Category:Files by User:Pyb]]\n[[Category:Grave of $2 (Père-Lachaise, division $1)]]\n","mdRRegEx3":true,"mdRVar3":true,"mdMatchText3":"/-\\-\\-\\-azertyuiop(\\d+)\\:(\\d+)\\:(\\d+).*-\\-\\-\\-poiuytreza([\\s\\S]*)/","mdReplaceText3":"$1-$2-$3$4[[Category:$1 in Paris]]","mdRRegEx4":false,"mdRVar4":true,"mdMatchText4":"","mdReplaceText4":"","selPreserve":"secure","alsoPreserve":""},"action":"c_replace","objectMembers":{"queryParams":{"target":"Pyb","lestart":"20140528033041|88567801","ledir":"older"},"startInput":{"mode":"User","modeCat":false,"modeUser":true,"modePage":false,"target":"User:Pyb","loadThumbs":true,"loadWikitext":true,"startDate":"","startFile":""}},"proceedAt":{"vals":["20140528054523|88572909","20140528033041|88567801"],"setVals":["lestart"]},"time":"2014-06-01T09:28:30.549Z"}};
// </nowiki>
//////////////////////////////////vFCProfilEnd//

// </nowiki>