User:PerfektesChaos/js/editToolStrIns.js

/// editToolStrIns /// Edit tool to insert characters and strings--especially for WMF /// 2011-11-22 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.2; if(typeof editToolStrIns.gui!=="object"){ editToolStrIns.gui={};} if(typeof editToolStrIns.l10n!=="object"){ editToolStrIns.l10n={};} if(typeof editToolStrIns.menu!=="object"){ editToolStrIns.menu={};} if(typeof editToolStrIns.menu.separator!=="string"){ editToolStrIns.menu.separator="\xA0\xA0•\xA0 "; editToolStrIns.menu.divide={"font-weight":"bold"};} if(typeof editToolStrIns.menu.stick!=="string"){ editToolStrIns.menu.stick="…";} editToolStrIns.attr={names:{"class":false,"lang":false,"dir":false,"font-family":true,"font-size":true}}; editToolStrIns.defs={"global":null}; with(editToolStrIns){ gui.container=".mw-editTools"; gui.self="editToolStrIns"; gui.$wrapper=false;}} with(mw.libs.editToolStrIns){ gui.old="#specialchars,#editpage-specialchars"; l10n["dewiki"]={"list":{"0":"Standard","":"WikiSyntax",":6":"Datei:",":10":"Vorlage:","IPA":"IPA-Lautschrift","Latin":"Lateinisch","AHD":"AHD-Lautschrift","grc":"Altgriechisch","ar":"Arabisch","DMG":"DMG-Umschrift","eo":"Esperanto","et":"Estnisch","fr":"Französisch","gl":"Galicisch","el":"Griechisch","haw":"Hawaiisch","is":"Isländisch","it":"Italienisch","iw":"Hebräisch","hbs":"Kroatisch/Serbisch/Bosnisch","Cyril":"Kyrillisch","Latin":"Lateinisch","lv":"Lettisch","lt":"Litauisch","mt":"Maltesisch","pl":"Polnisch","pt":"Portugiesisch","Pinyin":"Pinyin","roa":"Romanisch","ro":"Rumänisch","Scand":"Skandinavisch","wen":"Sorbisch","es":"Spanisch","cz":"Tschechisch","tr":"Türkisch","hu":"Ungarisch","vi":"Vietnamesisch"},"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":"–","—",["‘","’"], ["“","”",[0,false],[1,"°″′≈≠≤≥±−×÷√←→·§"], [0,"Sign your posts on talk pages:"], ["~"],[0,"Cite your sources:"], " "],"":0,"Insert:"], ["–","—",["‘","’"], ["“","”",[0,false],[1,"°″′≈≠≤≥±−×÷√←→·§"], [0,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,"āăäâēĕīĭîōŏôŭ"], [0,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]; var 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; var v; attr.current={}; for(v in attr.names){ attr.current[v]=false;} for(var q in defs.current){ d=defs.current[q]["defs"]; if(typeof d==="object"){ d=d[acquire]; if(typeof d==="object"){ attr.fetch(d);}} if(q===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; var p; var scope=false; var shift=false; var 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.current["global"]={"defs":defs.global}; defs.fluent("en","fallback",false,p);}} mw.libs.editToolStrIns.defs.fair=function{ with(mw.libs.editToolStrIns){ var d; var s; for(var p in defs.tmp){ s=defs.tmp[p]; if(typeof s==="string"){ if(s.length){ d=defs.finder(p); if(d){ defs.tmp[p]=[s,p,d[0],d[1],false]; }else{ s=false;} }else{ s=false;} }else{ s=false;} if(!s){ delete defs.tmp[p];}}}} mw.libs.editToolStrIns.defs.find=function(access,alike){ var r=false; with(mw.libs.editToolStrIns){ var p; for(var o in defs.current){ p=defs.current[o][access]; if(typeof p===alike){ if(p){ r=p; break;}}}} return r;} mw.libs.editToolStrIns.defs.finder=function(acquire){ var r=false; with(mw.libs.editToolStrIns){ var d; var p; for(var o in defs.current){ p=defs.current[o]["defs"]; if(typeof p==="object"){ d=p[acquire]; if(typeof d==="object"){ if(d.length>1){ r=[d,o]; break;}}}}} return r;} mw.libs.editToolStrIns.defs.filter=function{ var r=0; with(mw.libs.editToolStrIns){ var reNS=false; for(var s in defs.tmp){ r++; if(typeof s==="string"){ switch(s.charCodeAt(0)){ case 47: ///////////////////////////// break; case 58: if(!reNS){ reNS="^:"+mw.config.get("wgNamespaceNumber")+"(_.*)?$" ; reNS=new RegExp(reNS,"");} if(!reNS.test(s)){ delete defs.tmp[s]; r--;} break;}}}} return r;} mw.libs.editToolStrIns.defs.fluent=function(assign,appoint,another,already){ var r=(already?already:[false,false]); with(mw.libs.editToolStrIns){ var slang=assign.toLowerCase; var k=assign.indexOf("-"); if(k>1){ var s=slang.substr(0,k-1); var 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; var d; var o; var p; for(o in defs.current){ c=defs.current[o]["defs"]; if(typeof c==="object"){ if(c){ for(p in c){ d=c[p]; if(attr.fit(d)){ c[p]=[d]; }else{ if(!attr.fit(d[0])){ c[p]=[null].concat(d);}}} }else{ delete o["defs"];} }else{ delete o["defs"];}}}} mw.libs.editToolStrIns.defs.found=function(appoint,assign){ var r=false; with(mw.libs.editToolStrIns){ var o=false; var s=typeof assign; if(s==="string"){ o=l10n[assign]; }else if(s==="object"){ o=assign;} if(typeof o==="object"){ if(o){ defs.current[appoint]=o; r=o;}}} return r;} mw.libs.editToolStrIns.defs.furnish=function{ with(mw.libs.editToolStrIns){ var c=user.custom; var d; var e; var m=0; var p; var s; var t={}; for(p in c){ s=c[p]; if(typeof s==="string"){ if(s.length){ d=defs.finder(p); if(d){ t[p]=[s,p,d[0],d[1],false];}} }else if(s===true){ e=defs.tmp[p]; if(typeof e==="object"){ t[p]=e;} }else if(s===false){ t[p]=false; m++;}} for(p in defs.tmp){ if(t[p]===undefined){ t[p]=defs.tmp[p];}} for(p in t){ if(typeof t[p]!=="object"){ delete t[p]; m--; if(!m){ break;}}} defs.tmp=t;}} mw.libs.editToolStrIns.gui.facet=function(action){ with(mw.libs.editToolStrIns){ var k=-1; if(action){ k=gui.$gadget.attr("value"); }else{ if(typeof gui.selection==="string"){ k=gui.find(gui.selection);} if(k<0){ if(typeof cookie==="string"){ var s=jQuery.cookie(cookie); k=gui.find(s);}} gui.$gadget.attr("value",k);} k=(k<0?0:k); if(!defs.list[k][4]){ defs.list[k][4]=menu.factory(defs.list[k]);} gui.$menu.children.detach; gui.$menu.append(defs.list[k][4]); if(typeof cookie==="string"){ jQuery.cookie(cookie,defs.list[k][1],{expires:null,path:"/"});}}} 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.list.length; for(var i=0;i<n;i++){ if(defs.list[i][1]===adjust){ r=i; break;}}} return r;} mw.libs.editToolStrIns.gui.fit=function(arglist){ with(mw.libs.editToolStrIns){ if(gui.$current.length){ var pars={}; var 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],""); var 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 rangeSel=wikEd.GetSelection; var numRange=rangeSel.rangeCount; if(numRange){ var located=false; var loop=true; var rangeLast=rangeSel.getRangeAt(numRange-1); var container=rangeLast.endContainer; var m=rangeLast.endOffset; var c; var n; var s; while(container){ switch(container.nodeType){ case Node.ELEMENT_NODE: container=gui.flipper(container); 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);} break;} if(container){ if(container.nodeType===Node.TEXT_NODE){ m=container.textContent.length;}}}}}} mw.libs.editToolStrIns.gui.flipper=function(after){ var container=after; var loop=true; var parent; var previous; var r=null; while(loop){ parent=container.parentNode; if(parent.nodeName.toLowerCase==="html"){ loop=false; }else{ previous=container.previousSibling; if(previous){ r=previous; loop=false; }else{ container=parent;}}} 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[2]; var lead=false; var n=d.length; var 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); if(typeof menu.divide==="object"){ for(var p in menu.divide){ menu.$sep.css(p,menu.divide[p]);}}}}} attr.furnish($r,apply[1],apply[3]); sel=$r.attr("class"); if(typeof sel==="string"){ sel=sel+","; }else{ sel="";} sel=sel+gui.self+"-menu-"+apply[1]; $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; var m; var more=apply.length; var n; var sep=String.fromCharCode(-apply[0]); var subs; var stream; for(var i=1;i<more;i++){ stream=apply[i]; if(typeof stream==="string"){ subs=stream.split(sep); n=subs.length; menu.fence(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){ var $sep=menu.$sep.clone; $sep.attr("class",gui.self+"-sep"); assign.append($sep);}}}} mw.libs.editToolStrIns.menu.field=function(assign,apply,align){ var r=true; with(mw.libs.editToolStrIns){ var begin=apply[0]; var 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>159){ light=false;}} if(!light){ var n=apply.length; menu.fence(align); for(var i=0;i=j;i--){ menu.fill(assign,i);}}}}} mw.libs.editToolStrIns.menu.fill=function(assign,apply){ with(mw.libs.editToolStrIns){ var fun=false; var light=false; var pars=false; var say=""; var story=false; switch(typeof apply){ case "number": say=menu.fromCharCode(apply); light=true; break; case "string": say=apply; light=true; break; case "object": var loose=false; var n=apply.length; var sample=""; var start=(apply[0]?apply[0]:""); var 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": fun=function{apply[5](apply); return false; }; break; case "string": fun=function{gui.fit(apply); return false; }; break;}}}}}} if(!fun){ 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){ fun=function{gui.fill(pars); return false; };} if(fun){ var $space=jQuery(" "); var $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(fun); 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; var m; var more=apply.length; var n; var 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.factory=function{ with(mw.libs.editToolStrIns){ var i=0; var n; defs.lead=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;} n=defs.filter; if(n){ defs.list=Array(n); for(var p in defs.tmp){ defs.list[i]=defs.tmp[p]; i++;} }else{ defs.list=false;} delete defs.tmp;}} mw.libs.editToolStrIns.about_defs=function(alerting){ var r=false; with(mw.libs.editToolStrIns){ var collect=[]; var d; var n; var p; var q; var v; for(p in defs.current){ d=defs.current[p]["defs"]; for(q in d){ v=d[q]; if(typeof v==="object"){ if(v.length>1){ 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.select=function(action){ with(mw.libs.editToolStrIns){ gui.selection=action; if(typeof defs.list==="object"){ gui.facet;}}} mw.libs.editToolStrIns.update=function{ with(mw.libs.editToolStrIns){ if(gui.$wrapper){ gui.$container.remove("."+gui.self);} factory; if(defs.list){ var n=defs.list.length; var x=""; if(vsn<1){ x=" ***** TEST "+gui.self+" "+vsn;} var $opt; var $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.list[i][0]); 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.$container=jQuery(gui.container); if(gui.$container.length){ if(typeof gui.old==="string"){ mw.util.addCSS(gui.old+"{display:none}");} gui.focus; update;}}} mw.libs.editToolStrIns.off=true;} if(mw.libs.editToolStrIns.off===undefined){ jQuery(document).ready(mw.libs.editToolStrIns.fire);} mw.loader.state("mw-editTools/editToolStrIns","ready"); /// end of editToolStrIns.js