MediaWiki:Vector.js
Note: After saving, you may have to bypass your browser's cache to see the changes. Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Mac). Google Chrome: press Ctrl-Shift-R (Command-Shift-R on a Mac). Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5. Konqueror: click Reload or press F5. Opera: clear the cache in Tools → Preferences
var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'nv': {
'type': 'booklet',
'label': 'Diné bizaad yee álʼíiniiʼ'
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'nv',
'pages': {
'emoticons': {
'layout': 'characters',
'label': 'Diné bizaad yee alʼíinii',
'characters': [ 'Á', 'á', 'É', 'é', 'Í', 'í', 'Ó', 'ó', 'Ą', 'ą', 'Ę', 'ę', 'Į', 'į', 'Ǫ', 'ǫ', 'Ą́', 'ą́', 'Ę́', 'ę́', 'Į́', 'į́', 'Ǫ́', 'ǫ́', 'Ł', 'ł', 'Ń', 'ń', 'ʼ' ]
}
}
} );
};
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 );
} );
}
} );
}
// SVG images: adds links to rendered PNG images in different resolutions
function SVGThumbs() {
var file = document.getElementById("file"); // might fail if MediaWiki can't render the SVG
if (file && wgIsArticle && mw.config.get('wgTitle').match(/\.svg$/i)) {
var thumbu = file.getElementsByTagName('IMG')[0].src;
if(!thumbu) return;
function svgAltSize( w, title) {
var path = thumbu.replace(/\/\d+(px-[^\/]+$)/, "/" + w + "$1");
var a = document.createElement("A");
a.setAttribute("href", path);
a.appendChild(document.createTextNode(title));
return a;
}
var p = document.createElement("p");
p.className = "SVGThumbs";
p.appendChild(document.createTextNode("Díí kweʼé eʼelyaaígíí \"PNG format\" bikʼehgo ályaa"+": "));
var l = [200, 500, 1000, 2000];
for( var i = 0; i < l.length; i++ ) {
p.appendChild(svgAltSize( l[i], l[i] + "px"));
if( i < l.length-1 ) p.appendChild(document.createTextNode(", "));
}
p.appendChild(document.createTextNode("."));
var info = file.parentNode.getElementsByClassName( '.fullMedia' )[0];
if( info ) info.appendChild(p);
}
};
$( SVGThumbs );
/* Disable Firefox's spellchecker (doesn't know Navajo) */
$(function() {
$('input, textarea').attr('spellcheck', false);
});