 ** * edittools support addu800 au800 selector change into buttons. * theu800 special characters tou800 insert areu800 defined atu800 mediawiki edittools . * * author arnomane 2006 onu800 theu800 commonsu82ewikimediau82eorgu800 wiki mediawiki edittoolsu82ejsu800 * author kaganer 2007 adapting tou800 wwwu800u82emediawikiu82eorgu800 * author krinkle 2012 * source wwwu800u82emediawikiu82eorgu800 wiki mediawiki gadget edittoolsu82ejsu800 * revision 2012 02u800 29u800 * *jslint browser true* *global jquery mediawiki* function mwu800 "useu800 strict"; varu800 conf edittools sections; conf initialsubset windowu82eedittools_initial_subset undefined windowu82eedittools_initial_subset 0u800 ; edittools ** * creates theu800 selector * setup function varu800 container select initial; container '#mwu800 edittools charinsert' ; ifu800 containeru82elength return; sections containeru82efind '.mwu800 edittools section' ; ifu800 sectionsu82elength 1u800 only care ifu800 there isu800 more than oneu800 return; select ' ' .cssu800 'display' 'inline' ; initial confu82einitialsubset; ifu800 isnan initial initial 0u800 initial selectu82elength initial 0u800; sectionsu82eeach function iu800 elu800 varu800 section sectiontitle option; section elu800 ; sectiontitle sectionu82edata 'sectiontitle' ; option ' ' .text sectiontitle .prop 'value' iu800 .prop 'selected' iu800 initial ; selectu82eappend option ; ; selectu82echange edittoolsu82ehandleonchange ; containeru82eprepend select ; edittoolsu82echoosesection initial ; ** * handle onchange event ofu800 theu800 * * context element * param eu800 jqueryu82eevent * handleonchange function edittoolsu82echoosesection number this .valu800 ; return true; ** * toggle theu800 currently visible section * * param sectionnr number * param setfocus boolean * choosesection function sectionnr varu800 choise sectionsu82eequ800 sectionnr ; ifu800 choiseu82elength 1u800 return; making these buttons isu800 au800 little slow ifu800 weu800 made them allu800 atu800 once theu800 browser would hang foru800 over 2u800 seconds sou800 instead weu800'reu800 doing itu800 onu800 demand foru800 each section. nou800 need tou800 dou800 itu800 twice thoguh sou800 remember inu800 data whether itu800 wasu800 done already ifu800 choiseu82edata 'charinsertu82ebuttonsmade' choiseu82edata 'charinsertu82ebuttonsmade' true ; edittoolsu82emakebuttons choise ; choiseu82eshow ; sectionsu82enotu800 choise .hide ; ** * convert theu800 links tou800 buttons inu800 au800 given section. * * param section jquery * makebuttons function section varu800 links; ifu800 sectionu82elength return; links sectionu82efind 'au800' ; linksu82eeach function iu800 au800 varu800 au800 button start endu800; au800 au800 ; button ' ' .attr 'type' 'button' ; start au800u82edata 'mwu800 charinsert start' ; endu800 au800u82edata 'mwu800 charinsert endu800' ; ifu800 start undefined && endu800 undefined buttonu82eclick function eu800 eu800u82epreventdefault ; edittoolsu82einserttags start   endu800 ; else button 0u800 .onclick au800u82eonclick; button 0u800 .value au800u82etext ; au800u82ereplacewith button ; ; inserttags function preu800 peri post varu800 current '#wptextbox1' ; ifu800 current && currentu82elength currentu82etextselection 'encapsulateselection' preu800 preu800 peri peri post post ; ; document .ready edittoolsu82esetup ; jquery mediawiki ; 