3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,435 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
Common.util = Common.util || {};
Common.util.LanguageInfo = new(function () {
var localLanguageName = {
54: ["af", "Afrikaans"],
1078: ["af-ZA", "Afrikaans (Suid Afrika)"],
28: ["sq", "Shqipe"],
1052: ["sq-AL", "Shqipe (Shqipëria)"],
132: ["gsw", "Elsässisch"],
1156: ["gsw-FR", "Elsässisch (Frànkrisch)"],
94: ["am", "አማርኛ"],
1118: ["am-ET", "አማርኛ (ኢትዮጵያ)"],
1: ["ar", "العربية"],
5121: ["ar-DZ", "العربية (الجزائر)"],
15361: ["ar-BH", "العربية (البحرين)"],
3073: ["ar-EG", "العربية (مصر)"],
2049: ["ar-IQ", "العربية (العراق)"],
11265: ["ar-JO", "العربية (الأردن)"],
13313: ["ar-KW", "العربية (الكويت)"],
12289: ["ar-LB", "العربية (لبنان)"],
4097: ["ar-LY", "العربية (ليبيا)"],
6145: ["ar-MA", "العربية (المملكة المغربية)"],
8193: ["ar-OM", "العربية (عمان)"],
16385: ["ar-QA", "العربية (قطر)"],
1025: ["ar-SA", "العربية (المملكة العربية السعودية)"],
10241: ["ar-SY", "العربية (سوريا)"],
7169: ["ar-TN", "العربية (تونس)"],
14337: ["ar-AE", "العربية (الإمارات العربية المتحدة)"],
9217: ["ar-YE", "العربية (اليمن)"],
43: ["hy", "Հայերեն"],
1067: ["hy-AM", "Հայերեն (Հայաստան)"],
77: ["as", "অসমীয়া"],
1101: ["as-IN", "অসমীয়া (ভাৰত)"],
44: ["az", "Azərbaycan­ılı"],
29740: ["az-Cyrl", "Азәрбајҹан дили"],
2092: ["az-Cyrl-AZ", "Азәрбајҹан (Азәрбајҹан)"],
30764: ["az-Latn", "Azərbaycan­ılı"],
1068: ["az-Latn-AZ", "Azərbaycan­ılı (Azərbaycan)"],
109: ["ba", "Башҡорт"],
1133: ["ba-RU", "Башҡорт (Россия)"],
45: ["eu", "Euskara"],
1069: ["eu-ES", "Euskara (Euskara)"],
35: ["be", "Беларускі"],
1059: ["be-BY", "Беларускі (Беларусь)"],
69: ["bn", "বাংলা"],
2117: ["bn-BD", "বাংলা (বাংলাদেশ)"],
1093: ["bn-IN", "বাংলা (ভারত)"],
30746: ["bs", "bosanski"],
25626: ["bs-Cyrl", "Босански (Ћирилица)"],
8218: ["bs-Cyrl-BA", "Босански (Босна и Херцеговина)"],
26650: ["bs-Latn", "Bosanski (Latinica)"],
5146: ["bs-Latn-BA", "Bosanski (Bosna i Hercegovina)"],
126: ["br", "Brezhoneg"],
1150: ["br-FR", "Brezhoneg (Frañs)"],
2: ["bg", "Български"],
1026: ["bg-BG", "Български (България)"],
3: ["ca", "Català"],
1027: ["ca-ES", "Català (Català)"],
30724: ["zh", "中文"],
4: ["zh-Hans", "中文(简体)"],
2052: ["zh-CN", "中文(中华人民共和国)"],
4100: ["zh-SG", "中文(新加坡)"],
31748: ["zh-Hant", "中文(繁體)"],
3076: ["zh-HK", "中文(香港特別行政區)"],
5124: ["zh-MO", "中文(澳門特別行政區)"],
1028: ["zh-TW", "中文(台灣)"],
131: ["co", "Corsu"],
1155: ["co-FR", "Corsu (France)"],
26: ["hr", "Hrvatski"],
1050: ["hr-HR", "Hrvatski (Hrvatska)"],
4122: ["hr-BA", "Hrvatski (Bosna i Hercegovina)"],
5: ["cs", "Čeština"],
1029: ["cs-CZ", "Čeština (Česká republika)"],
6: ["da", "Dansk"],
1030: ["da-DK", "Dansk (Danmark)"],
140: ["prs", "درى"],
1164: ["prs-AF", "درى (افغانستان)"],
101: ["dv", "ދިވެހިބަސް"],
1125: ["dv-MV", "ދިވެހިބަސް (ދިވެހި ރާއްޖެ)"],
19: ["nl", "Nederlands"],
2067: ["nl-BE", "Nederlands (België)"],
1043: ["nl-NL", "Nederlands (Nederland)"],
9: ["en", "English"],
3081: ["en-AU", "English (Australia)"],
10249: ["en-BZ", "English (Belize)"],
4105: ["en-CA", "English (Canada)"],
9225: ["en-029", "English (Caribbean)"],
16393: ["en-IN", "English (India)"],
6153: ["en-IE", "English (Ireland)"],
8201: ["en-JM", "English (Jamaica)"],
17417: ["en-MY", "English (Malaysia)"],
5129: ["en-NZ", "English (New Zealand)"],
13321: ["en-PH", "English (Philippines)"],
18441: ["en-SG", "English (Singapore)"],
7177: ["en-ZA", "English (South Africa)"],
11273: ["en-TT", "English (Trinidad y Tobago)"],
2057: ["en-GB", "English (United Kingdom)"],
1033: ["en-US", "English (United States)"],
12297: ["en-ZW", "English (Zimbabwe)"],
37: ["et", "Eesti"],
1061: ["et-EE", "Eesti (Eesti)"],
56: ["fo", "Føroyskt"],
1080: ["fo-FO", "Føroyskt (Føroyar)"],
100: ["fil", "Filipino"],
1124: ["fil-PH", "Filipino (Pilipinas)"],
11: ["fi", "Suomi"],
1035: ["fi-FI", "Suomi (Suomi)"],
12: ["fr", "Français"],
2060: ["fr-BE", "Français (Belgique)"],
3084: ["fr-CA", "Français (Canada)"],
1036: ["fr-FR", "Français (France)"],
5132: ["fr-LU", "Français (Luxembourg)"],
6156: ["fr-MC", "Français (Principauté de Monaco)"],
4108: ["fr-CH", "Français (Suisse)"],
98: ["fy", "Frysk"],
1122: ["fy-NL", "Frysk (Nederlân)"],
86: ["gl", "Galego"],
1110: ["gl-ES", "Galego (Galego)"],
55: ["ka", "ქართული"],
1079: ["ka-GE", "ქართული (საქართველო)"],
7: ["de", "Deutsch"],
3079: ["de-AT", "Deutsch (Österreich)"],
1031: ["de-DE", "Deutsch (Deutschland)"],
5127: ["de-LI", "Deutsch (Liechtenstein)"],
4103: ["de-LU", "Deutsch (Luxemburg)"],
2055: ["de-CH", "Deutsch (Schweiz)"],
8: ["el", "Ελληνικά"],
1032: ["el-GR", "Ελληνικά (Ελλάδα)"],
111: ["kl", "Kalaallisut"],
1135: ["kl-GL", "Kalaallisut (Kalaallit Nunaat)"],
71: ["gu", "ગુજરાતી"],
1095: ["gu-IN", "ગુજરાતી (ભારત)"],
104: ["ha", "Hausa"],
31848: ["ha-Latn", "Hausa (Latin)"],
1128: ["ha-Latn-NG", "Hausa (Nigeria)"],
13: ["he", "עברית"],
1037: ["he-IL", "עברית (ישראל)"],
57: ["hi", "हिंदी"],
1081: ["hi-IN", "हिंदी (भारत)"],
14: ["hu", "Magyar"],
1038: ["hu-HU", "Magyar (Magyarország)"],
15: ["is", "Íslenska"],
1039: ["is-IS", "Íslenska (Ísland)"],
112: ["ig", "Igbo"],
1136: ["ig-NG", "Igbo (Nigeria)"],
33: ["id", "Bahasa Indonesia"],
1057: ["id-ID", "Bahasa Indonesia (Indonesia)"],
93: ["iu", "Inuktitut"],
31837: ["iu-Latn", "Inuktitut (Qaliujaaqpait)"],
2141: ["iu-Latn-CA", "Inuktitut"],
30813: ["iu-Cans", "ᐃᓄᒃᑎᑐᑦ (ᖃᓂᐅᔮᖅᐸᐃᑦ)"],
1117: ["iu-Cans-CA", "ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)"],
60: ["ga", "Gaeilge"],
2108: ["ga-IE", "Gaeilge (Éire)"],
52: ["xh", "isiXhosa"],
1076: ["xh-ZA", "isiXhosa (uMzantsi Afrika)"],
53: ["zu", "isiZulu"],
1077: ["zu-ZA", "isiZulu (iNingizimu Afrika)"],
16: ["it", "Italiano"],
1040: ["it-IT", "Italiano (Italia)"],
2064: ["it-CH", "Italiano (Svizzera)"],
17: ["ja", "日本語"],
1041: ["ja-JP", "日本語 (日本)"],
75: ["kn", "ಕನ್ನಡ"],
1099: ["kn-IN", "ಕನ್ನಡ (ಭಾರತ)"],
63: ["kk", "Қазақ"],
1087: ["kk-KZ", "Қазақ (Қазақстан)"],
83: ["km", "ខ្មែរ"],
1107: ["km-KH", "ខ្មែរ (កម្ពុជា)"],
134: ["qut", "K'iche"],
1158: ["qut-GT", "K'iche (Guatemala)"],
135: ["rw", "Kinyarwanda"],
1159: ["rw-RW", "Kinyarwanda (Rwanda)"],
65: ["sw", "Kiswahili"],
1089: ["sw-KE", "Kiswahili (Kenya)"],
87: ["kok", "कोंकणी"],
1111: ["kok-IN", "कोंकणी (भारत)"],
18: ["ko", "한국어"],
1042: ["ko-KR", "한국어 (대한민국)"],
64: ["ky", "Кыргыз"],
1088: ["ky-KG", "Кыргыз (Кыргызстан)"],
84: ["lo", "ລາວ"],
1108: ["lo-LA", "ລາວ (ສ.ປ.ປ. ລາວ)"],
38: ["lv", "Latviešu"],
1062: ["lv-LV", "Latviešu (Latvija)"],
39: ["lt", "Lietuvių"],
1063: ["lt-LT", "Lietuvių (Lietuva)"],
31790: ["dsb", "Dolnoserbšćina"],
2094: ["dsb-DE", "Dolnoserbšćina (Nimska)"],
110: ["lb", "Lëtzebuergesch"],
1134: ["lb-LU", "Lëtzebuergesch (Luxembourg)"],
1071: ["mk-MK", "Македонски јазик (Македонија)"],
47: ["mk", "Македонски јазик"],
62: ["ms", "Bahasa Melayu"],
2110: ["ms-BN", "Bahasa Melayu (Brunei Darussalam)"],
1086: ["ms-MY", "Bahasa Melayu (Malaysia)"],
76: ["ml", "മലയാളം"],
1100: ["ml-IN", "മലയാളം (ഭാരതം)"],
58: ["mt", "Malti"],
1082: ["mt-MT", "Malti (Malta)"],
129: ["mi", "Reo Māori"],
1153: ["mi-NZ", "Reo Māori (Aotearoa)"],
122: ["arn", "Mapudungun"],
1146: ["arn-CL", "Mapudungun (Chile)"],
78: ["mr", "मराठी"],
1102: ["mr-IN", "मराठी (भारत)"],
124: ["moh", "Kanien'kéha"],
1148: ["moh-CA", "Kanien'kéha"],
80: ["mn", "Монгол хэл"],
30800: ["mn-Cyrl", "Монгол хэл"],
1104: ["mn-MN", "Монгол хэл (Монгол улс)"],
31824: ["mn-Mong", "ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ"],
2128: ["mn-Mong-CN", "ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)"],
97: ["ne", "नेपाली"],
1121: ["ne-NP", "नेपाली (नेपाल)"],
20: ["no", "Norsk"],
31764: ["nb", "Norsk (bokmål)"],
30740: ["nn", "Norsk (Nynorsk)"],
1044: ["nb-NO", "Norsk, bokmål (Norge)"],
2068: ["nn-NO", "Norsk, nynorsk (Noreg)"],
130: ["oc", "Occitan"],
1154: ["oc-FR", "Occitan (França)"],
72: ["or", "ଓଡ଼ିଆ"],
1096: ["or-IN", "ଓଡ଼ିଆ (ଭାରତ)"],
99: ["ps", "پښتو"],
1123: ["ps-AF", "پښتو (افغانستان)"],
41: ["fa", "فارسى"],
1065: ["fa-IR", "فارسى (ایران)"],
21: ["pl", "Polski"],
1045: ["pl-PL", "Polski (Polska)"],
22: ["pt", "Português"],
1046: ["pt-BR", "Português (Brasil)"],
2070: ["pt-PT", "Português (Portugal)"],
70: ["pa", "ਪੰਜਾਬੀ"],
1094: ["pa-IN", "ਪੰਜਾਬੀ (ਭਾਰਤ)"],
107: ["quz", "Runasimi"],
1131: ["quz-BO", "Runasimi (Qullasuyu)"],
2155: ["quz-EC", "Runasimi (Ecuador)"],
3179: ["quz-PE", "Runasimi (Piruw)"],
24: ["ro", "Română"],
1048: ["ro-RO", "Română (România)"],
23: ["rm", "Rumantsch"],
1047: ["rm-CH", "Rumantsch (Svizra)"],
25: ["ru", "Русский"],
1049: ["ru-RU", "Русский (Россия)"],
28731: ["smn", "Sämikielâ"],
31803: ["smj", "Julevusámegiella"],
59: ["se", "Davvisámegiella"],
29755: ["sms", "Sääm´ǩiõll"],
30779: ["sma", "åarjelsaemiengiele"],
9275: ["smn-FI", "Sämikielâ (Suomâ)"],
4155: ["smj-NO", "Julevusámegiella (Vuodna)"],
5179: ["smj-SE", "Julevusámegiella (Svierik)"],
3131: ["se-FI", "Davvisámegiella (Suopma)"],
1083: ["se-NO", "Davvisámegiella (Norga)"],
2107: ["se-SE", "Davvisámegiella (Ruoŧŧa)"],
8251: ["sms-FI", "Sääm´ǩiõll (Lää´ddjânnam)"],
6203: ["sma-NO", "åarjelsaemiengiele (Nöörje)"],
7227: ["sma-SE", "åarjelsaemiengiele (Sveerje)"],
79: ["sa", "संस्कृत"],
1103: ["sa-IN", "संस्कृत (भारतम्)"],
145: ["gd", "Gàidhlig"],
1169: ["gd-GB", "Gàidhlig (An Rìoghachd Aonaichte)"],
31770: ["sr", "Srpski"],
27674: ["sr-Cyrl", "Српски (Ћирилица)"],
7194: ["sr-Cyrl-BA", "Српски (Босна и Херцеговина)"],
12314: ["sr-Cyrl-ME", "Српски (Црна Гора)"],
3098: ["sr-Cyrl-CS", "Српски (Србија и Црна Гора (Претходно))"],
10266: ["sr-Cyrl-RS", "Српски (Србија)"],
28698: ["sr-Latn", "Srpski (Latinica)"],
6170: ["sr-Latn-BA", "Srpski (Bosna i Hercegovina)"],
11290: ["sr-Latn-ME", "Srpski (Crna Gora)"],
2074: ["sr-Latn-CS", "Srpski (Srbija i Crna Gora (Prethodno))"],
9242: ["sr-Latn-RS", "Srpski (Srbija)"],
108: ["nso", "Sesotho sa Leboa"],
1132: ["nso-ZA", "Sesotho sa Leboa (Afrika Borwa)"],
50: ["tn", "Setswana"],
1074: ["tn-ZA", "Setswana (Aforika Borwa)"],
91: ["si", "සිංහ"],
1115: ["si-LK", "සිංහ (ශ්රී ලංකා)"],
27: ["sk", "Slovenčina"],
1051: ["sk-SK", "Slovenčina (Slovenská republika)"],
36: ["sl", "Slovenski"],
1060: ["sl-SI", "Slovenski (Slovenija)"],
10: ["es", "Español"],
11274: ["es-AR", "Español (Argentina)"],
16394: ["es-BO", "Español (Bolivia)"],
13322: ["es-CL", "Español (Chile)"],
9226: ["es-CO", "Español (Colombia)"],
5130: ["es-CR", "Español (Costa Rica)"],
7178: ["es-DO", "Español (República Dominicana)"],
12298: ["es-EC", "Español (Ecuador)"],
17418: ["es-SV", "Español (El Salvador)"],
4106: ["es-GT", "Español (Guatemala)"],
18442: ["es-HN", "Español (Honduras)"],
2058: ["es-MX", "Español (México)"],
19466: ["es-NI", "Español (Nicaragua)"],
6154: ["es-PA", "Español (Panamá)"],
15370: ["es-PY", "Español (Paraguay)"],
10250: ["es-PE", "Español (Perú)"],
20490: ["es-PR", "Español (Puerto Rico)"],
3082: ["es-ES", "Español (España, alfabetización internacional)"],
21514: ["es-US", "Español (Estados Unidos)"],
14346: ["es-UY", "Español (Uruguay)"],
8202: ["es-VE", "Español (Republica Bolivariana de Venezuela)"],
29: ["sv", "Svenska"],
2077: ["sv-FI", "Svenska (Finland)"],
1053: ["sv-SE", "Svenska (Sverige)"],
90: ["syr", "ܣܘܪܝܝܐ"],
1114: ["syr-SY", "ܣܘܪܝܝܐ (سوريا)"],
40: ["tg", "Тоҷикӣ"],
31784: ["tg-Cyrl", "Тоҷикӣ"],
1064: ["tg-Cyrl-TJ", "Тоҷикӣ (Тоҷикистон)"],
95: ["tzm", "Tamazight"],
31839: ["tzm-Latn", "Tamazight (Latin)"],
2143: ["tzm-Latn-DZ", "Tamazight (Djazaïr)"],
73: ["ta", "தமிழ்"],
1097: ["ta-IN", "தமிழ் (இந்தியா)"],
68: ["tt", "Татар"],
1092: ["tt-RU", "Татар (Россия)"],
74: ["te", "తెలుగు"],
1098: ["te-IN", "తెలుగు (భారత దేశం)"],
30: ["th", "ไทย"],
1054: ["th-TH", "ไทย (ไทย)"],
81: ["bo", "བོད་ཡིག"],
1105: ["bo-CN", "བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)"],
31: ["tr", "Türkçe"],
1055: ["tr-TR", "Türkçe (Türkiye)"],
66: ["tk", "Türkmençe"],
1090: ["tk-TM", "Türkmençe (Türkmenistan)"],
34: ["uk", "Українська"],
1058: ["uk-UA", "Українська (Україна)"],
46: ["hsb", "Hornjoserbšćina"],
1070: ["hsb-DE", "Hornjoserbšćina (Němska)"],
32: ["ur", "اُردو"],
1056: ["ur-PK", "اُردو (پاکستان)"],
128: ["ug", "ئۇيغۇر يېزىقى"],
1152: ["ug-CN", "(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى"],
30787: ["uz-Cyrl", "Ўзбек"],
2115: ["uz-Cyrl-UZ", "Ўзбек (Ўзбекистон)"],
67: ["uz", "U'zbek"],
31811: ["uz-Latn", "U'zbek"],
1091: ["uz-Latn-UZ", "U'zbek (U'zbekiston Respublikasi)"],
42: ["vi", "Tiếng Việt"],
1066: ["vi-VN", "Tiếng Việt (Việt Nam)"],
82: ["cy", "Cymraeg"],
1106: ["cy-GB", "Cymraeg (y Deyrnas Unedig)"],
136: ["wo", "Wolof"],
1160: ["wo-SN", "Wolof (Sénégal)"],
133: ["sah", "Саха"],
1157: ["sah-RU", "Саха (Россия)"],
120: ["ii", "ꆈꌠꁱꂷ"],
1144: ["ii-CN", "ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)"],
106: ["yo", "Yoruba"],
1130: ["yo-NG", "Yoruba (Nigeria)"],
2129: ["bo-BT", "Tibetan, Bhutan"],
1126: ["bin-NG", "Bini, Nigeria"],
1116: ["chr-US", "Cherokee, United States"],
15369: ["en-HK", "English, Hong Kong"],
14345: ["en-ID", "English, Indonesia"],
1034: ["es-ES_tradnl", "Spanish"],
15372: ["fr-HT", "French, Haiti"],
9228: ["fr-CG", "French, Congo"],
12300: ["fr-CI", "French, Cote d'Ivoire"],
11276: ["fr-CM", "French, Cameroon"],
14348: ["fr-MA", "French, Morocco"],
13324: ["fr-ML", "French, Mali"],
8204: ["fr-RE", "French, Reunion"],
10252: ["fr-SN", "French, Senegal"],
7180: ["fr-West", "French"],
1127: ["fuv-NG", "Nigerian Fulfulde, Nigeria"],
1138: ["gaz-ET", "West Central Oromo, Ethiopia"],
1140: ["gn-PY", "Guarani, Paraguay"],
1141: ["haw-US", "Hawaiian, UnitedStates"],
1129: ["ibb-NG", "Ibibio, Nigeria"],
1137: ["kr-NG", "Kanuri, Nigeria"],
1112: ["mni", "Manipuri"],
1109: ["my-MM", "Burmese, Myanmar"],
2145: ["ne-IN", "Nepali, India"],
1145: ["pap-AN", "Papiamento, Netherlands Antilles"],
2118: ["pa-PK", "Panjabi, Pakistan"],
1165: ["plt-MG", "Plateau Malagasy, Madagascar"],
2072: ["ro-MO", "Romanian, Macao"],
2073: ["ru-MO", "Russian, Macao"],
1113: ["sd-IN", "Sindhi, India"],
2137: ["sd-PK", "Sindhi, Pakistan"],
1143: ["so-SO", "Somali, Somalia"],
1072: ["st-ZA", "Southern Sotho, South Africa"],
1139: ["ti-ER", "Tigrinya, Eritrea"],
2163: ["ti-ET", "Tigrinya, Ethiopia"],
1119: ["tmz", "Tamanaku"],
3167: ["tmz-MA", "Tamanaku, Morocco"],
1073: ["ts-ZA", "Tsonga, South Africa"],
2080: ["ur-IN", "Urdu, India"],
1075: ["ven-ZA", "South Africa"]
};
return {
getLocalLanguageName: function (code) {
return localLanguageName[code] || ["", code];
}
};
})();

View File

@@ -0,0 +1,105 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
Common.util = Common.util || {};
define(["backbone", "keymaster"], function (Backbone) {
var Shortcuts = function (options) {
this.cid = _.uniqueId("shortcuts");
this.initialize.apply(this, arguments);
return this;
};
_.extend(Shortcuts.prototype, Backbone.Events, {
initialize: function () {
window.key.filter = function (event) {
return true;
};
Common.NotificationCenter.on({
"modal:show": function (e) {
window.key.suspend();
},
"modal:close": function (e) {
window.key.resume();
},
"modal:hide": function (e) {
window.key.resume();
}
});
},
delegateShortcuts: function (options) {
if (!options || !options.shortcuts) {
return;
}
this.removeShortcuts(options);
var callback, match, method, scope, shortcut, shortcutKey;
var _results = [];
for (shortcut in options.shortcuts) {
callback = options.shortcuts[shortcut];
if (!_.isFunction(callback)) {
method = options[callback];
if (!method) {
throw new Error("Method " + callback + " does not exist");
}
} else {
method = callback;
}
match = shortcut.match(/^(\S+)\s*(.*)$/);
shortcutKey = match[1];
scope = match[2].length ? match[2] : "all";
method = _.bind(method, this);
_results.push(window.key(shortcutKey, scope, method));
}
},
removeShortcuts: function (options) {
if (!options || !options.shortcuts) {
return;
}
var match, scope, shortcut, shortcutKey;
var _results = [];
for (shortcut in options.shortcuts) {
match = shortcut.match(/^(\S+)\s*(.*)$/);
shortcutKey = match[1];
scope = match[2].length ? match[2] : "all";
window.key.unbind(shortcutKey, scope);
}
},
suspendEvents: function (key, scope) {
window.key.suspend(key, scope);
},
resumeEvents: function (key, scope) {
window.key.resume(key, scope);
}
});
Shortcuts.extend = Backbone.View.extend;
Common.util.Shortcuts = new Shortcuts;
});

View File

@@ -0,0 +1,235 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
(function ($) {
var _superclass = $.fn.tooltip;
_superclass.prototype = $.fn.tooltip.Constructor.prototype;
$.extend($.fn.tooltip.Constructor.DEFAULTS, {
container: "body",
delay: {
show: 500
},
arrow: false
});
var Tip = function (element, options) {
this.init("tooltip", element, options);
};
Tip.prototype = $.extend({},
$.fn.tooltip.Constructor.prototype, {
constructor: Tip,
init: function () {
_superclass.prototype.init.apply(this, arguments);
if (this.options.placement == "cursor") {
if (/hover/.exec(this.options.trigger)) {
this.$element.on("mousemove.tooltip", this.options.selector, $.proxy(this.mousemove, this));
}
}
if (this.options.zIndex) {
this.tip().css("z-index", this.options.zIndex);
}
var me = this;
Common.NotificationCenter.on({
"layout:changed": function (e) {
if (!me.options.hideonclick && me.tip().is(":visible")) {
me.hide();
}
}
});
},
mousemove: function (e) {
this.targetXY = [e.clientX, e.clientY];
},
leave: function (obj) {
_superclass.prototype.leave.apply(this, arguments);
this.dontShow = undefined;
},
show: function (at) {
if (this.hasContent() && this.enabled && !this.dontShow) {
if (!this.$element.is(":visible") && this.$element.closest("[role=menu]").length > 0) {
return;
}
var $tip = this.tip();
var placement = typeof this.options.placement === "function" ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement;
if (this.options.arrow === false) {
$tip.addClass("arrow-free");
}
if (this.options.cls) {
$tip.addClass(this.options.cls);
}
var placementEx = /^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(placement);
if (!at && !placementEx[2].length) {
_superclass.prototype.show.apply(this, arguments);
} else {
var e = $.Event("show.bs.tooltip");
this.$element.trigger(e);
if (e.isDefaultPrevented()) {
return;
}
this.setContent();
if (this.options.animation) {
$tip.addClass("fade");
}
$tip.detach().css({
top: 0,
left: 0,
display: "block"
});
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element);
if (typeof at == "object") {
var tp = {
top: at[1] + 15,
left: at[0] + 18
};
if (tp.left + $tip.width() > window.innerWidth) {
tp.left = window.innerWidth - $tip.width() - 30;
}
$tip.offset(tp).addClass("in");
} else {
var pos = this.getPosition();
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight;
switch (placementEx[1]) {
case "bottom":
tp = {
top: pos.top + pos.height + 10
};
break;
case "top":
tp = {
top: pos.top - actualHeight - 10
};
break;
}
switch (placementEx[2]) {
case "left":
tp.left = pos.left;
if (this.$element.outerWidth() <= 18) {
tp.left -= 4;
}
break;
case "right":
tp.left = pos.left + pos.width - actualWidth;
if (this.$element.outerWidth() <= 18) {
tp.left += 4;
}
break;
}
this.applyPlacement(tp, placementEx[1]);
this.moveArrow();
$tip.addClass(placementEx[1]).addClass(placementEx[0]);
}
this.$element.trigger("shown.bs.tooltip");
}
var self = this;
clearTimeout(self.timeout);
self.timeout = setTimeout(function () {
if (self.hoverState == "in") {
self.hide();
}
self.dontShow = false;
},
5000);
}
},
moveArrow: function () {
var $arrow = this.tip().find(".tooltip-arrow, .arrow");
var new_arrow_position = 10;
switch (this.options.placement) {
case "top-left":
case "bottom-left":
$arrow.css("left", new_arrow_position);
break;
case "top-right":
case "bottom-right":
$arrow.css("right", new_arrow_position);
break;
}
},
enter: function (obj) {
if (obj.type !== "mouseenter") {
return;
}
var $target = $(obj.target);
if ($target.is("[role=menu]") || $target.parentsUntil(obj.currentTarget, "[role=menu]").length || this.tip().is(":visible")) {
return;
}
var self = obj instanceof this.constructor ? obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data("bs.tooltip");
clearTimeout(self.timeout);
self.hoverState = "in";
if (!self.options.delay || !self.options.delay.show) {
self.show();
} else {
self.timeout = setTimeout(function () {
if (self.hoverState == "in") {
self.show(self.options.placement == "cursor" ? self.targetXY : undefined);
}
},
self.options.delay.show);
}
},
replaceArrow: function (delta, dimension, position) {
this.options.arrow === false ? this.arrow().hide() : _superclass.prototype.replaceArrow.apply(this, arguments);
},
getCalculatedOffset: function (placement, pos, actualWidth, actualHeight) {
var out = _superclass.prototype.getCalculatedOffset.apply(this, arguments);
if (this.options.offset > 0 || this.options.offset < 0) {
switch (/(bottom|top)/.exec(placement)[1]) {
case "bottom":
out.top += this.options.offset;
break;
case "top":
out.top -= this.options.offset;
break;
}
}
return out;
}
});
var old = $.fn.tooltip;
$.fn.tooltip = function (option) {
return this.each(function () {
var $this = $(this),
data = $this.data("bs.tooltip"),
options = typeof option === "object" && option;
if (!data) {
$this.data("bs.tooltip", (data = new Tip(this, options)));
}
if (typeof option === "string") {
data[option]();
}
});
};
$.fn.tooltip.Constructor = Tip;
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old;
return this;
};
})(window.jQuery);

View File

@@ -0,0 +1,499 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
if (Common.Utils === undefined) {
Common.Utils = {};
}
Common.Utils = new(function () {
var userAgent = navigator.userAgent.toLowerCase(),
check = function (regex) {
return regex.test(userAgent);
},
isStrict = document.compatMode == "CSS1Compat",
version = function (is, regex) {
var m;
return (is && (m = regex.exec(userAgent))) ? parseFloat(m[1]) : 0;
},
docMode = document.documentMode,
isOpera = check(/opera/),
isOpera10_5 = isOpera && check(/version\/10\.5/),
isChrome = check(/\bchrome\b/),
isWebKit = check(/webkit/),
isSafari = !isChrome && check(/safari/),
isSafari2 = isSafari && check(/applewebkit\/4/),
isSafari3 = isSafari && check(/version\/3/),
isSafari4 = isSafari && check(/version\/4/),
isSafari5_0 = isSafari && check(/version\/5\.0/),
isSafari5 = isSafari && check(/version\/5/),
isIE = !isOpera && (check(/msie/) || check(/trident/)),
isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 7),
isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9 && docMode != 10) || docMode == 8),
isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8 && docMode != 10) || docMode == 9),
isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 8 && docMode != 9) || docMode == 10),
isIE11 = isIE && ((check(/trident\/7\.0/) && docMode != 7 && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 11),
isIE6 = isIE && check(/msie 6/),
isGecko = !isWebKit && !isIE && check(/gecko/),
isGecko3 = isGecko && check(/rv:1\.9/),
isGecko4 = isGecko && check(/rv:2\.0/),
isGecko5 = isGecko && check(/rv:5\./),
isGecko10 = isGecko && check(/rv:10\./),
isFF3_0 = isGecko3 && check(/rv:1\.9\.0/),
isFF3_5 = isGecko3 && check(/rv:1\.9\.1/),
isFF3_6 = isGecko3 && check(/rv:1\.9\.2/),
isWindows = check(/windows|win32/),
isMac = check(/macintosh|mac os x/),
isLinux = check(/linux/),
chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/),
ieVersion = version(isIE, /msie (\d+\.\d+)/),
operaVersion = version(isOpera, /version\/(\d+\.\d+)/),
safariVersion = version(isSafari, /version\/(\d+\.\d+)/),
webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/),
isSecure = /^https/i.test(window.location.protocol),
emailRe = /^(mailto:)?([a-z0-9\._-]+@[a-z0-9\.-]+\.[a-z]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,
ipRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;`~=%!,]*)(\.[\wа-яё]{2,})?)*)*\/?/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;`~=%!,]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;`~=%!,]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
emailStrongRe = /(mailto:)([a-z0-9\._-]+@[a-z0-9\.-]+\.[a-z]{2,4})([a-яё0-9\._%+-=\? :&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;`~=%!,]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;`~=%!,]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig;
return {
userAgent: userAgent,
isStrict: isStrict,
isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)),
isOpera: isOpera,
isOpera10_5: isOpera10_5,
isWebKit: isWebKit,
isChrome: isChrome,
isSafari: isSafari,
isSafari3: isSafari3,
isSafari4: isSafari4,
isSafari5: isSafari5,
isSafari5_0: isSafari5_0,
isSafari2: isSafari2,
isIE: isIE,
isIE6: isIE6,
isIE7: isIE7,
isIE7m: isIE6 || isIE7,
isIE7p: isIE && !isIE6,
isIE8: isIE8,
isIE8m: isIE6 || isIE7 || isIE8,
isIE8p: isIE && !(isIE6 || isIE7),
isIE9: isIE9,
isIE9m: isIE6 || isIE7 || isIE8 || isIE9,
isIE9p: isIE && !(isIE6 || isIE7 || isIE8),
isIE10: isIE10,
isIE10m: isIE6 || isIE7 || isIE8 || isIE9 || isIE10,
isIE10p: isIE && !(isIE6 || isIE7 || isIE8 || isIE9),
isIE11: isIE11,
isIE11m: isIE6 || isIE7 || isIE8 || isIE9 || isIE10 || isIE11,
isIE11p: isIE && !(isIE6 || isIE7 || isIE8 || isIE9 || isIE10),
isGecko: isGecko,
isGecko3: isGecko3,
isGecko4: isGecko4,
isGecko5: isGecko5,
isGecko10: isGecko10,
isFF3_0: isFF3_0,
isFF3_5: isFF3_5,
isFF3_6: isFF3_6,
isFF4: 4 <= firefoxVersion && firefoxVersion < 5,
isFF5: 5 <= firefoxVersion && firefoxVersion < 6,
isFF10: 10 <= firefoxVersion && firefoxVersion < 11,
isLinux: isLinux,
isWindows: isWindows,
isMac: isMac,
chromeVersion: chromeVersion,
firefoxVersion: firefoxVersion,
ieVersion: ieVersion,
operaVersion: operaVersion,
safariVersion: safariVersion,
webKitVersion: webKitVersion,
isSecure: isSecure,
emailRe: emailRe,
ipRe: ipRe,
hostnameRe: hostnameRe,
localRe: localRe,
emailStrongRe: emailStrongRe,
ipStrongRe: ipStrongRe,
hostnameStrongRe: hostnameStrongRe
};
})();
Common.Utils.ThemeColor = new(function () {
return {
ThemeValues: [6, 15, 7, 16, 0, 1, 2, 3, 4, 5],
setColors: function (colors, standart_colors) {
var i, j, item;
if (standart_colors && standart_colors.length > 0) {
var standartcolors = [];
for (i = 0; i < standart_colors.length; i++) {
item = this.getHexColor(standart_colors[i].get_r(), standart_colors[i].get_g(), standart_colors[i].get_b());
standartcolors.push(item);
}
this.standartcolors = standartcolors;
}
var effectСolors = [];
for (i = 0; i < 6; i++) {
for (j = 0; j < 10; j++) {
var idx = i + j * 6;
item = {
color: this.getHexColor(colors[idx].get_r(), colors[idx].get_g(), colors[idx].get_b()),
effectId: idx,
effectValue: this.ThemeValues[j]
};
effectСolors.push(item);
}
}
this.effectcolors = effectСolors;
},
getEffectColors: function () {
return this.effectcolors;
},
getStandartColors: function () {
return this.standartcolors;
},
getHexColor: function (r, g, b) {
r = r.toString(16);
g = g.toString(16);
b = b.toString(16);
if (r.length == 1) {
r = "0" + r;
}
if (g.length == 1) {
g = "0" + g;
}
if (b.length == 1) {
b = "0" + b;
}
return r + g + b;
},
getRgbColor: function (clr) {
var color = (typeof(clr) == "object") ? clr.color : clr;
color = color.replace(/#/, "");
if (color.length == 3) {
color = color.replace(/(.)/g, "$1$1");
}
color = parseInt(color, 16);
var c = new CAscColor();
c.put_type((typeof(clr) == "object" && clr.effectId !== undefined) ? c_oAscColor.COLOR_TYPE_SCHEME : c_oAscColor.COLOR_TYPE_SRGB);
c.put_r(color >> 16);
c.put_g((color & 65280) >> 8);
c.put_b(color & 255);
c.put_a(255);
if (clr.effectId !== undefined) {
c.put_value(clr.effectId);
}
return c;
},
colorValue2EffectId: function (clr) {
if (typeof(clr) == "object" && clr.effectValue !== undefined && this.effectcolors) {
for (var i = 0; i < this.effectcolors.length; i++) {
if (this.effectcolors[i].effectValue === clr.effectValue && clr.color.toUpperCase() === this.effectcolors[i].color.toUpperCase()) {
clr.effectId = this.effectcolors[i].effectId;
break;
}
}
}
return clr;
}
};
})();
Common.Utils.Metric = new(function () {
var me = this;
me.c_MetricUnits = {
cm: 0,
pt: 1
};
me.currentMetric = me.c_MetricUnits.pt;
me.metricName = ["cm", "pt"];
return {
c_MetricUnits: me.c_MetricUnits,
metricName: me.metricName,
setCurrentMetric: function (value) {
me.currentMetric = value;
},
getCurrentMetric: function () {
return me.currentMetric;
},
fnRecalcToMM: function (value) {
if (value !== null && value !== undefined) {
switch (me.currentMetric) {
case me.c_MetricUnits.cm:
return value * 10;
case me.c_MetricUnits.pt:
return value * 25.4 / 72;
}
}
return value;
},
fnRecalcFromMM: function (value) {
switch (me.currentMetric) {
case me.c_MetricUnits.cm:
return parseFloat((value / 10).toFixed(4));
case me.c_MetricUnits.pt:
return parseFloat((value * 72 / 25.4).toFixed(3));
}
return value;
}
};
})();
Common.Utils.RGBColor = function (colorString) {
var r, g, b;
if (colorString.charAt(0) == "#") {
colorString = colorString.substr(1, 6);
}
colorString = colorString.replace(/ /g, "");
colorString = colorString.toLowerCase();
var colorDefinitions = [{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
process: function (bits) {
return [parseInt(bits[1]), parseInt(bits[2]), parseInt(bits[3])];
}
},
{
re: /^hsb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
process: function (bits) {
var rgb = {};
var h = Math.round(bits[1]);
var s = Math.round(bits[2] * 255 / 100);
var v = Math.round(bits[3] * 255 / 100);
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255 - s) * v / 255;
var t3 = (t1 - t2) * (h % 60) / 60;
if (h == 360) {
h = 0;
}
if (h < 60) {
rgb.r = t1;
rgb.b = t2;
rgb.g = t2 + t3;
} else {
if (h < 120) {
rgb.g = t1;
rgb.b = t2;
rgb.r = t1 - t3;
} else {
if (h < 180) {
rgb.g = t1;
rgb.r = t2;
rgb.b = t2 + t3;
} else {
if (h < 240) {
rgb.b = t1;
rgb.r = t2;
rgb.g = t1 - t3;
} else {
if (h < 300) {
rgb.b = t1;
rgb.g = t2;
rgb.r = t2 + t3;
} else {
if (h < 360) {
rgb.r = t1;
rgb.g = t2;
rgb.b = t1 - t3;
} else {
rgb.r = 0;
rgb.g = 0;
rgb.b = 0;
}
}
}
}
}
}
}
return [Math.round(rgb.r), Math.round(rgb.g), Math.round(rgb.b)];
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
process: function (bits) {
return [parseInt(bits[1], 16), parseInt(bits[2], 16), parseInt(bits[3], 16)];
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
process: function (bits) {
return [parseInt(bits[1] + bits[1], 16), parseInt(bits[2] + bits[2], 16), parseInt(bits[3] + bits[3], 16)];
}
}];
for (var i = 0; i < colorDefinitions.length; i++) {
var re = colorDefinitions[i].re;
var processor = colorDefinitions[i].process;
var bits = re.exec(colorString);
if (bits) {
var channels = processor(bits);
r = channels[0];
g = channels[1];
b = channels[2];
}
}
r = (r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r);
g = (g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g);
b = (b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b);
var isEqual = function (color) {
return ((r == color.r) && (g == color.g) && (b == color.b));
};
var toRGB = function () {
return "rgb(" + r + ", " + g + ", " + b + ")";
};
var toRGBA = function (alfa) {
if (alfa === undefined) {
alfa = 1;
}
return "rgba(" + r + ", " + g + ", " + b + ", " + alfa + ")";
};
var toHex = function () {
var _r = r.toString(16);
var _g = g.toString(16);
var _b = b.toString(16);
if (_r.length == 1) {
_r = "0" + _r;
}
if (_g.length == 1) {
_g = "0" + _g;
}
if (_b.length == 1) {
_b = "0" + _b;
}
return "#" + _r + _g + _b;
};
var toHSB = function () {
var hsb = {
h: 0,
s: 0,
b: 0
};
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
hsb.b = max;
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (r == max) {
hsb.h = 0 + (g - b) / delta;
} else {
if (g == max) {
hsb.h = 2 + (b - r) / delta;
} else {
hsb.h = 4 + (r - g) / delta;
}
}
} else {
hsb.h = 0;
}
hsb.h *= 60;
if (hsb.h < 0) {
hsb.h += 360;
}
hsb.s *= 100 / 255;
hsb.b *= 100 / 255;
hsb.h = parseInt(hsb.h);
hsb.s = parseInt(hsb.s);
hsb.b = parseInt(hsb.b);
return hsb;
};
return {
r: r,
g: g,
b: b,
isEqual: isEqual,
toRGB: toRGB,
toRGBA: toRGBA,
toHex: toHex,
toHSB: toHSB
};
};
Common.Utils.String = new(function () {
return {
format: function (format) {
var args = _.toArray(arguments).slice(1);
return format.replace(/\{(\d+)\}/g, function (s, i) {
return args[i];
});
},
htmlEncode: function (string) {
return _.escape(string);
},
htmlDecode: function (string) {
return _.unescape(string);
},
ellipsis: function (value, len, word) {
if (value && value.length > len) {
if (word) {
var vs = value.substr(0, len - 2),
index = Math.max(vs.lastIndexOf(" "), vs.lastIndexOf("."), vs.lastIndexOf("!"), vs.lastIndexOf("?"));
if (index !== -1 && index >= (len - 15)) {
return vs.substr(0, index) + "...";
}
}
return value.substr(0, len - 3) + "...";
}
return value;
},
platformKey: function (string, template, hookFn) {
if (_.isEmpty(template)) {
template = " ({0})";
}
if (Common.Utils.isMac) {
if (_.isFunction(hookFn)) {
string = hookFn.call(this, string);
}
return Common.Utils.String.format(template, string.replace(/\+(?=\S)/g, "").replace(/Ctrl|ctrl/g, "⌘").replace(/Alt|alt/g, "⌥").replace(/Shift|shift/g, "⇧"));
}
return Common.Utils.String.format(template, string);
}
};
})();
Common.Utils.isBrowserSupported = function () {
return ! ((Common.Utils.ieVersion != 0 && Common.Utils.ieVersion < 9) || (Common.Utils.safariVersion != 0 && Common.Utils.safariVersion < 5) || (Common.Utils.firefoxVersion != 0 && Common.Utils.firefoxVersion < 4) || (Common.Utils.chromeVersion != 0 && Common.Utils.chromeVersion < 7) || (Common.Utils.operaVersion != 0 && Common.Utils.operaVersion < 10.5));
};
Common.Utils.showBrowserRestriction = function () {
var editor = (window.DE ? "Document" : window.SSE ? "Spreadsheet" : window.PE ? "Presentation" : "that");
var newDiv = document.createElement("div");
newDiv.innerHTML = '<div class="application-error-panel">' + '<div class="application-error-message-block">' + '<div class="application-error-message-inner">' + '<div class="application-error-message-title">Your browser is not supported.</div>' + '<div class="application-error-message-text">Sorry, ' + editor + " Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>" + "</div>" + "</div>" + '<div class="application-error-message-auxiliary"></div>' + "</div>";
document.body.appendChild(newDiv);
$("#loading-mask").hide().remove();
$("#viewport").hide().remove();
};
String.prototype.strongMatch = function (regExp) {
if (regExp && regExp instanceof RegExp) {
var arr = this.toString().match(regExp);
return !! (arr && arr.length > 0 && arr[0].length == this.length);
}
return false;
};