Changeset 3433719
- Timestamp:
- 01/06/2026 02:54:55 PM (3 months ago)
- Location:
- loco-translate/trunk
- Files:
-
- 11 edited
-
languages/loco-translate.pot (modified) (19 diffs)
-
loco.php (modified) (2 diffs)
-
pub/js/min/admin.js (modified) (268 diffs)
-
readme.txt (modified) (1 diff)
-
src/ajax/SaveController.php (modified) (1 diff)
-
src/data/CompiledData.php (modified) (1 diff)
-
src/hooks/AdminHooks.php (modified) (3 diffs)
-
src/mvc/AdminRouter.php (modified) (6 diffs)
-
src/mvc/AjaxRouter.php (modified) (5 diffs)
-
src/mvc/Controller.php (modified) (2 diffs)
-
src/test/WordPressTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
loco-translate/trunk/languages/loco-translate.pot
r3317498 r3433719 4 4 "Project-Id-Version: Loco Translate 2.8.1-dev\n" 5 5 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/loco-translate/\n" 6 "POT-Creation-Date: 202 5-06-25 08:58+0000\n"6 "POT-Creation-Date: 2026-01-06 14:53+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 14 14 "Content-Transfer-Encoding: 8bit\n" 15 15 "X-Generator: Loco https://localise.biz/\n" 16 "X-Loco-Version: 2.8.1-dev; wp-6. 8.1; php-8.3.14\n"16 "X-Loco-Version: 2.8.1-dev; wp-6.9; php-8.3.27\n" 17 17 "X-Domain: loco-translate" 18 18 … … 290 290 msgstr "" 291 291 292 #: src/mvc/AjaxRouter.php:1 75292 #: src/mvc/AjaxRouter.php:166 293 293 msgid "Ajax controller returned empty JSON" 294 294 msgstr "" 295 295 296 296 #. Fatal error where %s represents an unexpected value 297 #: src/mvc/AjaxRouter.php:1 70297 #: src/mvc/AjaxRouter.php:161 298 298 #, php-format 299 299 msgid "Ajax route not found: \"%s\"" … … 401 401 msgstr "" 402 402 403 #: src/admin/config/ApisController.php:79 404 msgid "Chat Completions" 405 msgstr "" 406 403 407 #: src/js/Strings.php:139 404 408 msgid "Check console output for debugging information" … … 506 510 507 511 #. Page title for core WordPress translations 508 #: src/mvc/AdminRouter.php:5 6512 #: src/mvc/AdminRouter.php:55 509 513 msgid "Core translations ‹ Loco" 510 514 msgstr "" … … 535 539 msgstr "" 536 540 537 #: src/mvc/AdminRouter.php:7 7src/error/Debug.php:19541 #: src/mvc/AdminRouter.php:76 src/error/Debug.php:19 538 542 #: src/admin/config/DebugController.php:12 539 #: src/admin/bundle/BaseController.php:107540 543 msgid "Debug" 541 544 msgstr "" … … 594 597 msgstr "" 595 598 596 #: src/mvc/AjaxRouter.php:1 98599 #: src/mvc/AjaxRouter.php:189 597 600 msgid "Download action not found" 598 601 msgstr "" 599 602 600 #: src/mvc/AjaxRouter.php: 203603 #: src/mvc/AjaxRouter.php:194 601 604 msgid "Download controller returned empty output" 602 605 msgstr "" … … 1022 1025 msgstr "" 1023 1026 1024 #: src/mvc/AdminRouter.php:4 21027 #: src/mvc/AdminRouter.php:41 1025 1028 msgid "Home" 1026 1029 msgstr "" … … 1130 1133 msgstr "" 1131 1134 1132 #: src/mvc/AdminRouter.php:5 91135 #: src/mvc/AdminRouter.php:58 1133 1136 msgid "Languages" 1134 1137 msgstr "" 1135 1138 1136 1139 #. Page title for installed languages page 1137 #: src/mvc/AdminRouter.php:6 11140 #: src/mvc/AdminRouter.php:60 1138 1141 msgid "Languages ‹ Loco" 1139 1142 msgstr "" … … 1187 1190 1188 1191 #. Name of the plugin 1189 #: src/mvc/AdminRouter.php:3 7src/hooks/AdminHooks.php:881192 #: src/mvc/AdminRouter.php:36 src/hooks/AdminHooks.php:88 1190 1193 msgid "Loco Translate" 1191 1194 msgstr "" … … 1216 1219 1217 1220 #. Page title for plugin home screen 1218 #: src/mvc/AdminRouter.php:3 91221 #: src/mvc/AdminRouter.php:38 1219 1222 msgid "Loco, Translation Management" 1220 1223 msgstr "" … … 1414 1417 msgstr "" 1415 1418 1416 #: src/mvc/AdminRouter.php:24 31419 #: src/mvc/AdminRouter.php:240 1417 1420 msgid "Page not found" 1418 1421 msgstr "" … … 1454 1457 msgstr "" 1455 1458 1456 #: src/mvc/AdminRouter.php:6 6src/admin/config/ApisController.php:691459 #: src/mvc/AdminRouter.php:65 src/admin/config/ApisController.php:69 1457 1460 #: src/admin/config/PrefsController.php:42 1458 1461 #: src/admin/config/VersionController.php:22 … … 1462 1465 1463 1466 #. Page title for plugin translations 1464 #: src/mvc/AdminRouter.php:5 11467 #: src/mvc/AdminRouter.php:50 1465 1468 msgid "Plugin translations ‹ Loco" 1466 1469 msgstr "" 1467 1470 1468 #: src/mvc/AdminRouter.php:4 9src/admin/Navigation.php:301471 #: src/mvc/AdminRouter.php:48 src/admin/Navigation.php:30 1469 1472 #: src/admin/bundle/LocaleController.php:154 1470 1473 msgid "Plugins" … … 1559 1562 msgstr "" 1560 1563 1564 #: src/admin/config/ApisController.php:78 1565 msgid "Provider" 1566 msgstr "" 1567 1561 1568 #: tpl/admin/common/inc-fsconn.php:27 1562 1569 msgid "Read only" … … 1681 1688 msgstr "" 1682 1689 1683 #: src/mvc/AdminRouter.php:6 7 src/mvc/AdminRouter.php:721690 #: src/mvc/AdminRouter.php:66 src/mvc/AdminRouter.php:71 1684 1691 #: tpl/ajax/modal-apis-empty.php:15 src/admin/file/EditController.php:182 1685 1692 #: tpl/admin/common/inc-fsconn.php:18 tpl/admin/common/inc-fsconn.php:43 … … 1867 1874 1868 1875 #. Page title for theme translations 1869 #: src/mvc/AdminRouter.php:4 61876 #: src/mvc/AdminRouter.php:45 1870 1877 msgid "Theme translations ‹ Loco" 1871 1878 msgstr "" 1872 1879 1873 #: src/mvc/AdminRouter.php:4 4src/admin/Navigation.php:271880 #: src/mvc/AdminRouter.php:43 src/admin/Navigation.php:27 1874 1881 #: src/admin/bundle/LocaleController.php:149 1875 1882 msgid "Themes" … … 2151 2158 msgstr "" 2152 2159 2153 #: src/mvc/AdminRouter.php:7 1src/admin/config/PrefsController.php:132160 #: src/mvc/AdminRouter.php:70 src/admin/config/PrefsController.php:13 2154 2161 #: src/admin/config/BaseController.php:19 2155 2162 msgid "User options" … … 2214 2221 msgstr "" 2215 2222 2216 #: src/mvc/AdminRouter.php:5 42223 #: src/mvc/AdminRouter.php:53 2217 2224 msgid "WordPress" 2218 2225 msgstr "" -
loco-translate/trunk/loco.php
r3433545 r3433719 88 88 * @return mixed return value from included file 89 89 */ 90 function loco_include( string $relpath ){90 function loco_include( string $relpath, bool $strict = false ){ 91 91 $path = loco_plugin_root().'/'.$relpath; 92 if( !file_exists($path) ){93 $message = 'File not found: '.$path;94 // debug specifics to error log in case full call stack not visible95 if('cli' !== PHP_SAPI ) {96 error_log( sprintf( '[Loco.debug] Failed on loco_include(%s). !file_exists(%s)', var_export($relpath,true), var_export($path,true) ) );97 }98 // handle circular file inclusion error if error class not found99 if( loco_class_exists('Loco_error_Exception') ){100 throw new Loco_error_Exception( $message);92 if( file_exists($path) ){ 93 return include $path; 94 } 95 if( loco_debugging() && 'cli' !== PHP_SAPI ) { 96 error_log( sprintf( '[Loco.debug] Failed on loco_include(%s). !file_exists(%s)', var_export($relpath,true), var_export($path,true) ) ); 97 } 98 if( $strict ){ 99 if( class_exists('Loco_error_Exception') ){ 100 throw new Loco_error_Exception('File not found: '.$relpath); 101 101 } 102 102 else { 103 throw new Exception( $message.'; additionally src/error/Exception.php not loadable');103 throw new Exception('File not found: '.$relpath.'; additionally src/error/Exception.php not loadable'); 104 104 } 105 105 } 106 return include $path;106 return null; 107 107 } 108 108 … … 152 152 153 153 /** 154 * class_exists wrapper that fails silently. 155 * TODO Scrap this and let the normal autoloader fail silently. 154 * @deprecated Just call class_exists 156 155 */ 157 156 function loco_class_exists( string $class ): bool { 158 try { 159 return class_exists($class); 160 } 161 catch( Throwable $e ){ 162 return false; 163 } 157 return class_exists($class); 164 158 } 165 159 -
loco-translate/trunk/pub/js/min/admin.js
r3433545 r3433719 5 5 const w = {}; 6 6 return { 7 register: function( t, E) {8 w[ t] = E;9 }, 10 require: function( t) {7 register: function(r, E) { 8 w[r] = E; 9 }, 10 require: function(r) { 11 11 var E; 12 if (!(E = w[ t])) throw Error("Bad module [" + t+ "]");12 if (!(E = w[r])) throw Error("Bad module [" + r + "]"); 13 13 return E; 14 14 }, 15 include: function( t) {16 return w[ t];15 include: function(r) { 16 return w[r]; 17 17 }, 18 18 noop: function() {} 19 19 }; 20 20 }(); 21 D.register("1", function(w, t, E) {21 D.register("1", function(w, r, E) { 22 22 function y(p) { 23 const u= typeof p;24 if ("string" === u) if (/[^ <>!=()%^&|?:n0-9]/.test(p)) console.error("Invalid plural: " + p); else return new Function("n", "return " + p);25 "function" !== u&& (p = function(e) {23 const t = typeof p; 24 if ("string" === t) if (/[^ <>!=()%^&|?:n0-9]/.test(p)) console.error("Invalid plural: " + p); else return new Function("n", "return " + p); 25 "function" !== t && (p = function(e) { 26 26 return 1 != e; 27 27 }); … … 29 29 } 30 30 w.init = function(p) { 31 function u(l, m, r) {32 return (l = g[l]) && l[ r] ? l[r] : m || "";31 function t(l, m, q) { 32 return (l = g[l]) && l[q] ? l[q] : m || ""; 33 33 } 34 34 function e(l) { 35 return u(l, l, 0);35 return t(l, l, 0); 36 36 } 37 37 function b(l, m) { 38 return u(m + "" + l, l, 0);39 } 40 function k(l, m, r) {41 r = Number(p(r));42 isNaN( r) && (r= 0);43 return u(l, r ? m : l, r);38 return t(m + "" + l, l, 0); 39 } 40 function k(l, m, q) { 41 q = Number(p(q)); 42 isNaN(q) && (q = 0); 43 return t(l, q ? m : l, q); 44 44 } 45 45 p = y(p); … … 64 64 return w; 65 65 }({}, K, M)); 66 D.register("2", function(w, t, E) {66 D.register("2", function(w, r, E) { 67 67 w.ie = function() { 68 68 return !1; … … 73 73 return w; 74 74 }({}, K, M)); 75 D.register("3", function(w, t, E) {76 Number.prototype.format = function(y, p, u) {75 D.register("3", function(w, r, E) { 76 Number.prototype.format = function(y, p, t) { 77 77 var e = Math.pow(10, y || 0); 78 78 y = []; … … 85 85 y.unshift(e.substring(k - 3, k)); 86 86 } while (0 < (k -= 3)); 87 e = y.join( u|| ",");87 e = y.join(t || ","); 88 88 if (b) { 89 89 { 90 u= b;91 y = u.length;90 t = b; 91 y = t.length; 92 92 let g; 93 for (;"0" === u.charAt(--y); ) g = y;94 g && ( u = u.substring(0, g));95 b = u;93 for (;"0" === t.charAt(--y); ) g = y; 94 g && (t = t.substring(0, g)); 95 b = t; 96 96 } 97 97 b && (e += (p || ".") + b); … … 100 100 }; 101 101 Number.prototype.percent = function(y) { 102 let p = 0, u= this && y ? this / y * 100 : 0;103 if (0 === u) return "0";104 if (100 === u) return "100";105 if (99 < u) u = Math.min(u, 99.9), y = u.format(++p); else if (.5 > u) {106 u = Math.max(u, 1e-4);102 let p = 0, t = this && y ? this / y * 100 : 0; 103 if (0 === t) return "0"; 104 if (100 === t) return "100"; 105 if (99 < t) t = Math.min(t, 99.9), y = t.format(++p); else if (.5 > t) { 106 t = Math.max(t, 1e-4); 107 107 do { 108 y = u.format(++p);108 y = t.format(++p); 109 109 } while ("0" === y && 4 > p); 110 110 y = y.substring(1); 111 } else y = u.format(0);111 } else y = t.format(0); 112 112 return y; 113 113 }; 114 114 return w; 115 115 }({}, K, M)); 116 D.register("4", function(w, t, E) {116 D.register("4", function(w, r, E) { 117 117 Array.prototype.indexOf || (Array.prototype.indexOf = function(y) { 118 118 if (null == this) throw new TypeError(); 119 var p = Object(this), u= p.length >>> 0;120 if (0 === u) return -1;119 var p = Object(this), t = p.length >>> 0; 120 if (0 === t) return -1; 121 121 var e = 0; 122 122 1 < arguments.length && (e = Number(arguments[1]), e != e ? e = 0 : 0 != e && Infinity != e && -Infinity != e && (e = (0 < e || -1) * Math.floor(Math.abs(e)))); 123 if (e >= u) return -1;124 for (e = 0 <= e ? e : Math.max( u - Math.abs(e), 0); e < u; e++) if (e in p && p[e] === y) return e;123 if (e >= t) return -1; 124 for (e = 0 <= e ? e : Math.max(t - Math.abs(e), 0); e < t; e++) if (e in p && p[e] === y) return e; 125 125 return -1; 126 126 }); 127 127 return w; 128 128 }({}, K, M)); 129 D.register("5", function(w, t, E) {130 E = t.JSON;129 D.register("5", function(w, r, E) { 130 E = r.JSON; 131 131 E || (E = { 132 132 parse: A.parseJSON, 133 133 stringify: null 134 }, t.JSON = E);134 }, r.JSON = E); 135 135 w.parse = E.parse; 136 136 w.stringify = E.stringify; 137 137 return w; 138 138 }({}, K, M)); 139 D.register("6", function(w, t, E) {139 D.register("6", function(w, r, E) { 140 140 w.trim = function(y, p) { 141 141 for (p || (p = " \n"); y && -1 !== p.indexOf(y.charAt(0)); ) y = y.substring(1); … … 147 147 }; 148 148 w.vsprintf = function(y, p) { 149 let u= 0;149 let t = 0; 150 150 return y.replace(/%(?:([1-9][0-9]*)\$)?([sud%])/g, function(e, b, k) { 151 151 if ("%" === k) return "%"; 152 e = b ? p[Number(b) - 1] : p[ u++];152 e = b ? p[Number(b) - 1] : p[t++]; 153 153 return null != e ? String(e) : "s" === k ? "" : "0"; 154 154 }); … … 156 156 return w; 157 157 }({}, K, M)); 158 D.register("1a", function(w, t, E) {158 D.register("1a", function(w, r, E) { 159 159 function y(p) { 160 return function( u, e) {161 let b = u[p] || 0;162 for (;( u = u.offsetParent) && u !== (e || E.body); ) b += u[p] || 0;160 return function(t, e) { 161 let b = t[p] || 0; 162 for (;(t = t.offsetParent) && t !== (e || E.body); ) b += t[p] || 0; 163 163 return b; 164 164 }; … … 166 166 w.top = y("offsetTop"); 167 167 w.left = y("offsetLeft"); 168 w.el = function(p, u) {168 w.el = function(p, t) { 169 169 p = E.createElement(p || "div"); 170 u && (p.className = u);170 t && (p.className = t); 171 171 return p; 172 172 }; … … 179 179 return w; 180 180 }({}, K, M)); 181 D.register("7", function(w, t, E) {181 D.register("7", function(w, r, E) { 182 182 function y(c, d, h) { 183 183 function n() { 184 184 v(); 185 z= setTimeout(d, h);185 C = setTimeout(d, h); 186 186 } 187 187 function v() { 188 z && clearTimeout(z);189 z= 0;190 } 191 let z= 0;188 C && clearTimeout(C); 189 C = 0; 190 } 191 let C = 0; 192 192 n(); 193 193 A(c).on("mouseenter", v).on("mouseleave", n); … … 203 203 c.slideUp(d, function() { 204 204 c.remove(); 205 A( t).triggerHandler("resize");205 A(r).triggerHandler("resize"); 206 206 }); 207 207 }); 208 208 return c; 209 209 } 210 function u(c, d) {210 function t(c, d) { 211 211 function h(G) { 212 r[C] = null;212 q[B] = null; 213 213 p(A(c), 250); 214 z && z.die();214 C && C.die(); 215 215 var H; 216 216 if (H = G) G.stopPropagation(), G.preventDefault(), H = !1; … … 218 218 } 219 219 function n(G) { 220 z && z.die();221 return z= y(c, h, G);220 C && C.die(); 221 return C = y(c, h, G); 222 222 } 223 223 const v = A(c); 224 let z, C, B, F = v.find("button");224 let C, B, z, F = v.find("button"); 225 225 0 === F.length && (v.addClass("is-dismissible"), F = A('<button type="button" class="notice-dismiss"> </a>').appendTo(v)); 226 226 F.off("click").on("click", h); 227 A( t).triggerHandler("resize");227 A(r).triggerHandler("resize"); 228 228 m(); 229 C = r.length;230 r.push(h);231 d && ( z= n(d));229 B = q.length; 230 q.push(h); 231 d && (C = n(d)); 232 232 return { 233 233 link: function(G, H) { … … 235 235 H = A(c).find("nav"); 236 236 G = A("<nav></nav>").append(A("<a></a>").attr("href", G).text(J)); 237 B ? (B.push(G.html()), H.html(B.join("<span> | </span>"))) : (B= [ G.html() ],237 z ? (z.push(G.html()), H.html(z.join("<span> | </span>"))) : (z = [ G.html() ], 238 238 A(c).addClass("has-nav").append(G)); 239 239 return this; 240 240 }, 241 241 stick: function() { 242 z && z.die();243 z= null;244 r[C] = null;242 C && C.die(); 243 C = null; 244 q[B] = null; 245 245 return this; 246 246 }, … … 262 262 function b(c, d, h, n) { 263 263 c = e(h, d, c).css("opacity", "0").fadeTo(500, 1); 264 A( t).triggerHandler("resize");265 return u(c, n);264 A(r).triggerHandler("resize"); 265 return t(c, n); 266 266 } 267 267 function k(c) { 268 return b(c, q, "warning");268 return b(c, u, "warning"); 269 269 } 270 270 function g() { 271 271 A("#loco-notices").find("div.notice").each(function(c, d) { 272 272 -1 === d.className.indexOf("jshide") && (c = -1 === d.className.indexOf("notice-success") ? null : 5e3, 273 u(d, c));274 }); 275 } 276 const l = t.console || {273 t(d, c)); 274 }); 275 } 276 const l = r.console || { 277 277 log: function() {} 278 278 }, m = Date.now || function() { 279 279 return new Date().getTime(); 280 280 }; 281 let r = [], x, q, f, a;281 let q = [], x, u, f, a; 282 282 w.error = function(c) { 283 283 return b(c, x, "error"); … … 299 299 w.clear = function() { 300 300 let c = -1; 301 const d = r, h = d.length;301 const d = q, h = d.length; 302 302 for (;++c < h; ) { 303 303 const n = d[c]; 304 304 n && n.call && n(); 305 305 } 306 r= [];306 q = []; 307 307 return w; 308 308 }; … … 311 311 (w[c.type] || w.error).call(w, c.message); 312 312 }; 313 w.convert = u;313 w.convert = t; 314 314 w.init = function(c) { 315 315 x = c._("Error"); 316 q= c._("Warning");316 u = c._("Warning"); 317 317 f = c._("Notice"); 318 318 a = c._("OK"); … … 322 322 return w; 323 323 }({}, K, M)); 324 D.register("8", function(w, t, E) {325 function y( q) {326 let f = A("<pre>" + q+ "</pre>").text();327 f && (f = f.replace(/[\r\n]+/g, "\n").replace(/(^|\n)\s+/g, "$1").replace(/\s+$/, ""));328 f || (f = q) || (f= "Blank response from server");329 return f;330 } 331 function p( q) {332 return ( q = q.split(/[\r\n]/)[0]) ? (q = q.replace(/ +in +\S+ on line \d+/, ""),333 q = q.replace(/^[()! ]+Fatal error:\s*/, "")) : r._("Server returned invalid data");334 } 335 function u(q) {336 t.console && console.error && console.error('No nonce for "' + q+ '"');324 D.register("8", function(w, r, E) { 325 function y(f) { 326 let a = A("<pre>" + f + "</pre>").text(); 327 a && (a = a.replace(/[\r\n]+/g, "\n").replace(/(^|\n)\s+/g, "$1").replace(/\s+$/, "")); 328 a || (a = f) || (a = "Blank response from server"); 329 return a; 330 } 331 function p(f) { 332 return (f = f.split(/[\r\n]/)[0]) ? (f = f.replace(/ +in +\S+ on line \d+/, ""), 333 f = f.replace(/^[()! ]+Fatal error:\s*/, "")) : x._("Server returned invalid data"); 334 } 335 function t(f) { 336 r.console && console.error && console.error('No nonce for "' + f + '"'); 337 337 return ""; 338 338 } 339 function e(q, f, a) { 340 q[f] = a; 341 } 342 function b(q, f, a) { 343 q.push({ 344 name: f, 345 value: a 346 }); 347 } 348 function k(q, f, a) { 349 q.append(f, a); 350 } 351 function g(q, f, a, c) { 352 function d(n, v, z) { 353 if ("abort" !== v) { 354 var C = r || { 355 _: function(O) { 356 return O; 357 } 358 }, B = n.status || 0, F = n.responseText || "", G = y(F), H = n.getResponseHeader("Content-Type") || "Unknown type", J = n.getResponseHeader("Content-Length") || F.length; 359 "success" === v && z ? h.error(z) : (h.error(p(G) + ".\n" + C._("Check console output for debugging information")), 360 h.log("Ajax failure for " + q, { 361 status: B, 362 error: v, 363 message: z, 364 output: F 365 }), "parsererror" === v && (z = "Response not JSON"), h.log([ C._("Provide the following text when reporting a problem") + ":", "----", "Status " + B + ' "' + (z || C._("Unknown error")) + '" (' + H + " " + J + " bytes)", G, "====" ].join("\n"))); 366 a && a.call && a(n, v, z); 367 x = n; 368 } 369 } 370 c.url = l; 371 c.dataType = "json"; 372 const h = D.require("7").clear(); 373 x = null; 374 return A.ajax(c).fail(d).done(function(n, v, z) { 375 const C = n && n.data, B = n && n.notices, F = B && B.length; 376 !C || n.error ? d(z, v, n && n.error && n.error.message) : f && f(C, v, z); 377 for (n = -1; ++n < F; ) h.raise(B[n]); 378 }); 379 } 380 const l = t.ajaxurl || "/wp-admin/admin-ajax.php"; 381 let m = {}, r, x; 382 w.init = function(q) { 383 m = q.nonces || m; 339 function e(f, a, c) { 340 f[a] = c; 341 } 342 function b(f, a, c) { 343 f.push({ 344 name: a, 345 value: c 346 }); 347 } 348 function k(f, a, c) { 349 f.append(a, c); 350 } 351 function g(f, a, c, d) { 352 function h(v, C, B) { 353 if ("abort" !== C) { 354 var z = x || { 355 _: function(R) { 356 return R; 357 } 358 }, F = v.status || 0, G = v.responseText || "", H = y(G), J = v.getResponseHeader("Content-Type") || "Unknown type", O = v.getResponseHeader("Content-Length") || G.length; 359 "success" === C && B ? n.error(B) : (n.error(p(H) + ".\n" + z._("Check console output for debugging information")), 360 n.log("Ajax failure for " + f, { 361 status: F, 362 error: C, 363 message: B, 364 output: G 365 }), "parsererror" === C && (B = "Response not JSON"), n.log([ z._("Provide the following text when reporting a problem") + ":", "----", "Status " + F + ' "' + (B || z._("Unknown error")) + '" (' + J + " " + O + " bytes)", H, "====" ].join("\n"))); 366 c && c.call && c(v, C, B); 367 u = v; 368 } 369 } 370 d.url = m; 371 d.dataType = "json"; 372 const n = D.require("7").clear(); 373 u = null; 374 return A.ajax(d).fail(h).done(function(v, C, B) { 375 const z = v && v.data, F = v && v.notices, G = F && F.length; 376 !z || v.error ? h(B, C, v && v.error && v.error.message) : a && a(z, C, B); 377 for (v = -1; ++v < G; ) n.raise(F[v]); 378 }); 379 } 380 function l(f) { 381 A(f).on("heartbeat-send", function(a, c) { 382 c["loco-translate"] = { 383 nonces: q 384 }; 385 }).on("heartbeat-tick", function(a, c) { 386 q = c["loco-translate"] && c["loco-translate"].nonces || {}; 387 }); 388 } 389 const m = r.ajaxurl || "/wp-admin/admin-ajax.php"; 390 let q = {}, x, u; 391 w.init = function(f) { 392 q = f.nonces || q; 393 l(E); 384 394 return w; 385 395 }; 386 w.localise = function( q) {387 r = q;396 w.localise = function(f) { 397 x = f; 388 398 return w; 389 399 }; 390 400 w.xhr = function() { 391 return x;401 return u; 392 402 }; 393 403 w.strip = y; 394 404 w.parse = p; 395 w.submit = function( q, f, a) {396 function c(z, C) {397 C.disabled ? C.setAttribute("data-was-disabled", "true") : C.disabled = !0;398 } 399 function d(z, C) {400 C.getAttribute("data-was-disabled") || (C.disabled = !1);401 } 402 function h(z) {403 z.find(".button-primary").removeClass("loading");404 z.find("button").each(d);405 z.find("input").each(d);406 z.find("select").each(d);407 z.find("textarea").each(d);408 z.removeClass("disabled loading");409 } 410 const n = A(q), v = n.serialize();411 (function( z) {412 z.find(".button-primary").addClass("loading");413 z.find("button").each(c);414 z.find("input").each(c);415 z.find("select").each(c);416 z.find("textarea").each(c);417 z.addClass("disabled loading");418 })( n);419 return g( q.route.value, function(z, C, B) {420 h(n);421 f && f(z, C, B);422 }, function( z, C, B) {423 h(n);424 a && a(z, C, B);405 w.submit = function(f, a, c) { 406 function d(B, z) { 407 z.disabled ? z.setAttribute("data-was-disabled", "true") : z.disabled = !0; 408 } 409 function h(B, z) { 410 z.getAttribute("data-was-disabled") || (z.disabled = !1); 411 } 412 function n(B) { 413 B.find(".button-primary").removeClass("loading"); 414 B.find("button").each(h); 415 B.find("input").each(h); 416 B.find("select").each(h); 417 B.find("textarea").each(h); 418 B.removeClass("disabled loading"); 419 } 420 const v = A(f), C = v.serialize(); 421 (function(B) { 422 B.find(".button-primary").addClass("loading"); 423 B.find("button").each(d); 424 B.find("input").each(d); 425 B.find("select").each(d); 426 B.find("textarea").each(d); 427 B.addClass("disabled loading"); 428 })(v); 429 return g(f.route.value, function(B, z, F) { 430 n(v); 431 a && a(B, z, F); 432 }, function(B, z, F) { 433 n(v); 434 c && c(B, z, F); 425 435 }, { 426 type: q.method,427 data: v428 }); 429 }; 430 w.post = function( q, f, a, c) {431 let d = !0, h = f || {}, n = m[q] || u(q);432 t.FormData && h instanceof FormData ? (d = !1, f = k) : f = Array.isArray(h) ? b : e;433 f(h, "action", "loco_json");434 f(h, "route", q);435 f(h, "loco-nonce", n);436 return g( q, a, c, {436 type: f.method, 437 data: C 438 }); 439 }; 440 w.post = function(f, a, c, d) { 441 let h = !0, n = a || {}, v = q[f] || t(f); 442 r.FormData && n instanceof FormData ? (h = !1, a = k) : a = Array.isArray(n) ? b : e; 443 a(n, "action", "loco_json"); 444 a(n, "route", f); 445 a(n, "loco-nonce", v); 446 return g(f, c, d, { 437 447 type: "post", 438 data: h,439 processData: d,440 contentType: d? "application/x-www-form-urlencoded; charset=UTF-8" : !1441 }); 442 }; 443 w.get = function( q, f, a, c) {444 f = f|| {};445 const d = m[q] || u(q);446 f.action = "loco_json";447 f.route = q;448 f["loco-nonce"] = d;449 return g( q, a, c, {448 data: n, 449 processData: h, 450 contentType: h ? "application/x-www-form-urlencoded; charset=UTF-8" : !1 451 }); 452 }; 453 w.get = function(f, a, c, d) { 454 a = a || {}; 455 const h = q[f] || t(f); 456 a.action = "loco_json"; 457 a.route = f; 458 a["loco-nonce"] = h; 459 return g(f, c, d, { 450 460 type: "get", 451 data: f452 }); 453 }; 454 w.setNonce = function( q, f) {455 m[q] = f;461 data: a 462 }); 463 }; 464 w.setNonce = function(f, a) { 465 q[f] = a; 456 466 return w; 457 467 }; … … 530 540 yih: 1 531 541 }); 532 D.register("9", function(w, t, E) {542 D.register("9", function(w, r, E) { 533 543 function y() {} 534 544 const p = D.require("1b"); 535 let u;545 let t; 536 546 w.init = function() { 537 547 return new y(); … … 546 556 }; 547 557 w.parse = function(e) { 548 e = ( u || (u= /^([a-z]{2,3})(?:[-_]([a-z]{2}))?(?:[-_]([a-z0-9]{3,8}))?$/i)).exec(e);558 e = (t || (t = /^([a-z]{2,3})(?:[-_]([a-z]{2}))?(?:[-_]([a-z0-9]{3,8}))?$/i)).exec(e); 549 559 if (!e) return null; 550 560 const b = new y(); … … 554 564 return b; 555 565 }; 556 t= y.prototype;557 t.isValid = function() {566 r = y.prototype; 567 r.isValid = function() { 558 568 return !!this.lang; 559 569 }; 560 t.isKnown = function() {570 r.isKnown = function() { 561 571 const e = this.lang; 562 572 return e && "zxx" !== e; 563 573 }; 564 t.toString = function(e) {574 r.toString = function(e) { 565 575 e = e || "_"; 566 576 let b = this.lang || "zxx"; … … 569 579 return b; 570 580 }; 571 t.getIcon = function() {581 r.getIcon = function() { 572 582 let e = 3, b = []; 573 583 const k = [ "variant", "region", "lang" ]; … … 578 588 return b.join(" "); 579 589 }; 580 t.isRTL = function() {590 r.isRTL = function() { 581 591 return !!p[String(this.lang).toLowerCase()]; 582 592 }; 583 t= null;593 r = null; 584 594 return w; 585 595 }({}, K, M)); … … 996 1006 "ӯ": "у" 997 1007 }); 998 D.register("a", function(w, t, E) {1008 D.register("a", function(w, r, E) { 999 1009 w.init = function() { 1000 1010 function y(a) { 1001 return r[a] || a;1011 return q[a] || a; 1002 1012 } 1003 1013 function p(a, c, d) { … … 1009 1019 if (v && null == d[v]) { 1010 1020 const F = []; 1011 var z= v.length;1021 var C = v.length; 1012 1022 let G = 0; 1013 1023 do { 1014 var C = q.exec(v);1015 if ( C) {1016 C = C[0];1017 var B = C.length;1018 if (G) for (let H = 0; H < G; H++) F[H] += C; else if (B === z) {1019 null == d[ C] && (c.push(C), d[C] = !0);1024 var B = u.exec(v); 1025 if (B) { 1026 B = B[0]; 1027 var z = B.length; 1028 if (G) for (let H = 0; H < G; H++) F[H] += B; else if (z === C) { 1029 null == d[B] && (c.push(B), d[B] = !0); 1020 1030 continue a; 1021 1031 } 1022 F.push( C);1032 F.push(B); 1023 1033 G++; 1024 v = v.substring( B);1034 v = v.substring(z); 1025 1035 if ("" === v) break; 1026 1036 } 1027 if ( C= f.exec(v)) {1028 C = C[0];1029 if (G) for ( B = 0; B < G; B++) F[B] += C; else F.push(C), G++;1030 v = v.substring( C.length);1037 if (B = f.exec(v)) { 1038 B = B[0]; 1039 if (G) for (z = 0; z < G; z++) F[z] += B; else F.push(B), G++; 1040 v = v.substring(B.length); 1031 1041 } 1032 1042 } while ("" !== v); 1033 for (v = 0; v < F.length; v++) z = F[v], null == d[z] && (c.push(z), d[z] = !0);1043 for (v = 0; v < F.length; v++) C = F[v], null == d[C] && (c.push(C), d[C] = !0); 1034 1044 } 1035 1045 } 1036 1046 return c; 1037 1047 } 1038 function u(a) {1048 function t(a) { 1039 1049 return p(a, [], {}); 1040 1050 } … … 1049 1059 } 1050 1060 let k = [], g = [], l = ""; 1051 const m = /[^a-z0-9]/g, r = D.require("1c"), x = /\s+/, q= /^[\d\p{L}]+/u, f = /^[^\d\p{L}]+/u;1061 const m = /[^a-z0-9]/g, q = D.require("1c"), x = /\s+/, u = /^[\d\p{L}]+/u, f = /^[^\d\p{L}]+/u; 1052 1062 return { 1053 split: u,1063 split: t, 1054 1064 find: function(a, c) { 1055 const d = [], h = [], n = String(a || "").toLowerCase().replace(m, y).split(" "), v = n.length, z = l && a.substring(0, l.length) === l ? g : k, C = z.length, B= !!c;1065 const d = [], h = [], n = String(a || "").toLowerCase().replace(m, y).split(" "), v = n.length, C = l && a.substring(0, l.length) === l ? g : k, B = C.length, z = !!c; 1056 1066 let F = -1, G = 0; 1057 a: for (;++F < C; ) {1058 const H = z[F], J = H && H.length;1067 a: for (;++F < B; ) { 1068 const H = C[F], J = H && H.length; 1059 1069 if (J) { 1060 1070 b: for (let O = 0; O < v; O++) { … … 1064 1074 } 1065 1075 h[F] = H; 1066 d.push( B? c[F] : F);1076 d.push(z ? c[F] : F); 1067 1077 } else G++; 1068 1078 } … … 1072 1082 }, 1073 1083 add: function(a, c) { 1074 k[a] = u(c);1084 k[a] = t(c); 1075 1085 l && b(); 1076 1086 }, … … 1102 1112 return w; 1103 1113 }({}, K, M)); 1104 D.register("b", function(w, t, E) {1114 D.register("b", function(w, r, E) { 1105 1115 w.listen = function(y, p) { 1106 function u() {1107 q[g ? "show" : "hide"]();1116 function t() { 1117 u[g ? "show" : "hide"](); 1108 1118 } 1109 1119 function e(f) { 1110 x && r.setAttribute("size", 2 + f.length);1120 x && q.setAttribute("size", 2 + f.length); 1111 1121 g = f; 1112 u();1122 t(); 1113 1123 return f; 1114 1124 } … … 1118 1128 } 1119 1129 function k(f) { 1120 let a = r.value;1130 let a = q.value; 1121 1131 a !== g ? (l && clearTimeout(l), e(a), f ? l = setTimeout(b, f) : b()) : l && null == f && (clearTimeout(l), 1122 1132 b()); 1123 1133 } 1124 1134 let g, l, m = 150; 1125 const r = y instanceof jQuery ? y[0] : y, x = 1 === Number(r.size), q= A('<a href="#clear" tabindex="-1" class="icon clear"><span>clear</span></a>').on("click", function(f) {1135 const q = y instanceof jQuery ? y[0] : y, x = 1 === Number(q.size), u = A('<a href="#clear" tabindex="-1" class="icon clear"><span>clear</span></a>').on("click", function(f) { 1126 1136 f.preventDefault(); 1127 r.value = "";1137 q.value = ""; 1128 1138 k(); 1129 A( r).triggerHandler("blur");1139 A(q).triggerHandler("blur"); 1130 1140 return !1; 1131 1141 }); 1132 e( r.value);1133 A( r).on("input", function() {1142 e(q.value); 1143 A(q).on("input", function() { 1134 1144 k(m); 1135 1145 return !0; … … 1137 1147 k(null); 1138 1148 return !0; 1139 }).after( q);1140 u();1149 }).after(u); 1150 t(); 1141 1151 return { 1142 1152 delay: function(f) { … … 1145 1155 }, 1146 1156 ping: function(f) { 1147 f ? (l && clearTimeout(l), e( r.value), b(), f = void 0) : f = k();1157 f ? (l && clearTimeout(l), e(q.value), b(), f = void 0) : f = k(); 1148 1158 return f; 1149 1159 }, … … 1151 1161 if (null == f) return g; 1152 1162 l && clearTimeout(l); 1153 r.value = e(f);1154 u();1163 q.value = e(f); 1164 t(); 1155 1165 }, 1156 1166 el: function() { 1157 return r;1167 return q; 1158 1168 }, 1159 1169 blur: function(f) { 1160 return A( r).on("blur", f);1170 return A(q).on("blur", f); 1161 1171 }, 1162 1172 destroy: function() { … … 1167 1177 return w; 1168 1178 }({}, K, M)); 1169 D.register("c", function(w, t, E) {1179 D.register("c", function(w, r, E) { 1170 1180 function y(b, k) { 1171 1181 return "function" == typeof b ? b.call(k) : b; … … 1181 1191 fade: !0, 1182 1192 offset: 5, 1183 delayIn: u,1193 delayIn: t, 1184 1194 delayOut: e, 1185 1195 anchor: b.attr("data-anchor"), … … 1190 1200 }; 1191 1201 w.delays = function(b, k) { 1192 u= b || 150;1202 t = b || 150; 1193 1203 e = k || 100; 1194 1204 }; … … 1199 1209 k.data("tipsy").setTitle(b); 1200 1210 }; 1201 let u, e;1211 let t, e; 1202 1212 w.delays(); 1203 1213 A(E.body).on("overlayOpened overlayClosing", function(b) { … … 1224 1234 height: k[0].offsetHeight 1225 1235 }); 1226 let r;1236 let q; 1227 1237 switch (m.charAt(0)) { 1228 1238 case "n": 1229 r= {1239 q = { 1230 1240 top: k.top + k.height + this.options.offset, 1231 1241 left: k.left + k.width / 2 - b / 2 … … 1234 1244 1235 1245 case "s": 1236 r= {1246 q = { 1237 1247 top: k.top - l - this.options.offset, 1238 1248 left: k.left + k.width / 2 - b / 2 … … 1241 1251 1242 1252 case "e": 1243 r= {1253 q = { 1244 1254 top: k.top + k.height / 2 - l / 2, 1245 1255 left: k.left - b - this.options.offset … … 1248 1258 1249 1259 case "w": 1250 r= {1260 q = { 1251 1261 top: k.top + k.height / 2 - l / 2, 1252 1262 left: k.left + k.width + this.options.offset 1253 1263 }; 1254 1264 } 1255 2 === m.length && ("w" === m.charAt(1) ? r.left = k.left + k.width / 2 - 15 : r.left = k.left + k.width / 2 - b + 15);1256 g.css( r).addClass("tipsy-" + m);1265 2 === m.length && ("w" === m.charAt(1) ? q.left = k.left + k.width / 2 - 15 : q.left = k.left + k.width / 2 - b + 15); 1266 g.css(q).addClass("tipsy-" + m); 1257 1267 g.find(".tipsy-arrow")[0].className = "tipsy-arrow tipsy-arrow-" + m.charAt(0); 1258 1268 this.options.className && g.addClass(y(this.options.className, this.$element[0])); … … 1301 1311 A.fn.tipsy = function(b) { 1302 1312 function k(x) { 1303 var q= A.data(x, "tipsy");1304 q || (q = new p(x, A.fn.tipsy.elementOptions(x, b)), A.data(x, "tipsy", q));1305 return q;1313 var u = A.data(x, "tipsy"); 1314 u || (u = new p(x, A.fn.tipsy.elementOptions(x, b)), A.data(x, "tipsy", u)); 1315 return u; 1306 1316 } 1307 1317 function g() { 1308 var x = k(this), q= b.delayIn;1318 var x = k(this), u = b.delayIn; 1309 1319 x.hoverState = "in"; 1310 0 == q? x.show() : (x.fixTitle(), setTimeout(function() {1320 0 == u ? x.show() : (x.fixTitle(), setTimeout(function() { 1311 1321 "in" == x.hoverState && x.show(); 1312 }, q));1322 }, u)); 1313 1323 } 1314 1324 function l() { 1315 var x = k(this), q= b.delayOut;1325 var x = k(this), u = b.delayOut; 1316 1326 x.hoverState = "out"; 1317 0 == q? x.hide() : (x.tip().removeClass("in"), setTimeout(function() {1327 0 == u ? x.hide() : (x.tip().removeClass("in"), setTimeout(function() { 1318 1328 "out" == x.hoverState && x.hide(); 1319 }, q));1329 }, u)); 1320 1330 } 1321 1331 b = A.extend({}, A.fn.tipsy.defaults, b); … … 1324 1334 }); 1325 1335 if ("manual" != b.trigger) { 1326 var m = b.live ? "live" : "bind", r= "hover" == b.trigger ? "mouseleave" : "blur";1327 this[m]("hover" == b.trigger ? "mouseenter" : "focus", g)[m]( r, l);1336 var m = b.live ? "live" : "bind", q = "hover" == b.trigger ? "mouseleave" : "blur"; 1337 this[m]("hover" == b.trigger ? "mouseenter" : "focus", g)[m](q, l); 1328 1338 } 1329 1339 return this; … … 1348 1358 }; 1349 1359 A.fn.tipsy.autoNS = function() { 1350 return A(this).offset().top > A(E).scrollTop() + A( t).height() / 2 ? "s" : "n";1360 return A(this).offset().top > A(E).scrollTop() + A(r).height() / 2 ? "s" : "n"; 1351 1361 }; 1352 1362 A.fn.tipsy.autoWE = function() { 1353 return A(this).offset().left > A(E).scrollLeft() + A( t).width() / 2 ? "e" : "w";1363 return A(this).offset().left > A(E).scrollLeft() + A(r).width() / 2 ? "e" : "w"; 1354 1364 }; 1355 1365 A.fn.tipsy.autoBounds = function(b, k) { 1356 1366 return function() { 1357 var g = k[0], l = 1 < k.length ? k[1] : !1, m = A(E).scrollTop() + b, r= A(E).scrollLeft() + b, x = A(this);1367 var g = k[0], l = 1 < k.length ? k[1] : !1, m = A(E).scrollTop() + b, q = A(E).scrollLeft() + b, x = A(this); 1358 1368 x.offset().top < m && (g = "n"); 1359 x.offset().left < r&& (l = "w");1360 A( t).width() + A(E).scrollLeft() - x.offset().left < b && (l = "e");1361 A( t).height() + A(E).scrollTop() - x.offset().top < b && (g = "s");1369 x.offset().left < q && (l = "w"); 1370 A(r).width() + A(E).scrollLeft() - x.offset().left < b && (l = "e"); 1371 A(r).height() + A(E).scrollTop() - x.offset().top < b && (g = "s"); 1362 1372 return g + (l ? l : ""); 1363 1373 }; … … 1365 1375 return w; 1366 1376 }({}, K, M)); 1367 D.register("28", function(w, t, E) {1377 D.register("28", function(w, r, E) { 1368 1378 "".localeCompare || (String.prototype.localeCompare = function() { 1369 1379 return 0; … … 1373 1383 }); 1374 1384 "".padStart || (String.prototype.padStart = function(y, p) { 1375 let u= this.valueOf();1376 for (;y > u.length; ) u = p + u;1377 return u;1385 let t = this.valueOf(); 1386 for (;y > t.length; ) t = p + t; 1387 return t; 1378 1388 }); 1379 1389 "".padEnd || (String.prototype.padEnd = function(y, p) { 1380 let u= this.valueOf();1381 for (;y > u.length; ) u+= p;1382 return u;1390 let t = this.valueOf(); 1391 for (;y > t.length; ) t += p; 1392 return t; 1383 1393 }); 1384 1394 w.html = function() { … … 1389 1399 return '<a href="' + l + '" target="' + (m.indexOf(k) ? "_blank" : "_top") + '">' + m + "</a>"; 1390 1400 } 1391 let u, e, b, k, g = function() {1392 u= /[<>&]/g;1401 let t, e, b, k, g = function() { 1402 t = /[<>&]/g; 1393 1403 e = /(\r\n|\n|\r)/g; 1394 1404 b = /(?:https?):\/\/(\S+)/gi; … … 1398 1408 return function(l, m) { 1399 1409 g && g(); 1400 l = l.replace( u, y);1410 l = l.replace(t, y); 1401 1411 m && (l = l.replace(b, p).replace(e, "<br />")); 1402 1412 return l; … … 1405 1415 return w; 1406 1416 }({}, K, M)); 1407 D.register("29", function(w, t, E) {1417 D.register("29", function(w, r, E) { 1408 1418 function y() {} 1409 let p, u;1419 let p, t; 1410 1420 const e = D.require("1b"); 1411 1421 w.init = function() { … … 1421 1431 }; 1422 1432 w.parse = function(b) { 1423 p || ( u= /[-_+]/, p = /^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}|[0-9]{3}))?(?:-([0-9][a-z0-9]{3,8}|[a-z0-9]{5,8}))?(?:-([a-z]-[-a-z]+))?$/i);1424 b = String(b).split( u).join("-");1433 p || (t = /[-_+]/, p = /^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}|[0-9]{3}))?(?:-([0-9][a-z0-9]{3,8}|[a-z0-9]{5,8}))?(?:-([a-z]-[-a-z]+))?$/i); 1434 b = String(b).split(t).join("-"); 1425 1435 b = p.exec(b); 1426 1436 if (!b) return null; … … 1433 1443 return k; 1434 1444 }; 1435 t= y.prototype;1436 t.isValid = function() {1445 r = y.prototype; 1446 r.isValid = function() { 1437 1447 return !!this.lang; 1438 1448 }; 1439 t.toString = function(b) {1449 r.toString = function(b) { 1440 1450 b = b || "-"; 1441 1451 let k, g = this.lang || "zxx"; … … 1446 1456 return g; 1447 1457 }; 1448 t.getIcon = function() {1458 r.getIcon = function() { 1449 1459 let b = 4, k = []; 1450 1460 const g = [ "variant", "region", "script", "lang" ]; … … 1456 1466 return k.join(" "); 1457 1467 }; 1458 t.isRTL = function() {1468 r.isRTL = function() { 1459 1469 return !!e[String(this.script || this.lang).toLowerCase()]; 1460 1470 }; 1461 t= null;1471 r = null; 1462 1472 return w; 1463 1473 }({}, K, M)); 1464 D.register("2a", function(w, t, E) {1474 D.register("2a", function(w, r, E) { 1465 1475 function y(b) { 1466 t.console && console.error && console.error(b);1476 r.console && console.error && console.error(b); 1467 1477 } 1468 1478 function p() { 1469 1479 y("Method not implemented"); 1470 1480 } 1471 function u() {}1481 function t() {} 1472 1482 function e(b) {} 1473 u.prototype.toString = function() {1483 t.prototype.toString = function() { 1474 1484 return "[Undefined]"; 1475 1485 }; … … 1477 1487 let k, g, l = !0; 1478 1488 for (k in this) g = this[k], g === p ? (y(b + "." + k + "() must be implemented"), 1479 l = !1) : g instanceof u&& (y(b + "." + k + " must be defined"), l = !1);1489 l = !1) : g instanceof t && (y(b + "." + k + " must be defined"), l = !1); 1480 1490 return l; 1481 1491 }; … … 1486 1496 for (;0 !== l--; ) g[b[l]] = p; 1487 1497 } 1488 if (k) for (b = k.length; 0 !== b--; ) g[k[b]] = new u();1498 if (k) for (b = k.length; 0 !== b--; ) g[k[b]] = new t(); 1489 1499 return g; 1490 1500 }; … … 1495 1505 return w; 1496 1506 }({}, K, M)); 1497 D.register("31", function(w, t, E) {1498 let y = 0, p = t.requestAnimationFrame, u = t.cancelAnimationFrame;1499 if (!p || ! u) for (const b in {1507 D.register("31", function(w, r, E) { 1508 let y = 0, p = r.requestAnimationFrame, t = r.cancelAnimationFrame; 1509 if (!p || !t) for (const b in { 1500 1510 ms: 1, 1501 1511 moz: 1, 1502 1512 webkit: 1, 1503 1513 o: 1 1504 }) if (p = t[b + "RequestAnimationFrame"]) if (u = t[b + "CancelAnimationFrame"] || t[b + "CancelRequestAnimationFrame"]) break;1505 p && u|| (p = function(b) {1514 }) if (p = r[b + "RequestAnimationFrame"]) if (t = r[b + "CancelAnimationFrame"] || r[b + "CancelRequestAnimationFrame"]) break; 1515 p && t || (p = function(b) { 1506 1516 var k = e(); 1507 1517 const g = Math.max(0, 16 - (k - y)), l = k + g; 1508 k = t.setTimeout(function() {1518 k = r.setTimeout(function() { 1509 1519 b(l); 1510 1520 }, g); 1511 1521 y = l; 1512 1522 return k; 1513 }, u= function(b) {1523 }, t = function(b) { 1514 1524 clearTimeout(b); 1515 1525 }); … … 1526 1536 return { 1527 1537 stop: function() { 1528 m && u(m);1538 m && t(m); 1529 1539 m = null; 1530 1540 } … … 1533 1543 return w; 1534 1544 }({}, K, M)); 1535 D.register("2e", function(w, t, E) {1536 function y( r, x, q, f) {1545 D.register("2e", function(w, r, E) { 1546 function y(q, x, u, f) { 1537 1547 if (e) { 1538 const a = q;1539 q= function(c) {1548 const a = u; 1549 u = function(c) { 1540 1550 if ((c.MSPOINTER_TYPE_TOUCH || "touch") === c.pointerType) return a(c); 1541 1551 }; 1542 1552 } 1543 r.addEventListener(x, q, f);1553 q.addEventListener(x, u, f); 1544 1554 return { 1545 1555 unbind: function() { 1546 r.removeEventListener(x, q, f);1547 } 1548 }; 1549 } 1550 function p( r) {1551 r.preventDefault();1552 r.stopPropagation();1556 q.removeEventListener(x, u, f); 1557 } 1558 }; 1559 } 1560 function p(q) { 1561 q.preventDefault(); 1562 q.stopPropagation(); 1553 1563 return !1; 1554 1564 } 1555 let u;1556 const e = !! t.navigator.msPointerEnabled, b = e ? "MSPointerDown" : "touchstart", k = e ? "MSPointerMove" : "touchmove", g = e ? "MSPointerUp" : "touchend";1557 w.ok = function( r) {1558 null == u && (u= "function" === typeof E.body.addEventListener);1559 u && r && r(w);1560 return u;1565 let t; 1566 const e = !!r.navigator.msPointerEnabled, b = e ? "MSPointerDown" : "touchstart", k = e ? "MSPointerMove" : "touchmove", g = e ? "MSPointerUp" : "touchend"; 1567 w.ok = function(q) { 1568 null == t && (t = "function" === typeof E.body.addEventListener); 1569 t && q && q(w); 1570 return t; 1561 1571 }; 1562 1572 w.ms = function() { 1563 1573 return e; 1564 1574 }; 1565 w.dragger = function( r, x) {1566 function q(d) {1567 r.addEventListener(d, a[d], !1);1575 w.dragger = function(q, x) { 1576 function u(d) { 1577 q.addEventListener(d, a[d], !1); 1568 1578 } 1569 1579 function f(d) { 1570 r.removeEventListener(d, a[d], !1);1580 q.removeEventListener(d, a[d], !1); 1571 1581 } 1572 1582 const a = {}; … … 1576 1586 x(d, n, c); 1577 1587 }); 1578 q(k);1579 q(g);1588 u(k); 1589 u(g); 1580 1590 return !0; 1581 1591 }; … … 1596 1606 return p(d); 1597 1607 }; 1598 q(b);1608 u(b); 1599 1609 let c = { 1600 1610 kill: function() { … … 1602 1612 f(k); 1603 1613 f(g); 1604 r= c = x = null;1614 q = c = x = null; 1605 1615 } 1606 1616 }; 1607 1617 return c; 1608 1618 }; 1609 w.swiper = function( r, x, q) {1619 w.swiper = function(q, x, u) { 1610 1620 function f(F) { 1611 r.addEventListener(F, v[F], !1);1621 q.addEventListener(F, v[F], !1); 1612 1622 } 1613 1623 function a(F) { 1614 r.removeEventListener(F, v[F], !1);1624 q.removeEventListener(F, v[F], !1); 1615 1625 } 1616 1626 function c() { … … 1618 1628 d = null; 1619 1629 } 1620 let d, h, n, v = {}, z = [], C = [], B= [];1630 let d, h, n, v = {}, C = [], B = [], z = []; 1621 1631 v[b] = function(F) { 1622 1632 h = !1; … … 1624 1634 const G = m(); 1625 1635 l(F, function(H, J) { 1626 z[H] = G;1627 C[H] = J.clientX;1628 B[H] = J.clientY;1629 }); 1630 n = r.scrollLeft;1636 C[H] = G; 1637 B[H] = J.clientX; 1638 z[H] = J.clientY; 1639 }); 1640 n = q.scrollLeft; 1631 1641 return !0; 1632 1642 }; 1633 1643 v[g] = function(F) { 1634 1644 l(F, function(G, H) { 1635 const J = m() - z[G];1636 G = C[G] - H.clientX;1645 const J = m() - C[G]; 1646 G = B[G] - H.clientX; 1637 1647 x(Math.abs(G) / J, G ? 0 > G ? -1 : 1 : 0); 1638 1648 }); … … 1643 1653 let G, H; 1644 1654 null == n || l(F, function(J, O) { 1645 G = C[J] - O.clientX;1646 H = B[J] - O.clientY;1655 G = B[J] - O.clientX; 1656 H = z[J] - O.clientY; 1647 1657 }); 1648 1658 if (H && Math.abs(H) > Math.abs(G)) return h = !0; 1649 G && (h = !0, r.scrollLeft = Math.max(0, n + G));1659 G && (h = !0, q.scrollLeft = Math.max(0, n + G)); 1650 1660 return p(F); 1651 1661 }; 1652 if (!e || q) f(b), f(k), f(g), e && (r.className += " mstouch");1662 if (!e || u) f(b), f(k), f(g), e && (q.className += " mstouch"); 1653 1663 return { 1654 1664 kill: function() { … … 1665 1675 }, 1666 1676 snap: function(F) { 1667 e && ! q && (r.style["-ms-scroll-snap-points-x"] = "snapInterval(0px," + F + "px)",1668 r.style["-ms-scroll-snap-type"] = "mandatory", r.style["-ms-scroll-chaining"] = "none");1677 e && !u && (q.style["-ms-scroll-snap-points-x"] = "snapInterval(0px," + F + "px)", 1678 q.style["-ms-scroll-snap-type"] = "mandatory", q.style["-ms-scroll-chaining"] = "none"); 1669 1679 }, 1670 1680 scroll: function(F, G, H) { 1671 1681 c(); 1672 let J = r.scrollLeft;1682 let J = q.scrollLeft; 1673 1683 const O = F > J ? 1 : -1, R = Math[1 === O ? "min" : "max"], I = Math.round(16 * G * O); 1674 1684 return d = D.require("31").loop(function(Q) { 1675 Q && (J = Math.max(0, R(F, J + I)), r.scrollLeft = J, F === J && (c(), H && H(J)));1676 }, r);1677 } 1678 }; 1679 }; 1680 w.start = function( r, x) {1681 return y( r, b, x, !1);1682 }; 1683 w.move = function( r, x) {1684 return y( r, k, x, !1);1685 }; 1686 w.end = function( r, x) {1687 return y( r, g, x, !1);1688 }; 1689 const l = w.each = function( r, x) {1690 if (e) ( r.MSPOINTER_TYPE_TOUCH || "touch") === r.pointerType && x(0, r); else {1691 r = (r.originalEvent || r).changedTouches || [];1692 for (var q = -1; ++q < r.length; ) x(q, r[q]);1685 Q && (J = Math.max(0, R(F, J + I)), q.scrollLeft = J, F === J && (c(), H && H(J))); 1686 }, q); 1687 } 1688 }; 1689 }; 1690 w.start = function(q, x) { 1691 return y(q, b, x, !1); 1692 }; 1693 w.move = function(q, x) { 1694 return y(q, k, x, !1); 1695 }; 1696 w.end = function(q, x) { 1697 return y(q, g, x, !1); 1698 }; 1699 const l = w.each = function(q, x) { 1700 if (e) (q.MSPOINTER_TYPE_TOUCH || "touch") === q.pointerType && x(0, q); else { 1701 q = (q.originalEvent || q).changedTouches || []; 1702 for (var u = -1; ++u < q.length; ) x(u, q[u]); 1693 1703 } 1694 1704 }, m = Date.now || function() { … … 1697 1707 return w; 1698 1708 }({}, K, M)); 1699 D.register("32", function(w, t, E) {1709 D.register("32", function(w, r, E) { 1700 1710 w.init = function(y) { 1701 1711 function p() { … … 1703 1713 return !0; 1704 1714 } 1705 function u() {1715 function t() { 1706 1716 const l = k; 1707 1717 l.textContent = y.value; … … 1715 1725 const b = y.parentNode; 1716 1726 let k = b.insertBefore(E.createElement("div"), y); 1717 A(y).on("input", u).on("scroll", p);1727 A(y).on("input", t).on("scroll", p); 1718 1728 A(b).addClass("has-mirror"); 1719 1729 k.className = "ta-mirror"; 1720 1730 const g = y.offsetWidth - y.clientWidth; 1721 1731 2 < g && (k.style.marginRight = String(g - 2) + "px"); 1722 u();1732 t(); 1723 1733 p(); 1724 1734 return { 1725 1735 kill: function() { 1726 A(y).off("input", u).off("scroll", p);1736 A(y).off("input", t).off("scroll", p); 1727 1737 b.removeChild(k); 1728 1738 k = null; … … 1733 1743 return w; 1734 1744 }({}, K, M)); 1735 D.register("23", function(w, t, E) {1745 D.register("23", function(w, r, E) { 1736 1746 function y(e, b) { 1737 1747 e = p[e] || []; 1738 b = b && t[b];1748 b = b && r[b]; 1739 1749 const k = e.length; 1740 1750 let g = -1, l = 0; … … 1746 1756 } 1747 1757 const p = {}; 1748 let u= "";1758 let t = ""; 1749 1759 w.load = function(e, b, k) { 1750 1760 function g() { 1751 r && (clearTimeout(r), r= null);1761 q && (clearTimeout(q), q = null); 1752 1762 x && (x.onreadystatechange = null, x = x = x.onload = null); 1753 1763 e && (delete p[e], e = null); 1754 1764 } 1755 function l( q, f) {1756 q= x && x.readyState;1757 if (f || ! q || "loaded" === q || "complete" === q) f || y(e, k), g();1765 function l(u, f) { 1766 u = x && x.readyState; 1767 if (f || !u || "loaded" === u || "complete" === u) f || y(e, k), g(); 1758 1768 } 1759 1769 function m() { … … 1761 1771 g(); 1762 1772 } 1763 if (k && t[k]) "function" === typeof b && b(t[k]); else if (null != p[e]) p[e].push(b); else {1773 if (k && r[k]) "function" === typeof b && b(r[k]); else if (null != p[e]) p[e].push(b); else { 1764 1774 p[e] = [ b ]; 1765 var r= setTimeout(m, 4e3), x = E.createElement("script");1775 var q = setTimeout(m, 4e3), x = E.createElement("script"); 1766 1776 x.setAttribute("src", e); 1767 1777 x.setAttribute("async", "true"); … … 1775 1785 w.stat = function(e) { 1776 1786 var b; 1777 if (!(b = u)) {1787 if (!(b = t)) { 1778 1788 { 1779 1789 b = E.getElementsByTagName("script"); … … 1783 1793 const m = b[g].getAttribute("src"); 1784 1794 if (m) { 1785 const r= m.indexOf("/lib/vendor");1786 if (-1 !== r) {1787 l = m.substring(0, r);1795 const q = m.indexOf("/lib/vendor"); 1796 if (-1 !== q) { 1797 l = m.substring(0, q); 1788 1798 break; 1789 1799 } … … 1792 1802 b = l || "/static"; 1793 1803 } 1794 b = u= b;1804 b = t = b; 1795 1805 } 1796 1806 return b + e; … … 1801 1811 return w; 1802 1812 }({}, K, M)); 1803 D.register("10", function(w, t, E) {1804 function y(m, r) {1813 D.register("10", function(w, r, E) { 1814 function y(m, q) { 1805 1815 m.setReadOnly(!1); 1806 m.on("change", function(x, q) {1807 return r.val(q.getValue());1816 m.on("change", function(x, u) { 1817 return q.val(u.getValue()); 1808 1818 }); 1809 1819 m.on("focus", function() { 1810 return r.focus();1820 return q.focus(); 1811 1821 }); 1812 1822 m.on("blur", function() { 1813 return r.blur();1823 return q.blur(); 1814 1824 }); 1815 1825 } … … 1819 1829 m.off("blur"); 1820 1830 } 1821 function u(m) {1831 function t(m) { 1822 1832 p(m); 1823 1833 m.setReadOnly(!0); … … 1825 1835 m.setHighlightActiveLine(!1); 1826 1836 } 1827 function e(m, r) {1837 function e(m, q) { 1828 1838 function x() { 1829 1839 this.HighlightRules = f; 1830 1840 } 1831 1841 m = m.require; 1832 const q = m("ace/lib/oop"), f = b(r);1833 q.inherits(f, m("ace/mode/text_highlight_rules").TextHighlightRules);1834 q.inherits(x, m("ace/mode/text").Mode);1842 const u = m("ace/lib/oop"), f = b(q); 1843 u.inherits(f, m("ace/mode/text_highlight_rules").TextHighlightRules); 1844 u.inherits(x, m("ace/mode/text").Mode); 1835 1845 return new x(); 1836 1846 } 1837 1847 function b(m) { 1838 1848 return function() { 1839 let r= {1849 let q = { 1840 1850 start: [ { 1841 1851 token: "empty_line", … … 1861 1871 } ] 1862 1872 }, x = k(m); 1863 "icu" === m ? r= {1864 start: r.start.concat([ {1873 "icu" === m ? q = { 1874 start: q.start.concat([ { 1865 1875 token: "icu-quoted", 1866 1876 regex: /'([{}][^']*)?'/ … … 1895 1905 defaultToken: "icu" 1896 1906 } ] 1897 } : x && r.start.push({1907 } : x && q.start.push({ 1898 1908 token: "printf", 1899 1909 regex: x 1900 1910 }); 1901 this.$rules = r;1911 this.$rules = q; 1902 1912 }; 1903 1913 } … … 1930 1940 } 1931 1941 let g, l = "auto"; 1932 w.init = function(m, r, x) {1933 let q, f = !1, a = x || l, c = m.parentNode, d = c.appendChild(E.createElement("div"));1942 w.init = function(m, q, x) { 1943 let u, f = !1, a = x || l, c = m.parentNode, d = c.appendChild(E.createElement("div")); 1934 1944 A(c).addClass("has-proxy has-ace"); 1935 1945 D.require("23").load("https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ace.js", function(h) { 1936 1946 if (d) { 1937 1947 if (!h) throw Error("Failed to load code editor"); 1938 q= h.edit(d);1939 var n = q.session, v = q.renderer;1940 q.$blockScrolling = Infinity;1941 q.setShowInvisibles(f);1942 q.setWrapBehavioursEnabled(!1);1943 q.setBehavioursEnabled(!1);1944 q.setHighlightActiveLine(!1);1948 u = h.edit(d); 1949 var n = u.session, v = u.renderer; 1950 u.$blockScrolling = Infinity; 1951 u.setShowInvisibles(f); 1952 u.setWrapBehavioursEnabled(!1); 1953 u.setBehavioursEnabled(!1); 1954 u.setHighlightActiveLine(!1); 1945 1955 n.setUseSoftTabs(!1); 1946 1956 v.setShowGutter(!0); … … 1948 1958 v.setScrollMargin(8); 1949 1959 n.setMode(e(h, a)); 1950 q.setValue(m.value, -1);1960 u.setValue(m.value, -1); 1951 1961 n.setUseWrapMode(!0); 1952 r ? y(q, r) : u(q);1962 q ? y(u, q) : t(u); 1953 1963 } 1954 1964 }, "ace"); 1955 1965 return { 1956 1966 kill: function() { 1957 q && (p(q), q.destroy(), q= null);1967 u && (p(u), u.destroy(), u = null); 1958 1968 d && (c.removeChild(d), A(c).removeClass("has-proxy has-ace"), d = null); 1959 1969 return this; 1960 1970 }, 1961 1971 disable: function() { 1962 q && u(q);1963 r= null;1972 u && t(u); 1973 q = null; 1964 1974 return this; 1965 1975 }, 1966 1976 enable: function(h) { 1967 r= h;1968 q && y(q, h);1977 q = h; 1978 u && y(u, h); 1969 1979 return this; 1970 1980 }, 1971 1981 resize: function() { 1972 q && q.resize();1982 u && u.resize(); 1973 1983 return this; 1974 1984 }, 1975 1985 val: function(h) { 1976 q && h !== q.getValue() && q.setValue(h, -1);1986 u && h !== u.getValue() && u.setValue(h, -1); 1977 1987 return this; 1978 1988 }, 1979 1989 invs: function(h) { 1980 1990 h = h || !1; 1981 f !== h && (f = h, q && q.setShowInvisibles(h));1991 f !== h && (f = h, u && u.setShowInvisibles(h)); 1982 1992 return this; 1983 1993 }, 1984 1994 strf: function(h) { 1985 1995 h = h || l; 1986 h !== a && (a = h, q && q.session.setMode(e(t.ace, h)));1996 h !== a && (a = h, u && u.session.setMode(e(r.ace, h))); 1987 1997 return this; 1988 1998 }, 1989 1999 focus: function() { 1990 q && q.focus();1991 return this; 1992 } 1993 }; 1994 }; 1995 w.strf = function(m, r) {2000 u && u.focus(); 2001 return this; 2002 } 2003 }; 2004 }; 2005 w.strf = function(m, q) { 1996 2006 l = m; 1997 g = r;2007 g = q; 1998 2008 return w; 1999 2009 }; 2000 2010 return w; 2001 2011 }({}, K, M)); 2002 D.register("33", function(w, t, E) {2012 D.register("33", function(w, r, E) { 2003 2013 function y(b, k) { 2004 2014 function g() { … … 2021 2031 b.off("blur"); 2022 2032 } 2023 function u(b) {2033 function t(b) { 2024 2034 p(b); 2025 2035 b.setMode("readonly"); … … 2035 2045 function g(h) { 2036 2046 x = h; 2037 q= "<p>" === h.substring(0, 3) && "</p>" === h.substring(h.length - 4);2047 u = "<p>" === h.substring(0, 3) && "</p>" === h.substring(h.length - 4); 2038 2048 return h.replace(/(<\/?)script/gi, "$1loco:script"); 2039 2049 } … … 2044 2054 n = this._getContent(n); 2045 2055 n = n.replace(/(<\/?)loco:script/gi, "$1script"); 2046 if (! q&& "<p>" === n.substring(0, 3) && "</p>" === n.substring(n.length - 4)) {2056 if (!u && "<p>" === n.substring(0, 3) && "</p>" === n.substring(n.length - 4)) { 2047 2057 const v = n.substring(3, n.length - 4); 2048 2058 if (v === x || -1 === v.indexOf("</p>")) n = v; … … 2054 2064 return this._setContent(g(n), v); 2055 2065 }; 2056 k ? (y(h, k), k.reset()) : u(h);2066 k ? (y(h, k), k.reset()) : t(h); 2057 2067 A(c).removeClass("loading"); 2058 2068 } 2059 let m, r = !1, x = "", q= !1, f = b.parentNode, a = f.parentNode, c = f.appendChild(E.createElement("div")), d = a.insertBefore(E.createElement("nav"), f);2069 let m, q = !1, x = "", u = !1, f = b.parentNode, a = f.parentNode, c = f.appendChild(E.createElement("div")), d = a.insertBefore(E.createElement("nav"), f); 2060 2070 d.id = "_tb" + String(++e); 2061 2071 A(f).addClass("has-proxy has-mce"); … … 2124 2134 }, 2125 2135 disable: function() { 2126 m && u(m);2136 m && t(m); 2127 2137 k = null; 2128 2138 return this; … … 2134 2144 invs: function(h) { 2135 2145 h = h || !1; 2136 r !== h && (r= h, A(f)[h ? "addClass" : "removeClass"]("show-invs"));2146 q !== h && (q = h, A(f)[h ? "addClass" : "removeClass"]("show-invs")); 2137 2147 return this; 2138 2148 } … … 2141 2151 return w; 2142 2152 }({}, K, M)); 2143 D.register("34", function(w, t, E) {2153 D.register("34", function(w, r, E) { 2144 2154 w.init = function(y, p) { 2145 function u(a) {2155 function t(a) { 2146 2156 x !== a && (f.textContent = a.format(0), x = a, a = 0 === a ? "empty" : 0 === p || a < p ? "lt" : p === a ? "eq" : "gt", 2147 a !== r && (r = a, q.className = "wg-count is-" + a));2157 a !== q && (q = a, u.className = "wg-count is-" + a)); 2148 2158 } 2149 2159 function e(a) { 2150 m && ( q.removeChild(m), m = null);2151 0 < a && (m = q.appendChild(g.el("span").appendChild(g.txt(" / " + a.format(0)))));2160 m && (u.removeChild(m), m = null); 2161 0 < a && (m = u.appendChild(g.el("span").appendChild(g.txt(" / " + a.format(0))))); 2152 2162 p = a; 2153 2163 } 2154 2164 function b(a, c) { 2155 u(c.length);2165 t(c.length); 2156 2166 } 2157 2167 function k() { 2158 r= "";2168 q = ""; 2159 2169 x = -1; 2160 u(y.val().length);2170 t(y.val().length); 2161 2171 } 2162 2172 const g = D.require("1a"), l = A(y.parent()).on("changing", b); 2163 let m, r, x, q = g.el("div"), f = q.appendChild(g.el("span"));2164 l.append( q);2173 let m, q, x, u = g.el("div"), f = u.appendChild(g.el("span")); 2174 l.append(u); 2165 2175 e(p); 2166 2176 k(); … … 2172 2182 kill: function() { 2173 2183 const a = l && l[0]; 2174 a && q && q.parentNode === a && (l.off("changing", b), a.removeChild(q));2184 a && u && u.parentNode === a && (l.off("changing", b), a.removeChild(u)); 2175 2185 } 2176 2186 }; … … 2178 2188 return w; 2179 2189 }({}, K, M)); 2180 D.register("2f", function(w, t, E) {2190 D.register("2f", function(w, r, E) { 2181 2191 function y(e) { 2182 2192 function b() { 2183 f && ( r.off("input", k), f = !1);2193 f && (q.off("input", k), f = !1); 2184 2194 } 2185 2195 function k() { 2186 2196 const c = e.value; 2187 c !== a && ( r.trigger("changing", [ c, a ]), a = c);2197 c !== a && (q.trigger("changing", [ c, a ]), a = c); 2188 2198 } 2189 2199 function g() { 2190 2200 k(); 2191 f && q !== a && r.trigger("changed", [ a ]);2201 f && u !== a && q.trigger("changed", [ a ]); 2192 2202 } 2193 2203 function l() { 2194 u= e;2195 q= a;2196 f || ( r.on("input", k), f = !0);2197 r.trigger("editFocus");2204 t = e; 2205 u = a; 2206 f || (q.on("input", k), f = !0); 2207 q.trigger("editFocus"); 2198 2208 x.addClass("has-focus"); 2199 2209 return !0; 2200 2210 } 2201 2211 function m() { 2202 u === e && (u= null);2203 r.trigger("editBlur");2212 t === e && (t = null); 2213 q.trigger("editBlur"); 2204 2214 x.removeClass("has-focus"); 2205 2215 f && (g(), b()); 2206 2216 return !0; 2207 2217 } 2208 const r= A(e), x = A(e.parentNode);2209 let q, f = !1, a = e.value;2210 r.on("blur", m).on("focus", l);2218 const q = A(e), x = A(e.parentNode); 2219 let u, f = !1, a = e.value; 2220 q.on("blur", m).on("focus", l); 2211 2221 return { 2212 2222 val: function(c) { 2213 a !== c && (e.value = c, r.triggerHandler("input"), a = c);2223 a !== c && (e.value = c, q.triggerHandler("input"), a = c); 2214 2224 return !0; 2215 2225 }, 2216 2226 kill: function() { 2217 2227 b(); 2218 r.off("blur", m).off("focus", l);2228 q.off("blur", m).off("focus", l); 2219 2229 }, 2220 2230 fire: function() { … … 2226 2236 focus: l, 2227 2237 reset: function() { 2228 q= a = e.value;2238 u = a = e.value; 2229 2239 } 2230 2240 }; … … 2233 2243 this.e = e; 2234 2244 } 2235 let u;2245 let t; 2236 2246 w._new = function(e) { 2237 2247 return new p(e); … … 2242 2252 return b; 2243 2253 }; 2244 t= p.prototype;2245 t.destroy = function() {2254 r = p.prototype; 2255 r.destroy = function() { 2246 2256 this.unlisten(); 2247 2257 const e = this.p; … … 2250 2260 this.e = null; 2251 2261 }; 2252 t.reload = function(e, b) {2262 r.reload = function(e, b) { 2253 2263 let k = this.l; 2254 2264 this.nocount(); … … 2258 2268 return this; 2259 2269 }; 2260 t.val = function(e) {2270 r.val = function(e) { 2261 2271 const b = this.e; 2262 2272 if (null == e) return b.value; … … 2267 2277 return this; 2268 2278 }; 2269 t.fire = function() {2279 r.fire = function() { 2270 2280 this.l && this.l.fire(); 2271 2281 return this; 2272 2282 }; 2273 t.ping = function() {2283 r.ping = function() { 2274 2284 this.l && this.l.ping(); 2275 2285 return this; 2276 2286 }; 2277 t.focus = function() {2287 r.focus = function() { 2278 2288 const e = this.p; 2279 2289 e ? e.focus() : A(this.e).focus(); 2280 2290 }; 2281 t.focused = function() {2282 return u && u=== this.el;2283 }; 2284 t.parent = function() {2291 r.focused = function() { 2292 return t && t === this.el; 2293 }; 2294 r.parent = function() { 2285 2295 return this.e.parentNode; 2286 2296 }; 2287 t.attr = function(e, b) {2297 r.attr = function(e, b) { 2288 2298 const k = this.e; 2289 2299 if (1 === arguments.length) return k.getAttribute(e); … … 2291 2301 return this; 2292 2302 }; 2293 t.editable = function() {2303 r.editable = function() { 2294 2304 return !!this.l; 2295 2305 }; 2296 t.enable = function() {2306 r.enable = function() { 2297 2307 const e = this.p; 2298 2308 this.e.removeAttribute("readonly"); … … 2301 2311 return this; 2302 2312 }; 2303 t.disable = function() {2313 r.disable = function() { 2304 2314 const e = this.p; 2305 2315 this.e.setAttribute("readonly", !0); … … 2308 2318 return this; 2309 2319 }; 2310 t.listen = function() {2320 r.listen = function() { 2311 2321 const e = this.l; 2312 2322 e && e.kill(); … … 2314 2324 return this; 2315 2325 }; 2316 t.unlisten = function() {2326 r.unlisten = function() { 2317 2327 const e = this.l; 2318 2328 e && (e.kill(), this.l = null); 2319 2329 return this; 2320 2330 }; 2321 t.setInvs = function(e, b) {2331 r.setInvs = function(e, b) { 2322 2332 const k = this.i || !1; 2323 2333 if (b || k !== e) this._i && (this._i.kill(), delete this._i), (b = this.p) && b.invs ? b.invs(e) : e && (this._i = D.require("32").init(this.e)), … … 2325 2335 return this; 2326 2336 }; 2327 t.getInvs = function() {2337 r.getInvs = function() { 2328 2338 return this.i || !1; 2329 2339 }; 2330 t.setMode = function(e) {2340 r.setMode = function(e) { 2331 2341 let b = this.p, k = this.i || !1; 2332 2342 e !== (this.m || "") && (this.m = e, b && b.kill(), this.p = b = "code" === e ? D.require("10").init(this.e, this.l, this["%"]) : "html" === e ? D.require("33").init(this.e, this.l) : null, 2333 this.setInvs(k, !0), u&& this.focus());2334 return this; 2335 }; 2336 t.setStrf = function(e) {2343 this.setInvs(k, !0), t && this.focus()); 2344 return this; 2345 }; 2346 r.setStrf = function(e) { 2337 2347 this["%"] = e; 2338 2348 "code" === this.m && this.p.strf(e); 2339 2349 return this; 2340 2350 }; 2341 t.name = function(e) {2351 r.name = function(e) { 2342 2352 this.e.setAttribute("name", e); 2343 2353 return this; 2344 2354 }; 2345 t.placeholder = function(e) {2355 r.placeholder = function(e) { 2346 2356 this.e.setAttribute("placeholder", e); 2347 2357 return this; 2348 2358 }; 2349 t.redraw = function() {2359 r.redraw = function() { 2350 2360 const e = this.p; 2351 2361 e && e.resize && e.resize(); 2352 2362 }; 2353 t.counter = function(e) {2363 r.counter = function(e) { 2354 2364 let b = this.c; 2355 2365 b ? b.ping(e) : this.c = D.require("34").init(this, e); … … 2358 2368 return this; 2359 2369 }; 2360 t.nocount = function() {2370 r.nocount = function() { 2361 2371 const e = this.c; 2362 2372 e && (e.kill(), this.c = null, this.e.removeAttribute("maxlength")); … … 2364 2374 return w; 2365 2375 }({}, K, M)); 2366 D.register("30", function(w, t, E) {2376 D.register("30", function(w, r, E) { 2367 2377 function y(f) { 2368 const a = t.console;2378 const a = r.console; 2369 2379 a && a.error && a.error(f); 2370 2380 } … … 2374 2384 return a; 2375 2385 } 2376 function u(f) {2386 function t(f) { 2377 2387 return function() { 2378 2388 f.resize(); … … 2415 2425 } 2416 2426 return function(h) { 2417 const n = a || 0, v = c ? -1 : 1, z= f.rows || [];2418 h.sort(function( C, B) {2419 return v * ( z[C] || d(C)).cellVal(n).localeCompare((z[B] || d(B)).cellVal(n));2427 const n = a || 0, v = c ? -1 : 1, C = f.rows || []; 2428 h.sort(function(B, z) { 2429 return v * (C[B] || d(B)).cellVal(n).localeCompare((C[z] || d(z)).cellVal(n)); 2420 2430 }); 2421 2431 }; … … 2428 2438 this.length = 0; 2429 2439 } 2430 function r(f, a, c) {2440 function q(f, a, c) { 2431 2441 let d = E.createElement("div"); 2432 2442 d.className = c || ""; … … 2443 2453 return new l(f); 2444 2454 }; 2445 var q= l.prototype;2446 q.init = function(f) {2455 var u = l.prototype; 2456 u.init = function(f) { 2447 2457 let a = this.w, c = a.id; 2448 2458 var d = a.splity(c + "-thead", c + "-tbody"), h = d[0]; 2449 2459 d = d[1]; 2450 let n = [], v = [], z = [], C= [];2460 let n = [], v = [], C = [], B = []; 2451 2461 if (f) this.ds = f, this.idxs = v, this._idxs = null; else if (!(f = this.ds)) throw Error("No datasource"); 2452 2462 h.css.push("wg-thead"); 2453 2463 d.css.push("wg-tbody"); 2454 2464 f.eachCol(function(O, R, I) { 2455 z[O] = c + "-col-" + R;2456 C[O] = I || R;2457 }); 2458 var B= p();2459 let F = -1, G = z.length, H = p("wg-cols"), J = h.splitx.apply(h, z);2460 for (;++F < G; ) J[F].header( C[F]), H.appendChild(B.cloneNode(!1)).setAttribute("for", z[F]);2465 C[O] = c + "-col-" + R; 2466 B[O] = I || R; 2467 }); 2468 var z = p(); 2469 let F = -1, G = C.length, H = p("wg-cols"), J = h.splitx.apply(h, C); 2470 for (;++F < G; ) J[F].header(B[F]), H.appendChild(z.cloneNode(!1)).setAttribute("for", C[F]); 2461 2471 f.eachRow(function(O, R, I) { 2462 n[O] = new r(O, R, I);2472 n[O] = new q(O, R, I); 2463 2473 v[O] = O; 2464 2474 }); … … 2466 2476 this.cols = H; 2467 2477 this.ww = null; 2468 this.root = B= d.body;2478 this.root = z = d.body; 2469 2479 this.head = h; 2470 h.redraw = u(this);2480 h.redraw = t(this); 2471 2481 a.css.push("is-table"); 2472 2482 a.restyle(); … … 2476 2486 this.redrawDirty(); 2477 2487 this.render(); 2478 A( B).attr("tabindex", "-1").on("keydown", k(this)).on("mousedown", e(this)).on("scroll", b(this));2479 return this; 2480 }; 2481 q.clear = function() {2488 A(z).attr("tabindex", "-1").on("keydown", k(this)).on("mousedown", e(this)).on("scroll", b(this)); 2489 return this; 2490 }; 2491 u.clear = function() { 2482 2492 const f = this.pages || []; 2483 2493 let a = f.length; … … 2488 2498 return this; 2489 2499 }; 2490 q.render = function() {2491 let f, a = [], c = this.rows || [], d = -1, h, n = this.idxs, v = n.length, z = this.idxr = {}, C = this.r, B= this._r, F = this.root, G = this.cols;2500 u.render = function() { 2501 let f, a = [], c = this.rows || [], d = -1, h, n = this.idxs, v = n.length, C = this.idxr = {}, B = this.r, z = this._r, F = this.root, G = this.cols; 2492 2502 for (;++d < v; ) { 2493 2503 if (0 === d % 100) { … … 2500 2510 } 2501 2511 h = n[d]; 2502 z[h] = d;2512 C[h] = d; 2503 2513 H = c[h]; 2504 2514 if (null == H) throw Error("Render error, no data at [" + h + "]"); … … 2511 2521 this.redrawDirty(); 2512 2522 this.redraw(); 2513 null == C ? null != B && (H = c[B]) && H.page && (delete this._r, this.select(B, !0)) : (H = c[C]) && H.page ? this.select(C, !0) : (this.deselect(!1),2514 this._r = C);2515 return this; 2516 }; 2517 q.resize = function() {2523 null == B ? null != z && (H = c[z]) && H.page && (delete this._r, this.select(z, !0)) : (H = c[B]) && H.page ? this.select(B, !0) : (this.deselect(!1), 2524 this._r = B); 2525 return this; 2526 }; 2527 u.resize = function() { 2518 2528 let f = -1, a = this.ww || (this.ww = []); 2519 2529 var c = this.w; 2520 let d = c.cells[0], h = d.body.childNodes, n = h.length, v = this.pages || [], z= v.length;2530 let d = c.cells[0], h = d.body.childNodes, n = h.length, v = this.pages || [], C = v.length; 2521 2531 for (c.redraw.call(d); ++f < n; ) a[f] = h[f].style.width; 2522 if ( z) {2532 if (C) { 2523 2533 c = this.mx; 2524 2534 for (f = this.mn; f <= c; f++) v[f].widths(a); … … 2526 2536 } 2527 2537 }; 2528 q.redrawDirty = function() {2538 u.redrawDirty = function() { 2529 2539 let f = !1; 2530 2540 var a = this.root; … … 2535 2545 return f; 2536 2546 }; 2537 q.redraw = function() {2547 u.redraw = function() { 2538 2548 let f = 0, a = -1, c = null, d = null, h = this.ww; 2539 2549 var n = this.sy; 2540 let v = this.mn, z = this.mx, C= Math.max(0, n - 100);2550 let v = this.mn, C = this.mx, B = Math.max(0, n - 100); 2541 2551 n = this.vh + n + 100; 2542 let B, F = this.pages || [], G = F.length;2543 for (;++a < G && !(f > n); ) B = F[a], f += B.height(), f < C|| (null === c && (c = a),2544 d = a, B.rendered || B.render(h));2552 let z, F = this.pages || [], G = F.length; 2553 for (;++a < G && !(f > n); ) z = F[a], f += z.height(), f < B || (null === c && (c = a), 2554 d = a, z.rendered || z.render(h)); 2545 2555 if (v !== c) { 2546 2556 if (null !== v && c > v) for (a = v; a < c; a++) { 2547 B= F[a];2548 if (! B) throw Error("Shit!");2549 B.rendered && B.sleep();2557 z = F[a]; 2558 if (!z) throw Error("Shit!"); 2559 z.rendered && z.sleep(); 2550 2560 } 2551 2561 this.mn = c; 2552 2562 } 2553 if ( z!== d) {2554 if (null !== z && d < z) for (a = z; a > d; a--) B = F[a], B.rendered && B.sleep();2563 if (C !== d) { 2564 if (null !== C && d < C) for (a = C; a > d; a--) z = F[a], z.rendered && z.sleep(); 2555 2565 this.mx = d; 2556 2566 } 2557 2567 }; 2558 q.selected = function() {2568 u.selected = function() { 2559 2569 return this.r; 2560 2570 }; 2561 q.thead = function() {2571 u.thead = function() { 2562 2572 return this.w.cells[0]; 2563 2573 }; 2564 q.tbody = function() {2574 u.tbody = function() { 2565 2575 return this.w.cells[1]; 2566 2576 }; 2567 q.tr = function(f) {2577 u.tr = function(f) { 2568 2578 return (f = this.row(f)) ? f.cells() : []; 2569 2579 }; 2570 q.row = function(f) {2580 u.row = function(f) { 2571 2581 return this.rows[f]; 2572 2582 }; 2573 q.td = function(f, a) {2583 u.td = function(f, a) { 2574 2584 return this.tr(f)[a]; 2575 2585 }; 2576 q.next = function(f, a, c) {2586 u.next = function(f, a, c) { 2577 2587 null == c && (c = this.r || 0); 2578 2588 const d = this.idxs, h = d.length; … … 2584 2594 null) : c; 2585 2595 }; 2586 q.selectNext = function(f, a, c) {2596 u.selectNext = function(f, a, c) { 2587 2597 f = this.next(f, a, null); 2588 2598 null != f && this.r !== f && this.select(f, c); 2589 2599 return this; 2590 2600 }; 2591 q.deselect = function(f) {2601 u.deselect = function(f) { 2592 2602 const a = this.r; 2593 2603 null != a && (this.r = null, A(this.tr(a)).removeClass("selected"), this.w.fire("wgRowDeselect", [ a, f ])); 2594 2604 return this; 2595 2605 }; 2596 q.selectRow = function(f, a) {2606 u.selectRow = function(f, a) { 2597 2607 return this.select(this.idxs[f], a); 2598 2608 }; 2599 q.select = function(f, a) {2609 u.select = function(f, a) { 2600 2610 const c = this.rows[f]; 2601 2611 var d = c && c.page; … … 2614 2624 return this; 2615 2625 }; 2616 q.unfilter = function() {2626 u.unfilter = function() { 2617 2627 this._idxs && (this.idxs = this._sort(this._idxs), this._idxs = null, this.clear().render()); 2618 2628 return this; 2619 2629 }; 2620 q.filter = function(f) {2630 u.filter = function(f) { 2621 2631 this._idxs || (this._idxs = this.idxs); 2622 2632 this.idxs = this._sort(f); 2623 2633 return this.clear().render(); 2624 2634 }; 2625 q.each = function(f) {2635 u.each = function(f) { 2626 2636 let a, c = -1; 2627 2637 const d = this.rows || [], h = this.idxs || [], n = h.length; … … 2629 2639 return this; 2630 2640 }; 2631 q.sortable = function(f) {2641 u.sortable = function(f) { 2632 2642 const a = this.sc || (this.sc = new m(this)); 2633 2643 a.has(f) || a.add(f); 2634 2644 return this; 2635 2645 }; 2636 q._re_sort = function(f) {2646 u._re_sort = function(f) { 2637 2647 let a = -1, c = this.sc, d = c.active; 2638 2648 for (this.sc = c = new m(this); ++a < f; ) c.add(a); … … 2640 2650 return this; 2641 2651 }; 2642 q._sort = function(f, a) {2652 u._sort = function(f, a) { 2643 2653 a ? (this.s = a, a(f)) : (a = this.s) && a(f); 2644 2654 return f; 2645 2655 }; 2646 q.sort = function(f, a) {2656 u.sort = function(f, a) { 2647 2657 this._sort(this.idxs, g(this, f, a)); 2648 2658 this.sc.activate(f, a); 2649 2659 return this; 2650 2660 }; 2651 q= null;2652 q= m.prototype;2653 q.has = function(f) {2661 u = null; 2662 u = m.prototype; 2663 u.has = function(f) { 2654 2664 return null != this[f]; 2655 2665 }; 2656 q.add = function(f) {2666 u.add = function(f) { 2657 2667 const a = this, c = a.t.head.cells[f]; 2658 2668 a[f] = { … … 2668 2678 return a; 2669 2679 }; 2670 q.toggle = function(f) {2680 u.toggle = function(f) { 2671 2681 this.t.sort(f, !this[f].desc).clear().render(); 2672 2682 return this; 2673 2683 }; 2674 q.activate = function(f, a) {2684 u.activate = function(f, a) { 2675 2685 let c, d = this.active, h = this[f], n = this.t.head.cells; 2676 2686 d && (c = n[d.idx]) && (c.removeClass(d.css), d !== h && c.restyle()); … … 2679 2689 return this; 2680 2690 }; 2681 q= null;2682 q = r.prototype;2683 q.render = function(f) {2691 u = null; 2692 u = q.prototype; 2693 u.render = function(f) { 2684 2694 let a, c = [], d = this._, h = this.length; 2685 2695 if (d) { … … 2691 2701 return this; 2692 2702 }; 2693 q.update = function(f, a) {2703 u.update = function(f, a) { 2694 2704 a = a || this.c[f] || {}; 2695 2705 f = (this.d[f] || function() {})() || " "; … … 2697 2707 return a; 2698 2708 }; 2699 q.cells = function() {2709 u.cells = function() { 2700 2710 return this.c || [ this._ ]; 2701 2711 }; 2702 q.data = function() {2712 u.data = function() { 2703 2713 const f = [], a = this.length; 2704 2714 let c = -1; … … 2706 2716 return f; 2707 2717 }; 2708 q.destroy = function() {2718 u.destroy = function() { 2709 2719 this.page = null; 2710 2720 this.rendered = !1; 2711 2721 }; 2712 q.cellVal = function(f) {2722 u.cellVal = function(f) { 2713 2723 f = this.d[f]() || ""; 2714 2724 return String(f.textContent || f); 2715 2725 }; 2716 q= null;2717 q= x.prototype;2718 q.size = function() {2726 u = null; 2727 u = x.prototype; 2728 u.size = function() { 2719 2729 return this.rows.length; 2720 2730 }; 2721 q.insert = function(f) {2731 u.insert = function(f) { 2722 2732 const a = this.h, c = p("wg-dead"); 2723 2733 c.style.height = String(a) + "px"; … … 2725 2735 return this.dead = c; 2726 2736 }; 2727 q.top = function() {2737 u.top = function() { 2728 2738 return (this.rendered ? this.live : this.dead).offsetTop; 2729 2739 }; 2730 q.height = function() {2740 u.height = function() { 2731 2741 let f = this.h; 2732 2742 null == f && (this.h = f = this.rendered ? this.live.firstChild.offsetHeight : this.dead.offsetHeight); … … 2734 2744 return f; 2735 2745 }; 2736 q.render = function(f) {2746 u.render = function(f) { 2737 2747 let a, c = -1, d = this.rows, h = d.length; 2738 const n = this.dead, v = this.live, z= v.childNodes;2739 for (;++c < h; ) a = d[c], a.rendered || a.render( z);2748 const n = this.dead, v = this.live, C = v.childNodes; 2749 for (;++c < h; ) a = d[c], a.rendered || a.render(C); 2740 2750 h = f.length; 2741 for (c = 0; c < h; c++) z[c].style.width = f[c];2751 for (c = 0; c < h; c++) C[c].style.width = f[c]; 2742 2752 n.parentNode.replaceChild(v, n); 2743 2753 this.rendered = !0; … … 2745 2755 return this; 2746 2756 }; 2747 q.sleep = function() {2757 u.sleep = function() { 2748 2758 const f = this.height(), a = this.live, c = this.dead; 2749 2759 c.style.height = String(f) + "px"; … … 2753 2763 return this; 2754 2764 }; 2755 q.sleepH = function(f) {2765 u.sleepH = function(f) { 2756 2766 f *= this.rows.length; 2757 2767 const a = this.dead; … … 2760 2770 return this; 2761 2771 }; 2762 q.widths = function(f) {2772 u.widths = function(f) { 2763 2773 const a = this.live.childNodes; 2764 2774 let c = f.length; … … 2766 2776 return this; 2767 2777 }; 2768 q.destroy = function() {2778 u.destroy = function() { 2769 2779 var f = this.rendered ? this.live : this.dead; 2770 2780 const a = this.rows; … … 2774 2784 return w; 2775 2785 }({}, K, M)); 2776 D.register("2b", function(w, t, E) {2786 D.register("2b", function(w, r, E) { 2777 2787 function y(d, h) { 2778 2788 var n = d.id; 2779 let v = n && q[n], z= v && v.parent();2780 if (!v || ! z) return null;2781 var C = 1 === z.dir;2782 n = C? "X" : "Y";2783 let B= "page" + n;2784 C = C ? x : r;2785 let F = C(z.el);2789 let v = n && u[n], C = v && v.parent(); 2790 if (!v || !C) return null; 2791 var B = 1 === C.dir; 2792 n = B ? "X" : "Y"; 2793 let z = "page" + n; 2794 B = B ? x : q; 2795 let F = B(C.el); 2786 2796 n = h["offset" + n]; 2787 let G = z.el, H = G.className;2788 null == n && (n = h[ B] - C(d));2797 let G = C.el, H = G.className; 2798 null == n && (n = h[z] - B(d)); 2789 2799 n && (F += n); 2790 2800 G.className = H + " is-resizing"; … … 2794 2804 }, 2795 2805 move: function(J) { 2796 z.resize(J[B] - F, v);2806 C.resize(J[z] - F, v); 2797 2807 return !0; 2798 2808 } … … 2815 2825 return e(d); 2816 2826 } 2817 function u(d, h) {2827 function t(d, h) { 2818 2828 const n = h.type; 2819 2829 "touchmove" === n ? c && c.move(h) : "touchstart" === n ? c = y(d.target, h) : "touchend" === n && c && (c.done(), … … 2847 2857 this._cn = n; 2848 2858 this.css = v.concat("wg-cell"); 2849 q[h] = this;2859 u[h] = this; 2850 2860 this.clear(); 2851 2861 } 2852 const l = D.include("2d") || D.require("2"), m = D.require("1a"), r = m.top, x = m.left, q= {};2862 const l = D.include("2d") || D.require("2"), m = D.require("1a"), q = m.top, x = m.left, u = {}; 2853 2863 let f, a = 0, c = !1; 2854 2864 w.init = function(d) { … … 2856 2866 h.redraw(); 2857 2867 D.require("2e").ok(function(n) { 2858 n.dragger(d, u);2868 n.dragger(d, t); 2859 2869 }); 2860 2870 A(d).on("mousedown", p); 2861 2871 return h; 2862 2872 }; 2863 t= g.prototype;2864 t.fire = function(d, h) {2873 r = g.prototype; 2874 r.fire = function(d, h) { 2865 2875 d = A.Event(d); 2866 2876 d.cell = this; … … 2868 2878 return this; 2869 2879 }; 2870 t.each = function(d) {2880 r.each = function(d) { 2871 2881 let h = -1; 2872 2882 const n = this.cells, v = n.length; … … 2874 2884 return this; 2875 2885 }; 2876 t.indexOf = function(d) {2877 return (d = q[d.id || String(d)]) && d.pid === this.id ? d.index : -1;2878 }; 2879 t.on = function() {2886 r.indexOf = function(d) { 2887 return (d = u[d.id || String(d)]) && d.pid === this.id ? d.index : -1; 2888 }; 2889 r.on = function() { 2880 2890 return this.$("on", arguments); 2881 2891 }; 2882 t.off = function() {2892 r.off = function() { 2883 2893 return this.$("off", arguments); 2884 2894 }; 2885 t.find = function(d) {2895 r.find = function(d) { 2886 2896 return A(this.el).find(d); 2887 2897 }; 2888 t.$ = function(d, h) {2898 r.$ = function(d, h) { 2889 2899 A.fn[d].apply(A(this.el), h); 2890 2900 return this; 2891 2901 }; 2892 t.addClass = function(d) {2902 r.addClass = function(d) { 2893 2903 this.css.push(d); 2894 2904 return this; 2895 2905 }; 2896 t.removeClass = function(d) {2906 r.removeClass = function(d) { 2897 2907 d = this.css.indexOf(d); 2898 2908 -1 !== d && this.css.splice(d, 1); 2899 2909 return this; 2900 2910 }; 2901 t.parent = function() {2902 return this.pid && q[this.pid];2903 }; 2904 t.splitx = function() {2911 r.parent = function() { 2912 return this.pid && u[this.pid]; 2913 }; 2914 r.splitx = function() { 2905 2915 return this._split(1, arguments); 2906 2916 }; 2907 t.splity = function() {2917 r.splity = function() { 2908 2918 return this._split(2, arguments); 2909 2919 }; 2910 t._split = function(d, h) {2920 r._split = function(d, h) { 2911 2921 (this.length || this.field) && this.clear(); 2912 2922 let n = -1; 2913 let v = h.length, z = 1 / v, C= 0;2923 let v = h.length, C = 1 / v, B = 0; 2914 2924 for (;++n < v; ) { 2915 var B= m.el();2916 this.body.appendChild( B);2917 var F = B;2925 var z = m.el(); 2926 this.body.appendChild(z); 2927 var F = z; 2918 2928 { 2919 2929 var G = h[n]; 2920 2930 let H = 1, J = G; 2921 for (; q[G]; ) G = J + "-" + ++H;2931 for (;u[G]; ) G = J + "-" + ++H; 2922 2932 } 2923 2933 F.id = G; 2924 B = new g(B);2925 B.index = n;2926 B.pid = this.id;2927 B._locale(this.lang, this.rtl);2928 B.pos = C;2929 C += z;2930 this.cells.push( B);2934 z = new g(z); 2935 z.index = n; 2936 z.pid = this.id; 2937 z._locale(this.lang, this.rtl); 2938 z.pos = B; 2939 B += C; 2940 this.cells.push(z); 2931 2941 this.length++; 2932 2942 } … … 2935 2945 return this.cells; 2936 2946 }; 2937 t.count = function() {2947 r.count = function() { 2938 2948 return this.cells && this.cells.length || 0; 2939 2949 }; 2940 t.destroy = function() {2950 r.destroy = function() { 2941 2951 this.clear(); 2942 delete q[this.id];2952 delete u[this.id]; 2943 2953 const d = this.el; 2944 2954 d.innerHTML = ""; … … 2948 2958 return this; 2949 2959 }; 2950 t.exists = function() {2951 return this === q[this.id];2952 }; 2953 t.clear = function() {2954 const d = this.el, h = this.cells, n = this.field, v = this.body, z= this.nav;2955 let C= this.length || 0;2956 for (;0 !== C--; ) delete q[h[C].destroy().id];2960 r.exists = function() { 2961 return this === u[this.id]; 2962 }; 2963 r.clear = function() { 2964 const d = this.el, h = this.cells, n = this.field, v = this.body, C = this.nav; 2965 let B = this.length || 0; 2966 for (;0 !== B--; ) delete u[h[B].destroy().id]; 2957 2967 this.cells = []; 2958 2968 this.length = 0; 2959 z && (d.removeChild(z), this.nav = null);2969 C && (d.removeChild(C), this.nav = null); 2960 2970 v && (n && (n.destroy(), this.counter = this.field = null), this.table && (this.table = null), 2961 2971 d === v.parentNode && d.removeChild(v)); … … 2964 2974 return this; 2965 2975 }; 2966 t.resize = function(d, h) {2976 r.resize = function(d, h) { 2967 2977 if (!h && (h = this.cells[1], !h)) return; 2968 2978 var n = h.index; 2969 let v = this.cells, z = A(this.el)[1 === this.dir ? "width" : "height"](), C= v[n + 1];2979 let v = this.cells, C = A(this.el)[1 === this.dir ? "width" : "height"](), B = v[n + 1]; 2970 2980 n = v[n - 1]; 2971 h.pos = Math.min(( C ? C.pos * z : z) - ((h.body || h.el.firstChild).offsetTop || 0), Math.max(n ? n.pos * z : 0, d)) / z;2981 h.pos = Math.min((B ? B.pos * C : C) - ((h.body || h.el.firstChild).offsetTop || 0), Math.max(n ? n.pos * C : 0, d)) / C; 2972 2982 this.redraw(); 2973 2983 this.fire("wgResize"); 2974 2984 return this; 2975 2985 }; 2976 t.distribute = function(d) {2986 r.distribute = function(d) { 2977 2987 let h = -1, n = 0, v; 2978 const z = this.cells, C= d.length;2979 for (;++h < C && (v = z[++n]); ) v.pos = Math.max(0, Math.min(1, d[h]));2988 const C = this.cells, B = d.length; 2989 for (;++h < B && (v = C[++n]); ) v.pos = Math.max(0, Math.min(1, d[h])); 2980 2990 this.redraw(); 2981 2991 return this; 2982 2992 }; 2983 t.distribution = function() {2993 r.distribution = function() { 2984 2994 let d = [], h = 0; 2985 2995 const n = this.cells, v = n.length - 1; … … 2987 2997 return d; 2988 2998 }; 2989 t.restyle = function() {2999 r.restyle = function() { 2990 3000 var d = this.css.concat(); 2991 3001 0 === this.index ? d.push("first") : d.push("not-first"); … … 2998 3008 return this; 2999 3009 }; 3000 t.redraw = function(d) {3010 r.redraw = function(d) { 3001 3011 this.restyle(); 3002 3012 const h = this.el; 3003 3013 var n = this.body, v = this.field; 3004 3014 if (n) { 3005 var z = h.clientWidth || 0, C = h.clientHeight || 0, B= n.offsetTop || 0;3006 C = B > C ? 0 : C - B;3007 if (this._h !== C) {3008 this._h = C;3009 n.style.height = String( C) + "px";3015 var C = h.clientWidth || 0, B = h.clientHeight || 0, z = n.offsetTop || 0; 3016 B = z > B ? 0 : B - z; 3017 if (this._h !== B) { 3018 this._h = B; 3019 n.style.height = String(B) + "px"; 3010 3020 var F = v; 3011 3021 } 3012 this._w !== z && (this._w = z, F = v);3022 this._w !== C && (this._w = C, F = v); 3013 3023 F && F.redraw(); 3014 3024 } 3015 3025 n = this.length; 3016 z= 1;3017 C= this.nav;3018 for ( B = 2 === this.dir ? "height" : "width"; 0 !== n--; ) v = this.cells[n], C ? F = 1 : (v.fixed && (v.pos = v.fixed / A(h)[B]()),3019 F = z - v.pos, z = v.pos), v.el.style[B] = String(100 * F) + "%", v.redraw(d);3020 return this; 3021 }; 3022 t.contents = function(d, h) {3026 C = 1; 3027 B = this.nav; 3028 for (z = 2 === this.dir ? "height" : "width"; 0 !== n--; ) v = this.cells[n], B ? F = 1 : (v.fixed && (v.pos = v.fixed / A(h)[z]()), 3029 F = C - v.pos, C = v.pos), v.el.style[z] = String(100 * F) + "%", v.redraw(d); 3030 return this; 3031 }; 3032 r.contents = function(d, h) { 3023 3033 const n = this.el; 3024 3034 let v = this.body; … … 3031 3041 return this; 3032 3042 }; 3033 t.textarea = function(d, h) {3043 r.textarea = function(d, h) { 3034 3044 let n = this.field; 3035 3045 if (n) { … … 3044 3054 return n; 3045 3055 }; 3046 t.locale = function(d) {3056 r.locale = function(d) { 3047 3057 d = D.require("29").cast(d); 3048 3058 return this._locale(String(d), d.isRTL()); 3049 3059 }; 3050 t._locale = function(d, h, n) {3060 r._locale = function(d, h, n) { 3051 3061 const v = this.body; 3052 3062 if (n || d !== this.lang) this.lang = d, v && v.setAttribute("lang", d); … … 3054 3064 return this; 3055 3065 }; 3056 t.editable = function() {3066 r.editable = function() { 3057 3067 let d = this.field; 3058 3068 if (d) return d.editable() ? d : null; … … 3065 3075 return d; 3066 3076 }; 3067 t.eachTextarea = function(d) {3077 r.eachTextarea = function(d) { 3068 3078 const h = this.field; 3069 3079 h ? d(h) : this.each(function(n) { … … 3072 3082 return this; 3073 3083 }; 3074 t.append = function(d) {3084 r.append = function(d) { 3075 3085 d && (d.nodeType ? l.init(this.body.appendChild(d)) : l.init(A(d).appendTo(this.body))); 3076 3086 return this; 3077 3087 }; 3078 t.prepend = function(d) {3088 r.prepend = function(d) { 3079 3089 const h = this.body; 3080 3090 if (d.nodeType) { … … 3084 3094 return this; 3085 3095 }; 3086 t.before = function(d) {3096 r.before = function(d) { 3087 3097 const h = this.body; 3088 3098 d.nodeType ? l.init(this.el.insertBefore(d, h)) : l.init(A(d).insertBefore(h)); 3089 3099 return this; 3090 3100 }; 3091 t.header = function(d, h) {3101 r.header = function(d, h) { 3092 3102 if (null == d && null == h) return this.el.getElementsByTagName("header")[0]; 3093 3103 this.t = m.txt(d || ""); … … 3096 3106 return this; 3097 3107 }; 3098 t.toolbar = function() {3108 r.toolbar = function() { 3099 3109 const d = this.header(), h = d.getElementsByTagName("nav"); 3100 3110 return 0 === h.length ? d.appendChild(m.el("nav")) : h[0]; 3101 3111 }; 3102 t.title = function(d) {3112 r.title = function(d) { 3103 3113 const h = this.t; 3104 3114 if (h) return h.nodeValue = d || "", h; … … 3106 3116 return this.t; 3107 3117 }; 3108 t.titled = function() {3118 r.titled = function() { 3109 3119 return this.t && this.t.nodeValue; 3110 3120 }; 3111 t.bodyY = function() {3112 return r(this.body, this.el);3113 }; 3114 t.scrollY = function(d) {3121 r.bodyY = function() { 3122 return q(this.body, this.el); 3123 }; 3124 r.scrollY = function(d) { 3115 3125 if (la === d) return this.body.scrollTop; 3116 3126 this.body.scrollTop = d; 3117 3127 }; 3118 t.tabulate = function(d) {3128 r.tabulate = function(d) { 3119 3129 let h = this.table; 3120 3130 h ? h.clear() : h = D.require("30").create(this); … … 3122 3132 return this.table = h; 3123 3133 }; 3124 t.lock = function() {3134 r.lock = function() { 3125 3135 this.body.className += " locked"; 3126 3136 return this; 3127 3137 }; 3128 t.scrollTo = function(d, h) {3138 r.scrollTo = function(d, h) { 3129 3139 let n = this.body; 3130 3140 var v = n.scrollTop; 3131 let z = r(d, n);3132 if (v > z) v = z; else {3133 const C= n.clientHeight;3134 d = z+ A(d).outerHeight();3135 if ( C + v < d) v = d - C; else return;3141 let C = q(d, n); 3142 if (v > C) v = C; else { 3143 const B = n.clientHeight; 3144 d = C + A(d).outerHeight(); 3145 if (B + v < d) v = d - B; else return; 3136 3146 } 3137 3147 h ? n.scrollTop = v : A(n).stop(!0).animate({ … … 3139 3149 }, 250); 3140 3150 }; 3141 t.navigize = function(d, h) {3151 r.navigize = function(d, h) { 3142 3152 function n(H) { 3143 const J = C[H], O = z[H], R = A(J.el).show();3153 const J = B[H], O = C[H], R = A(J.el).show(); 3144 3154 O.addClass("active"); 3145 3155 F = H; … … 3148 3158 return R; 3149 3159 } 3150 const v = this, z = [], C= v.cells;3151 let B= v.nav, F;3152 B && v.el.removeChild(B);3153 B= v.nav = v.el.insertBefore(m.el("nav", "wg-tabs"), v.body);3154 const G = A( B).on("click", function(H) {3160 const v = this, C = [], B = v.cells; 3161 let z = v.nav, F; 3162 z && v.el.removeChild(z); 3163 z = v.nav = v.el.insertBefore(m.el("nav", "wg-tabs"), v.body); 3164 const G = A(z).on("click", function(H) { 3155 3165 const J = A(H.target).data("idx"); 3156 3166 if (null == J) return !0; 3157 3167 if (null != F) { 3158 3168 { 3159 const O = z[F];3160 A( C[F].el).hide();3169 const O = C[F]; 3170 A(B[F].el).hide(); 3161 3171 O.removeClass("active"); 3162 3172 } … … 3168 3178 null == h && (h = G.data("idx") || 0); 3169 3179 v.each(function(H, J) { 3170 z[J] = A('<a href="#' + H.id + '"></a>').data("idx", J).text(d[J]).appendTo(G);3180 C[J] = A('<a href="#' + H.id + '"></a>').data("idx", J).text(d[J]).appendTo(G); 3171 3181 H.pos = 0; 3172 3182 A(H.el).hide(); 3173 3183 }); 3174 n( C[h] ? h : 0);3184 n(B[h] ? h : 0); 3175 3185 v.lock(); 3176 3186 v.redraw(); 3177 3187 return v; 3178 3188 }; 3179 t.navigated = function() {3189 r.navigated = function() { 3180 3190 const d = this.nav; 3181 3191 if (d) return A(d).data("idx"); 3182 3192 }; 3183 t= null;3193 r = null; 3184 3194 return w; 3185 3195 }({}, K, M)); 3186 D.register("1d", function(w, t, E) {3196 D.register("1d", function(w, r, E) { 3187 3197 function y(a, c) { 3188 3198 a.stopPropagation(); 3189 r= c;3199 q = c; 3190 3200 return !0; 3191 3201 } … … 3194 3204 return [ null, [ c[5] ], [ c[1], c[5] ], [ c[1], c[3], c[5] ], [ c[1], c[3], c[4], c[5] ], [ c[1], c[2], c[3], c[4], c[5] ] ][a] || c; 3195 3205 } 3196 function u(a) {3206 function t(a) { 3197 3207 const c = []; 3198 3208 a && (a.saved() || c.push("po-unsaved"), a.fuzzy() ? c.push("po-fuzzy") : a.hasFlag() && c.push("po-flagged"), … … 3227 3237 D.require("3"); 3228 3238 const l = D.require("28").html, m = D.require("6").sprintf; 3229 let r, x;3239 let q, x; 3230 3240 w.extend = function(a) { 3231 3241 return a.prototype = new g(); … … 3235 3245 return w; 3236 3246 }; 3237 const q= function() {3247 const u = function() { 3238 3248 const a = E.createElement("p"), c = /(src|href|on[a-z]+)\s*=/gi; 3239 3249 return function(d) { … … 3280 3290 } 3281 3291 const d = D.require("2b").init(a); 3282 A( t).on("resize", c);3292 A(r).on("resize", c); 3283 3293 this.redraw = c; 3284 3294 A(a).on("wgFocus wgBlur", y); 3285 3295 this.destroy = function() { 3286 3296 d.destroy(); 3287 A( t).off("resize", c);3297 A(r).off("resize", c); 3288 3298 }; 3289 3299 this.rootDiv = a; … … 3310 3320 f.next = function(a, c, d) { 3311 3321 const h = this.listTable, n = this.po; 3312 let v = h.selected(), z = v, C;3322 let v = h.selected(), C = v, B; 3313 3323 for (;null != (v = h.next(a, d, v)); ) { 3314 if ( z=== v) {3324 if (C === v) { 3315 3325 v = null; 3316 3326 break; 3317 3327 } 3318 if (c && ( C = n.row(v), C.translated(0))) continue;3328 if (c && (B = n.row(v), B.translated(0))) continue; 3319 3329 break; 3320 3330 } … … 3363 3373 f.filter = function(a, c) { 3364 3374 const d = this.listTable, h = this.lastFound, n = this.lastSearch || ""; 3365 let v, z;3366 a ? ( z = this.dict.find(a), v = z.length, v === h && 0 === a.indexOf(n) ? c = !0 : d.filter(z)) : (v = this.po.length,3375 let v, C; 3376 a ? (C = this.dict.find(a), v = C.length, v === h && 0 === a.indexOf(n) ? c = !0 : d.filter(C)) : (v = this.po.length, 3367 3377 d.unfilter()); 3368 3378 this.lastFound = v; … … 3385 3395 var c = this.po.indexOf(a); 3386 3396 if ((c = this.listTable.tr(c)) && c.length) { 3387 var d = u(a);3397 var d = t(a); 3388 3398 a = c[0].className; 3389 3399 d = a.replace(/(?:^| +)po-[a-z]+/g, "") + " " + d; … … 3395 3405 if (this.dirty || a) { 3396 3406 const d = [], h = [], n = this.listTable; 3397 c.each(function(v, z, C) {3398 z.err && d.push(z);3399 z.saved() || (z.save(), (z = (v = n.row(C)) && v.page) && z.live ? h[z.i] = z.live : v && A(v.cells()).removeClass("po-unsaved"));3407 c.each(function(v, C, B) { 3408 C.err && d.push(C); 3409 C.saved() || (C.save(), (C = (v = n.row(B)) && v.page) && C.live ? h[C.i] = C.live : v && A(v.cells()).removeClass("po-unsaved")); 3400 3410 }); 3401 3411 h.length && A(h).find("div.po-unsaved").removeClass("po-unsaved"); … … 3431 3441 const d = a.po; 3432 3442 var h = d && d.locale() || a.targetLocale, n = d && d.source() || a.sourceLocale; 3433 const v = h && h.isRTL(), z= d && d.length || 0;3443 const v = h && h.isRTL(), C = d && d.length || 0; 3434 3444 if (!d || !d.row) return c && c.clear().header("Error").contents("Invalid messages list"), 3435 3445 !1; 3436 3446 a.setLocales(n, h); 3437 a.lastSearch && (a.lastSearch = "", a.lastFound = z, a.fire("poFilter", [ "", z]));3447 a.lastSearch && (a.lastSearch = "", a.lastFound = C, a.fire("poFilter", [ "", C ])); 3438 3448 n = (h = a.listTable) && h.thead().distribution(); 3439 let C= [];3449 let B = []; 3440 3450 a.listTable = h = c.tabulate({ 3441 eachCol: function( B) {3451 eachCol: function(z) { 3442 3452 const F = a.getListColumns(), G = a.getListHeadings(); 3443 3453 for (const H in F) { 3444 3454 const J = F[H]; 3445 B(J, H, G[J]);3446 } 3447 }, 3448 eachRow: function( B) {3455 z(J, H, G[J]); 3456 } 3457 }, 3458 eachRow: function(z) { 3449 3459 d.each(function(F, G) { 3450 a.validate(G) && C.push(G);3451 B(G.idx, a.getListEntry(G), u(G));3460 a.validate(G) && B.push(G); 3461 z(G.idx, a.getListEntry(G), t(G)); 3452 3462 }); 3453 3463 }, … … 3455 3465 }); 3456 3466 c = a.getListColumns(); 3457 for (const B in c) h.sortable(c[B]);3467 for (const z in c) h.sortable(c[z]); 3458 3468 n && h.thead().distribute(n); 3459 3469 h.tbody().$(v ? "addClass" : "removeClass", [ "is-rtl" ]); 3460 a.invalid = C.length ? C: null;3461 return !! z;3470 a.invalid = B.length ? B : null; 3471 return !!C; 3462 3472 }; 3463 3473 f.load = function(a, c) { … … 3502 3512 const d = []; 3503 3513 var h = this.labels, n = a.context(); 3504 let v = [], z = a.tags(), C = z && z.length;3514 let v = [], C = a.tags(), B = C && C.length; 3505 3515 n && (v.push("<span>" + l(h[4]) + "</span>"), v.push('<mark class="ctxt">' + l(n) + "</mark>")); 3506 if ( C && this.getTag) for (v.push("<span>Tagged:</span>"), h = -1; ++h < C; ) (n = this.getTag(z[h])) && v.push("<mark>" + l(n.mod_name) + "</mark>");3516 if (B && this.getTag) for (v.push("<span>Tagged:</span>"), h = -1; ++h < B; ) (n = this.getTag(C[h])) && v.push("<mark>" + l(n.mod_name) + "</mark>"); 3507 3517 v.length && d.push('<p class="tags">' + v.join(" ") + "</p>"); 3508 if (this.getMono() && (n = a.refs()) && ( z = n.split(/\s/), C = z.length)) {3509 for (v = []; 0 <= -- C; ) n = z[C], v.push("<code>" + l(n) + "</code>");3518 if (this.getMono() && (n = a.refs()) && (C = n.split(/\s/), B = C.length)) { 3519 for (v = []; 0 <= --B; ) n = C[B], v.push("<code>" + l(n) + "</code>"); 3510 3520 d.push('<p class="has-icon icon-file">' + v.join(" ") + "</p>"); 3511 3521 } … … 3536 3546 N.titled() !== P && e(N, P, L || "en"); 3537 3547 P = !1; 3538 B.setSrcMeta(a, N) && (P = !0);3548 z.setSrcMeta(a, N) && (P = !0); 3539 3549 if (a.plural()) { 3540 3550 P = -1; … … 3559 3569 N.on("changing", function(S, P) { 3560 3570 a.source(P, L); 3561 0 === L && B.updateListCell(a, "source");3562 B.unsave(a, L);3571 0 === L && z.updateListCell(a, "source"); 3572 z.unsave(a, L); 3563 3573 }).on("changed", function() { 3564 0 === L && B.po.reIndex(a);3565 B.dict && B.rebuildSearch();3566 B.fire("poUpdate", [ a ]);3574 0 === L && z.po.reIndex(a); 3575 z.dict && z.rebuildSearch(); 3576 z.fire("poUpdate", [ a ]); 3567 3577 }); 3568 3578 } … … 3575 3585 L.titled() !== U && e(L, U, S); 3576 3586 U = !1; 3577 !N && B.setSrcMeta(a, L) && (U = !0);3578 B.setTrgMeta(a, P, L) && (U = !0);3579 B.setStatus(a, P);3587 !N && z.setSrcMeta(a, L) && (U = !0); 3588 z.setTrgMeta(a, P, L) && (U = !0); 3589 z.setStatus(a, P); 3580 3590 if (1 !== S.nplurals && a.pluralized()) { 3581 3591 N = function(W) { … … 3593 3603 L.navigize(Y, P || null).on("wgTabSelect", function(W, ca) { 3594 3604 (W = Z && W.cell.editable()) && W.focus(); 3595 B.setTrgMeta(a, ca, L);3596 B.setStatus(a, ca);3597 B.fire("poTab", [ ca ]);3605 z.setTrgMeta(a, ca, L); 3606 z.setStatus(a, ca); 3607 z.fire("poTab", [ ca ]); 3598 3608 }); 3599 3609 } else U && L.redraw(), L.textarea(a.translation(), Z && !a.disabled(0)).setStrf(J).setMode(ba).setInvs(G), … … 3603 3613 function S() { 3604 3614 P = null; 3605 B.validate(a);3615 z.validate(a); 3606 3616 const V = a.errors(L).join(" "); 3607 U !== V && (U = V, B.setTrgMeta(a, L, N) && N.redraw(), B.reCssRow(a));3617 U !== V && (U = V, z.setTrgMeta(a, L, N) && N.redraw(), z.reCssRow(a)); 3608 3618 } 3609 3619 let P, U = a.errors(L).join(" "); … … 3611 3621 P && (clearTimeout(P), P = null); 3612 3622 a.translate(Y, L); 3613 0 === L && B.updateListCell(a, "target");3614 a.fuzzy(L) && a.saved(L) ? B.fuzzy(!1, a, L) : B.unsave(a, L);3615 "" === Y ? ( B.fire("poEmpty", [ !0, a, L ]), B.setStatus(a, L)) : "" === ea && (B.fire("poEmpty", [ !1, a, L ]),3616 B.setStatus(a, L));3623 0 === L && z.updateListCell(a, "target"); 3624 a.fuzzy(L) && a.saved(L) ? z.fuzzy(!1, a, L) : z.unsave(a, L); 3625 "" === Y ? (z.fire("poEmpty", [ !0, a, L ]), z.setStatus(a, L)) : "" === ea && (z.fire("poEmpty", [ !1, a, L ]), 3626 z.setStatus(a, L)); 3617 3627 P = setTimeout(S, U ? 300 : 1e3); 3618 3628 }).on("changed", function() { 3619 B.dict && B.rebuildSearch();3620 B.fire("poUpdate", [ a ]);3621 }); 3622 } 3623 function z(N) {3629 z.dict && z.rebuildSearch(); 3630 z.fire("poUpdate", [ a ]); 3631 }); 3632 } 3633 function C(N) { 3624 3634 N.off(); 3625 3635 const L = da[4]; 3626 N.titled() !== L && (e(N, L), B.setStatus(null));3636 N.titled() !== L && (e(N, L), z.setStatus(null)); 3627 3637 N.textarea(a.context(), !0).setMode(ba).setInvs(G); 3628 3638 oa && N.on("changing", function(S, P) { 3629 3639 a.context(P); 3630 B.updateListCell(a, "source");3631 B.unsave(a, ha);3640 z.updateListCell(a, "source"); 3641 z.unsave(a, ha); 3632 3642 }).on("changed", function() { 3633 B.po.reIndex(a);3634 B.dict && B.rebuildSearch();3635 B.fire("poUpdate", [ a ]);3636 }); 3637 } 3638 function C(N) {3643 z.po.reIndex(a); 3644 z.dict && z.rebuildSearch(); 3645 z.fire("poUpdate", [ a ]); 3646 }); 3647 } 3648 function B(N) { 3639 3649 const L = da[5]; 3640 3650 N.titled() !== L && e(N, L); 3641 3651 N.off().on("changing", function(S, P) { 3642 3652 a.comment(P); 3643 B.fire("poComment", [ a, P ]);3644 B.unsave(a, ha);3653 z.fire("poComment", [ a, P ]); 3654 z.unsave(a, ha); 3645 3655 }).textarea(a.comment(), !0); 3646 3656 } 3647 const B= this;3657 const z = this; 3648 3658 var F = a.isHTML(); 3649 const G = B.inv || !1, H = this.fmt || null, J = a.format() || null, O = a.is(B.active), R = B.sourceCell, I = B.targetCell, Q = B.contextCell, X = B.commentCell, Z = B.editable.target, ma = B.editable.source, oa = B.editable.context, pa = B.sourceLocale, ka = B.targetLocale, da = B.labels;3650 let ha = 0, ba = B.mode, ia = r;3651 B.html !== F && (B.html = F, "code" !== B.mode && (ba = F ? "html" : "", B.setMode(ba)));3652 B.active = a;3659 const G = z.inv || !1, H = this.fmt || null, J = a.format() || null, O = a.is(z.active), R = z.sourceCell, I = z.targetCell, Q = z.contextCell, X = z.commentCell, Z = z.editable.target, ma = z.editable.source, oa = z.editable.context, pa = z.sourceLocale, ka = z.targetLocale, da = z.labels; 3660 let ha = 0, ba = z.mode, ia = q; 3661 z.html !== F && (z.html = F, "code" !== z.mode && (ba = F ? "html" : "", z.setMode(ba))); 3662 z.active = a; 3653 3663 R && d(R, pa); 3654 Q && z(Q);3664 Q && C(Q); 3655 3665 I && ka && (ha = I.navigated() || 0, n(R, I, ka, ha)); 3656 X && C(X);3666 X && B(X); 3657 3667 ia && (ia.exists() || (ia = ia.parent()), (F = ia.editable()) && F.focus()); 3658 3668 H !== J && (this.fmt = J); 3659 O || B.fire("poSelected", [ a, ha ]);3669 O || z.fire("poSelected", [ a, ha ]); 3660 3670 }; 3661 3671 f.unloadActive = function() { … … 3692 3702 }; 3693 3703 f.cellText = function(a) { 3694 return (a = -1 !== a.indexOf("<") || -1 !== a.indexOf("&") ? q(a) : a.trim()) || " ";3704 return (a = -1 !== a.indexOf("<") || -1 !== a.indexOf("&") ? u(a) : a.trim()) || " "; 3695 3705 }; 3696 3706 f.fuzzy = function(a, c, d) { … … 3776 3786 return w; 3777 3787 }({}, K, M)); 3778 D.register("1e", function(w, t, E) {3788 D.register("1e", function(w, r, E) { 3779 3789 w.init = function() { 3780 3790 const y = /%([1-9]\d*\$)?[s%]/, p = /%([1-9]\d*\$)?(?:'.|[-+0 ])*\d*(?:\.\d+)?(.|$)/g; 3781 3791 return { 3782 parse: function( u, e) {3792 parse: function(t, e) { 3783 3793 const b = e && e.count || 0; 3784 3794 e = e && e.types || {}; 3785 3795 let k = !0, g = 0, l = 0; 3786 for (var m; null != (m = p.exec( u)); ) {3787 const r= m[2];3788 if ("%" !== r|| "%%" !== m[0]) {3789 if ("" === r || -1 === "suxXbcdeEfFgGo".indexOf(r)) {3796 for (var m; null != (m = p.exec(t)); ) { 3797 const q = m[2]; 3798 if ("%" !== q || "%%" !== m[0]) { 3799 if ("" === q || -1 === "suxXbcdeEfFgGo".indexOf(q)) { 3790 3800 k = !1; 3791 3801 break; … … 3793 3803 null == m[1] ? m = ++l : (m = parseInt(m[1]), g = Math.max(g, m)); 3794 3804 null == e[m] && (e[m] = {}); 3795 e[m][ r] = !0;3805 e[m][q] = !0; 3796 3806 } 3797 3807 } … … 3808 3818 }; 3809 3819 }, 3810 sniff: function( u) {3811 return y.test( u);3820 sniff: function(t) { 3821 return y.test(t); 3812 3822 } 3813 3823 }; … … 3815 3825 return w; 3816 3826 }({}, K, M)); 3817 D.register("d", function(w, t, E) {3827 D.register("d", function(w, r, E) { 3818 3828 function y() { 3819 3829 this.init(); … … 3824 3834 return g; 3825 3835 } 3826 function u(g) {3836 function t(g) { 3827 3837 return p("cloud").attr("title", g.labels[8] + " (Ctrl-U)").on("click", function(l) { 3828 3838 l.preventDefault(); … … 3843 3853 g = l.setRootCell(g); 3844 3854 var m = g.splity("po-list", "po-edit"); 3845 let r= m[0], x = m[1];3855 let q = m[0], x = m[1]; 3846 3856 m = x.splitx("po-trans", "po-comment"); 3847 var q= m[0];3857 var u = m[0]; 3848 3858 let f = m[1].header("Loading.."); 3849 m = q.splity("po-source", "po-target");3850 q= m[0].header("Loading..");3859 m = u.splity("po-source", "po-target"); 3860 u = m[0].header("Loading.."); 3851 3861 m = m[1].header("Loading.."); 3852 3862 g.distribute([ .34 ]); 3853 3863 x.distribute([ .8 ]); 3854 l.setListCell( r);3855 l.setSourceCell( q);3864 l.setListCell(q); 3865 l.setSourceCell(u); 3856 3866 l.setTargetCell(m); 3857 3867 l.commentCell = f; … … 3859 3869 return l; 3860 3870 }; 3861 t= y.prototype = D.require("1d").extend(y);3862 t.getListHeadings = function() {3871 r = y.prototype = D.require("1d").extend(y); 3872 r.getListHeadings = function() { 3863 3873 const g = this.t(), l = [ g._x("Source text", "Editor") ]; 3864 3874 this.targetLocale && (l[1] = g._x("Translation", "Editor")); 3865 3875 return l; 3866 3876 }; 3867 t.getListColumns = function() {3877 r.getListColumns = function() { 3868 3878 const g = { 3869 3879 source: 0 … … 3872 3882 return g; 3873 3883 }; 3874 t.getListEntry = function(g) {3884 r.getListEntry = function(g) { 3875 3885 const l = this.cellText, m = [ function() { 3876 let r, x = l(g.source() || ""), q= g.context();3877 return q ? (r = E.createElement("p"), r.appendChild(E.createElement("mark")).innerText = q,3878 r.appendChild(E.createTextNode(" " + x)), r) : x;3886 let q, x = l(g.source() || ""), u = g.context(); 3887 return u ? (q = E.createElement("p"), q.appendChild(E.createElement("mark")).innerText = u, 3888 q.appendChild(E.createTextNode(" " + x)), q) : x; 3879 3889 } ]; 3880 3890 this.targetLocale && (m[1] = function() { … … 3883 3893 return m; 3884 3894 }; 3885 t.stats = function() {3886 let g = this.po, l = g.length, m = 0, r= 0, x = 0;3887 g.each(function( q, f) {3888 f.fuzzy() ? x++ : f.translated() ? m++ : r++;3895 r.stats = function() { 3896 let g = this.po, l = g.length, m = 0, q = 0, x = 0; 3897 g.each(function(u, f) { 3898 f.fuzzy() ? x++ : f.translated() ? m++ : q++; 3889 3899 }); 3890 3900 return { … … 3892 3902 p: m.percent(l) + "%", 3893 3903 f: x, 3894 u: r3895 }; 3896 }; 3897 t.unlock = function() {3904 u: q 3905 }; 3906 }; 3907 r.unlock = function() { 3898 3908 const g = this.targetLocale; 3899 3909 this._unlocked || (this.editable = { … … 3905 3915 this.active && this.loadMessage(this.active)); 3906 3916 }; 3907 t.lock = function() {3917 r.lock = function() { 3908 3918 const g = this._unlocked; 3909 3919 g && (this.targetLocale = g, delete this._unlocked, this.po && this.po.lock(g), … … 3915 3925 this.active && this.loadMessage(this.active)); 3916 3926 }; 3917 t.locked = function() {3927 r.locked = function() { 3918 3928 return !this._unlocked; 3919 3929 }; 3920 t.setStatus = function(g) {3930 r.setStatus = function(g) { 3921 3931 let l = this.$tnav; 3922 3932 if (null == g) l && (l.remove(), this.$tnav = null); else { 3923 l || (this.$tnav = l = A("<nav></nav>").append( u(this)).append(e(this)).appendTo(this.targetCell.header()));3933 l || (this.$tnav = l = A("<nav></nav>").append(t(this)).append(e(this)).appendTo(this.targetCell.header())); 3924 3934 var m = []; 3925 3935 g.translated() ? g.fuzzy() && m.push("po-fuzzy") : m.push("po-empty"); … … 3927 3937 } 3928 3938 }; 3929 t.getSorter = function() {3930 function g( r, x) {3931 const q = r.weight(), f = x.weight();3932 return q === f ? l(r, x) : q> f ? -1 : 1;3933 } 3934 function l( r, x) {3935 return r.hash().localeCompare(x.hash());3939 r.getSorter = function() { 3940 function g(q, x) { 3941 const u = q.weight(), f = x.weight(); 3942 return u === f ? l(q, x) : u > f ? -1 : 1; 3943 } 3944 function l(q, x) { 3945 return q.hash().localeCompare(x.hash()); 3936 3946 } 3937 3947 const m = this; 3938 return function( r) {3939 const x = m.po, q= m.locked() ? g : l;3940 r.sort(function(f, a) {3941 return q(x.row(f), x.row(a));3942 }); 3943 }; 3944 }; 3945 t.validate = function(g) {3948 return function(q) { 3949 const x = m.po, u = m.locked() ? g : l; 3950 q.sort(function(f, a) { 3951 return u(x.row(f), x.row(a)); 3952 }); 3953 }; 3954 }; 3955 r.validate = function(g) { 3946 3956 g.err = null; 3947 3957 if (g.untranslated(0)) return 0; … … 3951 3961 return m; 3952 3962 }; 3953 t.validateMessagePrintf = function(g, l) {3963 r.validateMessagePrintf = function(g, l) { 3954 3964 const m = g.format(); 3955 3965 if ("no-" === m.substring(0, 3)) return 0; 3956 const r= g.msgid(), x = g.msgidPlural();3966 const q = g.msgid(), x = g.msgidPlural(); 3957 3967 null == k && (k = D.require("1e").init()); 3958 var q= k;3959 if (!("" !== m || q.sniff(r) || "" !== x && q.sniff(x))) return 0;3960 let f = 0, a = q.parse(r);3961 x && a.valid && (a = q.parse(x, a));3968 var u = k; 3969 if (!("" !== m || u.sniff(q) || "" !== x && u.sniff(x))) return 0; 3970 let f = 0, a = u.parse(q); 3971 x && a.valid && (a = u.parse(x, a)); 3962 3972 if (!a.valid) return 0; 3963 3973 let c = a.count; … … 3967 3977 l[h] = []; 3968 3978 if ("" !== n) { 3969 n = q.parse(n);3979 n = u.parse(n); 3970 3980 var v = n.count; 3971 3981 h = l[h]; … … 3974 3984 f++; else { 3975 3985 v = a.types; 3976 for (const z in n.types) for (const C in n.types[z]) if (null == v[z] || null == v[z][C]) {3986 for (const C in n.types) for (const B in n.types[C]) if (null == v[C] || null == v[C][B]) { 3977 3987 h.push(d.t()._("Mismatching placeholder type; check against source text formatting")); 3978 3988 f++; … … 3985 3995 } 3986 3996 }; 3987 t.handle = {};3997 r.handle = {}; 3988 3998 let k; 3989 3999 return w; 3990 4000 }({}, K, M)); 3991 D.register("e", function(w, t, E) {4001 D.register("e", function(w, r, E) { 3992 4002 const y = { 3993 4003 copy: 66, … … 4004 4014 40: !0, 4005 4015 73: !0 4006 }, u= {4016 }, t = { 4007 4017 66: function(e, b) { 4008 4018 if (e = b.current()) e.normalize(), b.focus().pasteMessage(e); … … 4035 4045 const m = l.which; 4036 4046 if (!g[m]) return !0; 4037 const r = u[m];4038 if (! r || l.altKey || l.shiftKey && !p[m] || !1 === r(l, e)) return !0;4047 const q = t[m]; 4048 if (!q || l.altKey || l.shiftKey && !p[m] || !1 === q(l, e)) return !0; 4039 4049 l.stopPropagation(); 4040 4050 l.preventDefault(); … … 4042 4052 } 4043 4053 const g = {}; 4044 A(b || t).on("keydown", k);4054 A(b || r).on("keydown", k); 4045 4055 return { 4046 4056 add: function(l, m) { 4047 u[y[l]] = m;4057 t[y[l]] = m; 4048 4058 return this; 4049 4059 }, … … 4053 4063 }, 4054 4064 disable: function() { 4055 A(b || t).off("keydown", k);4065 A(b || r).off("keydown", k); 4056 4066 e = b = null; 4057 for (const l in u) g[l] = !1;4067 for (const l in t) g[l] = !1; 4058 4068 } 4059 4069 }; … … 4061 4071 return w; 4062 4072 }({}, K, M)); 4063 D.register("1f", function(w, t, E) {4073 D.register("1f", function(w, r, E) { 4064 4074 function y() { 4065 4075 this.reIndex([]); … … 4068 4078 return new y(); 4069 4079 }; 4070 t= y.prototype;4071 t.reIndex = function(p) {4072 const u= {}, e = p.length;4080 r = y.prototype; 4081 r.reIndex = function(p) { 4082 const t = {}, e = p.length; 4073 4083 let b = -1; 4074 for (;++b < e; ) u[p[b]] = b;4084 for (;++b < e; ) t[p[b]] = b; 4075 4085 this.keys = p; 4076 4086 this.length = b; 4077 this.ords = u;4078 }; 4079 t.key = function(p, u) {4080 if (null == u) return this.keys[p];4081 const e = this.keys[p], b = this.ords[ u];4082 if ( u!== e) {4087 this.ords = t; 4088 }; 4089 r.key = function(p, t) { 4090 if (null == t) return this.keys[p]; 4091 const e = this.keys[p], b = this.ords[t]; 4092 if (t !== e) { 4083 4093 if (null != b) throw Error("Clash with item at [" + b + "]"); 4084 this.keys[p] = u;4094 this.keys[p] = t; 4085 4095 delete this.ords[e]; 4086 this.ords[ u] = p;4096 this.ords[t] = p; 4087 4097 } 4088 4098 return p; 4089 4099 }; 4090 t.indexOf = function(p) {4100 r.indexOf = function(p) { 4091 4101 p = this.ords[p]; 4092 4102 return null == p ? -1 : p; 4093 4103 }; 4094 t.add = function(p, u) {4104 r.add = function(p, t) { 4095 4105 let e = this.ords[p]; 4096 4106 null == e && (this.keys[this.length] = p, e = this.ords[p] = this.length++); 4097 this[e] = u;4107 this[e] = t; 4098 4108 return e; 4099 4109 }; 4100 t.get = function(p) {4110 r.get = function(p) { 4101 4111 return this[this.ords[p]]; 4102 4112 }; 4103 t.has = function(p) {4113 r.has = function(p) { 4104 4114 return null != this.ords[p]; 4105 4115 }; 4106 t.del = function(p) {4116 r.del = function(p) { 4107 4117 this.cut(this.ords[p], 1); 4108 4118 }; 4109 t.cut = function(p, u) {4110 u = u|| 1;4111 const e = [].splice.call(this, p, u);4112 this.keys.splice(p, u);4119 r.cut = function(p, t) { 4120 t = t || 1; 4121 const e = [].splice.call(this, p, t); 4122 this.keys.splice(p, t); 4113 4123 this.reIndex(this.keys); 4114 4124 return e; 4115 4125 }; 4116 t.each = function(p) {4117 const u= this.keys, e = this.length;4126 r.each = function(p) { 4127 const t = this.keys, e = this.length; 4118 4128 let b = -1; 4119 for (;++b < e; ) p( u[b], this[b], b);4120 return this; 4121 }; 4122 t.sort = function(p) {4123 const u= this.length, e = this.keys, b = this.ords, k = [];4129 for (;++b < e; ) p(t[b], this[b], b); 4130 return this; 4131 }; 4132 r.sort = function(p) { 4133 const t = this.length, e = this.keys, b = this.ords, k = []; 4124 4134 let g = -1; 4125 for (;++g < u; ) k[g] = [ this[g], e[g] ];4126 k.sort(function(m, r) {4127 return p(m[0], r[0]);4128 }); 4129 for (g = 0; g < u; g++) {4135 for (;++g < t; ) k[g] = [ this[g], e[g] ]; 4136 k.sort(function(m, q) { 4137 return p(m[0], q[0]); 4138 }); 4139 for (g = 0; g < t; g++) { 4130 4140 var l = k[g]; 4131 4141 this[g] = l[0]; … … 4136 4146 return this; 4137 4147 }; 4138 t.join = function(p) {4148 r.join = function(p) { 4139 4149 return [].join.call(this, p); 4140 4150 }; 4141 4151 return w; 4142 4152 }({}, K, M)); 4143 D.register("20", function(w, t, E) {4144 function y(p, u) {4145 var e = new RegExp("^.{0," + (p - 1) + "}[" + u + "]"), b = new RegExp("^[^" + u+ "]+");4153 D.register("20", function(w, r, E) { 4154 function y(p, t) { 4155 var e = new RegExp("^.{0," + (p - 1) + "}[" + t + "]"), b = new RegExp("^[^" + t + "]+"); 4146 4156 return function(k, g) { 4147 4157 for (var l = k.length, m; l > p; ) { … … 4159 4169 } 4160 4170 w.create = function(p) { 4161 function u(r) {4162 return g[ r] || "\\" + r;4171 function t(q) { 4172 return g[q] || "\\" + q; 4163 4173 } 4164 4174 var e = /(?:\r\n|[\r\n\v\f\u2028\u2029])/g, b = /[ \r\n]+/g, k = /[\t\v\f\x07\x08\\"]/g, g = { … … 4175 4185 } 4176 4186 return { 4177 pair: function( r, x) {4178 if (!x) return r+ ' ""';4179 x = x.replace(k, u);4180 var q= 0;4187 pair: function(q, x) { 4188 if (!x) return q + ' ""'; 4189 x = x.replace(k, t); 4190 var u = 0; 4181 4191 x = x.replace(e, function() { 4182 q++;4192 u++; 4183 4193 return "\\n\n"; 4184 4194 }); 4185 if (!( q || p && p < x.length + r.length + 3)) return r+ ' "' + x + '"';4186 r = [ r+ ' "' ];4195 if (!(u || p && p < x.length + q.length + 3)) return q + ' "' + x + '"'; 4196 q = [ q + ' "' ]; 4187 4197 x = x.split("\n"); 4188 if (m) for (var f = -1, a = x.length; ++f < a; ) m(x[f], r); else r = r.concat(x);4189 return r.join('"\n"') + '"';4190 }, 4191 prefix: function( r, x) {4192 r = r.split(e);4193 return x + r.join("\n" + x);4194 }, 4195 refs: function( r) {4196 r = r.replace(b, " ", r);4197 l && ( r = l(r, []).join("\n#: "));4198 return "#: " + r;4198 if (m) for (var f = -1, a = x.length; ++f < a; ) m(x[f], q); else q = q.concat(x); 4199 return q.join('"\n"') + '"'; 4200 }, 4201 prefix: function(q, x) { 4202 q = q.split(e); 4203 return x + q.join("\n" + x); 4204 }, 4205 refs: function(q) { 4206 q = q.replace(b, " ", q); 4207 l && (q = l(q, []).join("\n#: ")); 4208 return "#: " + q; 4199 4209 } 4200 4210 }; … … 4202 4212 return w; 4203 4213 }({}, K, M)); 4204 D.register("2c", function(w, t, E) {4214 D.register("2c", function(w, r, E) { 4205 4215 function y() { 4206 4216 this.length = 0; … … 4209 4219 return new y(); 4210 4220 }; 4211 t= y.prototype;4212 t.push = function(p) {4221 r = y.prototype; 4222 r.push = function(p) { 4213 4223 this[this.length++] = p; 4214 4224 return this; 4215 4225 }; 4216 t.sort = function(p) {4226 r.sort = function(p) { 4217 4227 [].sort.call(this, p); 4218 4228 return this; 4219 4229 }; 4220 t.each = function(p) {4221 for (var u = -1, e = this.length; ++u < e; ) p(u, this[u]);4230 r.each = function(p) { 4231 for (var t = -1, e = this.length; ++t < e; ) p(t, this[t]); 4222 4232 return this; 4223 4233 }; 4224 4234 return w; 4225 4235 }({}, K, M)); 4226 D.register("21", function(w, t, E) {4236 D.register("21", function(w, r, E) { 4227 4237 function y() {} 4228 4238 w.extend = function(p) { 4229 4239 return p.prototype = new y(); 4230 4240 }; 4231 t= y.prototype = D.require("2a").init([ "load" ]);4232 t.row = function(p) {4241 r = y.prototype = D.require("2a").init([ "load" ]); 4242 r.row = function(p) { 4233 4243 return this.rows[p]; 4234 4244 }; 4235 t.lock = function(p) {4245 r.lock = function(p) { 4236 4246 return this.locale(p || { 4237 4247 lang: "zxx", … … 4241 4251 }); 4242 4252 }; 4243 t.unlock = function() {4253 r.unlock = function() { 4244 4254 const p = this.loc; 4245 4255 this.loc = null; 4246 4256 return p; 4247 4257 }; 4248 t.locale = function(p) {4258 r.locale = function(p) { 4249 4259 null == p ? p = this.loc : this.loc = p = D.require("29").cast(p); 4250 4260 return p; 4251 4261 }; 4252 t.source = function(p) {4262 r.source = function(p) { 4253 4263 null == p ? p = this.src || D.require("29").cast({ 4254 4264 lang: "en", … … 4259 4269 return p; 4260 4270 }; 4261 t.each = function(p) {4271 r.each = function(p) { 4262 4272 this.rows.each(p); 4263 4273 return this; 4264 4274 }; 4265 t.indexOf = function(p) {4275 r.indexOf = function(p) { 4266 4276 "object" !== typeof p && (p = this.get(p)); 4267 4277 if (!p) return -1; … … 4269 4279 return p.idx; 4270 4280 }; 4271 t.get = function(p) {4281 r.get = function(p) { 4272 4282 return this.rows && this.rows.get(p); 4273 4283 }; 4274 t.has = function(p) {4284 r.has = function(p) { 4275 4285 return this.rows && this.rows.has(p); 4276 4286 }; 4277 t.del = function(p) {4287 r.del = function(p) { 4278 4288 p = this.indexOf(p); 4279 4289 if (-1 !== p) { 4280 const u= this.rows.cut(p, 1);4281 if ( u && u.length) return this.length = this.rows.length, this.rows.each(function(e, b, k) {4290 const t = this.rows.cut(p, 1); 4291 if (t && t.length) return this.length = this.rows.length, this.rows.each(function(e, b, k) { 4282 4292 b.idx = k; 4283 4293 }), p; 4284 4294 } 4285 4295 }; 4286 t.reIndex = function(p, u) {4296 r.reIndex = function(p, t) { 4287 4297 const e = p.hash(), b = this.indexOf(p), k = this.rows.indexOf(e); 4288 return k === b ? b : -1 !== k ? ( u = (u || 0) + 1, p.source("Error, duplicate " + String(u) + ": " + p.source()),4289 this.reIndex(p, u)) : this.rows.key(b, e);4290 }; 4291 t.sort = function(p) {4298 return k === b ? b : -1 !== k ? (t = (t || 0) + 1, p.source("Error, duplicate " + String(t) + ": " + p.source()), 4299 this.reIndex(p, t)) : this.rows.key(b, e); 4300 }; 4301 r.sort = function(p) { 4292 4302 this.rows.sort(p); 4293 4303 return this; 4294 4304 }; 4295 t.export = function() {4296 const p = this.rows, u= p.length, e = D.require("2c").init();4305 r.export = function() { 4306 const p = this.rows, t = p.length, e = D.require("2c").init(); 4297 4307 let b = -1; 4298 for (;++b < u; ) e.push(p[b]);4308 for (;++b < t; ) e.push(p[b]); 4299 4309 return e; 4300 4310 }; 4301 4311 return w; 4302 4312 }({}, K, M)); 4303 D.register("22", function(w, t, E) {4313 D.register("22", function(w, r, E) { 4304 4314 function y(e, b, k) { 4305 4315 if (null == k) return e[b] || ""; … … 4310 4320 this._id = this.id = ""; 4311 4321 } 4312 function u(e, b) {4322 function t(e, b) { 4313 4323 const k = e.length; 4314 4324 let g = -1; … … 4318 4328 return e.prototype = new p(); 4319 4329 }; 4320 t= p.prototype;4321 t.flag = function(e, b) {4330 r = p.prototype; 4331 r.flag = function(e, b) { 4322 4332 const k = this.flg || (this.flg = []); 4323 4333 if (null != b) k[b] = e; else for (b = Math.max(k.length, this.src.length, this.msg.length); 0 !== b--; ) k[b] = e; 4324 4334 return this; 4325 4335 }; 4326 t.flagged = function(e) {4336 r.flagged = function(e) { 4327 4337 return (this.flg || [])[e || 0] || 0; 4328 4338 }; 4329 t.hasFlag = function() {4339 r.hasFlag = function() { 4330 4340 const e = this.flg || []; 4331 4341 let b = e.length; … … 4333 4343 return !1; 4334 4344 }; 4335 t.isFlag = function(e) {4345 r.isFlag = function(e) { 4336 4346 return 0 < e; 4337 4347 }; 4338 t.flags = function() {4348 r.flags = function() { 4339 4349 const e = {}, b = [], k = this.flg || []; 4340 4350 let g = k.length; … … 4345 4355 return b; 4346 4356 }; 4347 t.flaggedAs = function(e, b) {4357 r.flaggedAs = function(e, b) { 4348 4358 const k = this.flg || []; 4349 4359 if (null != b) return e === k[b] || 0; … … 4351 4361 return !1; 4352 4362 }; 4353 t.fuzzy = function(e, b) {4363 r.fuzzy = function(e, b) { 4354 4364 const k = this.flaggedAs(4, e); 4355 4365 null != b && this.flag(b ? 4 : 0, e); 4356 4366 return k; 4357 4367 }; 4358 t.source = function(e, b) {4368 r.source = function(e, b) { 4359 4369 if (null == e) return this.src[b || 0] || ""; 4360 4370 this.src[b || 0] = e; 4361 4371 return this; 4362 4372 }; 4363 t.plural = function(e, b) {4373 r.plural = function(e, b) { 4364 4374 if (null == e) return this.src[b || 1] || ""; 4365 4375 this.src[b || 1] = e || ""; 4366 4376 return this; 4367 4377 }; 4368 t.sourceForms = function() {4378 r.sourceForms = function() { 4369 4379 return this.srcF; 4370 4380 }; 4371 t.targetForms = function() {4381 r.targetForms = function() { 4372 4382 return this.msgF; 4373 4383 }; 4374 t.each = function(e) {4384 r.each = function(e) { 4375 4385 const b = this.src, k = this.msg, g = Math.max(b.length, k.length); 4376 4386 let l = -1; … … 4378 4388 return this; 4379 4389 }; 4380 t.eachSrc = function(e) {4381 u(this.src, e);4382 return this; 4383 }; 4384 t.eachMsg = function(e) {4385 u(this.msg, e);4386 return this; 4387 }; 4388 t.count = function() {4390 r.eachSrc = function(e) { 4391 t(this.src, e); 4392 return this; 4393 }; 4394 r.eachMsg = function(e) { 4395 t(this.msg, e); 4396 return this; 4397 }; 4398 r.count = function() { 4389 4399 return Math.max(this.src.length, this.msg.length); 4390 4400 }; 4391 t.pluralized = function() {4401 r.pluralized = function() { 4392 4402 return 1 < this.src.length || 1 < this.msg.length; 4393 4403 }; 4394 t.translate = function(e, b) {4404 r.translate = function(e, b) { 4395 4405 this.msg[b || 0] = e || ""; 4396 4406 return this; 4397 4407 }; 4398 t.untranslate = function(e) {4408 r.untranslate = function(e) { 4399 4409 if (null != e) this.msg[e] = ""; else { 4400 4410 const b = this.msg, k = b.length; … … 4403 4413 return this; 4404 4414 }; 4405 t.translation = function(e) {4415 r.translation = function(e) { 4406 4416 return this.msg[e || 0] || ""; 4407 4417 }; 4408 t.errors = function(e) {4418 r.errors = function(e) { 4409 4419 return this.err && this.err[e || 0] || []; 4410 4420 }; 4411 t.valid = function() {4421 r.valid = function() { 4412 4422 return null == this.err; 4413 4423 }; 4414 t.translated = function(e) {4424 r.translated = function(e) { 4415 4425 if (null != e) return !!this.msg[e]; 4416 4426 const b = this.msg, k = b.length; … … 4418 4428 return !0; 4419 4429 }; 4420 t.untranslated = function(e) {4430 r.untranslated = function(e) { 4421 4431 if (null != e) return !this.msg[e]; 4422 4432 const b = this.msg, k = b.length; … … 4424 4434 return !0; 4425 4435 }; 4426 t.comment = function(e) {4436 r.comment = function(e) { 4427 4437 return y(this, "cmt", e); 4428 4438 }; 4429 t.notes = function(e) {4439 r.notes = function(e) { 4430 4440 return y(this, "xcmt", e); 4431 4441 }; 4432 t.refs = function(e) {4442 r.refs = function(e) { 4433 4443 return y(this, "rf", e); 4434 4444 }; 4435 t.format = function(e) {4445 r.format = function(e) { 4436 4446 return y(this, "fmt", e); 4437 4447 }; 4438 t.context = function(e) {4448 r.context = function(e) { 4439 4449 return y(this, "ctx", e); 4440 4450 }; 4441 t.tags = function() {4451 r.tags = function() { 4442 4452 return this.tg; 4443 4453 }; 4444 t.getMax = function(e) {4454 r.getMax = function(e) { 4445 4455 return (this.mx || [ 0 ])[e] || 0; 4446 4456 }; 4447 t.toString = t.toText = function() {4457 r.toString = r.toText = function() { 4448 4458 return this.src.concat(this.msg, [ this.id, this.ctx ]).join(" "); 4449 4459 }; 4450 t.weight = function() {4460 r.weight = function() { 4451 4461 let e = 0; 4452 4462 this.translation() || (e += 2); … … 4454 4464 return e; 4455 4465 }; 4456 t.equals = function(e) {4466 r.equals = function(e) { 4457 4467 return this === e || this.hash() === e.hash(); 4458 4468 }; 4459 t.hash = function() {4469 r.hash = function() { 4460 4470 return this.id; 4461 4471 }; 4462 t.normalize = function() {4472 r.normalize = function() { 4463 4473 let e = -1, b = this.msg.length; 4464 4474 for (;++e < b; ) this.msg[e] = this.src[Math.min(e, 1)] || ""; 4465 4475 }; 4466 t.disabled = function(e) {4476 r.disabled = function(e) { 4467 4477 return !!(this.lck || [])[e || 0]; 4468 4478 }; 4469 t.disable = function(e) {4479 r.disable = function(e) { 4470 4480 (this.lck || (this.lck = []))[e || 0] = !0; 4471 4481 return this; 4472 4482 }; 4473 t.saved = function(e) {4483 r.saved = function(e) { 4474 4484 const b = this.drt; 4475 4485 if (null == b) return !0; … … 4478 4488 return !0; 4479 4489 }; 4480 t.unsave = function(e) {4490 r.unsave = function(e) { 4481 4491 (this.drt || (this.drt = []))[e || 0] = !0; 4482 4492 return this; 4483 4493 }; 4484 t.save = function(e) {4494 r.save = function(e) { 4485 4495 null == e ? this.drt = null : (this.drt || (this.drt = []))[e] = !1; 4486 4496 return this; 4487 4497 }; 4488 t.is = function(e) {4498 r.is = function(e) { 4489 4499 return e && (e === this || e.idx === this.idx); 4490 4500 }; 4491 t.isHTML = function(e) {4501 r.isHTML = function(e) { 4492 4502 if (null == e) return this.htm || !1; 4493 4503 this.htm = e; 4494 4504 }; 4495 t= null;4505 r = null; 4496 4506 return w; 4497 4507 }({}, K, M)); 4498 D.register("f", function(w, t, E) {4508 D.register("f", function(w, r, E) { 4499 4509 function y(g) { 4500 4510 return { … … 4517 4527 return g; 4518 4528 } 4519 function u(g) {4520 const l = t.console;4529 function t(g) { 4530 const l = r.console; 4521 4531 l && l.error && l.error(g.message || String(g)); 4522 4532 } … … 4548 4558 } 4549 4559 var l = new Date(); 4550 const m = l.getUTCFullYear(), r = l.getUTCMonth() + 1, x = l.getUTCDate(), q= l.getUTCHours();4560 const m = l.getUTCFullYear(), q = l.getUTCMonth() + 1, x = l.getUTCDate(), u = l.getUTCHours(); 4551 4561 l = l.getUTCMinutes(); 4552 return g(m, 4) + "-" + g( r, 2) + "-" + g(x, 2) + " " + g(q, 2) + ":" + g(l, 2) + "+0000";4562 return g(m, 4) + "-" + g(q, 2) + "-" + g(x, 2) + " " + g(u, 2) + ":" + g(l, 2) + "+0000"; 4553 4563 }; 4554 4564 E.header = function(g, l) { … … 4564 4574 return this; 4565 4575 } 4566 const r= this.locale();4576 const q = this.locale(); 4567 4577 g = {}; 4568 4578 for (x in m) g[x] = String(m[x]); 4569 if ( r) {4570 g.Language = String( r) || "zxx";4571 g["Language-Team"] = r.label || g.Language;4572 g["Plural-Forms"] = "nplurals=" + ( r.nplurals || "2") + "; plural=" + (r.pluraleq || "n!=1") + ";";4579 if (q) { 4580 g.Language = String(q) || "zxx"; 4581 g["Language-Team"] = q.label || g.Language; 4582 g["Plural-Forms"] = "nplurals=" + (q.nplurals || "2") + "; plural=" + (q.pluraleq || "n!=1") + ";"; 4573 4583 var x = "PO-Revision-Date"; 4574 4584 } else g.Language = "", g["Plural-Forms"] = "nplurals=INTEGER; plural=EXPRESSION;", … … 4586 4596 l && g.context(l); 4587 4597 l = g.hash(); 4588 this.rows.get(l) ? u("Duplicate message at index " + this.indexOf(g)) : (g.idx = this.rows.add(l, g),4598 this.rows.get(l) ? t("Duplicate message at index " + this.indexOf(g)) : (g.idx = this.rows.add(l, g), 4589 4599 this.length = this.rows.length); 4590 4600 return g; 4591 4601 }; 4592 4602 E.load = function(g) { 4593 let l = -1, m, r;4603 let l = -1, m, q; 4594 4604 var x; 4595 let q, f, a, c = (x = this.locale()) && x.nplurals || 2, d = [];4596 for (;++l < g.length; ) m = g[l], null == m.parent ? ( r= m.source || m.id, x = m.target || "",4597 q = m.context, r || q ? (f = new k(r, x), f._id = m._id, q && f.context(q), m.flag && f.flag(m.flag, 0),4605 let u, f, a, c = (x = this.locale()) && x.nplurals || 2, d = []; 4606 for (;++l < g.length; ) m = g[l], null == m.parent ? (q = m.source || m.id, x = m.target || "", 4607 u = m.context, q || u ? (f = new k(q, x), f._id = m._id, u && f.context(u), m.flag && f.flag(m.flag, 0), 4598 4608 m.comment && f.comment(m.comment), m.notes && f.notes(m.notes), m.refs && f.refs(m.refs), 4599 4609 f.format(m.format), m.message = f, this.add(f), m.prev && m.prev[0] && (f.prev(m.prev[0].source, m.prev[0].context), … … 4602 4612 for (l = -1; ++l < d.length; ) try { 4603 4613 m = d[l]; 4604 r= m.source || m.id;4614 q = m.source || m.id; 4605 4615 f = g[m.parent] && g[m.parent].message; 4606 if (!f) throw Error("parent missing for plural " + r);4616 if (!f) throw Error("parent missing for plural " + q); 4607 4617 a = m.plural; 4608 1 === a && f.plural( r);4618 1 === a && f.plural(q); 4609 4619 a >= c || (m.flag && f.flag(m.flag, a), f.translate(m.target || "", a), m.format && !f.format() && f.format(m.format)); 4610 4620 } catch (h) { 4611 u(h);4621 t(h); 4612 4622 } 4613 4623 return this; … … 4618 4628 }; 4619 4629 E.toString = function() { 4620 var g, l = this.locale(), m = [], r = [], x = this.headers(), q= !l, f = l && l.nplurals || 2, a = this.fmtr || e();4630 var g, l = this.locale(), m = [], q = [], x = this.headers(), u = !l, f = l && l.nplurals || 2, a = this.fmtr || e(); 4621 4631 x[l ? "PO-Revision-Date" : "POT-Creation-Date"] = this.now(); 4622 for (g in x) r.push(g + ": " + x[g]);4623 r = new k("", r.join("\n"));4624 r.comment(this.headcmt || "");4625 q && r.fuzzy(0, !0);4626 m.push( r.toString());4632 for (g in x) q.push(g + ": " + x[g]); 4633 q = new k("", q.join("\n")); 4634 q.comment(this.headcmt || ""); 4635 u && q.fuzzy(0, !0); 4636 m.push(q.toString()); 4627 4637 m.push(""); 4628 4638 this.rows.each(function(c, d) { 4629 c && (m.push(d.cat(a, q, f)), m.push(""));4639 c && (m.push(d.cat(a, u, f)), m.push("")); 4630 4640 }); 4631 4641 return m.join("\n"); … … 4649 4659 }; 4650 4660 E.cat = function(g, l, m) { 4651 var r= [], x;4652 (x = this.cmt) && r.push(g.prefix(x, "# "));4653 (x = this.xcmt) && r.push(g.prefix(x, "#. "));4654 var q= this.rf;4655 if (x = this._id) q += (q? " " : "") + "loco:" + x;4656 q && /\S/.test(q) && r.push(g.refs(q));4657 !l && this.fuzzy() && r.push("#, fuzzy");4658 (x = this.fmt) && r.push("#, " + x + "-format");4659 (x = this._ctx) && r.push(g.prefix(g.pair("msgctxt", x), "#| "));4660 if (x = this._src) x[0] && r.push(g.prefix(g.pair("msgid", x[0]), "#| ")), x[1] && r.push(g.prefix(g.pair("msgid_plural", x[1]), "#| "));4661 (x = this.ctx) && r.push(g.pair("msgctxt", x));4662 r.push(g.pair("msgid", this.src[0]));4663 if (null == this.src[1]) r.push(g.pair("msgstr", l ? "" : this.msg[0])); else for (q= -1,4664 r.push(g.pair("msgid_plural", this.src[1])), x = this.msg || [ "", "" ], m = m || x.length; ++q < m; ) r.push(g.pair("msgstr[" + q + "]", l ? "" : x[q] || ""));4665 return r.join("\n");4661 var q = [], x; 4662 (x = this.cmt) && q.push(g.prefix(x, "# ")); 4663 (x = this.xcmt) && q.push(g.prefix(x, "#. ")); 4664 var u = this.rf; 4665 if (x = this._id) u += (u ? " " : "") + "loco:" + x; 4666 u && /\S/.test(u) && q.push(g.refs(u)); 4667 !l && this.fuzzy() && q.push("#, fuzzy"); 4668 (x = this.fmt) && q.push("#, " + x + "-format"); 4669 (x = this._ctx) && q.push(g.prefix(g.pair("msgctxt", x), "#| ")); 4670 if (x = this._src) x[0] && q.push(g.prefix(g.pair("msgid", x[0]), "#| ")), x[1] && q.push(g.prefix(g.pair("msgid_plural", x[1]), "#| ")); 4671 (x = this.ctx) && q.push(g.pair("msgctxt", x)); 4672 q.push(g.pair("msgid", this.src[0])); 4673 if (null == this.src[1]) q.push(g.pair("msgstr", l ? "" : this.msg[0])); else for (u = -1, 4674 q.push(g.pair("msgid_plural", this.src[1])), x = this.msg || [ "", "" ], m = m || x.length; ++u < m; ) q.push(g.pair("msgstr[" + u + "]", l ? "" : x[u] || "")); 4675 return q.join("\n"); 4666 4676 }; 4667 4677 E.compare = function(g, l) { 4668 let m = this.weight(), r= g.weight();4669 if (m > r) return 1;4670 if (m < r) return -1;4678 let m = this.weight(), q = g.weight(); 4679 if (m > q) return 1; 4680 if (m < q) return -1; 4671 4681 if (l) { 4672 4682 m = this.hash().toLowerCase(); 4673 r= g.hash().toLowerCase();4674 if (m < r) return 1;4675 if (m > r) return -1;4683 q = g.hash().toLowerCase(); 4684 if (m < q) return 1; 4685 if (m > q) return -1; 4676 4686 } 4677 4687 return 0; … … 4685 4695 return w; 4686 4696 }({}, K, M)); 4687 D.register("11", function(w, t, E) {4697 D.register("11", function(w, r, E) { 4688 4698 w.init = function(y, p) { 4689 function u() {4699 function t() { 4690 4700 return g || (g = A('<div id="loco-po-ref"></div>').dialog({ 4691 4701 dialogClass: "loco-modal loco-modal-wide", … … 4697 4707 })); 4698 4708 } 4699 function e(l, m, r) {4700 l = A("<p></p>").text( r);4701 u().dialog("close").html("").dialog("option", "title", "Error").append(l).dialog("open");4709 function e(l, m, q) { 4710 l = A("<p></p>").text(q); 4711 t().dialog("close").html("").dialog("option", "title", "Error").append(l).dialog("open"); 4702 4712 } 4703 4713 function b(l) { 4704 4714 const m = l && l.code; 4705 4715 if (m) { 4706 for (var r = m.length, x = A("<ol></ol>").attr("class", l.type), q = -1; ++q < r; ) A("<li></li>").html(m[q]).appendTo(x);4716 for (var q = m.length, x = A("<ol></ol>").attr("class", l.type), u = -1; ++u < q; ) A("<li></li>").html(m[u]).appendTo(x); 4707 4717 0 !== l.line && x.find("li").eq(l.line - 1).attr("class", "highlighted"); 4708 u().dialog("close").html("").dialog("option", "title", l.path + ":" + l.line).append(x).dialog("open");4718 t().dialog("close").html("").dialog("option", "title", l.path + ":" + l.line).append(x).dialog("open"); 4709 4719 } 4710 4720 } … … 4717 4727 return { 4718 4728 load: function(l) { 4719 u().html('<div class="loco-loading"></div>').dialog("option", "title", "Loading..").off("dialogopen").dialog("open").on("dialogopen", k);4729 t().html('<div class="loco-loading"></div>').dialog("option", "title", "Loading..").off("dialogopen").dialog("open").on("dialogopen", k); 4720 4730 l = A.extend({ 4721 4731 ref: l, … … 4728 4738 return w; 4729 4739 }({}, K, M)); 4730 D.register("12", function(w, t, E) {4740 D.register("12", function(w, r, E) { 4731 4741 function y() { 4732 4742 this.inf = {}; … … 4736 4746 let l, m; 4737 4747 return { 4738 sniff: function( r) {4739 if ( r=== l) return m;4740 l = r;4741 if (k.test( r) || g.test(r)) if (b.innerHTML = r, b.textContent !== r) return m = !0;4748 sniff: function(q) { 4749 if (q === l) return m; 4750 l = q; 4751 if (k.test(q) || g.test(q)) if (b.innerHTML = q, b.textContent !== q) return m = !0; 4742 4752 return m = !1; 4743 4753 } … … 4750 4760 return k; 4751 4761 }; 4752 const u= y.prototype;4753 u.init = function(b) {4762 const t = y.prototype; 4763 t.init = function(b) { 4754 4764 this.inf = b || {}; 4755 4765 return this; 4756 4766 }; 4757 u.param = function(b) {4767 t.param = function(b) { 4758 4768 return this.inf[b] || ""; 4759 4769 }; 4760 u.key = function() {4770 t.key = function() { 4761 4771 return this.param("key") || ""; 4762 4772 }; 4763 u.getId = function() {4773 t.getId = function() { 4764 4774 return this.param("id") || "none"; 4765 4775 }; 4766 u.getUrl = function() {4776 t.getUrl = function() { 4767 4777 return this.param("url") || ""; 4768 4778 }; 4769 u.toString = function() {4779 t.toString = function() { 4770 4780 return this.param("name") || this.getId(); 4771 4781 }; 4772 u.getSrc = function() {4782 t.getSrc = function() { 4773 4783 return this.param("src") || "en"; 4774 4784 }; 4775 u.setSrc = function(b) {4785 t.setSrc = function(b) { 4776 4786 this.inf.src = this.mapLang(b, this.getLangMap()); 4777 4787 }; 4778 u.stderr = function(b) {4779 const k = ( t.loco || {}).notices;4788 t.stderr = function(b) { 4789 const k = (r.loco || {}).notices; 4780 4790 k && k.error && k.error(String(this) + ": " + String(b)); 4781 4791 }; 4782 u.xhrError = function(b, k, g) {4792 t.xhrError = function(b, k, g) { 4783 4793 try { 4784 const l = b.responseText, m = l && t.JSON.parse(l);4794 const l = b.responseText, m = l && r.JSON.parse(l); 4785 4795 g = m && this.parseError(m) || g; 4786 4796 } catch (l) {} 4787 4797 return g || this.httpError(b); 4788 4798 }; 4789 u.httpError = function(b) {4799 t.httpError = function(b) { 4790 4800 return (b = b && b.status) && 200 !== b ? "Responded status " + b : "Unknown error"; 4791 4801 }; 4792 u.parseError = function(b) {4802 t.parseError = function(b) { 4793 4803 return b && b.error || ""; 4794 4804 }; 4795 u.mapLang = function(b, k) {4805 t.mapLang = function(b, k) { 4796 4806 const g = String(b).replace("_", "-").toLowerCase(); 4797 4807 var l = b.lang; … … 4805 4815 return k[0]; 4806 4816 }; 4807 u.getLangMap = function() {4817 t.getLangMap = function() { 4808 4818 return {}; 4809 4819 }; 4810 u.maxChr = function() {4820 t.maxChr = function() { 4811 4821 return 0; 4812 4822 }; 4813 u.fixURL = function(b) {4823 t.fixURL = function(b) { 4814 4824 b = b.split("://", 2); 4815 4825 1 === b.length && b.unshift("https"); 4816 4826 return b[0] + "://" + b[1].replace(/\/{2,}/g, "/"); 4817 4827 }; 4818 u.translate = function(b, k, g) {4828 t.translate = function(b, k, g) { 4819 4829 return this.batch([ b ], k, this.isHtml(b.source), g); 4820 4830 }; 4821 u.unwind = function(b, k) {4831 t.unwind = function(b, k) { 4822 4832 const g = [], l = b.length; 4823 4833 for (let m = 0; m < l; m++) g.push(b[m][k]); 4824 4834 return g; 4825 4835 }; 4826 u.contextualize = function(b) {4836 t.contextualize = function(b) { 4827 4837 return [ b.context || "", b.notes || "" ].join("\n").trim(); 4828 4838 }; 4829 u.verify = function(b) {4839 t.verify = function(b) { 4830 4840 return this.translate({ 4831 4841 source: "OK", … … 4841 4851 }); 4842 4852 }; 4843 u.hash = function() {4853 t.hash = function() { 4844 4854 return this.key(); 4845 4855 }; 4846 u._call = function(b) {4856 t._call = function(b) { 4847 4857 const k = this; 4848 4858 k.state = null; … … 4854 4864 return k.abortable(A.ajax(b)); 4855 4865 }; 4856 u.abortable = function(b) {4866 t.abortable = function(b) { 4857 4867 const k = this; 4858 4868 b.always(function() { … … 4861 4871 return k.$r = b; 4862 4872 }; 4863 u.abort = function() {4873 t.abort = function() { 4864 4874 const b = this.$r; 4865 4875 b && b.abort(); 4866 4876 }; 4867 u.isHtml = function(b) {4877 t.isHtml = function(b) { 4868 4878 return (e || (e = p())).sniff(b); 4869 4879 }; … … 4871 4881 return w; 4872 4882 }({}, K, M)); 4873 D.register("13", function(w, t, E) {4883 D.register("13", function(w, r, E) { 4874 4884 function y(p) { 4875 4885 this.api = p; … … 4879 4889 return new y(p); 4880 4890 }; 4881 t= y.prototype;4882 t.init = function(p, u) {4891 r = y.prototype; 4892 r.init = function(p, t) { 4883 4893 function e(c) { 4884 4894 let d = { … … 4893 4903 function b(c, d, h) { 4894 4904 var n = c.source(null, h); 4895 if (n && (c.untranslated(h) || u)) {4905 if (n && (c.untranslated(h) || t)) { 4896 4906 { 4897 4907 h = c.notes(); 4898 const z= c.context();4908 const C = c.context(); 4899 4909 c = n.length; 4900 4910 var v = g.isHtml(n); 4901 4911 n = { 4902 4912 source: n, 4903 context: z,4913 context: C, 4904 4914 notes: h 4905 4915 }; … … 4907 4917 v = h.items; 4908 4918 if (f && c > f) x++, c = void 0; else { 4909 if (h.length + c > q|| 50 === v.length) h = e(h), v = h.items;4919 if (h.length + c > u || 50 === v.length) h = e(h), v = h.items; 4910 4920 v.push(n); 4911 4921 h.length += c; 4912 4922 m += c; 4913 r+= 1;4923 q += 1; 4914 4924 c = n; 4915 4925 } … … 4919 4929 } 4920 4930 const k = [], g = this.api; 4921 let l = [], m = 0, r = 0, x = 0, q= 1e4, f = g.maxChr();4922 f && ( q = Math.min(q, f));4931 let l = [], m = 0, q = 0, x = 0, u = 1e4, f = g.maxChr(); 4932 f && (u = Math.min(u, f)); 4923 4933 e({ 4924 4934 html: !1 … … 4936 4946 l = []; 4937 4947 this.chars = m; 4938 this.length = r;4948 this.length = q; 4939 4949 this.batches = k; 4940 4950 this.locale = a; 4941 x && g.stderr("Strings over " + q+ " characters long will be skipped");4942 }; 4943 t.abort = function() {4951 x && g.stderr("Strings over " + u + " characters long will be skipped"); 4952 }; 4953 r.abort = function() { 4944 4954 this.state = "abort"; 4945 4955 return this; 4946 4956 }; 4947 t.dispatch = function(p) {4948 function u(C, B) {4957 r.dispatch = function(p) { 4958 function t(B, z) { 4949 4959 if (!b()) return !1; 4950 if (! B) return !0;4960 if (!z) return !0; 4951 4961 c++; 4952 const F = p.row( C.id), G = C.source;4962 const F = p.row(B.id), G = B.source; 4953 4963 let H = 0; 4954 4964 F.each(function(J, O, R) { 4955 B !== R && (G === O || 1 < J && F.source(null, 1) === G) && (F.translate(B, J),4965 z !== R && (G === O || 1 < J && F.source(null, 1) === G) && (F.translate(z, J), 4956 4966 H++, h++); 4957 4967 }); 4958 H && r("each", [ F ]);4959 } 4960 function e( C) {4961 return function( B, F) {4962 u(C[B], F);4968 H && q("each", [ F ]); 4969 } 4970 function e(B) { 4971 return function(z, F) { 4972 t(B[z], F); 4963 4973 return !0; 4964 4974 }; 4965 4975 } 4966 4976 function b() { 4967 return "abort" === x.state ? ( q && (q.abort(), m()), !1) : !0;4977 return "abort" === x.state ? (u && (u.abort(), m()), !1) : !0; 4968 4978 } 4969 4979 function k() { 4970 const C= f.shift();4971 if ( C) {4972 const B = C.items;4973 B && B.length ? q.batch(B, a, C.html, e(B)).fail(g).always(l) : l();4980 const B = f.shift(); 4981 if (B) { 4982 const z = B.items; 4983 z && z.length ? u.batch(z, a, B.html, e(z)).fail(g).always(l) : l(); 4974 4984 } else m(); 4975 4985 } … … 4980 4990 function l() { 4981 4991 d++; 4982 r("prog", [ d, v ]);4992 q("prog", [ d, v ]); 4983 4993 b() && k(); 4984 4994 } 4985 4995 function m() { 4986 q= f = null;4987 r("done");4988 } 4989 function r(C, B) {4990 C = z[C] || [];4991 let F = C.length;4992 for (;0 <= --F; ) C[F].apply(null, B);4993 } 4994 let x = this, q = x.api, f = x.batches || [], a = x.locale, c = 0, d = 0, h = 0, n = x.length, v = f.length, z= {4996 u = f = null; 4997 q("done"); 4998 } 4999 function q(B, z) { 5000 B = C[B] || []; 5001 let F = B.length; 5002 for (;0 <= --F; ) B[F].apply(null, z); 5003 } 5004 let x = this, u = x.api, f = x.batches || [], a = x.locale, c = 0, d = 0, h = 0, n = x.length, v = f.length, C = { 4995 5005 done: [], 4996 5006 each: [], … … 5000 5010 k(); 5001 5011 return { 5002 done: function( C) {5003 z.done.push(C);5004 return this; 5005 }, 5006 each: function( C) {5007 z.each.push(C);5008 return this; 5009 }, 5010 prog: function( C) {5011 z.prog.push(C);5012 done: function(B) { 5013 C.done.push(B); 5014 return this; 5015 }, 5016 each: function(B) { 5017 C.each.push(B); 5018 return this; 5019 }, 5020 prog: function(B) { 5021 C.prog.push(B); 5012 5022 return this; 5013 5023 }, … … 5026 5036 return w; 5027 5037 }({}, K, M)); 5028 D.register("14", function(w, t, E) {5038 D.register("14", function(w, r, E) { 5029 5039 function y() {} 5030 5040 w.create = function(p) { 5031 (y.prototype = new p()).batch = function( u, e, b, k) {5041 (y.prototype = new p()).batch = function(t, e, b, k) { 5032 5042 function g(x) { 5033 let q= -1;5034 for (;++ q < m && !1 !== k(q, x[q], e); );5035 } 5036 const l = t.loco, m = u.length;5037 u= {5043 let u = -1; 5044 for (;++u < m && !1 !== k(u, x[u], e); ); 5045 } 5046 const l = r.loco, m = t.length; 5047 t = { 5038 5048 hook: this.getId(), 5039 5049 type: b ? "html" : "text", 5040 5050 locale: String(e), 5041 5051 source: this.getSrc(), 5042 sources: u5043 }; 5044 const r= A.Deferred();5045 this.abortable(l.ajax.post("apis", u, function(x) {5052 sources: t 5053 }; 5054 const q = A.Deferred(); 5055 this.abortable(l.ajax.post("apis", t, function(x) { 5046 5056 g(x && x.targets || []); 5047 r.resolve();5057 q.resolve(); 5048 5058 }, function() { 5049 5059 g([]); 5050 r.reject();5060 q.reject(); 5051 5061 })); 5052 return r.promise();5062 return q.promise(); 5053 5063 }; 5054 5064 return new y(); … … 5062 5072 jv: [ "jw" ] 5063 5073 }); 5064 D.register("15", function(w, t, E) {5074 D.register("15", function(w, r, E) { 5065 5075 function y() {} 5066 5076 w.create = function(p) { … … 5069 5079 return "Google Translate"; 5070 5080 }; 5071 p.parseError = function( u) {5072 if ( u.error) {5073 const e = [], b = u.error.errors || [], k = b.length;5081 p.parseError = function(t) { 5082 if (t.error) { 5083 const e = [], b = t.error.errors || [], k = b.length; 5074 5084 let g = -1; 5075 5085 for (;++g < k; ) e.push(b[g].message || ""); 5076 return "Error " + u.error.code + ": " + e.join(";");5086 return "Error " + t.error.code + ": " + e.join(";"); 5077 5087 } 5078 5088 return ""; … … 5081 5091 return D.require("24"); 5082 5092 }; 5083 p.batch = function( u, e, b, k) {5084 function g( q) {5093 p.batch = function(t, e, b, k) { 5094 function g(u) { 5085 5095 const f = x.length; 5086 5096 let a = -1; 5087 for (;++a < f && !1 !== k(a, ( q[a] || {}).translatedText || "", e); );5097 for (;++a < f && !1 !== k(a, (u[a] || {}).translatedText || "", e); ); 5088 5098 } 5089 5099 const l = this, m = l.getSrc(); 5090 5100 b = b ? "html" : "text"; 5091 const r = l.mapLang(e, l.getLangMap()), x = this.unwind(u, "source");5101 const q = l.mapLang(e, l.getLangMap()), x = this.unwind(t, "source"); 5092 5102 return l._call({ 5093 url: "https://translation.googleapis.com/language/translate/v2?source=" + m + "&target=" + r+ "&format=" + b,5103 url: "https://translation.googleapis.com/language/translate/v2?source=" + m + "&target=" + q + "&format=" + b, 5094 5104 method: "POST", 5095 5105 traditional: !0, … … 5098 5108 q: x 5099 5109 } 5100 }).done(function( q, f, a) {5101 q.data ? g(q.data.translations || []) : (l.stderr(l.parseError(q) || l.httpError(a)),5110 }).done(function(u, f, a) { 5111 u.data ? g(u.data.translations || []) : (l.stderr(l.parseError(u) || l.httpError(a)), 5102 5112 g([])); 5103 5113 }).fail(function() { … … 5113 5123 pt: [ "pt", "pt-pt", "pt-br" ] 5114 5124 }); 5115 D.register("16", function(w, t, E) {5125 D.register("16", function(w, r, E) { 5116 5126 function y() {} 5117 5127 w.create = function(p) { 5118 5128 p = y.prototype = new p(); 5119 p.parseError = function( u) {5120 var e = u.details || {};5129 p.parseError = function(t) { 5130 var e = t.details || {}; 5121 5131 let b = e.message; 5122 5132 e = e.texts; … … 5124 5134 k += -1 === k.indexOf("?") ? "?" : "&"; 5125 5135 return k + "ref=loco"; 5126 }), "Error " + ( u.status || "0") + ": " + b) : "";5136 }), "Error " + (t.status || "0") + ": " + b) : ""; 5127 5137 }; 5128 5138 p.maxChr = function() { … … 5132 5142 return D.require("25"); 5133 5143 }; 5134 p.batch = function( u, e, b, k) {5135 function g( q) {5144 p.batch = function(t, e, b, k) { 5145 function g(u) { 5136 5146 const f = x.length; 5137 let a = -1, c = ( q[0] || {5147 let a = -1, c = (u[0] || { 5138 5148 translated: [] 5139 5149 }).translated || []; 5140 for (;++a < f && ( q = c[a] || "", !1 !== k(a, q, e)); );5150 for (;++a < f && (u = c[a] || "", !1 !== k(a, u, e)); ); 5141 5151 } 5142 5152 const l = this; 5143 5153 b = this.getSrc(); 5144 const m = l.param("api") || "https://api.lecto.ai", r = l.mapLang(e, l.getLangMap()), x = this.unwind(u, "source");5154 const m = l.param("api") || "https://api.lecto.ai", q = l.mapLang(e, l.getLangMap()), x = this.unwind(t, "source"); 5145 5155 return l._call({ 5146 5156 url: l.fixURL(m + "/v1/translate/text"), 5147 5157 method: "POST", 5148 5158 data: JSON.stringify({ 5149 to: [ r],5159 to: [ q ], 5150 5160 from: b, 5151 5161 texts: x … … 5156 5166 Accept: "application/json" 5157 5167 } 5158 }).done(function( q, f, a) {5159 q ? g(q.translations || []) : (l.stderr(l.parseError(q) || l.httpError(a)), g([]));5168 }).done(function(u, f, a) { 5169 u ? g(u.translations || []) : (l.stderr(l.parseError(u) || l.httpError(a)), g([])); 5160 5170 }).fail(function() { 5161 5171 g([]); … … 5179 5189 "zh-tw": [ "zh-hant" ] 5180 5190 }); 5181 D.register("17", function(w, t, E) {5191 D.register("17", function(w, r, E) { 5182 5192 function y() {} 5183 5193 w.create = function(p) { … … 5186 5196 return "Microsoft Translator text API"; 5187 5197 }; 5188 p.parseError = function( u) {5189 return u && u.error ? u.error.message : "";5198 p.parseError = function(t) { 5199 return t && t.error ? t.error.message : ""; 5190 5200 }; 5191 5201 p.maxChr = function() { … … 5201 5211 return this.key() + this.region(); 5202 5212 }; 5203 p.batch = function( u, e, b, k) {5213 p.batch = function(t, e, b, k) { 5204 5214 function g(a) { 5205 5215 let c = -1; … … 5207 5217 !1 !== k(c, d.text || "", e)); ); 5208 5218 } 5209 let l = this, m = [], r= l.getSrc();5210 u = this.unwind(u, "source");5211 let x = u.length, q= -1;5219 let l = this, m = [], q = l.getSrc(); 5220 t = this.unwind(t, "source"); 5221 let x = t.length, u = -1; 5212 5222 b = b ? "html" : "plain"; 5213 5223 let f = l.mapLang(e, l.getLangMap()); 5214 for (;++ q< x; ) m.push({5215 Text: u[q]5224 for (;++u < x; ) m.push({ 5225 Text: t[u] 5216 5226 }); 5217 5227 return l._call({ 5218 url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=" + r+ "&to=" + f + "&textType=" + b,5228 url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=" + q + "&to=" + f + "&textType=" + b, 5219 5229 method: "POST", 5220 5230 data: JSON.stringify(m), … … 5234 5244 return w; 5235 5245 }({}, K, M)); 5236 D.register("18", function(w, t, E) {5246 D.register("18", function(w, r, E) { 5237 5247 w.init = function(y) { 5238 5248 function p() { 5239 O || ( B.on("click", m), O = A('<div id="loco-fs-creds"></div>').dialog({5249 O || (z.on("click", m), O = A('<div id="loco-fs-creds"></div>').dialog({ 5240 5250 dialogClass: "request-filesystem-credentials-dialog loco-modal", 5241 5251 minWidth: 580, … … 5248 5258 return O; 5249 5259 } 5250 function u() {5260 function t() { 5251 5261 G && (e(A(a)), G = !1); 5252 5262 if (h && J) { … … 5262 5272 } 5263 5273 function b() { 5264 if (h) return O && O.dialog("close"), u(), A(y).find('button[type="submit"]').attr("disabled", !1),5265 A( t).triggerHandler("resize"), f && f(!0), !0;5274 if (h) return O && O.dialog("close"), t(), A(y).find('button[type="submit"]').attr("disabled", !1), 5275 A(r).triggerHandler("resize"), f && f(!0), !0; 5266 5276 v && O ? (G || (A(a).removeClass("jshide").hide().fadeIn(500), G = !0), H && (e(A(F)), 5267 H = !1)) : u();5277 H = !1)) : t(); 5268 5278 A(y).find('input[type="submit"]').attr("disabled", !0); 5269 5279 f && f(!1); … … 5280 5290 I.preventDefault(); 5281 5291 I = A(I.target).serializeArray(); 5282 q(I);5292 u(I); 5283 5293 d = !0; 5284 5294 return !1; … … 5294 5304 return !1; 5295 5305 } 5296 function r(I) {5306 function q(I) { 5297 5307 h = I.authed; 5298 5308 c = I.method; … … 5308 5318 Q.find('input[type="submit"]').addClass("button-primary"); 5309 5319 b(); 5310 A( t).triggerHandler("resize");5320 A(r).triggerHandler("resize"); 5311 5321 } else n.notices.error("Server didn't return credentials, nor a prompt for credentials"); 5312 5322 } … … 5314 5324 b(); 5315 5325 } 5316 function q(I) {5326 function u(I) { 5317 5327 d = !1; 5318 n.ajax.setNonce("fsConnect", C).post("fsConnect", I, r, x);5328 n.ajax.setNonce("fsConnect", B).post("fsConnect", I, q, x); 5319 5329 return I; 5320 5330 } 5321 var f, a = y, c = null, d = !1, h = !1, n = t.loco, v = y.path.value, z = y.auth.value, C = y["loco-nonce"].value, B= A(a).find("button.button-primary"), F = E.getElementById(a.id + "-warn"), G = !1, H = !1, J = "", O;5331 var f, a = y, c = null, d = !1, h = !1, n = r.loco, v = y.path.value, C = y.auth.value, B = y["loco-nonce"].value, z = A(a).find("button.button-primary"), F = E.getElementById(a.id + "-warn"), G = !1, H = !1, J = "", O; 5322 5332 n.notices.convert(F).stick(); 5323 5333 if (y.connection_type) { … … 5325 5335 R.connection_type = y.connection_type.value; 5326 5336 h = !0; 5327 } else v && z && q({5337 } else v && C && u({ 5328 5338 path: v, 5329 auth: z5339 auth: C 5330 5340 }); 5331 5341 b(); … … 5346 5356 connect: function() { 5347 5357 v = y.path.value; 5348 z= y.auth.value;5349 q(A(y).serializeArray());5358 C = y.auth.value; 5359 u(A(y).serializeArray()); 5350 5360 return this; 5351 5361 }, … … 5362 5372 return w; 5363 5373 }({}, K, M)); 5364 D.register("27", function(w, t, E) {5374 D.register("27", function(w, r, E) { 5365 5375 function y(b, k) { 5366 5376 return function(g) { … … 5376 5386 }; 5377 5387 } 5378 function u(b) {5388 function t(b) { 5379 5389 return function(k, g) { 5380 5390 return (k && k[b] || "").localeCompare(g && g[b] || ""); … … 5387 5397 } 5388 5398 w.sort = function(b, k, g, l) { 5389 k = "n" === g ? p(k) : u(k);5399 k = "n" === g ? p(k) : t(k); 5390 5400 l && (k = e(k)); 5391 5401 return y([].sort, [ k ])(b); … … 5393 5403 return w; 5394 5404 }({}, K, M)); 5395 D.register("19", function(w, t, E) {5405 D.register("19", function(w, r, E) { 5396 5406 w.init = function(y) { 5397 5407 function p(a) { 5398 5408 let c = -1; 5399 5409 const d = a.length; 5400 for (A("tr", r).remove(); ++c < d; ) r.appendChild(a[c].$);5401 } 5402 function u(a) {5403 g = a ? q.find(a, e) : e.slice(0);5410 for (A("tr", q).remove(); ++c < d; ) q.appendChild(a[c].$); 5411 } 5412 function t(a) { 5413 g = a ? u.find(a, e) : e.slice(0); 5404 5414 m && (a = b[m], g = f(g, m, a.type, a.desc)); 5405 5415 p(g); 5406 5416 } 5407 let e = [], b = [], k = 0, g, l, m, r= y.getElementsByTagName("tbody")[0];5417 let e = [], b = [], k = 0, g, l, m, q = y.getElementsByTagName("tbody")[0]; 5408 5418 var x = y.getElementsByTagName("thead")[0]; 5409 let q= D.require("a").init(), f = D.require("27").sort;5410 x && r&& (A("th", x).each(function(a, c) {5419 let u = D.require("a").init(), f = D.require("27").sort; 5420 x && q && (A("th", x).each(function(a, c) { 5411 5421 const d = c.getAttribute("data-sort-type"); 5412 5422 d && (a = k, A(c).addClass("loco-sort").on("click", function(h) { … … 5414 5424 { 5415 5425 h = a; 5416 let n = b[h], v = n.type, z= !(n.desc = !n.desc);5417 g = f(g || e.slice(0), h, v, z);5426 let n = b[h], v = n.type, C = !(n.desc = !n.desc); 5427 g = f(g || e.slice(0), h, v, C); 5418 5428 p(g); 5419 5429 l && l.removeClass("loco-desc loco-asc"); 5420 l = A(n.$).addClass( z ? "loco-desc" : "loco-asc").removeClass(z? "loco-asc" : "loco-desc");5430 l = A(n.$).addClass(C ? "loco-desc" : "loco-asc").removeClass(C ? "loco-asc" : "loco-desc"); 5421 5431 m = h; 5422 5432 } … … 5427 5437 }); 5428 5438 c.hasAttribute("colspan") ? k += Number(c.getAttribute("colspan")) : k++; 5429 }), A("tr", r).each(function(a, c) {5439 }), A("tr", q).each(function(a, c) { 5430 5440 let d, h = [], n = { 5431 5441 _: a, … … 5433 5443 }, v = c.getElementsByTagName("td"); 5434 5444 for (d in b) { 5435 const z= v[d];5436 (c = z.textContent.replace(/(^\s+|\s+$)/g, "")) && h.push(c);5437 z.hasAttribute("data-sort-value") && (c = z.getAttribute("data-sort-value"));5445 const C = v[d]; 5446 (c = C.textContent.replace(/(^\s+|\s+$)/g, "")) && h.push(c); 5447 C.hasAttribute("data-sort-value") && (c = C.getAttribute("data-sort-value")); 5438 5448 switch (b[d].type) { 5439 5449 case "n": … … 5443 5453 } 5444 5454 e[a] = n; 5445 q.index(a, h);5455 u.index(a, h); 5446 5456 }), y = A('form.loco-filter input[type="text"]', y.parentNode), y.length && (y = y[0], 5447 x = A(y.form), 1 < e.length ? D.require("b").listen(y, u) : x.hide(), x.on("submit", function(a) {5457 x = A(y.form), 1 < e.length ? D.require("b").listen(y, t) : x.hide(), x.on("submit", function(a) { 5448 5458 a.preventDefault(); 5449 5459 return !1; … … 5492 5502 }; 5493 5503 T.fs = D.require("18"); 5494 A("#loco-admin.wrap table.wp-list-table").each(function(w, t) {5495 D.require("19").init( t);5504 A("#loco-admin.wrap table.wp-list-table").each(function(w, r) { 5505 D.require("19").init(r); 5496 5506 }); 5497 5507 T.validate = function(w) { -
loco-translate/trunk/readme.txt
r3433545 r3433719 109 109 * Added support for other chat completion APIs via `vendor` config field 110 110 * Fixed single colon usage bug during chat completions 111 * Autoloader no longer throws when Loco_ class not found 112 * Refreshing Ajax nonces on WordPress heartbeat 111 113 * Bumped WordPress compatibility to 6.9 112 114 -
loco-translate/trunk/src/ajax/SaveController.php
r2613726 r3433719 9 9 */ 10 10 public function render(){ 11 11 12 12 $post = $this->validate(); 13 13 14 14 15 // path parameter must not be empty 15 16 $path = $post->path; -
loco-translate/trunk/src/data/CompiledData.php
r2876492 r3433719 45 45 private function __construct( $name ){ 46 46 $path = 'lib/data/'.$name.'.php'; 47 $this->data = loco_include( $path );47 $this->data = loco_include( $path, true ); 48 48 $this->name = $name; 49 49 } -
loco-translate/trunk/src/hooks/AdminHooks.php
r3051619 r3433719 45 45 // @codeCoverageIgnoreStart 46 46 if( loco_doing_ajax() ){ 47 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] :'';47 $action = $_REQUEST['action'] ?? ''; 48 48 // initialize Ajax router before hook fired so we can handle output buffering 49 if( 'loco_' === substr($action,0,5) && isset($_REQUEST['route']) ){49 if( isset($_REQUEST['route']) && str_starts_with($action,'loco_') ){ 50 50 spl_autoload_register( [__CLASS__,'autoload_compat'] ); 51 51 $this->router = new Loco_mvc_AjaxRouter; … … 150 150 /** 151 151 * pre_update_option_{$option} filter callback for $option = "active_plugins" 152 * @param array|null $value Active plugins 153 * @return array 154 */ 155 public function filter_pre_update_option_active_plugins( $value = null ){ 152 */ 153 public function filter_pre_update_option_active_plugins( ?array $value = null ){ 156 154 $this->purge_wp_cache(); 157 155 return $value; … … 161 159 /** 162 160 * pre_update_site_option_{$option} filter callback for $option = "active_sitewide_plugins" 163 * @param array|null $value Active sitewide plugins 164 * @return array 165 */ 166 public function filter_pre_update_site_option_active_sitewide_plugins( $value = null ){ 161 */ 162 public function filter_pre_update_site_option_active_sitewide_plugins( ?array $value = null ){ 167 163 $this->purge_wp_cache(); 168 164 return $value; 165 } 166 167 168 /** 169 * heartbeat_received filter callback 170 */ 171 public function filter_heartbeat_received( ?array $response = null, ?array $data = null ){ 172 if( is_array($data) && array_key_exists('loco-translate',$data) ){ 173 $nonces = $data['loco-translate']['nonces'] ?? []; 174 foreach( $nonces as $action => $value ){ 175 // Refresh nonce if it's either expired, or in its second tick. 176 // Ajax controllers check user permissions before nonce is checked. 177 if( 1 !== wp_verify_nonce($value,$action) ){ 178 $nonces[$action] = wp_create_nonce($action); 179 } 180 } 181 $response['loco-translate']['nonces'] = $nonces; 182 } 183 return $response; 169 184 } 170 185 -
loco-translate/trunk/src/mvc/AdminRouter.php
r3082470 r3433719 7 7 /** 8 8 * Current admin page controller 9 * @var Loco_mvc_AdminController 10 */ 11 private $ctrl; 9 */ 10 private ?Loco_mvc_AdminController $ctrl = null; 12 11 13 12 … … 32 31 $render = [ $this, 'renderPage' ]; 33 32 34 // main loco pages, hooking only if has permission33 // main loco pages, hooking only if user has permission 35 34 if( $user->has_cap($cap) ){ 36 35 … … 87 86 */ 88 87 public function on_current_screen( WP_Screen $screen ){ 89 $action = isset($_GET['action']) ? $_GET['action'] : null; 90 $this->initPage( $screen, $action ); 88 $this->initPage( $screen, $_GET['action']??'' ); 91 89 } 92 90 … … 96 94 * This is called early (before renderPage) so controller can listen on other hooks. 97 95 * 98 * @param string $action99 96 * @return Loco_mvc_AdminController|null 100 97 */ 101 public function initPage( WP_Screen $screen, $action = '' ){98 public function initPage( WP_Screen $screen, string $action = '' ){ 102 99 $class = null; 103 100 $args = []; … … 268 265 * @return string 269 266 */ 270 public static function generate( $route, array $args = [] ){267 public static function generate( string $route, array $args = [] ){ 271 268 $url = null; 272 $page = null;273 269 $action = null; 274 270 // empty action targets plugin root … … 298 294 throw new UnexpectedValueException( sprintf('Invalid admin route: %s', json_encode($route) ) ); 299 295 } 300 else {301 class_exists($class,true); // <- autoloader will throw if not class found296 else if( ! class_exists($class) ){ 297 throw new Loco_error_Exception('File not found for '.$class); 302 298 } 303 299 } -
loco-translate/trunk/src/mvc/AjaxRouter.php
r3233141 r3433719 7 7 /** 8 8 * Current ajax controller 9 * @var Loco_mvc_AjaxController 10 */ 11 private $ctrl; 12 13 /** 14 * @var Loco_output_Buffer 15 */ 16 private $buffer; 9 */ 10 private ?Loco_mvc_AjaxController $ctrl = null; 11 12 /** 13 * Buffer for collecting unintentional output 14 */ 15 private ?Loco_output_Buffer $buffer = null; 17 16 18 17 /** … … 22 21 * @return string 23 22 */ 24 public static function generate( $route, array $args = [] ){23 public static function generate( string $route, array $args = [] ){ 25 24 // validate route autoload if debugging 26 if( loco_debugging() ){27 class_exists( self::routeToClass($route));25 if( loco_debugging() && ! class_exists( self::routeToClass($route) ) ){ 26 throw new Exception('Loco class not found for '.$route); 28 27 } 29 28 $args += [ … … 50 49 */ 51 50 public function on_init(){ 52 try {53 $class = self::routeToClass( $_REQUEST['route'] );54 // autoloader will throw error if controller class doesn't exist51 $this->ctrl = null; 52 $class = self::routeToClass( $_REQUEST['route'] ); 53 if( class_exists($class) ){ 55 54 $this->ctrl = new $class; 56 55 $this->ctrl->_init( $_REQUEST ); … … 59 58 do_action('loco_ajax_init', $this->ctrl ); 60 59 } 61 catch( Loco_error_Exception $e ){62 $this->ctrl = null;63 // throw $e; // <- debug64 }65 60 } 66 61 67 62 68 /** 69 * @param string $route 70 * @return string 71 */ 72 private static function routeToClass( $route ){ 63 private static function routeToClass( string $route ):string { 73 64 $route = explode( '-', $route ); 74 65 // convert route to class name, e.g. "foo-bar" => "Loco_ajax_foo_BarController" … … 166 157 // respond with deferred failure from initAjax 167 158 if( ! $this->ctrl ){ 168 $route = isset($_REQUEST['route']) ? $_REQUEST['route'] :'';159 $route = $_REQUEST['route'] ?? ''; 169 160 // translators: Fatal error where %s represents an unexpected value 170 161 throw new Loco_error_Exception( sprintf( __('Ajax route not found: "%s"','loco-translate'), $route ) ); -
loco-translate/trunk/src/mvc/Controller.php
r3092998 r3433719 82 82 } 83 83 else { 84 throw new Loco_error_Exception('Failed security check for '.$name);84 throw new Loco_error_Exception('Failed security check. Please refresh the page'); 85 85 } 86 86 } … … 117 117 /** 118 118 * number_format_i18n filter callback because our admin screens assume number_format_i18n() returns unescaped text, not HTML. 119 * @param string 119 * @param string $formatted 120 120 * @return string 121 121 */ -
loco-translate/trunk/src/test/WordPressTestCase.php
r3269005 r3433719 212 212 $router->on_admin_menu(); 213 213 $screen = get_current_screen(); 214 $action = isset($_GET['action']) ? $_GET['action'] : null;214 $action = $_GET['action'] ?? ''; 215 215 $router->initPage( $screen, $action ); 216 216 $html = get_echo( [$router,'renderPage'] );
Note: See TracChangeset
for help on using the changeset viewer.