User:PerfektesChaos/js/editToolStrIns.js

/// editToolStrIns /// Edit tool to insert characters and strings--especially for WMF /// 2011-11-27 PerfektesChaos@de.wikipedia /// @license GPL [//www.mediawiki.org/w/COPYING](+CC-BY-SA) /// About:mw:User:PerfektesChaos/js/editToolStrIns if(typeof(mw.libs.editToolStrIns)!=="object"){ mw.libs.editToolStrIns={};} with(mw.libs){ editToolStrIns.vsn=0.3; if(typeof editToolStrIns.debug!=="object"){ editToolStrIns.debug=false;} if(typeof editToolStrIns.l10n!=="object"){ editToolStrIns.l10n={};} editToolStrIns.attr={names:{"class":false,"lang":false,"dir":false,"font-family":true,"font-size":true}}; editToolStrIns.defs={"global":null}; editToolStrIns.gui={"container":".mw-editTools","self":"editToolStrIns"}; editToolStrIns.menu={};} with(mw.libs.editToolStrIns){ gui.old="#specialchars,#editpage-specialchars"; menu.separator="\xA0\xA0•\xA0 "; menu.divide={"font-weight":"bold"}; menu.stick="…"; l10n["dewiki"]={"list":,"defs":{"AHD":{"class":"Unicode"},"ar":{"class":"spanAr","font-size":"1.25em"},"grc":{"class":"polytonic"},"haw":{"font-family":"Arial Unicode MS, Lucida Sans Unicode, MS Mincho, Arial, sans-serif;"}} }; l10n["enwiki"]={"defs":{"0":"–","—",["‘","’"], ["“","”",false,[1,"°″′≈≠≤≥±−×÷√←→·§"], [0,"Sign your posts on talk pages:"], ["~"],[0,"Cite your sources:"], " "],"":0,"Insert:"], ["–","—",["‘","’"], ["“","”",false,[1,"°″′≈≠≤≥±−×÷√←→·§"], false,["~",[" "]], [0,"Wiki markup:"], ", ["[","]"],["[[",""], [""],["#REDIRECT ",""]," ", [" "," "], ["",""], ["",""], [" "], [" "," "], [""','""], [" "], [""],""," "], [" "], [" "," "], [" "," "], ["",""], ["",""], [""]],["", ["",""]], "$","$"], [" "] ],[[" "], [" "], [" "]," "], [[" "," "], [" "," "], [" "," "],":10":[{"font-family":"monospace"}, ", ["","","","if"],["","","","ifeq"], ["","","","ifexist"],["","","","expr"], ["","","","ifexpr"],["","","","iferror"], ["","","","switch"],["","","","tag"], ["NaN","","","formatnum"],["","","","formatdate"], ["","","","","lc"],["","","","","uc"], ["","","","subst"],"ang":[{"lang":"ang"},[1,"ĀāÆæǢǣǼǽĊċÐðĒēĠġĪīŌōŪūǷƿȲȳÞþȜȝ"]],"ar":[{"lang":"ar","dir":"rtl"}, [1,"؛؟ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىي،","پچژگڭ"]],"bn":[{"lang":"bn"},[2,0x0981,0x0983,0x0985,0x098C,0x098F,0x0990,0x0993,0x09A8,0x09AA,0x09B0,0x09B2,0x09B2,0x09B6,0x09B9,0x09BC,0x09C4,0x09C7,0x09C8,0x09CB,0x09CE,0x09D7,0x09D7,0x09DC,0x09DD,0x09DF,0x09E3,0x09E6,0x09FB]],"cz":[{"lang":"cz"}, [1,"ÁáČčĎďÉéĚěÍíŇňÓóŘřŠšŤťÚúŮůÝýŽž"]],"de":[{"lang":"de"},[1,"ÄäÖößÜü"], "„","“"],["‚","‘"], ["»","«"],["›","‹"],"el":[{"lang":"el"}, [1,"ΑΆΒΓΔΕΈΖΗΉΘΙΊΚΛΜΝΞΟΌΠΡΣΤΥΎΦΧΨΩΏ","αάβγδεέζηήθιίκλμνξοόπρσςτυύφχψωώ"]],"eo":[{"lang":"eo"},[1,"ĈĉĜĝĤĥĴĵŜŝŬŭ"]],"es":[{"lang":"es"}, [1,"ÁáÉéÍíÑñÓóÚúÜü¡¿"]],"et":[{"lang":"et"},[1,"ČčŠšŽžÕõÄäÖöÜü"]],"fr":[{"lang":"fr"}, [1,"ÀàÂâÇçÉéÈèÊêËëÎîÏïÔôŒœÙùÛûÜüŸÿ"],"«","»"], ["‹","›"],"gl":[{"lang":"gl"},[1,"ÁáÀàÂâÄäÉéÈèÊêËëÌìÎîÏïÓóÒòÔôÖöÙùÛûẀẁŴŵẄẅÝýỲỳŶŷŸÿ"]],"grc":[{"lang":"grc"}, [1,"ΑαΆάΒβΓγΔδΕεΈέΖζΗηΉήΘθΙιΊίΪϊΐΚκΛλΜμΝνΞξΟοΌόΠπΡρΣσςΤτΥυΫϋΎύΰΦφΧχΨψΩωΏώ;·ἀἁὰᾶἂἃἄἅἆἇᾳᾀᾁᾴᾲᾷᾄᾅᾂᾃᾆᾇἐἑὲἔἕἒἓἠἡὴῆἤἢἣἥἦἧῃῄῂῇᾐᾑᾔᾒᾕᾓᾖᾗἰἱὶῖἴἲἵἳἶἷὸὀὁὄὅὂὃῤῥὐὑὺῦὔὕὒὓὖὗὠὡὼῶὤὢὥὣὦὧῳῴῲῷᾠᾡᾤᾢᾥᾣᾦᾧ`᾿῾῍῎῏῟῞῝῍῎ϜϝϘϙϠϡ"]],"gu":[{"lang":"gu"},[2,0x0A81,0x0A83,0x0A85,0x0A8D,0x0A8F,0x0A91,0x0A93,0x0AA8,0x0AAA,0x0AB0,0x0AB2,0x0AB3,0x0AB5,0x0AB9,0x0ABC,0x0AC5,0x0AC7,0x0AC9,0x0ACB,0x0ACD,0x0AD0,0x0AD0,0x0AE0,0x0AE3],[2,0x0AE6,0x0AEF,0x0AF1,0x0AF1]],"haw":[{"lang":"haw"}, [1,"ĀāĒēĪīŌōŪūʻ"]],"hbs":[{"lang":"hbs"},[-32,"Č č Ć ć Dž dž Đ đ Š š Ž ž"]],"hu":[{"lang":"hu"}, [1,"áéíŐöóőŰúüű"]],"is":[{"lang":"is"},[1,"ÁáÐðÉéÍíÓóÚúÝýÞþÆæÖöǫ"]],"it":[{"lang":"it"}, [1,"ÁáÀàÉéÈèÍíÌìÓóÒòÚúÙù"]],"iw":[{"lang":"yi","dir":"rtl"},[-32,"א אַ אָ ב בֿ ג ד ה ו וּװ ױ ז זש ח ט י יִ ײ ײַ כ ך כּל מ ם נ ן ס ע פ פּ פֿ ף צ ץ ק ר ש שׂ תּ ת ׳ ״ ־ "]],"lo":[{"lang":"lo"}, [2,0x0E81,0x0E82,0x0E84,0x0E84,0x0E87,0x0E88,0x0E8A,0x0E8A,0x0E8D,0x0E8D,0x0E94,0x0E97,0x0E99,0x0E9F,0x0EA1,0x0EA3,0x0EA5,0x0EA5,0x0EA7,0x0EA7,0x0EAA,0x0EAB,0x0EAD,0x0EB9,0x0EC0,0x0EC4,0x0EC6,0x0EC6,0x0EC8,0x0ECD,0x0ED0,0x0ED9,0x0EDC,0x0EDD]],"lv":[{"lang":"lv"},[1,"ĀČĒĢĪĶĻŅŠŪŽ","āčēģīķļņšūž"]],"lt":[{"lang":"lt"}, [1,"ĄČĘĖĮŠŲŪŽ","ąčęėįšųūž"]],"mt":[{"lang":"mt"},[1,"ĊċĠġĦħŻż"]],"pl":[{"lang":"pl"}, [1,"ąĄćĆęĘłŁńŃóÓśŚźŹżŻ"]],"pt":[{"lang":"pt"},[1,"ÁáÀàÂâÃãÇçÉéÊêÍíÓóÔôÕõÚúÜü"]],"ro":[{"lang":"ro"}, [1,"ĂăÂâÎîȘșȚț"]],"roa":[{"lang":"roa"},[1,"ĀāĒēĪīŌōŪū"]],"si":[{"lang":"si"}, [2,0x0D82,0x0D83,0x0D85,0x0D96,0x0D9A,0x0DB1,0x0DB3,0x0DBB,0x0DBD,0x0DBD,0x0DC0,0x0DC6,0x0DCA,0x0DCA,0x0DCF,0x0DD4,0x0DD6,0x0DD6,0x0DD8,0x0DDF,0x0DF2,0x0DF4]],"sk":[{"lang":"sk"},[1,"ÁáČčĎďÉéÍíĽľŇňÓóÔôŔŕŠšŤťÚúÝýŽž"]],"te":[{"lang":"te"}, [2,0x0C01,0x0C03,0x0C05,0x0C0C,0x0C0E,0x0C10,0x0C12,0x0C28,0x0C2A,0x0C33,0x0C35,0x0C39,0x0C3D,0x0C44,0x0C46,0x0C48,0x0C4A,0x0C4D,0x0C55,0x0C56,0x0C58,0x0C59,0x0C60,0x0C63,0x0C66,0x0C6F,0x0C78,0x0C7F]],"th":[{"lang":"th"},[2,0x0E01,0x0E3A],[2,0x0E3F,0x0E5B]],"tr":[{"lang":"tr"}, [-32,"Â Ə Ç Ğ Gʻ Î İ Ñ Ň Oʻ Ş Û Ý Ž","â ə ç ğ gʻ î ı ñ ň oʻ ş û ý ž"]],"vi":[{"lang":"vi"},[1,"ÀàẢảÁáẠạÃãĂăẰằẲẳẴẵẮắẶặÂâẦầẨẩẪẫẤấẬậ","Đđ","ÈèẺẻẼẽÉéẸẹÊêỀềỂểỄễẾếỆệ","ỈỉĨĩÍíỊịÌì","ỎỏÓóỌọÒòÕõÔôỒồỔổỖỗỐốỘộƠơỜờỞởỠỡỚớỢợ","ÙùỦủŨũÚúỤụƯưỪừỬửỮữỨứỰự","ỲỳỶỷỸỹỴỵÝý"]],"wen":[{"lang":"wen"}, [1,"ČčĆćěŁłńóřŕŠšŚśŽžŹź"]],"Khmr":[null,[2,0x1780,0x17DD],[2,0x17E0,0x17E9],[2,0x17F0,0x17F9]],"Phli":[{"dir":"rtl","font-family":"ZH Mono"}, [2,0x10B60,0x10B72],[2,0x10B78,0x10B7F]],"Prti":[{"dir":"rtl","font-family":"ZH Mono"},[2,0x10B40,0x10B55],[2,0x10B58,0x10B5F]],"Xsux":[{"font-family":"Akkadian, CuneiformComposite, Free Idg Serif"}, [2,0x12000,0x1236F],[2,0x12400,0x12462],[2,0x12470,0x12473]],"AHD":[null,[1,"āăäâēĕīĭîōŏôŭ"], false,"o͞o","","","food"],["o͝o","","","foot"],"Cyril":[null, [1,"АӘБВГҐЃҒДЂЕЄЁЖЗЅИІЇİЙӢЈКЌҚЛЉМНЊҢОӨПРСТЋУЎӮҰҮФХҲҺЦЧҶЏШЩЪЫЬЭЮЯ","аәбвгґѓғдђеєёжзѕиіїйӣјкќқлљмнњңоөпрстћуўӯұүфхҳһцчҷџшщъыьэюя"]],"DMG":[null,[1,"ʾʿĀāČčḌḍḎḏǦǧĠġḤḥḪḫĪīḷŋṢṣŠšṬṭṮṯŪūẒẓẔẕŽž"]],"Finance":[null, [1,"‰","₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥"],"¤","","","unspecified currency", [1,"©®™","§"]],"IPA":[{"class":"IPA"},[-32,"p t̪ t ʈ c k q ʡ ʔ","b d̪ d ɖ ɟ ɡ ɢ","ɓ ɗ ʄ ɠ ʛ","t͡s t͡ʃ t͡ɕ d͡z d͡ʒ d͡ʑ","ɸ f θ s ʃ ʅ ʆ ʂ ɕ ç ɧ x χ ħ ʜ h","β v ʍ ð z ʒ ʓ ʐ ʑ ʝ ɣ ʁ ʕ ʖ ʢ ɦ","ɬ ɮ","m m̩ ɱ ɱ̩ ɱ̍ n̪ n̪̍ n n̩ ɳ ɳ̩ ɲ ɲ̩ ŋ ŋ̍ ŋ̩ ɴ ","ɴ̩ ʙ ʙ̩ r r̩ ʀ ʀ̩","ɾ ɽ ɿ ɺ","l̪ l̪̩ l l̩ ɫ ɫ̩ ɭ ɭ̩ ʎ ʎ̩ ʟ ʟ̩","w ɥ ʋ ɹ ɻ j ɰ","ʘ ǂ ǀ ǃ ǁ","ʰ ʱ ʷ ʸ ʲ ʳ ⁿ ˡ ʴ ʵ ˢ ˣ ˠ ʶ ˤ ˁ ˀ ʼ","i i̯ ĩ y y̯ ỹ ɪ ɪ̯ ɪ̃ ʏ ʏ̯ ʏ̃ ɨ ɨ̯ ɨ̃ ʉ ʉ̯ ʉ̃ ɯ ɯ̯ ɯ̃ u u̯ ũ ʊ ʊ̯ ʊ̃","e e̯ ẽ ø ø̯ ø̃ ɘ ɘ̯ ɘ̃ ɵ ɵ̯ ɵ̃ ɤ ɤ̯ ɤ̃ o o̯ õ","ɛ ɛ̯ ɛ̃ œ œ̯ œ̃ ɜ ɜ̯ ɜ̃ ə ə̯ ə̃ ɞ ɞ̯ ɞ̃ ʌ ʌ̯ ʌ̃ ɔ ɔ̯ ɔ̃","æ æ̯ æ̃ ɶ ɶ̯ ɶ̃ a a̯ ã ɐ ɐ̯ ɐ̃ ɑ ɑ̯ ɑ̃ ɒ ɒ̯ ɒ̃","ˈ ˌ ː ˑ ˘ . ‿ | ‖"]],"KhmrSy":[null, [2,0x19E0,0x19FF]],"Latin":[null,[-32,"Á á Ć ć É é Í í Ó ó Ś ś Ú ú Ý ý Ǿ ǿ","À à È è Ì ì Ò ò Ù ù","Â â Ĉ ĉ Ê ê Ĝ ĝ Ĥ ĥ Î î Ĵ ĵ Ô ô ŝ Ŝ Û û","Ä ä Ë ë Ï ï Ö ö Ü ü ÿ","Ã ã Ñ ñ Õ õ","Å å","Ç ç","Č č Š š ŭ","Ł ł","Ő ő Ű ű","Ø ø","Ā ā Ē ē Ī ī Ō ō Ū ū Ȳ ȳ","Ă ă Ĕ ĕ Ğ ğ Ĭ ĭ Ŏ ŏ Ŭ ŭ Y̆ y̆","ß","Æ æ Œ œ","Ð ð Þ þ |"]],"Pinyin":[null, [1,"ÁáÀàǍǎĀāÉéÈèĚěĒēÍíÌìǏǐĪīÓóÒòǑǒŌōÚúÙùÜüǓǔŪūǗǘǛǜǙǚǕǖ"]],"Scand":[null,[1,"ÀàÉéÅåÆæÄäØøÖö","ÐðÍíÓóÚúÝýÞþǫ"]],"TeX":[null, "$","$"], ["{,}","","","comma",","],"\\", ["{","}"],"^",["\\cdot","","","cdot","·"], ["\\times","","","times","×"],["\\pm","","","pm","±"], ["\\sum{","}","","sum{}","Σ"],["\\frac{","}{}","","frac{}{}","—"], ["\\sqrt{","}","","sqrt{}","√"],["\\sqrt[n]{","}","","sqrt[n]{}","ⁿ√"], ["\\leq","","","leq","≤"],["\\geq","","","geq","≥"], ["\\approx","","","approx","≈"],["\\ne","","","ne","≠"], ["\\circ","","","circ","°"],["\\infty","","","infty","∞"], ["\\cup","","","cup","∪"],["\\cap","","","cap","∩"], ["\\begin","\\end","","","begin…end"],["\!\,","","","spacing","SPC"], ["\\{","","","","{"],["\\}","","","","}"],"TeX_ar":[null, "\\leftarrow","","","","←"],["\\leftrightarrow","","","","↔"], ["\\rightarrow","","","","→"],["\\Leftarrow","","","","⇐"], ["\\Leftrightarrow","","","","⇔"],["\\Rightarrow","","","","⇒"],"TeX_gr":[null, "\\alpha","","","","α"],["\\beta","","","","β"], ["\\gamma","","","","γ"],["\\delta","","","","δ"], ["\\epsilon","","","","ε"],["\\zeta","","","","ζ"], ["\\eta","","","","η"],["\\theta","","","","θ"], ["\\iota","","","","ι"],["\\kappa","","","","κ"], ["\\lambda","","","","λ"],["\\mu","","","","μ"], ["\\nu","","","","ν"],["\\xi","","","","ξ"], ["\\omicron","","","","ο"],["\\pi","","","","π"], ["\\rho","","","","ρ"],["\\sigma","","","","σ"], ["\\tau","","","","ς"],["\\upsilon","","","","τ"], ["\\phi","","","","υ"],["\\chi","","","","φ"], ["\\psi","","","","χ"],["\\omega","","","","ψ", "\\Alpha","","","","Α"],["\\Beta","","","","Β"], ["\\Gamma","","","","Γ"],["\\Delta","","","","Δ"], ["\\Epsilon","","","","Ε"],["\\Zeta","","","","Ζ"], ["\\Eta","","","","Η"],["\\Theta","","","","Θ"], ["\\Iota","","","","Ι"],["\\Kappa","","","","Κ"], ["\\Lambda","","","","Λ"],["\\Mu","","","","Μ"], ["\\Nu","","","","Ν"],["\\Xi","","","","Ξ"], ["\\Omicron","","","","Ο"],["\\Pi","","","","Π"], ["\\Rho","","","","Ρ"],["\\Sigma","","","","Σ"], ["\\Tau","","","","Τ"],["\\Upsilon","","","","Υ"], ["\\Phi","","","","Φ"],["\\Chi","","","","Χ"], ["\\Psi","","","","Ψ"],["\\Omega","","","","Ω", [0," var: "], "\\varepsilon","","","","ε"],["\\vartheta","","","","θ"], ["\\varkappa","","","","κ"],["\\varpi","","","","π"], ["\\varrho","","","","ρ"],["\\varsigma","","","","σ"], ["\\varphi","","","","υ"],"TeX_tx":[null,"\\mbox","","","","mbox"], ["\\text","","","","text"],["\\displaystyle","","","","displaystyle"], ["\\textstyle","","","","textstyle"],["\\boldsymbol{","}","","","boldsymbol"], ["\\mathit{","}","","italic","mathit"],["\\mathrm{","}","","roman","mathrm"], ["\\mathsf{","}","","sans serif","mathsf"],["\\color{","}","","","color"] }; defs.global["IPA_T"]=defs.global.IPA.concat([""]);} mw.libs.editToolStrIns.attr.fetch=function(access){ with(mw.libs.editToolStrIns){ var d=access[0],s; if(d){ for(var v in attr.current){ if(!attr.current[v]){ s=d[v]; if(typeof s==="string"){ attr.current[v]=s;}}}}}} mw.libs.editToolStrIns.attr.fit=function(attempt){ var r=false; with(mw.libs.editToolStrIns){ if(attempt){ for(var v in attr.names){ if(typeof attempt[v]==="string"){ r=true; break;}} }else{ r=true;}} return r;} mw.libs.editToolStrIns.attr.furnish=function(assign,acquire,applied){ with(mw.libs.editToolStrIns){ var d,n=defs.current.length,q,v; attr.current={}; for(v in attr.names){ attr.current[v]=false;} attr.current["dir"]="ltr"; for(var i=0;i<n;i++){ q=defs.current[i]; d=q[1]["defs"]; if(typeof d==="object"){ d=d[acquire]; if(typeof d==="object"){ attr.fetch(d);}} if(q[0]===applied){ break;}} for(v in attr.current){ d=attr.current[v]; if(d){ if(attr.names[v]){ assign.css(v,d); }else{ assign.attr(v,d);}}}}} mw.libs.editToolStrIns.defs.factory=function{ with(mw.libs.editToolStrIns){ var o,p,scope=false,shift=false,slang=false; defs.current=[]; if(typeof user==="object"){ o=defs.found("user",user); if(o){ p=o["lang"]; if(typeof p==="string"){ if(p.length){ shift=p;}} if(typeof o["custom"]==="object"){ defs.lead=true;}}} if(typeof project==="string"){ if(project.length){ scope=project;}} if(!scope){ scope=mw.config.get("wgDBname");} defs.found("db",scope); p=scope.search(/wik[it].+$/); if(p>0){ defs.found("project",scope.substr(p));} if(typeof lang==="string"){ if(lang.length){ slang=lang;}} if(typeof slang!=="string"){ slang=mw.config.get("wgContentLanguage");} p=defs.fluent(slang,"projlang","projsub",false); if(typeof shift!=="string"){ shift=mw.config.get("wgUserLanguage").toLowerCase;} p=defs.fluent(shift,"language","dialect",p); defs.features; defs.current.push(["global",{"defs":defs.global}]); defs.fluent("en","fallback",false,p);}} mw.libs.editToolStrIns.defs.fade=function(access){ with(mw.libs.editToolStrIns){ if(access){ var d,n=defs.opts.length; for(var i=0;i<n;i++){ d=defs.opts[i]; if(d[0]===access){ defs.opts.splice(i,1); break;}}}}} mw.libs.editToolStrIns.defs.fair=function{ with(mw.libs.editToolStrIns){ var d,j,n=defs.tmp.length / 2, say,seek; for(var i=0;i=0;i--){ c=defs.current[i][1]["config"]; if(typeof c==="object"){ for(p in c){ set(p,c[p]);}}}}} mw.libs.editToolStrIns.defs.filter=function{ with(mw.libs.editToolStrIns){ var n=defs.opts.length,s; for(var i=n-1;i>=0;i--){ s=defs.opts[i][0]; if(typeof s==="string"){ switch(s.charCodeAt(0)){ case 47: break; case 58: if(!defs.reNS){ defs.reNS="^:"+mw.config.get("wgNamespaceNumber")+"(_.*)?$" ; defs.reNS=new RegExp(defs.reNS,"");} if(!defs.reNS.test(s)){ defs.opts.splice(i,1); n--;} break;}}} if(!n){ defs.opts=false;}}} mw.libs.editToolStrIns.defs.find=function(access,alike){ var r=false; with(mw.libs.editToolStrIns){ var n=defs.current.length,p; for(var i=0;i1){ r=[acquire,d,g[0]]; break;}}}}} return r;} mw.libs.editToolStrIns.defs.fluent=function(assign,appoint,another,already){ var r=(already?already:[false,false]); with(mw.libs.editToolStrIns){ var k=assign.indexOf("-"),slang=assign.toLowerCase; if(k>1){ var s=slang.substr(0,k-1),sub=s+"_"+slang.substr(0,k+1); if(already){ if(already[0]===s){ s=false;} if(already[1]===sub){ sub=false;}} if(s){ defs.found(appoint,s);} if(sub){ defs.found(another,sub);} r=[s,sub]; }else{ if(already){ if(already[0]===slang){ slang=false;}} if(slang){ defs.found(appoint,slang); r=[slang,false];}}} return r;} mw.libs.editToolStrIns.defs.format=function{ with(mw.libs.editToolStrIns){ var c,d,e,g,n=defs.current.length,o,p; for(var i=0;i<n;i++){ o=defs.current[i][1]; c=o["defs"]; if(typeof c==="object"){ if(c){ for(e in c){ d=c[e]; if(typeof d==="object"){ if(attr.fit(d)){ c[e]=[d]; }else{ if(jQuery.isArray(d)){ if(!attr.fit(d[0])){ d.unshift([null]);} }else{ p=d["atributes"]; g=d["groups"]; if(p||g){ if(!p){ p=null;} if(g){ c[e]=[p,{"groups":g}]; }else{ c[e]=[p];} }else{ d=false;}}} }else{ d=false;} if(!d){ delete c[e];}}} }else{ c=false;} if(!c){ delete o["defs"];}}}} mw.libs.editToolStrIns.defs.found=function(appoint,assign){ var r=false; with(mw.libs.editToolStrIns){ var o=false; switch(typeof assign){ case "object": o=assign; break; case "string": o=l10n[assign]; break;} if(typeof o==="object"){ if(o){ defs.current.push([appoint,o]); r=o;}}} return r;} mw.libs.editToolStrIns.defs.friend=function(access){ var r=false; with(mw.libs.editToolStrIns){ var n=defs.opts.length,o; for(var i=0;i<n;i++){ o=defs.opts[i]; if(o[0]===access){ r=o[3]; break;}}} return r;} mw.libs.editToolStrIns.defs.furnish=function{ with(mw.libs.editToolStrIns){ if(typeof user.custom==="object"){ if(jQuery.isArray(user.custom)){ var n=user.custom.length / 2; if(n){ var j,opt,say,seek,temp=[]; for(var i=0;i<n;i++){ j=i+i; seek=user.custom[j]; if(typeof seek==="string"){ if(seek.length){ opt=false; j++; say=user.custom[j]; if(say){ if(typeof say==="string"){ say=jQuery.trimRight(say); if(!say.length){ say=false;} }else{ say=defs.friend(seek);} if(say){ opt=defs.finder(seek); if(opt){ opt=opt.concat([say,false]); temp.push(opt);}}} if(seek!==""){ defs.fade(seek);}}}} if(temp.length){ defs.opts=temp.concat(defs.opts);}}}}}} mw.libs.editToolStrIns.gui.facet=function(action){ with(mw.libs.editToolStrIns){ var k,learn=(typeof gui.cookie==="string"); if(action){ k=gui.$gadget.attr("value"); }else{ if(typeof gui.selection==="string"){ k=gui.find(gui.selection); }else{ k=-1;} if(k<0){ if(learn){ var s=jQuery.cookie(gui.cookie); k=gui.find(s);}} gui.$gadget.attr("value",k);} k=(k<0?0:k); if(!defs.opts[k][4]){ defs.opts[k][4]=menu.factory(defs.opts[k]);} gui.$menu.children.detach; gui.$menu.append(defs.opts[k][4]); if(learn){ jQuery.cookie(gui.cookie,defs.opts[k][0],{expires:null,path:"/"});}}} mw.libs.editToolStrIns.gui.favour=function{ with(mw.libs.editToolStrIns){ if(typeof gui.old==="string"){ mw.util.addCSS(gui.old+"{display:none}");}}} mw.libs.editToolStrIns.gui.fill=function(arglist){ with(mw.libs.editToolStrIns){ if(gui.$current.length){ if(gui.wikEd){ if(window.wikEd.disabled){ gui.wikEd.active=false;} if(gui.wikEd.active){ if(gui.wikEd.focus){ if(arglist["post"]||arglist["peri"]|| arglist["replace"]){ gui.flip;} wikEd.UpdateTextarea(null); gui.$current=gui.$textarea;} }else{ gui.wikEd.focus=false;}} gui.$current.textSelection("encapsulateSelection",arglist);}}} mw.libs.editToolStrIns.gui.find=function(adjust){ var r=-1; with(mw.libs.editToolStrIns){ var n=defs.opts.length; for(var i=0;i<n;i++){ if(defs.opts[i][0]===adjust){ r=i; break;}}} return r;} mw.libs.editToolStrIns.gui.fit=function(arglist){ with(mw.libs.editToolStrIns){ if(gui.$current.length){ var pars={},range=gui.$current.textSelection("getCaretPosition",{"startAndEnd": true}); if(arglist[0]){ pars["pre"]=arglist[0];} if(arglist[1]){ pars["post"]=arglist[1];} if(range[0]<range[1]){ if(typeof arglist[2]==="string"&&typeof arglist[5]==="string"){ var re=new RegExp(arglist[5],""),sel=gui.$current.textSelection("getSelection"); pars["peri"]=sel.replace(re,arglist[2]); pars["replace"]=true;}} gui.fill(pars);}}} mw.libs.editToolStrIns.gui.flip=function{ with(mw.libs.editToolStrIns){ var range=wikEd.GetSelection,sel=range.toString,n=sel.length,lead=(n!==jQuery.trimLeft(sel).length),later=(n!==jQuery.trimRight(sel).length); if(lead||later){ var numRange=range.rangeCount; if(numRange){ if(later){ gui.flipEnd(range,numRange);} if(lead){ }}}}} mw.libs.editToolStrIns.gui.flipEnd=function(assembly,amount){ with(mw.libs.editToolStrIns){ var located,rangeLast=assembly.getRangeAt(amount-1),container=rangeLast.endContainer,m=rangeLast.endOffset,c,n,s; while(container){ switch(container.nodeType){ case Node.ELEMENT_NODE: container=gui.flipper(container,Node.ELEMENT_NODE); break; case Node.TEXT_NODE: if(m){ s=container.textContent; m--; located=false; for(n=m;n>=0;n--){ c=s.charCodeAt(n); if(c>32&&c!==160){ break;} located=true;} if(located){ if(n>=0){ rangeLast.setEnd(container,n+1);}} container=false; }else{ container=gui.flipper(container,Node.TEXT_NODE);} break;} if(container){ if(container.nodeType===Node.TEXT_NODE){ m=container.textContent.length;}}}}} mw.libs.editToolStrIns.gui.flipper=function(after,about){ var container=after,mode=about,parent=null,previous,r=null; with(mw.libs.editToolStrIns){///////////////// while(true){ previous=container.previousSibling; if(previous){ r=previous; mode=0; break;} if(mode===Node.ELEMENT_NODE){ parent=container.parentNode; if(parent.nodeName.toLowerCase==="html"){ break; }else{ container=parent; mode=container.nodeType;}}}} return r;} mw.libs.editToolStrIns.gui.focus=function{ with(mw.libs.editToolStrIns){ gui.$textarea=jQuery("#wpTextbox1"); gui.$current=gui.$textarea; gui.wikEd=false; jQuery("textarea, input:text").focus(function{ gui.$current=jQuery(this); if(gui.wikEd){ gui.wikEd.focus=false;} }); if(typeof window.wikEd==="object"){ if(window.wikEd){ if(typeof window.wikEd.disabled!=="boolean"){ window.wikEd.Setup;} if(gui.$textarea.length&&!window.wikEd.disabled){ gui.wikEd={active:true,focus:true}; window.wikEd.frameDocument.addEventListener("click",gui.frames,false); window.wikEd.frameDocument.addEventListener("dblclick",gui.frames,false); window.wikEd.frameDocument.addEventListener("keypress",gui.frames,false);}}}}} mw.libs.editToolStrIns.gui.frames=function(active){ with(mw.libs.editToolStrIns){ if(gui.wikEd){ gui.wikEd.focus=true;}}} mw.libs.editToolStrIns.menu.factory=function(apply){ var $r; with(mw.libs.editToolStrIns){ var d=apply[1],lead=false,n=d.length,sel; $r=jQuery(" "); $r.css("display","inline"); if(typeof menu.$sep!=="object"){ menu.$sep=false; if(typeof menu.separator==="string"){ if(menu.separator.length){ menu.$sep=jQuery(" "); menu.$sep.text(menu.separator); menu.$sep.attr("class",gui.self+"-sep"); if(typeof menu.divide==="object"){ for(var p in menu.divide){ menu.$sep.css(p,menu.divide[p]);}}}}} attr.furnish($r,apply[0],apply[2]); sel=$r.attr("class"); if(typeof sel==="string"){ sel=sel+","; }else{ sel="";} sel=sel+gui.self+"-menu-"+apply[0]; $r.attr("class",sel); for(var i=1;i<n;i++){ lead=menu.field($r,d[i],lead);}} return $r;} mw.libs.editToolStrIns.menu.feed=function(assign,apply,align){ with(mw.libs.editToolStrIns){ var lead=align,m,more=apply.length,n,sep=String.fromCharCode(-apply[0]),subs,stream; for(var i=1;i<more;i++){ stream=apply[i]; if(typeof stream==="string"){ subs=stream.split(sep); n=subs.length; menu.fence(assign,n&&lead); for(m=0;m<n;m++){ menu.fill(assign,subs[m]);}} lead=true;}}} mw.libs.editToolStrIns.menu.fence=function(assign,align){ if(align){ with(mw.libs.editToolStrIns){ if(menu.$sep){ assign.append(menu.$sep.clone);}}}} mw.libs.editToolStrIns.menu.field=function(assign,apply,align){ var r=true; with(mw.libs.editToolStrIns){ var light=true; if(apply){ var begin=apply[0]; light=(typeof begin==="number"); if(light){ if(begin===1){ menu.flush(assign,apply,align); }else if(begin===2){ menu.figures(assign,apply,align); }else if(begin<-31){ menu.feed(assign,apply,align); }else if(!begin){ if(apply[1]){ menu.fixed(assign,apply[1],align);} r=false; }else if(begin>126){ light=false;}} }else{ r=false;} if(!light){ var n=apply.length; menu.fence(assign,align); for(var i=0;i-1024){ for(i>=j;i--){ menu.fill(assign,i);} m=false;}} if(m){ menu.fixed(assign,"ERROR: too many UCS chars: "+i+"..."+j,true);}}}} mw.libs.editToolStrIns.menu.fill=function(assign,apply){ with(mw.libs.editToolStrIns){ var exec=false,light=false,pars=false,say="",story=false; switch(typeof apply){ case "number": if(apply>0){ say=menu.fromCharCode(apply); light=true;} break; case "string": say=apply; light=true; break; case "object": var loose=false,n=apply.length,sample="",start=(apply[0]?apply[0]:""), suffix=""; if(typeof start==="number"){ start=menu.fromCharCode(start);} say=start; if(n>1){ if(apply[1]){ suffix=apply[1]; if(typeof suffix==="number"){ suffix=menu.fromCharCode(suffix);} say=start+suffix; story=start+menu.stick+suffix;} if(n>2){ if(apply[2]){ sample=apply[2]; story=say+sample+suffix;} if(n>3){ if(apply[3]){ story=apply[3];} if(n>4){ if(apply[4]){ say=apply[4];} if(n>5){ switch(typeof apply[5]){ case "boolean": loose=apply[5]; break; case "function": exec=function{menu.fun(apply); return false; }; break; case "string": exec=function{gui.fit(apply); return false; }; break;}}}}}} if(!exec){ pars={}; if(start){ pars["pre"]=start;} if(suffix){ pars["post"]=suffix;} if(sample){ pars["peri"]=sample;} if(loose){ pars["replace"]=true;} if(pars==={}){ pars=false;}} break;} if(say.length){ if(light){ pars={"pre":say};} if(pars){ exec=function{gui.fill(pars); return false; };} if(exec){ var $space=jQuery(" "), $token=jQuery(""); $token.attr("href","#"); $token.attr("class",gui.self+"-token"); $token.text(say.replace(/ /g,"\xA0")); if(story){ $token.attr("title",story);} $token.click(exec); assign.append($space); assign.append($token);}}}} mw.libs.editToolStrIns.menu.fixed=function(assign,apply,align){ var s=" "+(align?" ":"")+apply+" "; assign.append(s);} mw.libs.editToolStrIns.menu.flush=function(assign,apply,align){ with(mw.libs.editToolStrIns){ var lead=align,m,more=apply.length,n,stream; for(var i=1;i0xFFFF){ var c=address-0x10000; r=String.fromCharCode(0xD800+(c>>10),0xDC00+(c&0x3FF)); }else{ r=String.fromCharCode(address);} return r;} mw.libs.editToolStrIns.menu.fun=function(apply){ with(mw.libs.editToolStrIns){ var got=apply[5](apply,gui.$current.textSelection("getSelection")); if(typeof got==="object"){ gui.fill(got);}}} mw.libs.editToolStrIns.factory=function{ with(mw.libs.editToolStrIns){ var i=0; defs.lead=false; defs.opts=false; defs.reNS=false defs.factory; defs.tmp=defs.find("list","object"); gui.hintList=defs.find("hintList","string"); gui.hintMenu=defs.find("hintMenu","string"); defs.format; defs.fair; if(defs.lead){ defs.furnish;} if(defs.opts){ defs.filter}}} mw.libs.editToolStrIns.about_defs=function(alerting){ var r=false; with(mw.libs.editToolStrIns){ var collect=[],d,n,p,q,v; n=defs.current.length; for(var i=0;i1){ collect=collect.concat([q]);}}}} n=collect.length; if(n){ collect.sort; r=""; p=""; for(q=0;q<n;q++){ v=collect[q]; if(v!==p){ r+=" "+v; p=v;}} r=r.substr(1); }else{ r="*-*-*-*";}} if(alerting!==false){ if(typeof window==="object"){ window.alert(r); r=void(0);}} return r;} mw.libs.editToolStrIns.set=function(action,apply){ with(mw.libs.editToolStrIns){ switch(action){ case "cookieName": if(typeof apply==="string"){ gui.cookie=jQuery.trimLeft(apply); gui.cookie=jQuery.trimRight(gui.cookie); if(!gui.cookie.length){ gui.cookie=false;} }else{ gui.cookie=false;} break; case "ellipsis": if(typeof apply==="string"){ menu.stick=apply;} break; case "groupSeparator": menu.separator=apply; break; case "groupSeparatorCSS": if(typeof apply==="object"){ menu.divide=apply;} break; case "old": gui.old=apply; gui.favour; break; case "selection": gui.selection=apply; if(typeof defs.opts==="object"){ gui.facet;} break;}}} mw.libs.editToolStrIns.update=function{ with(mw.libs.editToolStrIns){ if(gui.$wrapper){ gui.$container.remove("."+gui.self);} factory; if(defs.opts){ var n=defs.opts.length; var x=""; if(vsn<1){ x=" ***** TEST "+gui.self+" "+vsn;} var $opt,$sep=jQuery(" "); gui.$wrapper=jQuery(" "); gui.$wrapper.attr("class",gui.self); gui.$gadget=jQuery(" "); gui.$gadget.attr("class",gui.self+"-gadget"); if(gui.hintList){ gui.$gadget.attr("title",gui.hintList /************/+x); }else{ gui.$gadget.attr("title",x);} for(var i=0;i<n;i++){ $opt=jQuery(" "); $opt.attr("value",i); $opt.text(defs.opts[i][3]); gui.$gadget.append($opt);} gui.$wrapper.append(gui.$gadget); gui.$wrapper.append($sep); gui.$menu=jQuery(" "); gui.$menu.attr("class",gui.self+"-menu"); gui.$menu.css("display","inline"); if(gui.hintMenu){ gui.$menu.attr("title",gui.hintMenu);} gui.$wrapper.append(gui.$menu); gui.facet(false); gui.$container.prepend(gui.$wrapper); gui.$gadget.change(gui.facet); gui.$gadget.keyup(gui.facet);}}} mw.libs.editToolStrIns.fire=function{ with(mw.libs.editToolStrIns){ if(typeof off==="undefined"){ gui.$wrapper=false; gui.$container=jQuery(gui.container); if(gui.$container.length){ gui.favour; gui.focus; update;}}} mw.libs.editToolStrIns.off=true;} if(mw.libs.editToolStrIns.off===undefined){ jQuery(document).ready(mw.libs.editToolStrIns.fire);} mw.loader.state("ext.gadget.editToolStrIns","ready"); /// end of editToolStrIns.js