User:PerfektesChaos/js/editToolStrIns/debug.js

/// editToolStrIns /// Edit tool to insert characters and strings -- especially for WMF /// 2011-11-22 PerfektesChaos@de.wikipedia

// Uses: //   MediaWiki 1.18 (mw.libs, jQuery.textSelection) //   jQuery (core; $.focus, .cookie) //   JavaScript 1.3

/* Based upon previous work of: mw:User:Alex Smotrov             2008 w:de:User:Revolus                2008/2009 w:de:User:WIKImaniac             2009 w:de:MediaWiki:Onlyifediting.js  2011-08-11 /// @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

// No customization recommended above this point. // Start adption and localization here:

with ( mw.libs.editToolStrIns ) { gui.old =  "#specialchars," + "#editpage-specialchars"; l10n[ "dewiki" ] = {  // example for introduction period "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.dewiki.list 2011-11-01 l10n[ "enwiki" ] = { "defs": {  // example for introduction period "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" ] ] ], // ISO 639 "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, "ČčĆćěŁłńóřŕŠšŚśŽžŹź" ] ], // ISO 15924 "Khmr": [ null,  // Khmer [ 2, 0x1780, 0x17DD ], [ 2, 0x17E0, 0x17E9 ], [ 2, 0x17F0, 0x17F9 ] ], "Phli": [ { "dir": "rtl",  // Pahlavi "font-family": "ZH Mono" }, [ 2, 0x10B60, 0x10B72 ], [ 2, 0x10B78, 0x10B7F ] ], "Prti": [ { "dir": "rtl",  // Parthian "font-family": "ZH Mono" }, [ 2, 0x10B40, 0x10B55 ], [ 2, 0x10B58, 0x10B5F ] ], "Xsux": [ { "font-family":  // Cuneiform "Akkadian, CuneiformComposite, Free Idg Serif" }, [ 2, 0x12000, 0x1236F ], [ 2, 0x12400, 0x12462 ], [ 2, 0x12470, 0x12473 ] ], // Others "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,  // Khmer lunatics [ 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 defs.global[ "IPA_T" ] = defs.global.IPA.concat( [ [ [ "" ] ] ] ); }  // with editToolStrIns

// No customization recommended beyond this point.

mw.libs.editToolStrIns.attr.fetch = function ( access ) { // Retrieve attribute setting from definition and use // Precondition: //   access    -- definition item // Uses: //   >< .attr.current // 2011-10-27 PerfektesChaos@de.wikipedia 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;              } }        }   // for v in .current }  }   // with editToolStrIns }  // .attr.fetch

mw.libs.editToolStrIns.attr.fit = function ( attempt ) { // Does definition element match requirements for a valid attr? // Precondition: //   attempt  -- item // Postcondition: //   Returns true if is valid attr // Uses: //   >  .attr.names // 2011-10-27 PerfektesChaos@de.wikipedia var r = false; with ( mw.libs.editToolStrIns ) { if ( attempt ) { for ( var v in attr.names ) { if ( typeof attempt[ v ] === "string" ) { r = true; break;  // for v in .names }        }   // for v in .names } else { r = true; }  }   // with editToolStrIns return r; }  // .attr.fit

mw.libs.editToolStrIns.attr.furnish = function ( assign, acquire, applied ) { // Equip menu with attributes // Precondition: //   assign   -- jQuery menu to be extended //   acquire  -- ID of requested content definition //   applied  -- definition element which provided menu content // Postcondition: //   Menu attributed by cascading properties, if any. // Uses: //   >  .attr.names //   >  .defs.current //    < .attr.current //   .attr.fetch // 2011-10-27 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { var d;     var v;      attr.current = { }; for ( v in attr.names ) { attr.current[ v ] = false; }  // for v in attr.names 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 q in defs.current }     }   // for q in defs.current for ( v in attr.current ) { d = attr.current[ v ]; if ( d ) { if ( attr.names[ v ] ) { assign.css( v, d ); } else { assign.attr( v, d ); }        }      }   // for v in attr.current }  // with editToolStrIns }  // .attr.furnish

mw.libs.editToolStrIns.defs.factory = function { // Build data model from project and user spec // Postcondition: //   .defs.current has been built in current environment // Uses: //   >  .user //   >  .user.lang //   >  .project //   >  .l10n //   >  .lang //    < .defs.current //    < .defs.lead //   .defs.found //   .defs.fluent // 2011-11-17 PerfektesChaos@de.wikipedia 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 ); }  // with editToolStrIns }  // .defs.factory

mw.libs.editToolStrIns.defs.fair = function { // Check standard list, reduce to valid items // Uses: //   >< .defs.tmp //   .defs.finder // 2011-10-27 PerfektesChaos@de.wikipedia 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 ]; }     }   // for p in defs.tmp }  // with editToolStrIns }  // .defs.fair

mw.libs.editToolStrIns.defs.find = function ( access, alike ) { // Find property within objects in current environment // Precondition: //   access  -- name of property //   alike   -- type of property // Postcondition: //   Returns not-empty value,  or false if not found // Uses: //   >  .defs.current // 2011-10-27 PerfektesChaos@de.wikipedia 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;   // for o in            } }     }   // for o in defs.current }  // with editToolStrIns return r; }  // .defs.find

mw.libs.editToolStrIns.defs.finder = function ( acquire ) { // Find content definition within current environment // Precondition: //   acquire  -- ID of requested content definition // Postcondition: //   Returns false if not found, or   //            Array(2):  [0] definition,  [1] origin // Uses: //   >  .defs.current // 2011-10-27 PerfektesChaos@de.wikipedia 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;  // for o in               } }        }      }   // for o in defs.current }  // with editToolStrIns return r; }  // .defs.finder

mw.libs.editToolStrIns.defs.filter = function { // Remove situation dependent list items // Postcondition: //   Returns number of valid items //   Standard list has been reduced if appropriate // Uses: //   >< .defs.tmp // 2011-10-27 PerfektesChaos@de.wikipedia 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 :  // '/' project type /////////////////////////////                 break; case 58 :  // ':' namespace if ( ! reNS ) { reNS = "^:" + mw.config.get( "wgNamespaceNumber" ) + "(_.*)?$" ;                    reNS = new RegExp( reNS, "" ); }                 if ( ! reNS.test( s ) ) { delete defs.tmp[ s ]; r--; }                 break; }  // switch charCodeAt }     }   // for s in defs.tmp }  // with editToolStrIns return r; }  // .defs.filter

mw.libs.editToolStrIns.defs.fluent = function ( assign, appoint, another, already ) { // Build data model with respect to language // Precondition: //   assign   -- string: code of language (ISO 639) //   appoint  -- string: id of language in current data model //   another  -- string: id of dialect in data model //   already  -- Array(2) of known items, or false if not yet set // Postcondition: //   Returns Array(2) of items, or false if not set // Uses: //   .defs.found // 2011-10-27 PerfektesChaos@de.wikipedia 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 ]; }     }   }   // with editToolStrIns return r; }  // .defs.fluent

mw.libs.editToolStrIns.defs.format = function { // Adjust all selected definitions as canonical form definition // Postcondition: //   All definitions available in canonical form // Uses: //   >  .defs.current //   .attr.fit // 2011-10-27 PerfektesChaos@de.wikipedia 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 ); }                 }               }   // for p in c            } else { delete o[ "defs" ]; }        } else { delete o[ "defs" ]; }     }   // for o in defs.current }  // with editToolStrIns }  // .defs.format

mw.libs.editToolStrIns.defs.found = function ( appoint, assign ) { // Append data model item to current model, if valid // Precondition: //   appoint  -- string: id in current data model //   assign   -- string: id in .l10n. object (direct access) // Postcondition: //   Returns object reference in data model // Uses: //   >  .l10n //    < .defs.current // 2011-10-27 PerfektesChaos@de.wikipedia 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;         } }  }   // with editToolStrIns return r; }  // .defs.found

mw.libs.editToolStrIns.defs.furnish = function { // Customize standard list by heading elements and removing items // Precondition: //   Customization entry available //   Standard list in preprocessed form // Postcondition: //   Standard list has been updated // Uses: //   >  .user.custom //   >< .defs.tmp //   .defs.finder // 2011-10-27 PerfektesChaos@de.wikipedia 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 user.custom for ( p in defs.tmp ) { if ( t[ p ] === undefined ) { t[ p ] = defs.tmp[ p ]; }     }   // for p in defs.tmp for ( p in t ) { if ( typeof t[ p ] !== "object" ) { delete t[ p ]; m--; if ( ! m ) { break;  // for p in t            } }     }   // for p in t      defs.tmp = t;   }   // with editToolStrIns }  // .defs.furnish

mw.libs.editToolStrIns.gui.facet = function ( action ) { // Display menu: initial selection or handle GUI event // Precondition: //   action  -- false:  initialization after setup //              object: GUI event // Uses: //   >  .gui.$gadget //   >  .gui.selection //   >  .cookie //   >  .gui.$menu //   >  .defs.list //   .gui.find //   jQuery.cookie // 2011-11-19 PerfektesChaos@de.wikipedia 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:    "/" } ); }  }   // with editToolStrIns }  // .gui.facet

mw.libs.editToolStrIns.gui.fill = function ( arglist ) { // Perform insertion // Precondition: //   arglist  -- parameters for jQuery.textSelection // Uses: //   >  .gui.$textarea //   >< .gui.wikEd:: //       >  .wikEd.focus //       >< .wikEd.active //   >< .gui.$current //      .gui.flip //   >  wikEd:: //         >  .disabled //   jQuery.textSelection // 2011-11-21 PerfektesChaos@de.wikipedia 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" ] ) { // jQuery.textSelection (2011-11) does not support // DOM composition wihin iframe gui.flip; }                 wikEd.UpdateTextarea(null); gui.$current = gui.$textarea; }           } else { gui.wikEd.focus = false; }        }         gui.$current.textSelection( "encapsulateSelection", arglist ); }  }   // with editToolStrIns }  // .gui.fill

mw.libs.editToolStrIns.gui.find = function ( adjust ) { // Retrieve number of item in gadget for a certain identifier // Precondition: //   adjust  -- identifier // Postcondition: //   Returns number,  < 0 if not found // Uses: //   >  .defs.list // 2011-10-27 PerfektesChaos@de.wikipedia 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;   // for i         } }  // for i   }   // with editToolStrIns return r; }  // .gui.find

mw.libs.editToolStrIns.gui.fit = function ( arglist ) { // Perform RegExp replacement // Precondition: //   arglist   -- Array(6) //                [0] to be inserted before caret / selection //                    string or empty //                [1] to be inserted after caret / selection //                    string or empty //                [2] string with replacement expression //                [5] string with RegExp to process selection // Uses: //   >  .gui.$current //   jQuery.textSelection //   gui.fill // 2011-11-21 PerfektesChaos@de.wikipedia 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 ); }  }   // with editToolStrIns }  // .gui.fit

mw.libs.editToolStrIns.gui.flip = function { // Strip trailing mainspace from current selection, mainly for wikEd // Precondition: //   Browser supports wikEd // Uses: //   .gui.flipper //   >  wikEd:: //         .GetSelection //   DOM // 2011-11-22 PerfektesChaos@de.wikipedia 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;  // for n-- }                       located = true; }  // for n-- if ( located ) { if ( n >= 0 ) { rangeLast.setEnd(container, n + 1); }                    }                     container = false; } else { container = gui.flipper( container ); }                 break; }  // switch nodeType if ( container ) { if ( container.nodeType === Node.TEXT_NODE ) { m = container.textContent.length; }           }         }      }   // while container }  // with editToolStrIns }  // .gui.flip

mw.libs.editToolStrIns.gui.flipper = function ( after ) { // Traverse upwards/forward in DOM tree // Precondition: //   after  -- DOM Node at end // Postcondition: //   Returns DOM Node sibling // Uses: //   DOM // 2011-11-22 PerfektesChaos@de.wikipedia 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; }     }   }   // while loop return r; }  // .gui.flipper

mw.libs.editToolStrIns.gui.focus = function { // Initialize focussing // Precondition: //   document ready // Postcondition: //   Binding is established // Uses: //    < .gui.$textarea //    < .gui.$current //    < .gui.wikEd //   >  wikEd:: //         >  .frameBody //         >  .disabled //         >  .frameDocument //         .Setup //   jQuery.focus //   (.gui.frames) // 2011-11-21 PerfektesChaos@de.wikipedia 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" ) { // asynchronous overrun 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 ); /* wikEd uses an iframe which cannot receive focus under < .gui.wikEd:: //        < .wikEd.focus // 2011-11-21 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { if ( gui.wikEd ) { gui.wikEd.focus = true; }  }   // with editToolStrIns }  // .gui.frames

mw.libs.editToolStrIns.menu.factory = function ( apply ) { // Build menu area // Precondition: //   apply  -- Array(5) //             [0] option title //             [1] identifier //             [2] definition //             [3] origin //             [4] $menu (false) // Postcondition: //   Returns jQuery object for $menu (apply[4]) // Uses: //   >  .menu.separator //   >< .menu.$sep //   .attr.furnish //   .menu.field // 2011-11-19 PerfektesChaos@de.wikipedia 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 ] ); }  // for p in menu.divide }           }         }      }      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 ); }  // for i   }   // with editToolStrIns return $r; }  // .menu.factory

mw.libs.editToolStrIns.menu.feed = function ( assign, apply, align ) { // Process a definition element of type "separated compressed" // Precondition: //   assign  -- jQuery element to be extended //   apply   -- definition item; Array with at least 2 elements //              [0] number < 0, -[0]: code of separator //              [1] and further: string, separated by -[0] //   align   -- true: insert group separator ahead // Uses: //   .menu.fence //   .menu.fill // 2011-10-27 PerfektesChaos@de.wikipedia 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] ); }  // for m         } lead = true; }  // for i   }   // with editToolStrIns }  // .menu.feed

mw.libs.editToolStrIns.menu.fence = function ( assign, align ) { // Insert group separator conditionally // Precondition: //   assign  -- jQuery element to be extended //   align   -- true: insert group separator ahead, else do nothing // Uses: //   >  .menu.$sep //   >  .gui.self // 2011-10-27 PerfektesChaos@de.wikipedia if ( align ) { with ( mw.libs.editToolStrIns ) { if ( menu.$sep ) { var $sep = menu.$sep.clone; $sep.attr( "class", gui.self + "-sep" ); assign.append( $sep ); }     }   // with editToolStrIns } }  // .menu.fence

mw.libs.editToolStrIns.menu.field = function ( assign, apply, align ) { // Process one item in definition array // Precondition: //   assign  -- jQuery element to be extended //   apply   -- definition element; Array //   align   -- true: insert group separator ahead // Postcondition: //   Returns necessity for separator before next group // Uses: //   .menu.flush //   .menu.figures //   .menu.feed //   .menu.fixed //   .menu.fence //   .menu.fill // 2011-10-27 PerfektesChaos@de.wikipedia 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 < n;  i++ ) { menu.fill( assign, apply[i] ); }  // for i      } }  // with editToolStrIns return r; }  // .menu.field

mw.libs.editToolStrIns.menu.figures = function ( assign, apply, align ) { // Process a definition element of type "numeric range of single UCS" // Precondition: //   assign  -- jQuery element to be extended //   apply   -- definition item; Array with at least 3 elements //              [0] code for "numeric range" //              [1] UCS of first character in first pair //              [2] UCS of last character in first pair //              [4] optional: UCS of first character in second pair //              [5] optional: UCS of last character in second pair //              ... etc.   //    align   -- true: insert group separator ahead // Uses: //   .menu.fence //   .menu.fill // 2011-11-09 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { var i, j;     var n = apply.length; menu.fence( align ); for ( k = 1; k < n;  k += 2 ) { i = apply[ k ]; j = apply[ k + 1 ]; if ( i < j ) { for ( i <= j; i++ ) { menu.fill( assign, i ); }  // for i         } else {   // rtl for ( i >= j; i-- ) { menu.fill( assign, i ); }  // for i-- }     }   // for k   }   // with editToolStrIns }  // .menu.figures

mw.libs.editToolStrIns.menu.fill = function ( assign, apply ) { // Create a single token // Precondition: //   assign  -- jQuery element to be extended //   apply   -- specification //              string: insert ahead //              number: insert UCS ahead //              Array(1...)    [0]...[4]: string or empty //              [0] to be inserted before cursor position / selection //              [1] to be inserted after cursor position / selection //              [2] to be inserted if there is no selection range //              [3] tooltip //              [4] explicit label for token //              [5] function to be executed instead of insertion //              [...] any further value that has currently no meaning // Uses: //   >  .menu.stick //   >  .gui.self //   .menu.fromCharCode //   (.gui.fill) //   (.gui.fit) // 2011-11-19 PerfektesChaos@de.wikipedia 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; }  // switch typeof apply[5] }                    }                  }               }            }            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; }  // switch typeof apply 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" ) );  // escapes self if ( story ) { $token.attr( "title", story ); }           $token.click( fun ); assign.append( $space ); assign.append( $token ); }     }   }   // with editToolStrIns }  // .menu.fill

mw.libs.editToolStrIns.menu.fixed = function ( assign, apply, align ) { // Process a definition element of type "fixed text" // Precondition: //   assign  -- jQuery element to be extended //   apply   -- (HTML) string to be inserted //   align   -- true: insert separating spaces ahead // Postcondition: //   apply has been appended to apply // 2011-10-27 PerfektesChaos@de.wikipedia var s = " " + ( align ? " " : "" ) + apply + " "; assign.append( s ); }  // .menu.fixed

mw.libs.editToolStrIns.menu.flush = function ( assign, apply, align ) { // Process a definition element of type "packed characters" // Precondition: //   assign  -- jQuery element to be extended //   apply   -- definition item; Array with at least 2 elements //              [0] === 1   //               [1] and further: string, character sequence group //   align   -- true: insert group separator ahead // Uses: //   .menu.fence //   .menu.fill // 2011-10-27 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { var lead = align; var m;     var more   = apply.length; var n;     var stream; for ( var i = 1; i < more;  i++ ) { stream = apply[i]; if ( typeof stream === "string" ) { n = stream.length; menu.fence( n && lead ); for ( m = 0; m < n;  m++ ) { menu.fill( assign, stream.substr( m, 1 ) ); }  // for m         } lead = true; }  // for i   }   // with editToolStrIns }  // .menu.flush

mw.libs.editToolStrIns.menu.fromCharCode = function ( address ) { // Extended fromCharCode for UCS > 0xFFFF (4 bytes/char) // Precondition: //   address  -- number, UCS // Postcondition: //   Returns a single character, //      which might have a string length of 2 instead of 1 // Requires: JavaScript 1.3  String.fromCharCode  2 byte chars only // 2011-10-27 PerfektesChaos@de.wikipedia var r;  if ( address > 0xFFFF ) { var c = address - 0x10000; r = String.fromCharCode( 0xD800 +  ( c >> 10 ),                               0xDC00  +  ( c & 0x3FF ) ); } else { r = String.fromCharCode( address ); }  return r; }   // .menu.fromCharCode

mw.libs.editToolStrIns.factory = function { // (Re-)build entire data model from project and user spec // Postcondition: //   .current defs are defined // Uses: //    < .gui.hintList //    < .gui.hintMenu //    < .defs.list //   >< .defs.lead //   >< .defs.tmp //   .defs.factory //   .defs.format //   .defs.fair //   .defs.furnish //   .defs.filter // 2011-11-17 PerfektesChaos@de.wikipedia 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++; }  // for p in defs.tmp } else { defs.list = false; }     delete defs.tmp; }  // with editToolStrIns }  // .factory

mw.libs.editToolStrIns.about_defs = function ( alerting ) { // Show message box with all available definition identifiers // Precondition: //   alerting  -- false: don't try to pop up message box // Postcondition: //   Message box is presented, if possible. //   Returns void(0) if message box shown, //           else string with definition identifiers. // Uses: //   > .defs.current // 2011-11-19 PerfektesChaos@de.wikipedia 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 ] ); }           }         }   // for q in d      }   // for p in defs.current 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;            } }  // for q         r = r.substr( 1 ); } else { r = "*-*-*-*"; }  }   // with editToolStrIns if ( alerting !== false ) { if ( typeof window ===  "object" ) { window.alert( r ); r = void( 0 ); }  // online }  return r; }   // .about_defs

mw.libs.editToolStrIns.select = function ( action ) { // Set predefined selection // Precondition: //   action  -- string: predefined selection by user // Postcondition: //   Gadget shifting as requested, or postponed after build // Uses: //   >  .defs.list //    < .gui.selection //   .gui.facet // 2011-10-27 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { gui.selection = action; if ( typeof defs.list === "object" ) { gui.facet; }  }   // with editToolStrIns }  // .select

mw.libs.editToolStrIns.update = function { // Furnish entire list and model once again (may be used as API) // Precondition: //   GUI environment available // Postcondition: //   Gadget equipped // Uses: //   >  .gui.$container //   >  .defs.list //   >  .gui.self //   >  .gui.hintList //   >  .gui.hintMenu //   >< .gui.$wrapper //    < .gui.$gadget //    < .gui.$menu //   .factory //   .gui.facet // 2011-11-17 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { if ( gui.$wrapper ) {  // reset gui.$container.remove( "." + gui.self ); }     factory; if ( defs.list ) { var n = defs.list.length; var x = "";  // DEVELOPMENT 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 ); }  // for i         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 ); }  }   // with editToolStrIns }  // .update

mw.libs.editToolStrIns.fire = function { // Start once on loading when document ready // Precondition: //   document ready // Postcondition: //   GUI environment established, initial equipment // Uses: //   >  .gui.container //   >  .gui.old //    < .gui.$container //    < .off //   .gui.focus //   .update // 2011-11-19 PerfektesChaos@de.wikipedia with ( mw.libs.editToolStrIns ) { if ( typeof off === "undefined" ) { gui.$container = jQuery( gui.container ); if ( gui.$container.length ) { if ( typeof gui.old === "string" ) { // Kick out competitors mw.util.addCSS( gui.old + "{display:none}" ); }           gui.focus; update; }     }   }   // with editToolStrIns mw.libs.editToolStrIns.off = true;  // avoid multiple setup }  // .fire

if ( mw.libs.editToolStrIns.off === undefined ) { jQuery( document ).ready( mw.libs.editToolStrIns.fire ); } mw.loader.state( "mw-editTools/editToolStrIns", "ready" ); /// end of editToolStrIns.js