|
|
(31 versions intermédiaires par le même utilisateur non affichées) |
Ligne 5 : |
Ligne 5 : |
| ********************************************************************************/ | | ********************************************************************************/ |
|
| |
|
| | | //alert ("Daniel:common.js"); |
| | |
| //--------------------------------------------------------------------------- | | //--------------------------------------------------------------------------- |
| // Rappels et notes | | // Rappels et notes |
Ligne 15 : |
Ligne 16 : |
| ... | | ... |
| */ | | */ |
|
| |
|
| |
| //---------------------------------------------------------------------------
| |
| // Test de copie d'un texte par bouton 11/2023
| |
| //---------------------------------------------------------------------------
| |
|
| |
| /*
| |
| Voir
| |
| https://www.mediawiki.org/wiki/Gadget_kitchen
| |
| https://www.mediawiki.org/wiki/Manual:CopyTextLayout
| |
| https://www.mediawiki.org/wiki/How_to_enhance_wiki_content_with_JavaScript
| |
| https://doc.wikimedia.org/oojs-ui/master/demos/?page=widgets&theme=wikimediaui&direction=ltr&platform=mobile#ButtonWidget-normal
| |
|
| |
| */
| |
|
| |
| mw.loader.using('mediawiki.widgets').then( function (){
| |
|
| |
| var copyText = new mw.widgets.CopyTextLayout( {
| |
| title: 'Copy the text',
| |
| align: 'right',
| |
| help: 'ceci est aide',
| |
| copyText: '\{\{subst:Modèle:entrée\}\}'
| |
| } );
| |
|
| |
| //$( '#bodyContent' ).prepend( copyText.$element );
| |
| $( '.dsg_RecetteCategorie' ).append(copyText.$element );
| |
|
| |
| });
| |
|
| |
| /*
| |
| mw.loader.using('mediawiki.widgets').then( function (){
| |
|
| |
| // A ButtonInputWidget rendered as an HTML button, the default.
| |
| var button = new OO.ui.ButtonInputWidget( {
| |
| label: 'Input button',
| |
| icon: 'check',
| |
| value: 'check'
| |
| } );
| |
|
| |
| $( '#mw-content-text' ).append( button.$element );
| |
|
| |
| });
| |
| */
| |
|
| |
| //---------------------------------------------------------------------------
| |
| // Test de boutons zoom et zoom out d'une page
| |
| //---------------------------------------------------------------------------
| |
|
| |
| /*
| |
| Voir
| |
| https://www.mediawiki.org/wiki/Gadget_kitchen
| |
| https://www.mediawiki.org/wiki/ChickTech_High_School_Kickoff_2017/Tasks
| |
| */
| |
|
| |
| /*
| |
| // toggled by toggle button. also determines which toggle button image to use
| |
| var useCustom = false;
| |
|
| |
| // toggleImgs[0] to switch to custom, toggleImgs[1] to revert to default
| |
| var toggleImgs = [
| |
| '//storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_search_black_24px.svg',
| |
| '//storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_youtube_searched_for_black_24px.svg'
| |
| ];
| |
| var zoomInImg = '//storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_zoom_in_black_24px.svg';
| |
| var zoomOutImg = '//storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_zoom_out_black_24px.svg';
| |
|
| |
| // create DOM elements
| |
| $('#firstHeading').append('<div id="zoomButtons">\
| |
| <img src="' + zoomInImg + '" alt="zoom in" onclick="zoom(1)">\
| |
| <img src="' + zoomOutImg + '" alt="zoom out" onclick="zoom(-1)">\
| |
| <img id="toggleButton" src="' + toggleImgs[+ useCustom] +
| |
| '" alt="toggle zoom" onclick="toggle()"> </div>');
| |
| $('#zoomButtons').css({'float': 'right'});
| |
|
| |
| // find DOM elements used later
| |
| var $bodyContent = $('.mw-body-content');
| |
| var $toggleButton = $('#toggleButton');
| |
|
| |
| // sizes[0] is default, sizes[1] is custom
| |
| var sizes = [parseFloat($('.mw-body-content').css('font-size'))];
| |
| // default custom zoom of 2
| |
| sizes[1] = sizes[0] + 2;
| |
|
| |
| // the + converts bool to 0 or 1 to use as array index
| |
| function updateSize() {
| |
| $bodyContent.css({'font-size':(sizes[+ useCustom] + 'pt')});
| |
| }
| |
| function toggle() {
| |
| useCustom = !useCustom;
| |
| $toggleButton.attr('src',toggleImgs[+ useCustom]);
| |
| updateSize();
| |
| }
| |
| function zoom(dif) {
| |
| sizes[1] += dif;
| |
| if (useCustom) {
| |
| updateSize();
| |
| } else {
| |
| toggle();
| |
| }
| |
| }
| |
|
| |
| //*/
| |