MediaWiki:EditShortcuts.js

/* */

/* ============== KEYBOARD SHORTCUTS ========================== author:       Petr Kajzar User:Slepi date:         06/2011 documentation: MediaWiki:EditacniKlavesoveZkratky.js/dokumentace description:  shortcuts on edit page ==========================================================

// FUNCTION ADDING SHORTCUTS function addShortcuts {

// pressed key Ctrl var isCtrl = false;

// reset: key Ctrl document.onkeyup=function(e) {

// compatibility among browsers if(window.event) { keycode = event.keyCode; } else if(e.which) { keycode = e.which; }

isCtrl=false; }

// shortcuts document.onkeydown=function(e) {

// compatibility if(window.event) { keycode = event.keyCode; } else if(e.which) { keycode = e.which; }

// set key Ctrl if(keycode == 17) isCtrl = true;

// set key Alt (in case of pressing right Alt = Ctrl+Alt) if(keycode == 18) { isCtrl = false; return true; }

// CTRL+B: bold text if(keycode == 66 && isCtrl == true) { insertTags("", "", "Bold text"); return false; }

// CTRL+I: italic text if(keycode == 73 && isCtrl == true) { insertTags("", "", "Italic text"); return false; }

// CTRL+L: link if(keycode == 76 && isCtrl == true) { insertTags("", "", "Link title"); return false; } } }

addOnloadHook( function  {    if (document.getElementById("wpTextbox1") && wgAction != "view") addShortcuts;  } );

/* */