MediaWiki:Toolbar.js

De la Wikipedia, enciclopedia liberă

Notă: După salvare, trebuie să treceți peste cache-ul browser-ului pentru a vedea modificările.

  • Mozilla, Google Chrome, Safari, Konqueror: țineți apăsat Shift în timp ce apăsați butonul Reload (sau apăsați Ctrl-Shift-R).
  • Internet Explorer: apăsați Ctrl-F5.
  • Opera: apăsați F5.
//citare
function addCiteCharPage() {
	$("#wpTextbox1").wikiEditor("addToToolbar", {
		section: "characters",
		pages: {
			cite: {
				layout: "characters",
				label: "Formate Citare",
                    'characters': [
                        {
                            'label': '{{Citat web}}',
                            'action': {
                                   'type': 'encapsulate',
                                   'options': {
                                           'pre': "{{citat web |url= |titlu= |autor= |lucrare= |dată= |datăaccesare=",
                                           'post': "}}"
                                   }
                            }
                        },
                        {
                            'label': '{{Citat carte}}',
                            'action': {
                                   'type': 'encapsulate',
                                   'options': {
                                           'pre': "{{citat carte | prenume= | nume= | titlu= | editură= | dată= ",
                                           'post': "}}"
                                   }
                            }
                        },
                        {
                            'label': '{{Citat revistă}}',
                            'action': {
                                   'type': 'encapsulate',
                                   'options': {
                                           'pre': "{{citat revistă | nume = | prenume = | dată = | titlu = | jurnal = | volum = | număr = | editură = | url =",
                                           'post': "}}"
                                   }
                            }
                        },
                    ]
			}
		}
	});
 
	var latinItem = $("#editform div.section-characters > div.index > div[rel='latin']");
	var citeItem = $("#editform div.section-characters > div.index > div[rel='cite']");
	latinItem.before(citeItem );
}

var customizeToolbar = function () {
	setTimeout(addCiteCharPage, 0);
	//simboluri matematice
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		'section': 'characters',
		'page': 'symbols',
		'characters': ['≡', '√', '∂', '∫', 'º', '¹', '²', '³', 'ⁿ']
	});
	//ghilimele
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
                'ghilimele': {
                        label: 'Ghilimele',
                        type: 'button',
                        icon: '//upload.wikimedia.org/wikipedia/commons/b/b7/Ghilimele_rom%C3%A2ne%C8%99ti.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "„",
                                        post: "”"
                                }
                        }
                }
        }
	} );
};

/* 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' ).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 );
		}
	} );
}