МедияУики:Gadget-MwToolbar.js
Забележка: За да се видят промените, необходимо е след съхраняване на страницата, кешът на браузъра да бъде изтрит.
- Firefox / Safari: Задържа се клавиш Shift и се щраква върху Презареждане (Reload) или чрез клавишната комбинация Ctrl-Shift-R (⌘-Shift-R за Mac);
- Google Chrome: клавишна комбинация Ctrl-Shift-R (⌘-Shift-R за Mac)
- Internet Explorer: Задържа се клавиш Ctrl и се щраква върху Refresh или чрез клавишната комбинация CTRL-F5;
- Opera: кешът се изчиства през менюто Tools → Preferences.
( function ( $, mw, undefined ) {
var toolbar, $currentFocused;
mw.libs.toolbar = {
/**
* Apply tagOpen/tagClose to selection in currently focused textarea.
*
* Uses `sampleText` if selection is empty.
*
* @param {string} tagOpen
* @param {string} tagClose
* @param {string} sampleText
*/
insertTags: function ( tagOpen, tagClose, sampleText ) {
if ( $currentFocused && $currentFocused.length ) {
$currentFocused.textSelection(
'encapsulateSelection', {
pre: tagOpen,
peri: sampleText,
post: tagClose
}
);
}
}
};
$( function () {
// Used to determine where to insert tags
$currentFocused = $( '#wpTextbox1' );
// Apply to dynamically created textboxes as well as normal ones
$( document ).on( 'focus', 'textarea, input:text', function () {
$currentFocused = $( this );
} );
} );
} )( jQuery, mediaWiki );
// vim: set ts=4 sts=4 sw=4 et: