1(function($) { 2 // ÐÑедваÑиÑелÑÐ½Ð°Ñ Ð·Ð°Ð³ÑÑзка изобÑажений 3 var cache = []; 4 5 $.extend({ 6 preLoadImages: function() 7 { 8 var args_len = arguments.length; 9 10 for (var i = args_len; i--;) 11 { 12 var cacheImage = document.createElement('img'); 13 cacheImage.src = arguments[i]; 14 cache.push(cacheImage); 15 } 16 } 17 }); 18 19 /*$.preLoadImages("/hostcmsfiles/images/shadow-b.png", 20 "/hostcmsfiles/images/shadow-l.png", 21 "/hostcmsfiles/images/shadow-lb.png", 22 "/hostcmsfiles/images/shadow-lt.png", 23 "/hostcmsfiles/images/shadow-r.png", 24 "/hostcmsfiles/images/shadow-rb.png", 25 "/hostcmsfiles/images/shadow-rt.png", 26 "/hostcmsfiles/images/shadow-t.png", 27 "/hostcmsfiles/images/ajax_loader.gif");*/ 28 29 $(document).keydown(function(event) { 30 31 if (event.ctrlKey && !$(document.activeElement).is(":input")) 32 { 33 switch (event.which) 34 { 35 case 0x25: // Ðазад 36 if ($('#id_prev').length) 37 { 38 window.location = $('#id_prev').attr('href'); 39 } 40 break; 41 case 0x27: // ÐпеÑед 42 if ($('#id_next').length) 43 { 44 window.location = $('#id_next').attr('href'); 45 } 46 break; 47 } 48 } 49 }); 50 51 // Ð¢ÐµÐ½Ñ Ð´Ð»Ñ Ð¾ÐºÐ½Ð° 52 $.fn.extend({ 53 // http://upshots.org/javascript/jquery-copy-style-copycss 54 getStyleObject: function() { 55 var dom = this.get(0); 56 var style; 57 var returns = {}; 58 if (window.getComputedStyle){ 59 var camelize = function(a,b){ 60 return b.toUpperCase(); 61 }; 62 style = window.getComputedStyle(dom, null); 63 for(var i = 0, l = style.length; i < l; i++){ 64 var prop = style[i]; 65 var camel = prop.replace(/\-([a-z])/g, camelize); 66 var val = style.getPropertyValue(prop); 67 returns[camel] = val; 68 }; 69 return returns; 70 }; 71 if (style = dom.currentStyle){ 72 for(var prop in style){ 73 returns[prop] = style[prop]; 74 }; 75 return returns; 76 }; 77 if (style = dom.style){ 78 for(var prop in style){ 79 if(typeof style[prop] != 'function'){ 80 returns[prop] = style[prop]; 81 }; 82 }; 83 return returns; 84 }; 85 return returns; 86 }, 87 applyShadow: function() 88 { 89 return this.each(function(index, object){ 90 var obj = $(object); 91 92 $('<div>').attr("class", 'tl').appendTo(obj); 93 $('<div>').attr("class", 't') 94 .height(15) 95 .appendTo(obj); 96 97 $('<div>').attr("class", 'tr').appendTo(obj); 98 $('<div>').attr("class", 'l') 99 .width(17) 100 .appendTo(obj); 101 102 $('<div>').attr("class", 'r') 103 .width(17) 104 .appendTo(obj); 105 106 $('<div>').attr("class", 'bl').appendTo(obj); 107 108 $('<div>').attr("class", 'b') 109 .height(21) 110 .appendTo(obj); 111 112 $('<div>').attr("class", 'br').appendTo(obj); 113 }); 114 }, 115 updateCaptcha: function(captchaKey, captchaHeight) { 116 return this.each(function(index, object) { 117 jQuery(object).prop('src', "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + Math.floor(Math.random()*100000)); 118 }); 119 }, 120 clearSelect: function() 121 { 122 return this.each(function(index, object){ 123 jQuery(object).empty().append(jQuery('<option>').attr('value', 0).text('â¦')); 124 }); 125 } 126 }); 127 128 var methods = { 129 show : function() { 130 $('body').css('cursor', 'wait'); 131 var fade_div = $('#ajaxLoader'), jWindow = $(window); 132 if (fade_div.length === 0) 133 { 134 fade_div = $('<div></div>') 135 .appendTo(document.body) 136 .hide() 137 .prop('id', 'ajaxLoader') 138 .css('z-index', '1500') 139 .css('position', 'absolute') 140 .append($('<img>').prop('src', '/hostcmsfiles/images/ajax_loader.gif')); 141 } 142 143 fade_div.show() 144 .css('top', (jWindow.height() - fade_div.outerHeight(true)) / 2 + jWindow.scrollTop()) 145 .css('left', (jWindow.width() - fade_div.outerWidth(true)) / 2 + jWindow.scrollLeft()); 146 }, 147 hide : function( ) { 148 $('#ajaxLoader').hide().css('left', -1000); 149 $('body').css('cursor', 'auto'); 150 } 151 }; 152 153 // ФÑнкÑии без ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÐºÐ¾Ð»Ð»ÐµÐºÑии 154 jQuery.extend({ 155 loadingScreen: function(method) { 156 // Method calling logic 157 if (methods[method] ) { 158 return methods[method].apply(this, Array.prototype.slice.call( arguments, 1 ));
159 } else { 160 $.error( 'Method ' + method + ' does not exist on jQuery.tooltip' ); 161 } 162 }, 163 clientSelectOptionsCallback: function(data, status, jqXHR) { 164 $.loadingScreen('hide'); 165 166 jQuery(this).empty(); 167 for (var key in data) 168 { 169 jQuery(this).append(jQuery('<option>').attr('value', key.substr(1)).text(data[key])); 170 } 171 }, 172 clientRequest: function(settings) { 173 if (typeof settings.callBack == 'undefined') 174 { 175 alert('Callback function is undefined'); 176 } 177 178 $.loadingScreen('show'); 179 180 var path = settings.path, data = {}; 181 data['_'] = Math.round(new Date().getTime()); 182 183 jQuery.ajax({ 184 context: settings.context, 185 url: path, 186 type: 'POST', 187 data: data, 188 dataType: 'json', 189 success: settings.callBack 190 }); 191 return false; 192 }, 193 loadLocations: function(path, shop_country_id) 194 { 195 $('#shop_country_location_city_id').clearSelect(); 196 $('#shop_country_location_city_area_id').clearSelect(); 197 $.clientRequest({path: path + '?ajaxLoad&shop_country_id=' + shop_country_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_id')}); 198 }, 199 loadCities: function(path, shop_country_location_id) 200 { 201 $('#shop_country_location_city_area_id').clearSelect(); 202 $.clientRequest({path: path + '?ajaxLoad&shop_country_location_id=' + shop_country_location_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_city_id')}); 203 }, 204 loadCityAreas: function(path, shop_country_location_city_id) 205 { 206 $.clientRequest({path: path + '?ajaxLoad&shop_country_location_city_id=' + shop_country_location_city_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_city_area_id')}); 207 }, 208 friendOperations: function(data, status, jqXHR) { 209 $.loadingScreen('hide'); 210 var $this = jQuery(this); 211 212 switch (data) 213 { 214 case 'Added': 215 $this.text('ÐапÑÐ¾Ñ Ð½Ð° добавление в дÑÑзÑÑ Ð¾ÑпÑавлен.').prop("onclick", null); 216 break; 217 case 'Removed': 218 $this.text('ÐолÑзоваÑÐµÐ»Ñ ÑбÑан из дÑÑзей.').prop("onclick", null); 219 break; 220 } 221 } 222 }); 223 224})(jQuery); 225 226function set_count_mod(input_id, step) 227{ 228 var oCountMod = document.getElementById(input_id); 229 230 if (!(iCurrCount = parseInt(oCountMod.value))) { 231 iCurrCount = 0; 232 } 233 234 if (!(iCurrCount <= 0 && step < 0)) { 235 oCountMod.value = iCurrCount + step; 236 } 237} 238 239// ÐÑобÑажаеÑ/ÑкÑÑÐ²Ð°ÐµÑ Ð¾ÐºÐ½Ð¾ 240function SlideWindow(windowId) 241{ 242 var windowDiv = document.getElementById(windowId); 243 244 if (windowDiv == undefined) 245 { 246 return false; 247 } 248 249 if (windowDiv.style.display == "block") 250 { 251 HideWindow(windowId); 252 } 253 else 254 { 255 ShowWindow(windowId); 256 } 257} 258 259// УдалÑÐµÑ Ð´Ð¾ÑеÑние ÑлеменÑÑ ÑлеменÑа Ñ ID, ÑавнÑм node_id 260function deleteChildNodes(node_id) 261{ 262 var node = document.getElementById(node_id); 263 264 if (node !== undefined) 265 { 266 if (node.hasChildNodes()) 267 { 268 while (node.firstChild) 269 { 270 node.removeChild(node.firstChild); 271 } 272 } 273 } 274} 275 276// Ðагазин 277function doSetLocation(shop_country_id, path) 278{ 279 var req = new JsHttpRequest(); 280 281 // ÐÑобÑажаем ÑкÑан загÑÑзки 282 $.loadingScreen('show'); 283 284 req.onreadystatechange = function() 285 { 286 if (req.readyState == 4) 287 { 288 // УбиÑаем заÑемнение. 289 $.loadingScreen('hide'); 290 291 if (req.responseJS != undefined) 292 { 293 // ÐаннÑе. 294 if (req.responseJS.result != undefined) 295 { 296 oSelect = document.getElementById(location_select_id); 297 298 // ÐÑиÑаем select 299 oSelect.options.length = 0; 300 301 // ÐобавлÑем знаÑение " ... " 302 oSelect.options[oSelect.options.length] = new Option(" ... ", 0); 303 304 for (var key in req.responseJS.result) 305 { 306 oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1)); 307 } 308 309 // УÑÑанавливаем гоÑода 310 //doSetCity(oSelect.options[oSelect.selectedIndex].value); 311 oCity = document.getElementById(city_select_id); 312 oCity.options.length = 0; 313 oCity.options[oCity.options.length] = new Option(" ... ", 0); 314 315 oCityarea = document.getElementById(cityarea_select_id); 316 oCityarea.options.length = 0; 317 oCityarea.options[oCityarea.options.length] = new Option(" ... ", 0); 318 } 319 } 320 return true; 321 } 322 } 323 324 req.open('get', path + "?action=get_location&shop_country_id="+shop_country_id, true); 325 326 // ÐÑÑÑлаем даннÑе в обÑабоÑÑик. 327 req.send(null); 328} 329 330function doSetCity(shop_location_id, path) 331{ 332 var req = new JsHttpRequest(); 333 334 // ÐÑобÑажаем ÑкÑан загÑÑзки 335 $.loadingScreen('show'); 336 337 req.onreadystatechange = function() 338 { 339 if (req.readyState == 4) 340 { 341 // УбиÑаем заÑемнение. 342 $.loadingScreen('hide'); 343 344 if (req.responseJS != undefined) 345 { 346 // ÐаннÑе. 347 if (req.responseJS.result != undefined) 348 { 349 oSelect = document.getElementById(city_select_id); 350 351 // ÐÑиÑаем select 352 oSelect.options.length = 0; 353 354 // ÐобавлÑем знаÑение " ... " 355 oSelect.options[oSelect.options.length] = new Option(" ... ", 0); 356 357 for (var key in req.responseJS.result) 358 { 359 oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1)); 360 } 361 362 // УÑÑанавливаем ÑÐ°Ð¹Ð¾Ð½Ñ 363 //doSetCityArea(oSelect.options[oSelect.selectedIndex].value); 364 365 oCityarea = document.getElementById(cityarea_select_id); 366 oCityarea.options.length = 0; 367 oCityarea.options[oCityarea.options.length] = new Option(" ... ", 0); 368 } 369 } 370 return true; 371 } 372 } 373 374 req.open('get', path + "?action=get_city&shop_location_id="+shop_location_id, true); 375 376 // ÐÑÑÑлаем даннÑе в обÑабоÑÑик. 377 req.send(null); 378} 379 380function doSetCityArea(shop_city_id, path) 381{ 382 var req = new JsHttpRequest(); 383 384 // ÐÑобÑажаем ÑкÑан загÑÑзки 385 $.loadingScreen('show'); 386 387 req.onreadystatechange = function() 388 { 389 if (req.readyState == 4) 390 { 391 // УбиÑаем заÑемнение. 392 $.loadingScreen('hide'); 393 394 if (req.responseJS != undefined) 395 { 396 // ÐаннÑе. 397 if (req.responseJS.result != undefined) 398 { 399 oSelect = document.getElementById(cityarea_select_id); 400 401 // ÐÑиÑаем select 402 oSelect.options.length = 0; 403 404 // ÐобавлÑем знаÑение " ... " 405 oSelect.options[oSelect.options.length] = new Option(" ... ", 0); 406 407 for (var key in req.responseJS.result) 408 { 409 oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1)); 410 } 411 } 412 } 413 return true; 414 } 415 } 416 417 req.open('get', path + "?action=get_cityarea&shop_city_id="+shop_city_id, true); 418 419 // ÐÑÑÑлаем даннÑе в обÑабоÑÑик. 420 req.send(null); 421} 422 423// ÐлаваÑÑие блоки 424// полÑÑаем иÑÑ Ð¾Ð´Ð½ÑÑ Ð¿Ð¾Ð·Ð¸ÑÐ¸Ñ Ð¿Ð»Ð°Ð²Ð°ÑÑего блока 425function GetStyle(drag_object, axis) 426{ 427 var str_value = ""; 428 429 if(document.defaultView && document.defaultView.getComputedStyle) 430 { 431 var css = document.defaultView.getComputedStyle(drag_object, null); 432 str_value = css ? css.getPropertyValue(axis) : null; 433 } 434 else if(drag_object.currentStyle) 435 { 436 str_value = drag_object.currentStyle[axis]; 437 438 if (str_value == 'auto') 439 { 440 if (axis == 'top') 441 { 442 str_value = drag_object.offsetTop; 443 } 444 else 445 { 446 str_value = drag_object.offsetLeft; 447 } 448 } 449 } 450 451 return str_value; 452} 453 454function SetGradeMessage(message_id, grade_val) 455{ 456 // ÐапÑÐ¾Ñ backend-Ñ 457 var req = new JsHttpRequest(); 458 459 // ÐÑобÑажаем ÑкÑан загÑÑзки 460 $.loadingScreen('show'); 461 462 req.onreadystatechange = function() 463 { 464 if (req.readyState == 4) 465 { 466 // УбиÑаем заÑемнение. 467 $.loadingScreen('hide'); 468 469 return true; 470 } 471 } 472 473 req.open('get', "./?action=set_message_grade&helpdesk_message_id="+message_id+"&grade="+grade_val, true); 474 475 // ÐÑÑÑлаем даннÑе в обÑабоÑÑик. 476 req.send(null); 477} 478 479/** 480 * Ðбновление каÑÑинки CAPTCHA
481 * captchaKey - иденÑиÑикаÑÐ¾Ñ CAPTCHA 482 * captchaHeight - вÑÑоÑа каÑÑинки Ñ CAPTCHA 483 */ 484function ReNewCaptcha(captchaKey, captchaHeight) 485{ 486 if (document.images['captcha'] != undefined) 487 { 488 var antiCache = Math.floor(Math.random()*100000); 489 document.images['captcha'].src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache; 490 } 491} 492 493/** 494 * Ðбновление каÑÑинки CAPTCHA Ð´Ð»Ñ ÐºÐ°ÑÑинки по ее ID 495 * captchaKey - иденÑиÑикаÑÐ¾Ñ CAPTCHA 496 * captchaHeight - вÑÑоÑа каÑÑинки Ñ CAPTCHA 497 */ 498function ReNewCaptchaById(imageId, captchaKey, captchaHeight) 499{ 500 $('#'+imageId).updateCaptcha(captchaKey, captchaHeight); 501} 502 503// ÐÑобÑажаеÑ/ÑкÑÑÐ²Ð°ÐµÑ Ð±Ð»Ð¾Ðº 504function ShowHide(divId) 505{ 506 var windowDiv = document.getElementById(divId); 507 508 if (windowDiv == undefined) 509 { 510 return false; 511 } 512 513 if (windowDiv.style.display == "block") 514 { 515 windowDiv.style.display = 'none'; 516 } 517 else 518 { 519 windowDiv.style.display = 'block'; 520 } 521} 522 523//ФÑнкÑÐ¸Ñ Ð¾Ð±ÑаÑного вÑзова пÑи загÑÑзке ÑоÑÐ¼Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð½Ð° доÑÐºÑ Ð¾Ð±ÑÑвлений 524function callbackfunction_showFormAddItem(responseJS) 525{ 526 if (typeof responseJS != 'undefined') 527 { 528 $.loadingScreen('hide'); 529 530 // ÐаннÑе. 531 if (typeof responseJS.result != 'undefined') 532 { 533 html = responseJS.result; 534 535 document.getElementById('AddItemForm').innerHTML = html; 536 537 // ÐÑполнÑем ÑкÑипÑÑ Ð¸Ð· полÑÑенного Ñ ÑеÑвеÑа HTML-а 538 runScripts(document.getElementById('AddItemForm').getElementsByTagName('SCRIPT')); 539 540 // ÐÑиÑаем поле ÑообÑений 541 var div_id_message = document.getElementById('AddItemMessage'); 542 543 if (div_id_message) 544 { 545 div_id_message.innerHTML = ''; 546 } 547 548 //cr('AddItemForm'); 549 } 550 } 551} 552 553//ФÑнкÑÐ¸Ñ Ð¾Ð±ÑаÑного вÑзова пÑи оÑпÑавке Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð½Ð° доÑÐºÑ Ð¾Ð±ÑÑвлений 554function callbackfunction_SendFormItem(responseJS) 555{ 556 if (typeof responseJS != 'undefined') 557 { 558 if (responseJS.message != 'undefined') 559 { 560 var div_id_message = document.getElementById('AddItemMessage'); 561 562 if (div_id_message) 563 { 564 div_id_message.innerHTML = responseJS.message; 565 566 // ÐÑполнÑем ÑкÑипÑÑ Ð¸Ð· полÑÑенного Ñ ÑеÑвеÑа HTML-а 567 runScripts(div_id_message.getElementsByTagName('SCRIPT')); 568 569 // ÐеÑÐµÑ Ð¾Ð´Ð¸Ð¼ к ÑообÑÐµÐ½Ð¸Ñ 570 window.location.href = (window.location.href.indexOf('#') >= 0 ? window.location.href : window.location.href + '#FocusAddItemMessage'); 571 } 572 } 573 } 574} 575 576function ShowImgWindow(title, src, width, height) 577{ 578 obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0"); 579 obj.document.write("<html>"); 580 obj.document.write("<head>"); 581 obj.document.write("<title>"+title+"</title>"); 582 obj.document.write("</head>"); 583 obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>"); 584 obj.document.write("<img src=\""+src+"\" width=\""+width+"\" height=\""+height+"\" />"); 585 obj.document.write("</body>"); 586 obj.document.write("</html>"); 587 obj.document.close(); 588} 589 590function getElementsByName_iefix(tag, name) 591{ 592 var elem = document.getElementsByTagName(tag); 593 var arr = new Array(); 594 595 var iarr = 0; 596 597 for(i = 0; i < elem.length; i++) 598 { 599 att = elem[i].getAttribute("name"); 600 601 if(att == name) 602 { 603 arr[iarr] = elem[i]; 604 iarr++; 605 } 606 } 607 return arr; 608} 609 610// Ðзменение вÑÑоÑÑ Ð±Ð»Ð¾ÐºÐ° 611function changeHeightFloatBlockBorder (oBorder, iHeightAttribute, iStyleTop) 612{ 613 var iElementHeight = 0; 614 615 for (i = 0; i < oBorder.length; i++) 616 { 617 iElementHeight = oBorder[i].parentNode.offsetHeight + iHeightAttribute; 618 619 if (iElementHeight > 0) 620 { 621 oBorder[i].style.height = iElementHeight + 'px'; 622 oBorder[i].style.top = iStyleTop + 'px'; 623 } 624 } 625} 626 627// -- Forum -- 628function HideShow(id, id1) 629{ 630 $("#"+id).css('display', 'none'); 631 $("#"+id1).css('display', 'block'); 632} 633 634// СкÑÐ¸Ð¿Ñ Ð¾ÑкÑÑваеÑ/ÑкÑÑÐ²Ð°ÐµÑ ÑоÑÑÐ¼Ñ ÑекÑÑей гÑÑппÑ
635function ShowForums(up,id,count) 636{ 637 var down,up; 638 if (up == 0) 639 { 640 down = "none"; 641 up = ""; 642 } 643 else 644 { 645 down = ""; 646 up = "none"; 647 } 648 649 $("#down_"+id).css('display', down); 650 $("#up_"+id).css('display', up); 651 652 for(var i=1; i <= count; i++) 653 { 654 $("#"+id+"_"+i).css('display', up); 655 } 656} 657// --/ Forum --
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.