 ** * * warning global gadget file * changes tou800 this page affect many users. * please discuss changes atu800 wtu800 twu800 before editing. * * * imported from github . * allu800 changes should beu800 made inu800 theu800 repository otherwise they will beu800 lost. * * * * this isu800 azatoth azatoth'su800 twinkle theu800 popular script sidekick foru800 newbies admins andu800 * every wikipedian inu800 between. visit wpu800 twu800 foru800 more information. * * global morebits * function window document wrap with anonymous function check ifu800 account isu800 experienced enough tou800 useu800 twinkle ifu800 morebitsu82euserisingroup 'autoconfirmed' && morebitsu82euserisingroup 'confirmed' return; varu800 twinkle ; windowu82etwinkle twinkle; allow global access foru800 useu800 byu800 custom modules normally empty twinkleu82einitcallbacks ; twinkleu82eaddinitcallback function twinkleaddinitcallback func twinkleu82einitcallbacksu82epush func ; ; twinkleu82edefaultconfig ; ** * this holds theu800 default setu800 ofu800 preferences used byu800 twinkle. * itu800 isu800 important that allu800 newu800 preferences added here especially admin only ones areu800 also added tou800 * twinkleu82econfigu82esections inu800 twinkleconfigu82ejsu800 sou800 they areu800 configurable viau800 theu800 twinkle preferences panel. * foru800 help onu800 theu800 actual preferences seeu800 theu800 comments inu800 twinkleconfigu82ejsu800. * * formerly twinkleu82edefaultconfigu82etwinkle andu800 twinkleu82edefaultconfigu82efriendly * twinkleu82edefaultconfig general summaryad ' u8d988u8d9be u8d8aau8d988u8db8cu8d986u8daa9u8d984 u8d8aau8d988u8db8cu8d986u8daa9u8d984 ' localized deletionsummaryad ' u8d988u8d9be u8d8aau8d988u8db8cu8d986u8daa9u8d984 u8d8aau8d988u8db8cu8d986u8daa9u8d984 ' localized protectionsummaryad ' u8d988u8d9be u8d8aau8d988u8db8cu8d986u8daa9u8d984 u8d8aau8d988u8db8cu8d986u8daa9u8d984 ' localized usertalkpagemode 'tabu800' dialoglargefont false disabledmodules disabledsysopmodules arvu800 spiwatchreport 'yesu800 block defaulttopartialblocks false blanktalkpageonindefblock false fluff revert andu800 rollback automenuafterrollback false opentalkpage 'agfu800' 'norm' 'vand' opentalkpageonautorevert false rollbackinplace false markrevertedpagesasminor 'vand' watchrevertedpages 'agfu800' 'norm' 'vand' 'torev' offerreasononnormalrevert true confirmonfluff false showrollbacklinks 'diff' 'others diu800 twinkleimage notifyuserondeli true deliwatchpage 'default' deliwatchuser 'default' prod watchprodpages true markprodpagesaspatrolled false prodreasondefault   logprodpages false prodlogpagename 'u8d986u8d8a7u8d985u8d8b2u8d8afu8d987u8d8a7u8db8c u8d8adu8d8b0u8d981 u8d8b2u8d985u8d8a7u8d986u8e2808cu8d8afu8d8a7u8d8b1' localized csdu800 speedyselectionstyle 'buttonclick' watchspeedypages "u8d8b9u8dbb3" "u8d8b9u8dbb5" "u8d8b9u8dbb1u8dbb0" "u8d8b9u8dbb1u8dbb1" "u8d8b9u8dbb1u8dbb2" localized markspeedypagesaspatrolled false these next twou800 should probably beu800 identical byu800 default welcomeuseronspeedydeletionnotification "u8d8adu8d8b0u8d981 u8d8b3u8d8b1u8db8cu8d8b9" "u8d8b9u8dbb1" "u8d8b9u8dbb2" "u8d8b9u8dbb3" "u8d8b9u8dbb4" "u8d8b9u8dbb6" "u8d8b9u8dbb1u8dbb0" "u8d8b9u8dbb1u8dbb1" "u8d8b9u8dbb1u8dbb2" "u8d8b9u8dbb1u8dbb3" "u8d985u8dbb1" "u8d985u8dbb2" "u8d985u8dbb3" "u8d985u8dbb5" "u8d985u8dbb7" "u8d985u8dbb9" "u8d985u8dbb1u8dbb0" "u8d985u8dbb1u8dbb1" "u8d9beu8dbb1" "u8d9beu8dbb2" "u8d9beu8dbb3" "u8d9beu8dbb7" "u8d9beu8dbb9" "u8d9beu8dbb1u8dbb0" "u8daa9u8dbb3" "u8daa9u8dbb5" "u8d8aau8dbb2" "u8d8aau8dbb3" "u8d8afu8dbb1" "u8d8afu8dbb2" localized notifyuseronspeedydeletionnomination "u8d8adu8d8b0u8d981 u8d8b3u8d8b1u8db8cu8d8b9" "u8d8b9u8dbb1" "u8d8b9u8dbb2" "u8d8b9u8dbb3" "u8d8b9u8dbb4" "u8d8b9u8dbb6" "u8d8b9u8dbb1u8dbb0" "u8d8b9u8dbb1u8dbb1" "u8d8b9u8dbb1u8dbb2" "u8d8b9u8dbb1u8dbb3" "u8d985u8dbb1" "u8d985u8dbb2" "u8d985u8dbb3" "u8d985u8dbb5" "u8d985u8dbb7" "u8d985u8dbb9" "u8d985u8dbb1u8dbb0" "u8d985u8dbb1u8dbb1" "u8d9beu8dbb1" "u8d9beu8dbb2" "u8d9beu8dbb3" "u8d9beu8dbb7" "u8d9beu8dbb9" "u8d9beu8dbb1u8dbb0" "u8daa9u8dbb3" "u8daa9u8dbb5" "u8d8aau8dbb2" "u8d8aau8dbb3" "u8d8afu8dbb1" "u8d8afu8dbb2" localized warnuseronspeedydelete "u8d8adu8d8b0u8d981 u8d8b3u8d8b1u8db8cu8d8b9" "u8d8b9u8dbb1" "u8d8b9u8dbb2" "u8d8b9u8dbb3" "u8d8b9u8dbb4" "u8d8b9u8dbb5" "u8d8b9u8dbb1u8dbb0" "u8d8b9u8dbb1u8dbb1" "u8d8b9u8dbb1u8dbb2" "u8d985u8dbb1" "u8d985u8dbb3" "u8d985u8dbb7" "u8d985u8dbb9" "u8d985u8dbb1u8dbb0" "u8d985u8dbb1u8dbb1" "u8d9beu8dbb3" "u8d9beu8dbb7" "u8d9beu8dbb9" "u8daa9u8dbb3" "u8daa9u8dbb5" "u8d8aau8dbb2" "u8d8afu8dbb1" localized promptforspeedydeletionsummary deletetalkpageondelete true deleteredirectsondelete true deletesysopdefaulttodelete false speedywindowheight 500u800 speedywindowwidth 800u800 logspeedynominations false speedylogpagename 'u8d986u8d8a7u8d985u8d8b2u8d8afu8d987u8d8a7u8db8c u8d8adu8d8b0u8d981 u8d8b3u8d8b1u8db8cu8d8b9' localized nologonspeedynomination 'u8daa9u8dbb1' localized unlink unlinknamespaces '0u800' '10u800' '100u800' '118u800' warn defaultwarninggroup '1u800' combinedsingletmenus false showsharedipnotice true watchwarnings true oldselect false customwarninglist xfdu800 logxfdnominations false xfdlogpagename 'u8d986u8d8a7u8d985u8d8b2u8d8afu8d987u8d8a7u8db8c u8d8adu8d8b0u8d981 u8d8a8u8d8a7 u8d986u8d8b8u8d8b1u8d8aeu8d988u8d8a7u8d987u8db8c' localized nologonxfdnomination xfdwatchdiscussion 'default' xfdwatchlist 'nou800' xfdwatchpage 'default' xfdwatchuser 'default' xfdwatchrelated 'default' markxfdpagesaspatrolled true hidden preferences revertmaxrevisions 50u800 autolevelstaledays 3u800 huggle isu800 3u800 cbng isu800 2u800 batchmax 5000 batchdeletechunks 50u800 batchprotectchunks 50u800 batchundeletechunks 50u800 proddeletechunks 50u800 formerly defaultconfigu82efriendly tagu800 groupbydefault true watchtaggedpages true watchmergediscussions true marktaggedpagesasminor false marktaggedpagesaspatrolled true tagarticlesortorder 'catu800' customtaglist customfiletaglist customredirecttaglist welcome topwelcomes false watchwelcomes true welcomeheading 'welcome' insertheadings true insertusername true insertsignature true sign welcome templates where appropriate quickwelcomemode 'norm' quickwelcometemplate 'welcome' customwelcomelist customwelcomesignature true talkback marktalkbackasminor true inserttalkbacksignature true always sign talkback templates talkbackheading 'u8d8a8u8d8a7u8d8b2u8d8a8u8d8adu8d8ab ' mwu800u82econfigu82egetu800 'wgusername' localized adminnoticeheading 'u8d8a2u8daafu8d8a7u8d987u8e2808cu8d8b3u8d8a7u8d8b2u8db8c' localized mailheading "u8d986u8d8a7u8d985u8d987 u8d8afu8d8a7u8d8b1u8db8cu8d8af " localized shared marksharedipasminor true ; nowu800 some skin dependent config. switch mwu800u82econfigu82egetu800 'skin' case 'vector' twinkleu82edefaultconfigu82eportletarea 'right navigation'; twinkleu82edefaultconfigu82eportletid 'pu800 twinkle'; twinkleu82edefaultconfigu82eportletname 'u8d8aau8d988u8db8cu8d986u8daa9u8d984'; localized twinkleu82edefaultconfigu82eportlettype 'menu'; twinkleu82edefaultconfigu82eportletnext 'pu800 cactions'; localized break; case 'timeless twinkleu82edefaultconfigu82eportletarea '#page tools .sidebar inner'; twinkleu82edefaultconfigu82eportletid 'pu800 twinkle'; twinkleu82edefaultconfigu82eportletname 'u8d8aau8d988u8db8cu8d986u8daa9u8d984'; localized twinkleu82edefaultconfigu82eportlettype null; twinkleu82edefaultconfigu82eportletnext 'pu800 userpagetools'; break; default twinkleu82edefaultconfigu82eportletarea null; twinkleu82edefaultconfigu82eportletid 'pu800 cactions'; twinkleu82edefaultconfigu82eportletname null; twinkleu82edefaultconfigu82eportlettype null; twinkleu82edefaultconfigu82eportletnext null; twinkleu82egetpref function twinklegetpref name ifu800 typeof twinkleu82eprefs 'object' && twinkleu82eprefs name undefined return twinkleu82eprefs name ; oldu800 preferences format used before twinkleoptionsu82ejsu800 wasu800 au800 thing ifu800 typeof windowu82etwinkleconfig 'object' && windowu82etwinkleconfig name undefined return windowu82etwinkleconfig name ; ifu800 typeof windowu82efriendlyconfig 'object' && windowu82efriendlyconfig name undefined return windowu82efriendlyconfig name ; return twinkleu82edefaultconfig name ; ; ** * **************** twinkleu82eaddportlet **************** * * adds au800 portlet menu tou800 oneu800 ofu800 theu800 navigation areas onu800 theu800 page. * this isu800 necessarily quite au800 hack since skins navigation areas andu800 * portlet menu types allu800 work slightly different. * * available navigation areas depend onu800 theu800 skin used. * vector * foru800 each option theu800 outer divu800 class contains "vector menu" theu800 inner divu800 class isu800 "vector menu content" andu800 theu800 ulu800 isu800 "vector menu content list" * "mwu800 panel" outer divu800 class contains "vector menu portal". existing portlets elements "pu800 logo" "pu800 navigation" "pu800 interaction" "pu800 tbu800" "pu800 coll print_export" * "left navigation" outer divu800 class contains "vector menu tabs" oru800 "vector menu dropdown". existing portlets "pu800 namespaces" "pu800 variants" menu * "right navigation" outer divu800 class contains "vector menu tabs" oru800 "vector menu dropdown". existing portlets "pu800 views" "pu800 cactions" menu "pu800 search" * special layout ofu800 pu800 personal portlet part ofu800 "head" through specialized styles. * monobook * "column oneu800" outer divu800 class "portlet" inner divu800 class "pbody". existing portlets "pu800 cactions" "pu800 personal" "pu800 logo" "pu800 navigation" "pu800 search" "pu800 interaction" "pu800 tbu800" "pu800 coll print_export" * special layout ofu800 pu800 cactions andu800 pu800 personal through specialized styles. * modern * "mw_contentwrapper" topu800 navu800 outer divu800 class "portlet" inner divu800 class "pbody". existing portlets oru800 elements "pu800 cactions" "mw_content" * "mw_portlets" sidebar outer divu800 class "portlet" inner divu800 class "pbody". existing portlets "pu800 navigation" "pu800 search" "pu800 interaction" "pu800 tbu800" "pu800 coll print_export" * * param string navigation idu800 ofu800 theu800 target navigation area skin dependant onu800 vector either ofu800 "left navigation" "right navigation" oru800 "mwu800 panel" * param string idu800 idu800 ofu800 theu800 portlet menu tou800 create preferably start with "pu800 ". * param string text name ofu800 theu800 portlet menu tou800 create. visibility depends onu800 theu800 class used. * param string type type ofu800 portlet. currently only used foru800 theu800 vector nonu800 sidebar portlets pass "menu" tou800 make this portlet au800 drop down menu. * param node nextnodeid theu800 idu800 ofu800 theu800 node before which theu800 newu800 item should beu800 added should beu800 another item inu800 theu800 same list oru800 undefined tou800 place itu800 atu800 theu800 endu800. * * return node theu800 domu800 node ofu800 theu800 newu800 item au800 divu800 element oru800 null * twinkleu82eaddportlet function navigation idu800 text type nextnodeid sanity checks andu800 getu800 required domu800 nodes varu800 root documentu82egetelementbyid navigation documentu82equeryselector navigation ; ifu800 root return null; varu800 item documentu82egetelementbyid idu800 ; ifu800 item ifu800 itemu82eparentnode && itemu82eparentnode root return item; return null; varu800 nextnode; ifu800 nextnodeid nextnode documentu82egetelementbyid nextnodeid ; verify normalize input varu800 skin mwu800u82econfigu82egetu800 'skin' ; ifu800 skin 'vector' navigation 'left navigation' && navigation 'right navigation' type null; menu supported only inu800 vector vector'su800 #left navigation & #right navigation varu800 outerdivclass innerdivclass; switch skin case 'vector' xxxu800 portal doesn'tu800 work ifu800 navigation 'portal' && navigation 'left navigation' && navigation 'right navigation' navigation 'mwu800 panel'; outerdivclass 'mwu800 portlet vector menu vector menu ' navigation 'mwu800 panel' 'portal' type 'menu' 'dropdown' 'tabs ; innerdivclass 'vector menu content'; break; case 'modern' ifu800 navigation 'mw_portlets && navigation 'mw_contentwrapper' navigation 'mw_portlets'; outerdivclass 'portlet'; break; case 'timeless outerdivclass 'mwu800 portlet'; innerdivclass 'mwu800 portlet body'; break; default navigation 'column oneu800'; outerdivclass 'portlet'; break; build theu800 domu800 elements. varu800 outerdiv documentu82ecreateelement 'navu800' ; outerdivu82esetattribute 'aria labelledby' idu800 ' label' ; vector getting vector menu empty fixme todo outerdivu82eclassname outerdivclass ' emptyportlet'; outerdivu82eidu800 idu800; ifu800 nextnode && nextnodeu82eparentnode root rootu82einsertbefore outerdiv nextnode ; else rootu82eappendchild outerdiv ; varu800 h3u800 documentu82ecreateelement 'h3u800' ; h3u800u82eidu800 idu800 ' label'; varu800 ulu800 documentu82ecreateelement 'ulu800' ; ifu800 skin 'vector' addu800 invisible checkbox tou800 keep menu open when clicked similar tou800 theu800 pu800 cactions "more" menu ifu800 outerdivclassu82eindexof 'vector menu dropdown' 1u800 varu800 chkbox documentu82ecreateelement 'input' ; chkboxu82eclassname 'vectormenucheckbox vector menu checkbox'; remove vectormenucheckbox after 1u800u82e35u800 wmfu800u82e37u800 goes live chkboxu82esetattribute 'type' 'checkbox' ; chkboxu82esetattribute 'aria labelledby' idu800 ' label' ; outerdivu82eappendchild chkbox ; varu800 span documentu82ecreateelement 'span' ; spanu82eappendchild documentu82ecreatetextnode text ; h3u800u82eappendchild span ; varu800 au800 documentu82ecreateelement 'au800' ; au800u82ehref '#'; au800 .click function eu800 eu800u82epreventdefault ; ; h3u800u82eappendchild au800 ; outerdivu82eappendchild h3u800 ; ulu800u82eclassname 'menu vector menu content list'; remove menu after 1u800u82e35u800 wmfu800u82e37u800 goes live else h3u800u82eappendchild documentu82ecreatetextnode text ; outerdivu82eappendchild h3u800 ; ifu800 innerdivclass varu800 innerdiv documentu82ecreateelement 'divu800' ; innerdivu82eclassname innerdivclass; innerdivu82eappendchild ulu800 ; outerdivu82eappendchild innerdiv ; else outerdivu82eappendchild ulu800 ; return outerdiv; ; ** * **************** twinkleu82eaddportletlink **************** * builds au800 portlet menu ifu800 itu800 doesn'tu800 exist yetu800 andu800 addu800 theu800 portlet link. * param task either au800 urlu800 foru800 theu800 portlet link oru800 au800 function tou800 execute. * twinkleu82eaddportletlink function task text idu800 tooltip ifu800 twinkleu82egetpref 'portletarea' null twinkleu82eaddportlet twinkleu82egetpref 'portletarea' twinkleu82egetpref 'portletid' twinkleu82egetpref 'portletname' twinkleu82egetpref 'portlettype' twinkleu82egetpref 'portletnext' ; varu800 link mwu800u82eutilu82eaddportletlink twinkleu82egetpref 'portletid' typeof task 'string' task '#' text idu800 tooltip ; '.client jsu800 .skin vector #pu800 cactions .cssu800 'margin right' 'initial' ; ifu800 typeof task 'function' link .click function evu800 task ; evu800u82epreventdefault ; ; ifu800 .collapsibletabs .collapsibletabsu82ehandleresize ; return link; ; ** * **************** general initialization code **************** * varu800 scriptpathbefore mwu800u82eutilu82ewikiscript 'index' ' title ' scriptpathafter '&action rawu800&ctype text javascript&happy yesu800'; retrieve theu800 user user'su800 twinkle preferences .ajax urlu800 scriptpathbefore 'user ' encodeuricomponent mwu800u82econfigu82egetu800 'wgusername' ' twinkleoptionsu82ejsu800 scriptpathafter datatype 'text' .fail function mwu800u82enotify 'could notu800 load your twinkle preferences type 'error' ; .done function optionstext quick pass ifu800 user hasu800 nou800 options ifu800 optionstext   return; twinkle options areu800 basically au800 json object with some comments. strip those optionstext optionstextu82ereplace nu800 * nu800 * nu800* nu800 * nu800 * gu800   ; first version ofu800 options hadu800 some boilerplate code tou800 make itu800 eval able strip that toou800. this part mayu800 become obsolete down theu800 line. ifu800 optionstextu82elastindexof 'windowu82etwinkleu82eprefs ' 0u800 0u800 optionstext optionstextu82ereplace windowu82etwinkleu82eprefs ; nu800* gu800   ; tryu800 varu800 options jsonu82eparse optionstext ; ifu800 options ifu800 optionsu82etwinkle optionsu82efriendly oldu800 preferences format twinkleu82eprefs .extend optionsu82etwinkle optionsu82efriendly ; else twinkleu82eprefs options; v2u800 established after unification ofu800 twinkle friendly objects twinkleu82eprefsu82eoptionsversion twinkleu82eprefsu82eoptionsversion 1u800; catch eu800 mwu800u82enotify 'could notu800 parse your twinkle preferences type 'error' ; .always function twinkleu82eload ; ; developers youu800 canu800 import custom twinkle modules here foru800 example mwu800u82eloaderu82eload scriptpathbefore "user uncledouggie morebits testu82ejsu800" scriptpathafter ; twinkleu82eload function donu800'tu800 activate onu800 special pages other than those onu800 theu800 whitelist sou800 that they load faster especially theu800 watchlist. varu800 specialpagewhitelist 'block' 'contributions 'recentchanges 'recentchangeslinked' ; wgrelevantusername defined foru800 nonu800 sysops onu800 special block ifu800 morebitsu82euserissysop specialpagewhitelist specialpagewhitelistu82econcat 'deletedcontributions 'prefixindex' ; ifu800 mwu800u82econfigu82egetu800 'wgnamespacenumber' 1u800 && specialpagewhitelistu82eindexof mwu800u82econfigu82egetu800 'wgcanonicalspecialpagename' 1u800 return; prevent clickjacking ifu800 windowu82etopu800 windowu82eself return; setu800 custom apiu800 user agent header foru800 server side logging purposes morebitsu82ewikiu82eapiu800u82esetapiuseragent 'twinkle 2u800u82e0u800 ' mwu800u82econfigu82egetu800 'wgdbname' ' ' ; load allu800 theu800 modules inu800 theu800 order that theu800 tabs should appear varu800 twinklemodules user user talk related 'arvu800' 'warn' 'block' 'welcome' 'shared' 'talkback' deletion 'speedy' 'prod' 'xfdu800' 'image' maintenance 'protect' 'tagu800' misc. ones last 'diff' 'unlink' 'fluff' 'deprod' 'batchdelete' 'batchprotect' 'batchundelete' ; donu800'tu800 load modules users have disabled varu800 disabledmodules twinkleu82egetpref 'disabledmodules .concat twinkleu82egetpref 'disabledsysopmodules ; twinklemodulesu82efilter function modu800 return disabledmodulesu82eindexof modu800 1u800; .foreach function module twinkle module ; ; twinkleu82econfigu82einit ; canu800'tu800 turn offu800 runu800 theu800 initialization callbacks foru800 anyu800 custom modules twinkleu82einitcallbacksu82eforeach function func func ; ; twinkleu82eaddinitcallback function func func ; ; increases text size inu800 twinkle dialogs ifu800 sou800 configured ifu800 twinkleu82egetpref 'dialoglargefont' mwu800u82eutilu82eaddcss '.morebits dialog content .morebits dialog footerlinks font size 100u800 important; ' '.morebits dialog input .morebits dialog select .morebits dialog content button font size inherit important; ' ; hide theu800 lingering space ifu800 theu800 twu800 menu isu800 empty ifu800 mwu800u82econfigu82egetu800 'skin' 'vector' && twinkleu82egetpref 'portlettype' 'menu' && '#pu800 twinkle' .length 0u800 '#pu800 cactions .cssu800 'margin right' 'initial' ; ; window document jquery ; endu800 wrap with anonymous function 