1var addAttribute = function(x, attr, value) { 2 x.setAttribute(attr, value); 3/*-- 4 attr = document.createAttribute(attr); 5 attr.value = value; 6 7 x.setAttributeNode(attr);*/ 8}; 9 10var addCSS = function(str, uri) { 11 var style = document.getElementsByTagName('head')[0].appendChild(document.createElement('style')), replaceURIRe = new RegExp('url\\(([\\\'"])([^/])', 'ig'), replaceURI = function(str, uri) { 12 return str.replace(replaceURIRe, 'url($1' + uri.substring(0, uri.lastIndexOf('/') + 1) + '$2'); 13 }; 14/*--after ie8*/ 15 if (document.all) { 16 style = document.styleSheets[document.styleSheets.length - 1]; 17 18 addCSS = function(str, uri) { 19 style.cssText += replaceURI(str, uri); 20 }; 21 } else { 22 addCSS = function(str, uri) { 23 style.appendChild(document.createTextNode(replaceURI(str, uri))); 24 }; 25 } 26 27 addCSS(str, uri); 28}; 29/*-- 30var addEvent; 31 32if (window.addEventListener) { 33 addEvent = function(e, type, f) { 34 e.addEventListener(type, f, false); 35 } 36} else if (window.attachEvent) { 37 addEvent = function(e, type, f) { 38 e.attachEvent('on' + type, function() { 39 f.call(e, window.event); 40 }); 41 } 42};*/ 43 44var applyCSSClass = function(x, cName, f) { 45 if (x.classList) { 46 if (f) { 47 x.classList.add(cName); 48 } else { 49 x.classList.remove(cName); 50 } 51 } else if (!f) { 52 x.className = x.className.replace(cName, ''); 53 } else if (x.className.indexOf(cName) == -1) { 54 x.className += ' ' + cName; 55 } 56}; 57 58var applyPageProgress = function(f, _innerCall) { 59 if (!_innerCall) { 60 if (f) { 61 applyPageProgress.counter++; 62 } else if (applyPageProgress.counter !== 0) { 63 applyPageProgress.counter--; 64 } 65 } 66 67 if (document.body) { 68 if (applyPageProgress.counter) { 69 if (applyPageProgress.bodyHTML.parentNode != document.body) { 70 document.body.appendChild(applyPageProgress.bodyHTML); 71 72 return; 73 } 74 } else if (applyPageProgress.bodyHTML.parentNode == document.body) { 75 document.body.removeChild(applyPageProgress.bodyHTML); 76 } 77 } else if (f) { 78 setTimeout(function() { 79 applyPageProgress(true, true); 80 }, 100); 81 } 82}; 83applyPageProgress.counter = 0; 84applyPageProgress.upload = {}; 85applyPageProgress.uploadTotal = 0; 86applyPageProgress.uploadLoaded = 0; 87 88applyPageProgress.bodyHTML = document.createElement('div'); 89applyPageProgress.bodyHTML.className = 'Loading'; 90applyPageProgress.bodyHTML.appendChild(document.createTextNode('...')); //ÐагÑÑзка')); 91 92var applyProgress = function(control, f) { 93 var body = new Image(); 94 95 body.className = 'Progress'; 96 body.src = THEME_URI + '/' + PROGRESS_IMAGE_IN_THEME_URI; 97 98 applyProgress = function(control, f) { 99 control.loading = !!f; 100 101 applyPageProgress(f); 102 103 if (control.toProgressHTML) { 104 if (f) { 105 control.progressHTML = control.toProgressHTML.appendChild(body.cloneNode(true)); 106 } else if (control.progressHTML.parentNode) { 107 control.progressHTML.parentNode.removeChild(control.progressHTML); 108 } 109 } 110 }; 111 112 applyProgress(control, f); 113}; 114 115var cookieRead = function(name) { 116 var j = esc(name) + '=', i = document.cookie.indexOf(j); 117 118 if (i != -1) { 119 return dec(document.cookie.substring(i += j.length, (j = document.cookie.indexOf(';', i)) == -1 ? document.cookie.length : j)); 120 } 121}; 122 123var cookieWrite = function(name, value, path, domain, expires, secure) { 124 var cookie = esc(name) + '=' + esc(value); 125 126 if (path) { 127 cookie += ';path=' + path; 128 } 129 130 if (domain) { 131 cookie += ';domain=' + domain; 132 } 133 134 if (expires) { 135 cookie += ';expires=' + new Date(expires).toGMTString(); 136 } 137 138 if (secure) { 139 cookie += ';secure'; 140 } 141 142 document.cookie = cookie; 143}; 144 145var cookieRemove = function(name, path, domain) { 146 cookieWrite(name, '', path, domain, 'Thu, 01 Jan 1970 00:00:01 GMT'); 147}; 148 149var cmp = function(a, b) { 150 return getArray(a).sort().join('|') == getArray(b).sort().join('|'); 151}; 152 153var dec = function(val) { 154 return decodeURIComponent(getStr(val)); 155}; 156 157var esc = function(val) { 158 return encodeURIComponent(getStr(val)); 159}; 160 161var encodePathComponent = function(str) { 162 return getStr(str).replace(encodePathComponent.re, SLASH_IN_URI_PARAM); 163}; 164 165encodePathComponent.re = new RegExp('/', 'g'); 166 167var getNewId = function() { 168 return 'id' + (++window.num); 169}; 170 171var getIdById = function(id) { 172 if (!id) { 173 return; 174 } 175 176 for (var roole, ids = id.split(getIdById.orRe), i = 0; i < ids.length; i++) { 177 id = ids[i]; 178 roole = id.split(getIdById.ifRe); 179 180 if (roole.length == 2) {
181 if (getCtrl(roole[0])) { 182 id = roole[1]; 183 } else { 184 return; 185 } 186 } 187 188 if (getCtrl(id)) { 189 return id; 190 } 191 192 if (id == THIS_WIN_NAME) { 193 return window.currentWin.id; 194 } 195 } 196 197 return id; 198}; 199 200getIdById.orRe = new RegExp('\\s*\\|\\s*'); 201getIdById.ifRe = new RegExp('\\s*\\:\\s*'); 202 203var getName = function(name) { 204 if (name) { 205 for (var roole, names = name.split(getIdById.orRe), i = 0; i < names.length; i++) { 206 name = names[i]; 207 roole = name.split(getIdById.ifRe); 208 209 if (roole.length == 2) { 210 if (getCtrl(roole[0])) { 211 return roole[1]; 212 } 213 } 214 } 215 } 216 217 return name; 218}; 219 220var getSettingsById = function(id) { 221/* 222 if (DEBUG) { 223 setSettingsById(id); 224 225 return; 226 }*/ 227 228 var sett = window.settings[id]; 229 230 if (sett) { 231 return sett; 232 } 233 234 if (!!window.localStorage) { 235 sett = localStorage.getItem(id); 236 } else { 237 sett = cookieRead(id); 238 } 239 240 if (sett) { 241 try { 242 return eval('(' + sett + ')'); 243 } catch (exception) { 244 } 245 } 246}; 247 248var setSettingsById = function(id, sett, expires) { 249 if (window.localStorage) { 250 localStorage.setItem(id, serialize(sett)); 251 } else { 252 cookieWrite(id, serialize(sett), '/', undefined, expires); 253 } 254} 255 256var getDocumentElement = function(x) { 257 if (x) { 258 return x.documentElement || x; 259 } 260}; 261 262var getFileURI = function(value, notes, isImage) { 263 var uri = notes.module ? '/' + notes.module : (notes.uri || FILE_URI); 264/* 265 if (notes.module) { 266 notes.uri = '/' + notes.module; 267 } else if (!notes.uri) { 268 notes.uri = FILE_URI; <-obfuscator error 269 } 270 271 var uri = notes.uri;*/ 272 273 if (notes.schema) { 274 uri += '/' + SCHEMA_PARAM + '/' + notes.schema; 275 } 276 277 uri += '/' + TABLE_PARAM + '/' + notes.table; 278 279 if (notes.field) { 280 uri += '/' + FIELD_PARAM + '/' + notes.field; 281 } 282 283 if (notes.contentField) { 284 uri += '/' + CONTENT_FIELD_PARAM + '/' + notes.contentField; 285 } 286 287 if (!isImage) { 288 if (notes.contentTypeField) { 289 uri += '/' + CONTENT_TYPE_FIELD_PARAM + '/' + notes.contentTypeField; 290 } 291 292 if (notes.contentSizeField) { 293 uri += '/' + CONTENT_SIZE_FIELD_PARAM + '/' + notes.contentSizeField; 294 } 295 } 296 297 if (notes.equalityField) { 298 uri += '/' + EQUALITY_FIELD_PARAM + '/' + notes.equalityField; 299 } 300 301 if (value) { 302 uri += '/' + EQUALITY_PARAM + '/' + value; 303 } 304 305 if (notes.tableFrom && notes.foreignKeyField && notes.onField) { 306 uri += '/' + TABLE_FROM_PARAM + '/' + notes.tableFrom + '/' + FOREIGN_KEY_FIELD_PARAM + '/' + notes.foreignKeyField + '/' + ON_FIELD_PARAM + '/' + notes.onField; 307 } 308 309 return uri; 310}; 311 312var getImageURI = function(value, notes, format) { 313 notes.uri = IMAGE_URI; 314 315 var uri = getFileURI(value, notes, true); 316 317 if (notes.width) { 318 uri += '/' + WIDTH_PARAM + '/' + notes.width; 319 } 320 321 if (notes.height) { 322 uri += '/' + HEIGHT_PARAM + '/' + notes.height; 323 } 324 325 if (notes.noCrop) { 326 uri += '/' + NO_CROP_PARAM + '/' + notes.noCrop; 327 } 328 329 if (notes.sharp) { 330 uri += '/' + SHARP_PARAM + '/' + notes.sharp; 331 } 332 333 return uri + '/' + (!notes.schema && window['poliglot_suffix'] ? window['poliglot_suffix'] : 1) + '/' + (format || '1.jpg'); 334}; 335 336var getModalURI = function(uri) { 337 return MODAL_URI + '?' + encodeURIComponent(URI_PARAM) + '=' + encodeURIComponent(uri); 338}; 339 340var getFrom = function(x, win) { 341 if (!win) { 342 win = window; 343 } 344 345 var from = { 346 parent: x.parentNode, 347 before: x.nextSibling 348 }; 349 350 if (win.isModal) { 351 from.body = from.scroll = win.contentHTML; 352 } else { 353 from.body = win.from.body; 354 from.scroll = win.from.scroll; 355 } 356 357 x.parentNode.removeChild(x); 358 359 return from; 360}; 361/*-- 362var getXMLHttpRequest; 363 364if (window.XMLHttpRequest) { 365 getXMLHttpRequest = function() { 366 return new XMLHttpRequest(); 367 } 368} else { 369 (function() { 370 for (var name, XMLHttps = ['Microsoft.XMLHTTP', 'Msxml2.XMLHTTP', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP.6.0'], i = XMLHttps.length - 1; i > -1; i--) { 371 try { 372 new ActiveXObject(name = XMLHttps[i]); 373 374 getXMLHttpRequest = function() { 375 return new ActiveXObject(name); 376 } 377 378 return; 379 } catch (exception) { 380 } 381 } 382 })(); 383}*/ 384 385var getMyAttribute = function(x, i) {
386 return x.getAttribute(HTML_ATTRIBUTE_PREFIX + i); 387}; 388 389var getElements = function(e, cmp, isNotRecursion) { 390 var arr = []; 391 392 for (e = e.firstChild; e; e = e.nextSibling) { 393 if (cmp(e)) { 394 arr.push(e); 395 } 396 397 if (!isNotRecursion && e.firstChild) { 398 arr = arr.concat(getElements(e, cmp, isNotRecursion)); 399 } 400 } 401 402 return arr; 403}; 404 405var getElementPosition = function(i, e) { 406 var applicants = i.getElementsByTagName(e.tagName); 407 408 for (i = 0; i < applicants.length; i++) { 409 if (applicants[i] == e) { 410 return { 411 tagName: e.tagName, 412 position: i 413 }; 414 } 415 } 416}; 417 418var getElementByPosition = function(e, pos) { 419 return pos ? e.getElementsByTagName(pos.tagName)[pos.position] : e; 420}; 421 422var getScriptDirectory = function(uri) { 423 for (var scripts = document.getElementsByTagName('script'), i = 0; i < scripts.length; i++) { 424 if (scripts[i].src && scripts[i].src.indexOf(uri) != -1) { 425 var src = scripts[i].src.replace(new RegExp('^https*:\/\/.+?/'), '/'); 426 427 return src.substring(0, src.indexOf(uri) - 1); 428 } 429 } 430}; 431/*-- 432var getURI = function(uri, notes) { 433 var j, params = []; 434 435 for (var i in notes) { 436 if (notes[i] instanceof Array) { 437 for (j = notes[i].length - 1; j > -1; j--) { 438//encodeURIComponent( 439 params.unshift(i + '=' + esc(notes[i][j])); 440 } 441 } else { 442 params.push(i + '=' + esc(notes[i])); 443 } 444 } 445 446 if (params.length) { 447 uri += (uri.indexOf('?') == -1 ? '?' : '&') + params.join('&'); 448 } 449 450 return uri; 451};*/ 452 453var getURI = function(uri, win) { 454 if (!win) { 455 win = window; 456 } 457 458 if (!win.uri) { 459 win.uri = window.uri; 460 } 461 462 if (uri) { 463 if (uri.indexOf('/') === 0) { 464 return uri; 465 } 466 467 return win.uri.substring(0, win.uri.lastIndexOf('/') + 1) + uri; 468 } 469 470 return win.uri; 471}; 472 473var getString = function(i) { 474 switch (typeof(i)) { 475 case 'string': 476 return i; 477 478 case 'object': 479 if (i === null) { 480 return ''; 481 } 482 483 var j, obj; 484 485 if (i instanceof Array) { 486 obj = []; 487 488 for (j = 0; j < i.length; j++) { 489 obj.push(getString(i[j])); 490 } 491 492 return obj.length ? (obj) : ''; 493 } else { 494 obj = {}; 495 496 for (j in i) { 497 obj[j] = getString(i[j]); 498 } 499 500 return obj; 501 } 502 503 case 'number': 504 return i.toString(); 505 506 case 'undefined': 507 return ''; 508 509 case 'boolean': 510 return i ? '1' : '0'; 511 } 512}; 513/* 514var xmlToJSON = function(x) { 515 if (!x) { 516 return; 517 } 518 var obj = {}, i = x.firstChild; 519 while (i) { 520 if (i.tagName) { 521 } 522 obj[j.tagName] = this._xGetValue(j); 523 j = j.nextSibling; 524 } 525 526 527 switch (typeof(i)) { 528 case 'string': 529 return i; 530 531 case 'object': 532 if (i === null) { 533 return ''; 534 } 535 536 var j, obj; 537 538 if (i instanceof Array) { 539 obj = []; 540 541 for (j = 0; j < i.length; j++) { 542 obj.push(getString(i[j])); 543 } 544 545 return obj.length ? (obj) : ''; 546 } else { 547 obj = {}; 548 549 for (j in i) { 550 obj[j] = getString(i[j]); 551 } 552 553 return obj; 554 } 555 556 case 'number': 557 return i.toString(); 558 559 case 'undefined': 560 return ''; 561 562 case 'boolean': 563 return i ? '1' : '0'; 564 } 565};*/ 566 567var getStr = function(val) { 568 return val || val === 0 ? val.toString() : ''; 569}; 570 571var strToNum = function(str) { 572 return getStr(str).replace(strToNum.spaceReplaceRe, '').replace(',', '.'); 573}; 574 575strToNum.spaceReplaceRe = new RegExp('\\s+', 'g'); 576 577var getInt = function(i) { 578 return parseInt(strToNum(i)); 579}; 580 581var getFloat = function(i) { 582 return parseFloat(strToNum(i)); 583}; 584 585var getArray = function(i) { 586 return i === undefined ? [] : (i instanceof Array ? i.concat() : [i]); 587}; 588 589var getDate = function(i) { 590 if (typeof(i) == 'string') { 591// i = i.replace(getDate.formatReplaceRe, '/').replace(getDate.msReplaceRe, ''); 592 i = i.replace(getDate.formatReplaceRe, '/'); 593 i = i.replace(getDate._dotRe, ''); 594 i = i.replace('+', ' +'); 595 } 596 if (!isNaN(i = new Date(i))) { 597 return i; 598 } 599}; 600getDate.formatReplaceRe = new RegExp('-', 'g'); 601getDate._dotRe = new RegExp('\\.\\d+', 'g'); 602//getDate.msReplaceRe = new RegExp('\\..+$'); 603 604var dateFormat = function(date, format) { 605 date = getDate(date); 606 607 if (!date) { 608 return ''; 609 } 610 611 var i = {}; 612 613 i['YYYY'] = date.getFullYear(); 614 i['MM'] = date.getMonth() + 1; 615 i['DD'] = date.getDate(); 616 i['hh'] = date.getHours(); 617 i['mm'] = date.getMinutes(); 618 i['ss'] = date.getSeconds(); 619 620// i['mon'] = ''; 621 622 for (var tpl in i) { 623 format = format.replace(tpl, zeroFormat(i[tpl], 2)); 624 } 625 626 return format; 627}; 628 629var zeroFormat = function(int, len) { 630 if (int > 9) { 631 return int; 632 } 633 634 for (var i = 1; i < len; i++) { 635 int = '0' + int; 636 } 637 638 return int; 639}; 640 641var getXHTMLString = function(x) { 642 var str; 643 644 if (x.tagName) { 645 var tagName = x.tagName.toLowerCase(); 646 647 str = '<' + tagName; 648 649 for (var i = x.attributes.length - 1; i > -1; i--) { 650 if (x.attributes[i].name != 'xmlns') { //'altHtml') { 651 str += ' ' + x.attributes[i].name + '="' + x.attributes[i].value.replace(getXHTMLString.ampRe, '&').replace(getXHTMLString.ltRe, '<').replace(getXHTMLString.quotRe, '"') + '"'; 652 } 653 } 654 655 x = x.firstChild; 656 657 if (x) { 658 str += '>'; 659 660 for (; x; x = x.nextSibling) { 661 str += getXHTMLString(x); 662 } 663 664 str += '</' + tagName + '>'; 665 } else { 666 switch (tagName) { 667 case 'br': 668 case 'img': 669 case 'hr': 670 str += ' />'; 671 break; 672 673 default: 674 str += '></' + tagName + '>'; 675 break; 676 } 677 } 678 } else { 679 str = x.nodeValue.replace(getXHTMLString.ampRe, '&').replace(getXHTMLString.ltRe, '<'); 680 } 681 682 return str; 683}; 684 685getXHTMLString.ampRe = new RegExp('&', 'g'); 686getXHTMLString.ltRe = new RegExp('<', 'g'); 687getXHTMLString.quotRe = new RegExp('"', 'g'); 688 689var getHTML; 690 691if (document.importNode && !document.all) { 692 getHTML = function(x) { 693 return document.importNode(x, true); 694 }; 695} else { 696 getHTML = function(x) { 697 var e = document.createElement(x.tagName); 698 699 for (var i = x.attributes.length - 1; i > -1; i--) { 700 e.setAttribute(x.attributes[i].name, x.attributes[i].value); 701 } 702 703 for (x = x.firstChild; x; x = x.nextSibling) { 704 e.appendChild(x.tagName ? getHTML(x) : document.createTextNode(x.nodeValue)); 705 } 706 707 return e; 708 }; 709} 710 711var getAmountString = function(i, arr) { 712 i = i.toString(); 713 714 if (i.length > 2) { 715 i = i.substr(i.length - 2); 716 } 717 718 if (i > 4 && i < 21) { 719 return arr[2]; 720 } 721 722 i = i.substr(i.length - 1); 723 724 if (i > 1 && i < 5) { 725 return arr[1]; 726 } 727 728 if (i == 1) { 729 return arr[0]; 730 } 731 732 return arr[2]; 733}; 734/* 735var getStyle; 736 737if (window.getComputedStyle) { 738 getStyle = function(x, prop) { 739 return document.defaultView.getComputedStyle(x, null).getPropertyValue(prop); 740 }; 741} else {// if (document.documentElement.currentStyle) { 742 getStyle = function(x, prop) { 743 return x.currentStyle[prop]; 744 }; 745}*/ 746/* 747var getStyleObj = function(i) { 748 i = stringToArray(i); 749 750 var style = {}; 751 752 for (var arr, j = 0; j < i.length; j++) { 753 arr = i[j].split(getIdById.ifRe); 754 style[arr[0]] = arr[1]; 755 } 756 757 return style; 758}; 759 760var applyStyle = function(x, style) { 761 style = getStyleObj(style); 762 763 if (!style['']) { 764 delete style['']; 765 } 766 767 var arr; 768 769 for (var i in style) { 770 arr = style.split('-'); 771 x.style[arr.length == 1 ? arr[0] : arr[0] + arr[1].charAt(0).toUpperCase() + arr[1].substring(1)] = style[i]; 772 } 773};*/ 774
775var goURI = function(uri) { 776 document.location.href = uri; 777}; 778 779var numberFormat = function(i, r, isSimple) { 780 var d, isMinus = i < 0; 781 782 if (isMinus) { 783 i *= -1; 784 } 785 786 i = i.toString(); 787 788 var j = i.indexOf('.'); 789 if (j != -1) { 790 d = i.substr(j + 1); 791 i = i.substr(0, j); 792 } 793 if (i.length > 3) { 794 var format = ''; 795 796 for (j = i.length; j > -1; j -= 3) { 797 if (j > 2) { 798 format = ' ' + i.substr(j - 3, 3) + format; 799 } else if (j) { 800 format = i.substr(0, j) + format; 801 } 802 } 803 804 i = format.indexOf(' ') === 0 ? format.replace(' ', '') : format; 805 } 806 if (d) { 807 if (r && d.length > r) { 808 d = d.substr(0, r); 809 } 810// if (!isSimple && d === '00') { 811// i += ',' + d; 812// } 813 if (!isSimple || d !== '00') { 814 i += ',' + d; 815 } 816 } 817 818 if (isMinus) { 819 i = '-' + i; 820 } 821 822 return i; 823}; 824 825var load = function(uri, notes) { 826 if (window.onBeforeLoad) { 827 window.onBeforeLoad(uri, notes); 828 } 829 830 notes.method = notes.method ? notes.method.toUpperCase() : 'GET'; 831 832 if (notes.method == 'GET' && notes.async && load.glue.testURIRe.test(uri)) { 833 load.glue.load(uri, notes); 834 return; 835 } 836 837 var l = new XMLHttpRequest(); 838 839 if (!notes.noProgress) { 840 applyPageProgress(true); 841 842 if (l.upload) { 843 var lId = load._i++, loadingTitle = (window.Use && Use.locale['loading']) || 'Loading', pLoaded = 0; 844 845 applyPageProgress.upload[lId] = 0; 846 847 l.upload.onprogress = function(evt) { 848 if (evt.lengthComputable) { 849 if (!applyPageProgress.upload[lId]) { 850 applyPageProgress.uploadTotal += (applyPageProgress.upload[lId] = evt.total); 851 } 852 853 applyPageProgress.bodyHTML.firstChild.nodeValue = loadingTitle + ' ' + Math.round((applyPageProgress.uploadLoaded += (evt.loaded - pLoaded)) * 100/applyPageProgress.uploadTotal) + '%'; 854 pLoaded = evt.loaded; 855 } 856 }; 857 858 l.upload.onload = function() { 859 applyPageProgress.uploadLoaded -= applyPageProgress.upload[lId]; 860 861 if (!(applyPageProgress.uploadTotal -= applyPageProgress.upload[lId])) { 862 applyPageProgress.bodyHTML.firstChild.nodeValue = loadingTitle; 863 } 864 865 delete applyPageProgress.upload[lId]; 866 }; 867 } 868 } 869 870 l.onreadystatechange = function() { 871 if (this.readyState != 4) { 872 return; 873 } 874 if (this.status != 200) { 875 var f; 876 if (notes.onError) {// instanceof Function) { 877 f = notes.onError(notes.isText ? this.responseText : this.responseXML); 878 } 879 if (!f) { 880 var stat, errtext, x = getDocumentElement(this.responseXML); 881 if (x && x.tagName.toUpperCase() == 'ERROR') { 882 stat = x.getAttribute(STATUS_ATTRIBUTE); 883 errtext = x.querySelector(':root > errtext') 884 if (!errtext) { 885 errtext = x.firstChild; 886 } 887 if (errtext) { 888 errtext = errtext.textContent; 889 } 890 } 891 if (!stat) { 892 stat = this.status; 893 } 894 if (!errtext && stat == 413) { 895 errtext = "ÐагÑÑжаемÑе ÑÐ°Ð¹Ð»Ñ ÑлиÑком болÑÑого ÑазмеÑа, попÑобÑйÑе зааÑÑ Ð¸Ð²Ð¸ÑоваÑÑ Ð¸Ñ ."; 896 } 897 showError({ 898 content: errtext || (Use.locale ? (Use.locale['error']['status-' + stat] || Use.locale['error']['unknown']) : 'Unknown error.'), 899 stat: window.DEBUG ? stat : undefined 900 }); 901 } 902 } else if (notes.onLoad) {// instanceof Function) { 903 notes.onLoad(notes.isText ? this.responseText : this.responseXML); 904 } 905 if (!notes.noProgress) { 906 applyPageProgress(); 907 } 908 }; 909 910var i, j, data; 911 912 if (notes.method == 'POST') { 913 l.open('POST', uri, !!notes.async); 914 l.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 915 if (notes.file && window.FormData) { 916// var i, j, data = new FormData(); 917data = new FormData(); 918 if (notes.param) { 919 for (i in notes.param) { 920 if (notes.param[i] instanceof Array) { 921 for (j = 0; j < notes.param[i].length; j++) { 922 data.append(i, load._valueToAppend(notes.param[i][j])); 923 } 924 } else { 925 data.append(i, load._valueToAppend(notes.param[i])); 926 } 927 } 928 } 929 if (notes.file) { 930 for (i in notes.file) { 931 if (notes.file[i].length) { 932 for (j = 0; j < notes.file[i].length; j++) { 933 data.append(i, notes.file[i][j]); 934//console.log(2, notes.file[i][j]); 935 } 936 } else { 937 data.append(i, notes.file[i]); 938//console.log(2, notes.file[i]); 939 } 940 } 941 } 942 l.send(data); 943 } else { 944 l.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 945//console.log(JSON.stringify(notes.param)); 946 l.send(load.paramToString(notes.param)); 947 } 948 } else { 949 if (!notes.param) { 950 notes.param = {}; 951 } 952 953 if (window.VERSION_PARAM) { 954 notes.param[VERSION_PARAM] = VERSION; 955 } 956 957 l.open('GET', uri + (uri.indexOf('?') == -1 ? '?' : '&') + load.paramToString(notes.param), !!notes.async); 958 l.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 959 l.send(null); 960 } 961}; 962 963load._i = 0; 964 965load._valueToAppend = function(value) {//from Chrome, append set value.toString() 966 return value || value === 0 ? (value) : ''; 967}; 968 969load.paramToString = function(param) { 970 if (!param) { 971 return ''; 972 } 973 974 var j, params = []; 975 976 for (var i in param) { 977 if (param[i] instanceof Array) { 978 for (j = 0; j < param[i].length; j++) { 979 params.push(esc(i) + '=' + esc(param[i][j])); 980 } 981 } else { 982 params.push(esc(i) + '=' + esc(param[i])); 983 } 984 } 985 986 return params.join('&'); 987};
988 989load.glue = { 990 loadSync: 0, 991 loadList: {}, 992 993 upGETSize: 2000, 994 995 testURIRe: new RegExp('^[^\\?]+\\.(js|xml|css)$'), 996 997 load: function(uri, notes) { 998 var s = ++this.loadSync; 999 1000 this.loadList[uri] = { 1001 onLoad: notes.onLoad, 1002 waiting: true 1003 }; 1004 1005 if (this.getURI(true).length > this.upGETSize) { 1006 this.send(notes.noProgress, s); 1007 1008 return; 1009 } 1010 1011 setTimeout(function() { 1012 load.glue.send(notes.noProgress, s); 1013 }, 10); 1014 }, 1015 1016 send: function(noProgress, s) { 1017 if (s != this.loadSync) { 1018 return; 1019 } 1020 1021 var u = this.getURI(); 1022 1023 load(u, { 1024 onLoad: function(x) { 1025 x = getDocumentElement(x); 1026 1027 if (!x) { 1028 if (DEBUG && window.console) { 1029 console.error('Load files (glue) error.'); 1030 } 1031 1032 return; 1033 } 1034 1035 var i; 1036 1037 for (x = x.firstChild; x; x = x.nextSibling) { 1038 if (x.tagName && (i = load.glue.loadList[x.getAttribute(URI_ATTRIBUTE)])) { 1039 if (i.onLoad) {// instanceof Function) { 1040 if (x.firstChild) { 1041 i.onLoad(x.firstChild.tagName ? x.firstChild.cloneNode(true) : x.firstChild.nodeValue); 1042 } else { 1043 i.onLoad(); 1044 } 1045 } 1046 } 1047 } 1048 }, 1049 1050 method: 'GLUE', 1051 async: true, 1052 noProgress: noProgress 1053 }); 1054 }, 1055 1056 getURI: function(waiting) { 1057 var uri = GLUE_URI; 1058 1059 for (var i in this.loadList) { 1060 if (this.loadList[i].waiting) { 1061 uri += '/' + encodePathComponent(i); 1062 } 1063 1064 if (!waiting) { 1065 delete this.loadList[i].waiting; 1066 } 1067 } 1068 1069 return uri + '/1/1.xml'; 1070 } 1071}; 1072 1073var refreshControl = function(control, notes, _innerCall) {//from, value, param, disabled, byForm 1074 if (!notes) { 1075 notes = {}; 1076 } 1077 if (notes.from && !notes.from.isValid) { 1078 return; 1079 } 1080 if (!control.isRefreshed) { 1081 control.iValue = notes.value; 1082 return; 1083 } 1084 notes.control = control; 1085 notes._innerCall = _innerCall; 1086 var s = ++control.sync; 1087 setTimeout(function() { 1088 _refreshControl(notes, s); 1089 }, 10); 1090}; 1091var _refreshControl = function(notes, s) { 1092 if (s != notes.control.sync) {// || (notes.from && (!notes.from.isValid || notes.from.loading))) { 1093 return; 1094 } 1095 1096 var i; 1097 1098 if (notes.control._class == "Form" || notes.control._class == "Modal") { 1099 if (!notes.control.iValue) { 1100 notes.control.iValue = notes.value; 1101 } 1102 1103 s = notes.control.toString(); 1104 1105 for (i in notes.control.collection) { 1106 refreshControl(getCtrl(i), { 1107 from: notes.from, 1108 value: s, 1109 param: notes.param, 1110 disabled: notes.disabled, 1111 byForm: true 1112 }, notes._innerCall); 1113 } 1114 1115 return; 1116 } 1117 1118 notes.control.iValue = notes.value; 1119 1120 s = notes.control; 1121 1122 if (!notes.byForm && !s.notes.skipRequiredTest && s.notes.dependedFields) { 1123 for (var j = s.notes.dependedFields.length - 1; j > -1; j--) { 1124 i = getCtrl(s.notes.dependedFields[j]); 1125 if (i && i.isField && !i.validate(true)) { 1126 return; 1127 } 1128 } 1129 } 1130 1131 if (!notes.control.loading) { 1132 applyProgress(notes.control, true); 1133 1134 if (notes.disabled) { 1135 if (notes.control.setDisable) {// instanceof Function) { 1136 notes.control.setDisable(true, notes._innerCall); 1137 } else { 1138 delete notes.disabled; 1139 } 1140 } 1141 } 1142 1143 __refreshControl(notes); 1144}; 1145 1146var __refreshControl = function(notes) { 1147 notes.waiting = true; 1148 window.refreshList[notes.control.id] = notes; 1149 1150 var s = ++window.refreshSync; 1151 1152 setTimeout(function() { 1153 ___refreshControl(notes, s); 1154 }, 10); 1155}; 1156 1157var ___refreshControl = function(notes, s) { 1158 if (s != window.refreshSync) { 1159 return; 1160 } 1161 1162 var param = {}, loading = {}, list = window.refreshList; 1163 1164 for (var i in list) { 1165 if (list[i].waiting) { 1166//! if (window.collection[i]) { 1167 setRefreshParam(param, list[i].control, notes.from, list[i].value, list[i].param, notes.byForm); 1168 loading[i] = list[i]; 1169//! } else { 1170//! rrrrX(list[i]); 1171//! } 1172 } 1173 1174 delete list[i].waiting; 1175 } 1176 1177 load(FIELDS_URI, { 1178 param: param, 1179 1180 onLoad: function(x) { 1181 x = getDocumentElement(x); 1182 1183 if (!x) { 1184 if (DEBUG && window.console) { 1185 console.error('Refresh control error.'); 1186 } 1187 1188 return; 1189 } 1190 1191 var i; 1192 1193 for (x = x.firstChild; x; x = x.nextSibling) { 1194 if (x.tagName && (i = loading[getMyAttribute(x, ID_ATTRIBUTE)])) { 1195 ____refreshControl(i, x); 1196 } 1197 } 1198 }, 1199 1200 method: 'POST', 1201 async: true, 1202 1203 onError: function() { 1204 for (var i in loading) { 1205 ____refreshControl(loading[i]); 1206 } 1207 } 1208 }); 1209}; 1210 1211var ____refreshControl = function(notes, x) { 1212 if (notes.byForm) { 1213 notes.control.byForm = true; 1214 } 1215 1216 notes.control.renewByXML(x, notes._innerCall); 1217 1218 delete notes.control.byForm; 1219 1220 if (notes.disabled) { 1221 notes.control.setDisable(false, notes._innerCall); 1222 } 1223 1224 if (notes.onRefresh) {// instanceof Function) { 1225 notes.onRefresh();
1226 } 1227 1228 applyProgress(notes.control); 1229}; 1230 1231var refreshFields = function(from, ids, value, _innerCall) { 1232 if (ids && (!from || (from.isValid && !from.loading))) { 1233 for (var ctrl, i = 0; i < ids.length; i++) { 1234 if (ctrl = window.collection[ids[i]]) { 1235 if (ctrl instanceof Array) { 1236 for (var j = 0; j < ctrl.length; j++) { 1237 refreshControl(ctrl[j], { 1238 from: from, 1239 value: value, 1240 disabled: true 1241 }, _innerCall); 1242 } 1243 } else { 1244 refreshControl(ctrl, { 1245 from: from, 1246 value: value, 1247 disabled: true 1248 }, _innerCall); 1249 } 1250 } 1251 } 1252 } 1253}; 1254 1255var refreshRelatedFields = function(from, _innerCall) { 1256 refreshFields(from, from.notes.relatedFields, from.toString(), _innerCall); 1257}; 1258 1259var setRefreshParam = function(param, control, from, value, controlParam, byForm) { 1260 if (!controlParam) { 1261 controlParam = {}; 1262 } 1263 1264// try { 1265 control.setRefreshParam(controlParam, from, value, byForm); 1266// } catch (exception) { 1267// } 1268 1269 controlParam[CONTROL_PARAM] = control._class; 1270 1271 var i = PREFIX_PARAM, j = control.id; 1272 1273 if (param[i] == undefined) { 1274 param[i] = j || ''; 1275 } else if (param[i] instanceof Array) { 1276 param[i].push(j); 1277 } else { 1278 param[i] = [param[i], j]; 1279 } 1280 1281 for (j in controlParam) { 1282 i = control.id + j; 1283 j = controlParam[j]; 1284 1285 if (param[i] == undefined) { 1286 param[i] = j || ''; 1287 } else { 1288 if (!(param[i] instanceof Array)) { 1289 param[i] = [param[i]]; 1290 } 1291 1292 if (j instanceof Array) { 1293 param[i] = param[i].concat(j); 1294 } else { 1295 param[i].push(j); 1296 } 1297 } 1298 } 1299}; 1300 1301var refreshElement = function(i, uri, notes) {//outputMethod, isParse, noProgress, param, onLoad, method, async, win, form, tab, onError) { 1302 if (typeof(i) == 'string') { 1303 i = document.getElementById(i); 1304 } 1305 1306 if (!notes) { 1307 notes = {}; 1308 } 1309 1310 if (!i && !notes.onLoad) { 1311 return; 1312 } 1313 1314 if (notes.outputMethod) { 1315 if (!notes.param) { 1316 notes.param = {}; 1317 } 1318 1319 notes.param[OUTPUT_METHOD_PARAM] = notes.outputMethod; 1320 } 1321/*--- 1322 if (!notes.method) { 1323 notes.method = 'POST'; 1324 }*/ 1325 1326 var onLoad = notes.onLoad; 1327 1328 notes.onLoad = function(t) { 1329 if (!i) { 1330 i = document.createElement('div'); 1331 } 1332 1333 i.innerHTML = t; 1334 1335 if (notes.isParse) { 1336 Use.parse(i, notes); 1337 1338 if (onLoad) {// instanceof Function) { 1339 Use.waitParse(function() { 1340 onLoad(t, i); 1341 }); 1342 } 1343 } else if (onLoad) {// instanceof Function) { 1344 onLoad(t, i); 1345 } 1346 }; 1347 1348 notes.isText = true; 1349 1350 load(uri, notes); 1351}; 1352/*?? 1353var insertMacros = function(id, uri) { 1354 refreshElement(id, uri, notes); 1355};*/ 1356 1357/*--after ie8*/ 1358var runScript; 1359if (window.execScript) { 1360 runScript = function(str) { 1361 window.execScript(str, 'javascript'); 1362 }; 1363} else { 1364 runScript = function(str) { 1365 window.eval(str); 1366 }; 1367} 1368 1369var serialize = function(value) { 1370 switch (typeof(value)) { 1371 case 'boolean': 1372 return value ? 1 : 0; 1373 1374 case 'number': 1375 return value; 1376 1377 case 'string': 1378 return '"' + value.replace(serialize.quoteReplaceRe, '\\u0022') + '"'; 1379 1380 case 'object': 1381 if (value == null) { 1382 return 'null'; 1383 } 1384 1385 var i, r = []; 1386 1387 if (value instanceof Array) { 1388 for (i = 0; i < value.length; i++) { 1389 r.push(serialize(value[i])); 1390 } 1391 1392 return '[' + r.join(',') + ']'; 1393 } 1394 1395 for (i in value) { 1396 r.push('"' + i.replace(serialize.quoteReplaceRe, '\\u0022') + '"' + ':' + serialize(value[i])); 1397 } 1398 1399 return '{' + r.join(',') + '}'; 1400 default: 1401 return 'undefined'; 1402 } 1403}; 1404 1405serialize.quoteReplaceRe = new RegExp('"', 'g'); 1406 1407var stringToObject = function(str) { 1408 if (str) { 1409// try { 1410 return eval('(' + str + ')'); 1411// } catch (e) { 1412// } 1413 } 1414}; 1415 1416var setParam = function(param, name, value) { 1417// param[name] = param[name] || param[name] === 0 ? getArray(param[name]).concat(value) : value; 1418 param[name] = param[name] === undefined ? (value || '') : getArray(param[name]).concat(value || ''); 1419}; 1420 1421var showModal = function(notes) { 1422 if (notes.controlFrom && notes.controlFrom.tagName) { 1423 notes._controlFromOnClcik = notes.controlFrom.onclick; 1424 1425 notes.controlFrom.onclick = function() { 1426 return false; 1427 }; 1428 } 1429 1430 Use.load("Button", true); 1431 Use.load("Modal", true); 1432
1433 Use.waitLoading(function() { 1434 if (notes._controlFromOnClcik) { 1435 notes.controlFrom.onclick = notes._controlFromOnClcik; 1436 } 1437 1438 showModal = function(notes) { 1439 var win = new Modal(); 1440 1441 win.init(notes.from || window.from, notes/*{ 1442 width: notes.width, 1443 height: notes.height, 1444 noScroll: notes.noScroll 1445 }*/); 1446 1447 var i = notes.controlFrom; 1448 1449 if (i && !i.tagName) { 1450//-- win.win = i.win; 1451 win.controlFrom = i; 1452 win.iValue = i.toString(); 1453 1454 win.notes.operation = i.notes.operation; 1455 1456 win.notes.schema = i.notes.schema; 1457 win.notes.table = i.notes.table; 1458 win.notes.selectedSchema = i.notes.selectedSchema; 1459 win.notes.selectedTable = i.notes.selectedTable; 1460 1461 win.onShow = function() { 1462 if (notes.uri) { 1463//alert(2 + ',' + this.controlFrom.id);//tbs.parseElement 1464 refreshRelatedFields(i); 1465 } 1466 1467 if (notes.onShow) {// instanceof Function) { 1468 notes.onShow.call(this); 1469 } 1470 }; 1471 1472 if (notes.controlFrom._class == "Button") { 1473 win.controlFrom = notes.controlFrom; 1474 } 1475 } else { 1476 win.onShow = function() { 1477 if (notes.onShow) {// instanceof Function) { 1478 notes.onShow.call(this); 1479 } 1480 }; 1481 } 1482 1483 win.onButtonClick = function(button) { 1484 if (notes.onButtonClick/* instanceof Function*/ && notes.onButtonClick.call(this, button)) { 1485//?? 1486 delete notes.onButtonClick; 1487 1488 this.close(); 1489 } 1490 1491//?? delete this.onClose; 1492 }; 1493 1494 win.onClose = function() { 1495 if (notes.onButtonClick) {// instanceof Function) { 1496 notes.onButtonClick.call(this); 1497 } 1498 1499 if (notes.onClose) {// instanceof Function) { 1500 notes.onClose.call(this); 1501 } 1502 }; 1503 1504 var buttons = []; 1505 1506 if (notes.buttonTypes) { 1507 for (i = notes.buttonTypes.length - 1; i > -1; i--) { 1508 buttons.unshift(new Button()); 1509 1510 buttons[0].init(undefined, { 1511 type: notes.buttonTypes[i] 1512 }); 1513 } 1514 } 1515 1516 if (notes.uri) { 1517 win.notes.method = notes.method; 1518 win.notes.param = notes.param; 1519 1520 win.showURI(notes.title, notes.uri, buttons); 1521 } else { 1522 win.show(notes.title, notes.content, buttons); 1523 } 1524 }; 1525 1526 showModal(notes); 1527 }); 1528}; 1529 1530var showWarning = function(notes) { 1531 notes.title = Use.locale['title'] ? Use.locale['title']['warning'] : 'Warning'; 1532 1533 showModal(notes); 1534}; 1535 1536var showError = function(notes) { 1537 if (window.DEBUG) { 1538 notes.title = Use.locale['title'] ? window.Use.locale['title']['error'] : 'Error'; 1539 } 1540 if (notes.stat && window.DEBUG) { 1541 notes.title += ' ' + notes.stat; 1542 } 1543 showModal(notes); 1544}; 1545 1546var showConfirm = function(notes) { 1547 notes.buttonTypes = ['yes', 'no']; 1548 1549 var onButtonClick = notes.onButtonClick; 1550 1551 notes.onButtonClick = function(button) { 1552 if (onButtonClick) {// instanceof Function/* && button.notes.type == 'yes'*/) { 1553 onButtonClick.call(this, button); 1554 } 1555 1556 return true; 1557 }; 1558 1559 showModal(notes); 1560}; 1561 1562var stringToArray = function(str) { 1563 return str || str === 0 ? str.toString().trim().split(stringToArray.separatorRe) : []; 1564}; 1565 1566stringToArray.separatorRe = new RegExp('\\s*;\\s*'); 1567 1568if (!String.trim) { 1569 String.prototype._replaceRe = new RegExp('^\\s+|\\s+$', 'g'); 1570 1571 String.prototype.trim = function() { 1572 return this.toString().replace(this._replaceRe, ''); 1573 }; 1574} 1575 1576 1577 1578var addSVG = function(src) { 1579 if (addSVG._src[src]) { 1580 return; 1581 } 1582 addSVG._src[src] = true; 1583 load(src, { 1584 onLoad: function(svg) { 1585 var c = document.createElement('div'); 1586 c.style.display = 'none'; 1587 c.innerHTML = svg; 1588 document.documentElement.appendChild(c); 1589 }, 1590 isText: true, 1591 async: true, 1592 noProgress: true 1593 }); 1594} 1595addSVG._src = {}; 1596 1597var initAdaptiveElements = function(widths) { 1598// widths ||= [768, 640, 425]; 1599 initAdaptiveElements.widths = widths; 1600 if (!initAdaptiveElements._isInit) { 1601 initAdaptiveElements._isInit = true; 1602 if (!document.readySate || document.readySate == 'loading') { 1603 window.addEventListener('load', initAdaptiveElements._f); 1604 } else { 1605 initAdaptiveElements._f(); 1606 } 1607 window.addEventListener('resize', initAdaptiveElements._f); 1608 } 1609} 1610initAdaptiveElements._f = function() { 1611 for (var i = initAdaptiveElements.widths.length; i > -1; i--) { 1612 var w = initAdaptiveElements.widths[i], elems = document.body.querySelectorAll('.to-move' + w), e = elems[0]; 1613 if (e) { 1614 if (w >= document.querySelector('body').offsetWidth) { 1615 if (!e.isMove) { 1616 for (var j = elems.length - 1; j > -1; j--) { 1617 e = elems[j];
1618 e.isMove = true; 1619 e._parentNode = e.parentNode; 1620 e._toMove = e._toMove || document.body.querySelector(e.dataset['toMove']); 1621 if (e._toMove) { 1622 e._toMove.appendChild(e); 1623 } else { 1624 console.error('Not found "data-to-move" attribute.', e); 1625 } 1626 } 1627 } 1628 } else if (e.isMove) { 1629 for (var j = elems.length - 1; j > -1; j--) { 1630 e = elems[j]; 1631 e.isMove = false; 1632 if (e._parentNode) { 1633 e._parentNode.appendChild(e); 1634 } 1635 } 1636 } 1637 } 1638 } 1639}; 1640 1641var byQ = function(q, fn, doc) { 1642 if (typeof(q) == 'string') { 1643 q = [q]; 1644 } 1645 if (!doc) { 1646 doc = document; 1647 } 1648 for (var i = 0; i < q.length; i++) { 1649 var el = doc.querySelectorAll(q[i]); 1650 for (var j = 0; j < el.length; j++) { 1651 fn(el[j]); 1652 } 1653 } 1654} 1655var byC = function(id, fn, win) { 1656 if (typeof(id) == 'string') { 1657 id = [id]; 1658 } 1659 if (!win) { 1660 win = window; 1661 } 1662 for (var i = 0; i < id.length; i++) { 1663 var ctrl = getArray(win.collection[id[i]]); 1664 for (var j = 0; j < ctrl.length; j++) { 1665 fn(ctrl[j]); 1666 } 1667 } 1668} 1669 1670 1671var addToCollection = function(control, collection) { 1672 var id = control.id; 1673 if (!id) { 1674 return; 1675 } 1676 if (collection[id]) { 1677 if (collection[id] instanceof Array) { 1678 if (!control.loading) { 1679 for (var j = 0; j < collection[id].length; j++) { 1680 if (collection[id][j].loading) { 1681 collection[id][j] = control; 1682 return true; 1683 } 1684 } 1685 } 1686 collection[id].push(control); 1687 } else if (collection[id].loading && !control.loading) { 1688 collection[id] = control; 1689 } else { 1690 collection[id] = [collection[id], control]; 1691 } 1692 } else { 1693 collection[id] = control; 1694 } 1695 return true; 1696} 1697var deleteFromCollection = function(control, collection) { 1698 var id = control.id; 1699 if (!id) { 1700 return; 1701 } 1702 if (collection[id] instanceof Array) { 1703 for (var i = 0; i < collection[id].length; i++) { 1704 if (control === collection[id][i]) { 1705 collection[id].splice(i, 1); 1706 switch (collection[id].length) { 1707 case 1: 1708 collection[id] = collection[id][0]; 1709 break; 1710 case 0: 1711 delete collection[id]; 1712 break; 1713 } 1714 return true; 1715 } 1716 } 1717 } else if (control === collection[id]) { 1718 delete collection[id]; 1719 return true; 1720 } 1721} 1722 1723 1724 1725var getCtrl = function(id, win) { 1726 if (!win) { 1727 win = window; 1728 } 1729 var ctrl = win.collection[id] instanceof Array ? win.collection[id][0] : win.collection[id]; 1730// if (ctrl && !ctrl.loading) { 1731 return ctrl; 1732// } 1733} 1734 1735var applyTemplatesCtrl = function(tpl) { 1736 if (!tpl) { 1737 return; 1738 } 1739 var m; 1740 while (m = applyTemplatesCtrl._re.exec(tpl)) { 1741 var val = ''; 1742 var id = getName(m[1]); 1743 if (id) { 1744 var ctrl = getCtrl(id); 1745 if (ctrl) { 1746 val = ctrl.toString(); 1747 } else { 1748 val = id; 1749 } 1750 } 1751 tpl = tpl.replace(m[0], val); 1752 } 1753 return tpl; 1754} 1755applyTemplatesCtrl._re = new RegExp('\\{\\{\\s*(.+?)\\s*\\}\\}'); 1756 1757function isFunction(arg) { 1758 return typeof(arg) === 'function'; 1759} 1760function isNumber(arg) { 1761 return typeof(arg) === 'number'; 1762} 1763function isObject(arg) { 1764 return typeof(arg) === 'object' && arg !== null; 1765} 1766function isUndefined(arg) { 1767 return arg === void(0); 1768} 1769 1770 1771 1772 1773var init = function() { 1774 if (!window.DOMIsReady) { 1775 setTimeout(init, 100); 1776 1777 return; 1778 } 1779/* 1780 if (!document.body) { 1781 var body = document.getElementsByTagName('body')[0]; 1782 1783 if (body) { 1784 document.body = body; 1785 } 1786 }*/ 1787 1788 window.contentHTML = document.getElementById('content'); 1789 if (window.contentHTML) { 1790 window.from = { 1791 body: window.contentHTML, 1792 scroll: window.contentHTML 1793 }; 1794 } else { 1795 window.contentHTML = document.documentElement; 1796 window.from = { 1797 body: document.body, 1798 scroll: document.scrollingElement || window.contentHTML 1799// scroll: navigator.userAgent.indexOf('WebKit') == -1 ? window.contentHTML : document.body 1800 }; 1801 } 1802 1803 var themeURI = getMyAttribute(window.contentHTML, THEME_URI_ATTRIBUTE); 1804 if (themeURI) { 1805 THEME_URI = themeURI; 1806 } 1807 1808// if (!DEBUG) { 1809 window.onbeforeunload = function() { 1810 var expires = new Date().getTime() + 456 * 24 * 60 * 60 * 1000; 1811 for (var i in window.settings) { 1812 setSettingsById(i, window.settings[i], expires); 1813 } 1814 }; 1815// } 1816 1817 Use.init(); 1818 1819 if (getMyAttribute(window.contentHTML, SKIP_PARSE_ATTRIBUTE) == null) { 1820 Use.parse(window.contentHTML, { 1821 async: true 1822 }); 1823 } 1824}; 1825 1826window._class = 'window'; 1827window.uri = new RegExp('.+?\\/\\/.+?(\\/.*)').exec(document.location.href)[1]; 1828window.currentWin = window; 1829 1830//--window.focused; 1831//window.contentHTML; 1832//window.DOMIsReady; 1833 1834window.from = {}; 1835window.notes = {}; 1836window.settings = {}; 1837 1838window.num = 0; 1839window.collection = {}; 1840 1841window.refreshSync = 0; 1842window.refreshList = {}; 1843 1844window.showed = true; 1845window.tooltips = []; 1846
1847var JS_URI = getScriptDirectory('page.js'); 1848//Client only 1849(function () { 1850 var uris = [JS_URI + '/const.js', JS_URI + '/lib/' + "Use" + '.js']; 1851 1852 window.loading = uris.length; 1853 1854 var l = new XMLHttpRequest(); 1855 1856 l.onreadystatechange = function() { 1857 if (l.readyState == 4) { 1858 runScript(l.responseText); 1859// window.eval(l.responseText); 1860 1861 window.loading--; 1862 1863 var f = function(t) { 1864 runScript(t); 1865// window.eval(t); 1866 1867 window.loading--; 1868 1869 if (!window.loading) { 1870 init(); 1871 } 1872 }; 1873 1874 for (var i = 1; i < uris.length; i++) { 1875 load(uris[i], { 1876 onLoad: f, 1877 isText: true, 1878 async: true, 1879 noProgress: true 1880 }); 1881 } 1882 } 1883 }; 1884 1885 l.open('GET', uris[0], true); 1886 l.send(null); 1887})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.