Wikipedista:Draceane/vector.js: Porovnání verzí

Z Wikipedie, otevřené encyklopedie
Smazaný obsah Přidaný obsah
m tilde?
m fix
Řádek 1: Řádek 1:
// <nowiki>
//tohle by snad mohlo fungovat
// tohle by snad mohlo fungovat
var customizeToolbar = function () {
var customizeToolbar = function () {
jQuery( document ).ready( function ( $ ) {
jQuery( document ).ready( function ( $ ) {
Řádek 53: Řádek 54:
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '&tilde;&tilde;&tilde;&tilde;'
pre: '~~' + '~~'
}
}
}
}
Řádek 59: Řádek 60:
}
}
} );
} );
} );
} );

$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'section': 'main',
'group': 'insert',
'group': 'insert',
'tool': 'signature'
'tool': 'signature'
});
} );

};
};



Verze z 11. 6. 2019, 08:34

// <nowiki>
// tohle by snad mohlo fungovat
var customizeToolbar = function () {
	jQuery( document ).ready( function ( $ ) {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'komentář',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '<!-- ',
                        peri: 'komentář',
                        post: ' -->'
                    }
                }
            }
        }
    } );
   } );
  	jQuery( document ).ready( function ( $ ) {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'komentář',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '<!-- ',
                        peri: 'komentář',
                        post: ' -->'
                    }
                }
            }
        }
    } );
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'main',
        group: 'insert',
        tools: {
            buttonId: {
                label: 'podpis-alt',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/c/c5/OOUI_JS_signature_icon_LTR.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '~~' + '~~'
                    }
                }
            }
        }
    } );
	} ); 

	$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
		'section': 'main',
		'group': 'insert',
		'tool': 'signature'
	} );

};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}

//nefunguje???
mw.loader.using('mediawiki.action.edit', function () {
 
        var button = { id: 'button-comment',
                       imageFile: 'http://upload.wikimedia.org/wikipedia/commons/a/a5/Buttonexperimenty.png',
                       speedTip: 'Experimenty',
                       tagOpen: '\x7b\x7bsubst:experimenty}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
        var button = { id: 'button-comment',
                       imageFile: 'http://upload.wikimedia.org/wikipedia/commons/1/16/Buttonexperimenty2.png',
                       speedTip: 'Experimenty2',
                       tagOpen: '\x7b\x7bsubst:experimenty2}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

        var button = { id: 'button-comment',
                       imageFile: 'http://upload.wikimedia.org/wikipedia/commons/4/4a/Button_welcome.png',
                       speedTip: 'Vítejte',
                       tagOpen: '\x7b\x7bsubst:vítejte}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
         mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

        var button = { id: 'button-comment',
                       imageFile: 'http://upload.wikimedia.org/wikipedia/commons/f/f8/Button_Tool_commons.png',
                       speedTip: 'Commons',
                       tagOpen: '\x7b\x7bCommons|',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

        var button = { id: 'button-comment',
                       imageFile: 'http://upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png',
                       speedTip: 'Citace elektronické monografie (webu)',
                       tagOpen: '<ref>\x7b\x7bCitace elektronické monografie\n | příjmení = \n | jméno = \n | odkaz na autora = \n | titul = \n | url = \n | datum vydání = \n | datum aktualizace = \n | datum přístupu = ' + (y = new Date().getFullYear ()) + '-' + (m = new Date ().getMonth () + 1) + '-' + (d = new Date ().getDate ()) + '\n  | vydavatel = \n | místo = \n | jazyk = \n}}</ref>',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

});