1jQuery.fn.outerHTML = function(s) { 2 return s 3 ? this.before(s).remove() 4 : jQuery("<p>").append( this.eq(0).clone() ).html(); 5}; 6jQuery.fn.check = function(mode) { // checkbox менÑÐµÑ ÑоÑÑоÑние 7 var mode = mode || 'on'; 8 9 return this.each(function() { 10 switch(mode) { 11 case 'on': 12 this.checked = true; 13 break; 14 case 'off': 15 this.checked = false; 16 break; 17 case 'toggle': 18 this.checked = !this.checked; 19 break; 20 } 21 }); 22}; 23jQuery.fn.animateCSS = function(x, func) { // анимаÑÐ¸Ñ CSS 24 if( func == undefined ) func = function() {}; 25 26 return this.removeClass(x + ' animated').addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ 27 $(this).removeClass(x + ' animated'); 28 func.apply($(this)); 29 }); 30}; 31(function($) { // appendPage 32 $.fn.appendPage = function( options ) { 33 var options = $.extend({ 34 nameItemClass: null, 35 url: null, 36 data: '', 37 sendType: 'GET', 38 distance: 500, 39 idElLoading: '', 40 need: 0, 41 onStart: function(){}, 42 onComplate: function(){}, 43 onAfter: function(){}, 44 45 me: null, 46 el: null, 47 nowItem: 0, 48 }, options); 49 var me = this, 50 el = $(this); 51 52 // if( $(this).length == 0 ) return; 53 // if( options.nameItemClass == null || options.url == null ) return; 54 55 if( el.hasClass('appendPage') == false ) { 56 $(window).scroll(function() { 57 var Ws = $(window).scrollTop(); 58 var Wh = $(document).height(); 59 60 var PagePercent = Wh-Ws-$(window).height(); 61 if( PagePercent < options.distance && el.data('Cont_isLoad') == undefined ) { 62 me.append(); 63 } 64 }); 65 el.addClass('appendPage'); 66 } 67 68 this.append = function() { 69 options.nowItem = $(options.nameItemClass, el).length; 70 if( el.data('new') != undefined ) options.nowItem = 0; 71 72 el.data('Cont_isLoad', 1); 73 if( options.idElLoading != '' ) $('#'+options.idElLoading).show(); 74 75 options.onStart( el, options ); 76 ajax.conf({ 77 'url': options.url.replace("%i%", options.nowItem), 78 'data': options.data, 79 'type': options.sendType, 80 'complete': function( jqXHR, textStatus ) { 81 if( options.idElLoading != '' ) $('#'+options.idElLoading).hide(); 82 options.onComplate( el, options ); 83 } 84 }).html(function(res, status, xhr) { 85 if( options.nowItem == 0 ) { 86 el.html(res); 87 } else { 88 if( xhr.getResponseHeader('appendPage') != 'end' ) { 89 el.append(res); 90 } 91 } 92 el.removeData('new'); 93 94 if( xhr.getResponseHeader('appendPage') != 'end' ) { 95 el.removeData('Cont_isLoad'); 96 97 if( options.need > options.nowItem ) { 98 me.append(); 99 } 100 if( options.need > 0 && options.need < options.nowItem ) options.need = 0; 101 } 102 103 options.onAfter( el, options ); 104 }); 105 }; 106 107 this.get = function( new_options ) { 108 options = $.extend( options, new_options ); 109 110 el.removeData('Cont_isLoad'); 111 el.data('new', 1); 112 me.append(); 113 }; 114 115 $(window).trigger('scroll'); 116 117 return this; 118 } 119 //ÐагÑÑзка ÑлеменÑов по кнопке "ÐоказаÑÑ ÐµÑе" 120 $.fn.loadMoreNews = function(options, el) { 121 var options = $.extend({ 122 nameItemClass: null, 123 url: null, 124 data: '', 125 sendType: 'GET', 126 distance: 500, 127 idElLoading: '', 128 idElButton: '', 129 need: 0, 130 onStart: function(){}, 131 onComplate: function(){}, 132 onAfter: function(){}, 133 me: null, 134 el: null, 135 nowItem: 0, 136 }, options); 137 options.nowItem = $(options.nameItemClass, el).length; 138 if(el.data('new') != undefined ) options.nowItem = 0; 139 el.data('Cont_isLoad', 1); 140 if( options.idElLoading != '' ) $('#'+options.idElLoading).show(); 141 if( options.idElButton != '' ) $('#'+options.idElButton).hide(); 142 options.onStart( el, options ); 143 ajax.conf({ 144 'url': options.url.replace("%i%", options.nowItem), 145 'data': options.data, 146 'type': options.sendType, 147 'complete': function( jqXHR, textStatus ) { 148 if( options.idElLoading != '' ) $('#'+options.idElLoading).hide(); 149 if(jqXHR.status !== 404 && jqXHR.status !== 500){ 150 if( options.idElButton != '' ) $('#'+options.idElButton).show(); 151 } 152 options.onComplate( el, options ); 153 } 154 }).html(function(res, status, xhr) { 155 if( options.nowItem == 0 ) { 156 el.html(res); 157 } else { 158 if( xhr.getResponseHeader('appendPage') != 'end' ) { 159 el.append(res); 160 } 161 } 162 el.removeData('new'); 163 164 if( xhr.getResponseHeader('appendPage') != 'end' ) { 165 el.removeData('Cont_isLoad'); 166 167 if( options.need > options.nowItem ) { 168 el.append(); 169 } 170 if( options.need > 0 && options.need < options.nowItem ) options.need = 0; 171 } 172 173 options.onAfter( el, options ); 174 }); 175 } 176})(jQuery); 177(function($) { // модеÑиÑиÑованнÑй плагин $browser 178 var userAgent = navigator.userAgent.toLowerCase(); 179 $.browser = { 180 version: (userAgent.match( /.+(?:firefox|rv|chrome|it|msie|version|opera)[\/: ](\d{1, 5}\.\d{1, 7})|(\d{1, 5}
180)/ ) || [0, '0'])[1], 181 chrome: /chrome/.test( userAgent ), 182 safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ), 183 opera: /opera/.test( userAgent ), 184 msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), 185 mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) 186 }; 187})(jQuery); 188(function(n) { // scrollLock (запÑÐµÑ ÑкÑола) пÑимеÑ: $('#element').scrollLock(); 189 var i = "onmousewheel" in window ? "ActiveXObject" in window ? "wheel" : "mousewheel" : "DOMMouseScroll", 190 t = ".scrollLock", 191 r = n.fn.scrollLock; 192 n.fn.scrollLock = function(r) { 193 return r == "off" ? this.each(function() { 194 n(this).off(t) 195 }) : this.each(function() { 196 n(this).on(i + t, function(t) { 197 var i = n(this), 198 u = i.scrollTop(), 199 e = i.prop("scrollHeight"), 200 o = i.prop("clientHeight"), 201 f = t.originalEvent.wheelDelta || -1 * t.originalEvent.detail || -1 * t.originalEvent.deltaY, 202 r = t.type == "wheel" ? t.originalEvent.deltaY : 0; 203 (f > 0 && u + r <= 0 || f < 0 && u + r >= e - o) && (t.stopPropagation(), t.preventDefault(), r && i.scrollTop(u + r)) 204 }) 205 }) 206 }, n.fn.scrollLock.noConflict = function() { 207 return n.fn.scrollLock = r, this 208 } 209})(jQuery); 210(function($) { // BGColor animate 211 function isRGBACapable() { 212 var $script = $('script:first'), 213 color = $script.css('color'), 214 result = false;
215 if (/^rgba/.test(color)) { 216 result = true; 217 } else { 218 try { 219 result = ( color != $script.css('color', 'rgba(0, 0, 0, 0.5)').css('color') ); 220 $script.css('color', color); 221 } catch (e) { 222 } 223 } 224 225 return result; 226 } 227 228 $.extend(true, $, { 229 support: { 230 'rgba': isRGBACapable() 231 } 232 }); 233 234 var properties = ['color', 'backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'outlineColor']; 235 $.each(properties, function(i, property) { 236 $.Tween.propHooks[ property ] = { 237 get: function(tween) { 238 return $(tween.elem).css(property); 239 }, 240 set: function(tween) { 241 var style = tween.elem.style; 242 var p_begin = parseColor($(tween.elem).css(property)); 243 var p_end = parseColor(tween.end); 244 tween.run = function(progress) { 245 style[property] = calculateColor(p_begin, p_end, progress); 246 } 247 } 248 } 249 }); 250 251 // borderColor doesn't fit in standard fx.step above. 252 $.Tween.propHooks.borderColor = { 253 set: function(tween) { 254 var style = tween.elem.style; 255 var p_begin = []; 256 var borders = properties.slice(2, 6); // All four border properties 257 $.each(borders, function(i, property) { 258 p_begin[property] = parseColor($(tween.elem).css(property)); 259 }); 260 var p_end = parseColor(tween.end); 261 tween.run = function(progress) { 262 $.each(borders, function(i, property) { 263 style[property] = calculateColor(p_begin[property], p_end, progress); 264 }); 265 } 266 } 267 } 268 269 // Calculate an in-between color. Returns "#aabbcc"-like string. 270 function calculateColor(begin, end, pos) { 271 var color = 'rgb' + ($.support['rgba'] ? 'a' : '') + '(' 272 + parseInt((begin[0] + pos * (end[0] - begin[0])), 10) + ',' 273 + parseInt((begin[1] + pos * (end[1] - begin[1])), 10) + ',' 274 + parseInt((begin[2] + pos * (end[2] - begin[2])), 10); 275 if ($.support['rgba']) { 276 color += ',' + (begin && end ? parseFloat(begin[3] + pos * (end[3] - begin[3])) : 1); 277 } 278 color += ')'; 279 return color; 280 } 281 282 // Parse an CSS-syntax color. Outputs an array [r, g, b] 283 function parseColor(color) { 284 var match, quadruplet; 285 286 // Match #aabbcc 287 if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) { 288 quadruplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1]; 289 290 // Match #abc 291 } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) { 292 quadruplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1]; 293 294 // Match rgb(n, n, n) 295 } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) { 296 quadruplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1]; 297 298 } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)) { 299 quadruplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])]; 300 301 // No browser returns rgb(n%, n%, n%), so little reason to support this format. 302 } 303 return quadruplet; 304 } 305})(jQuery); 306(function($) { // ÐвÑо-подгонка ÑÑиÑÑа под ÑазмеÑÑ Ð±Ð»Ð¾ÐºÐ° 307 $.fn.textAutoFill = function(options) { 308 var options = $.extend({ 309 minFontSize: 3, 310 }, options); 311 312 $(this).wrapInner('<span>'); 313 $(this).css({ 314 'white-space': 'nowrap', 315 'overflow': 'hidden', 316 }); 317 318 var minFontSize = options.minFontSize; 319 var fontSize = parseInt( $(this).css('font-size') ); 320 var ourText = $('span:visible:first', this); 321 var maxHeight = $(this).height(); 322 var maxWidth = $(this).width(); 323 var textHeight = ourText.height(); 324 var textWidth = ourText.width(); 325 326 while( textWidth > maxWidth && fontSize >= minFontSize ) { 327 ourText.css('font-size', fontSize); 328 textHeight = ourText.height(); 329 textWidth = ourText.width(); 330 fontSize = fontSize - 1; 331 } 332 333 return this; 334 } 335})(jQuery); 336(function($) { // ÑоÑÑиÑовка пеÑеÑÑгиванием 337 // Example: 338 // $( '#element' ).dragsort({ 339 // itemSelector: "li:not(.AddPhoto)", 340 // dragBetween: false, 341 // dragEnd: function() {}, 342 // placeHolderTemplate: "<li class='myMassPhotoUploaderItem'></li>", 343 // dragHandlerClass: 'dragHandler', 344 // }); 345 346 $.fn.dragsort = function(options) {
347 if (options == "destroy") { 348 $(this.selector).trigger("dragsort-uninit"); 349 return; 350 } 351 352 var opts = $.extend({}, $.fn.dragsort.defaults, options); 353 var lists = []; 354 var list = null, lastPos = null; 355 356 this.each(function(i, cont) { 357 358 if ($(cont).is("table") && $(cont).children().length == 1 && $(cont).children().is("tbody")) 359 cont = $(cont).children().get(0); 360 361 var newList = { 362 draggedItem: null, 363 placeHolderItem: null, 364 pos: null, 365 offset: null, 366 offsetLimit: null, 367 scroll: null, 368 container: cont, 369 370 init: function() { 371 opts.tagName = $(this.container).children().length == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase(); 372 if (opts.itemSelector == "") 373 opts.itemSelector = opts.tagName; 374 if (opts.dragSelector == "") 375 opts.dragSelector = opts.tagName; 376 if (opts.placeHolderTemplate == "") 377 opts.placeHolderTemplate = "<" + opts.tagName + "> </" + opts.tagName + ">"; 378 379 $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); 380 }, 381 382 uninit: function() { 383 var list = lists[$(this).attr("data-listidx")]; 384 $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); 385 }, 386 387 getItems: function() { 388 return $(this.container).children(opts.itemSelector); 389 }, 390 391 grabItem: function(e) { 392 var list = lists[$(this).attr("data-listidx")]; 393 var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); 394 var insideMoveableItem = list.getItems().filter(function() { return this == item; }).length > 0; 395 396 if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).length > 0 || !insideMoveableItem) 397 return; 398 399 e.preventDefault(); 400 401 var dragHandle = e.target; 402 while (!$(dragHandle).is(opts.dragSelector)) { 403 if (dragHandle == this) return; 404 dragHandle = dragHandle.parentNode; 405 } 406 $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); 407 $(dragHandle).css("cursor", "move"); 408 409 var listElem = this; 410 var trigger = function() { 411 list.dragStart.call(listElem, e); 412 $(list.container).unbind("mousemove", trigger); 413 }; 414 $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); 415 }, 416 417 dragStart: function(e) { 418 if (list != null && list.draggedItem != null) 419 list.dropItem(); 420 421 list = lists[$(this).attr("data-listidx")]; 422 list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) 423 424 list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); 425 426 var mt = parseInt(list.draggedItem.css("marginTop")); 427 var ml = parseInt(list.draggedItem.css("marginLeft")); 428 list.offset = list.draggedItem.offset(); 429 list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; 430 list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; 431 432 if (!opts.dragBetween) { 433 var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().length * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); 434 list.offsetLimit = $(list.container).offset(); 435 list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); 436 list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); 437 } 438 439 var h = list.draggedItem.height(); 440 var w = list.draggedItem.width(); 441 if (opts.tagName == "tr") { 442 list.draggedItem.children().each(function() { $(this).width($(this).width()); }); 443 list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true).addClass( opts.dragPlaceholderClass ); 444 list.draggedItem.after(list.placeHolderItem); 445 list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); 446 } else { 447 list.draggedItem.after(opts.placeHolderTemplate); 448 list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }
448).attr("data-placeholder", true).addClass( opts.dragPlaceholderClass ); 449 } 450 451 if (opts.tagName == "td") { 452 var listTable = list.draggedItem.closest("table").get(0); 453 $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem); 454 } 455 456 var orig = list.draggedItem.attr("style"); 457 list.draggedItem.attr("data-origstyle", orig ? orig : ""); 458 list.draggedItem.css({ position: "absolute", "z-index": 999, height: h, width: w }).addClass( opts.dragHandlerClass ); 459 460 list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; 461 list.scroll.scrollY = window.setInterval(function() { 462 if (opts.scrollContainer != window) { 463 $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); 464 return; 465 } 466 var t = $(opts.scrollContainer).scrollTop(); 467 if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { 468 $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); 469 list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); 470 } 471 }, 10); 472 list.scroll.scrollX = window.setInterval(function() { 473 if (opts.scrollContainer != window) { 474 $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); 475 return; 476 } 477 var l = $(opts.scrollContainer).scrollLeft(); 478 if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { 479 $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); 480 list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); 481 } 482 }, 10); 483 484 $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); 485 list.setPos(e.pageX, e.pageY); 486 $(document).bind("mousemove", list.swapItems); 487 $(document).bind("mouseup", list.dropItem); 488 if (opts.scrollContainer != window) 489 $(window).bind("wheel", list.wheel); 490 }, 491 492 setPos: function(x, y) { 493 var top = y - this.offset.top; 494 var left = x - this.offset.left; 495 496 if (!opts.dragBetween) { 497 top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); 498 left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); 499 } 500 501 var parent = this.draggedItem.offsetParent().not("body").offset(); 502 if (parent != null) { 503 top -= parent.top; 504 left -= parent.left; 505 } 506 507 if (opts.scrollContainer == window) { 508 y -= $(window).scrollTop(); 509 x -= $(window).scrollLeft(); 510 y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); 511 x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); 512 } else { 513 var cont = $(opts.scrollContainer); 514 var offset = cont.offset(); 515 y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); 516 x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); 517 } 518 519 list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); 520 list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); 521 522 this.draggedItem.css({ top: top, left: left }); 523 }, 524 525 wheel: function(e) { 526 if (list && opts.scrollContainer != window) { 527 var cont = $(opts.scrollContainer); 528 var offset = cont.offset(); 529 e = e.originalEvent; 530 if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { 531 var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; 532 cont.scrollTop(cont.scrollTop() + deltaY); 533 e.preventDefault(); 534 } 535 } 536 }, 537 538 buildPositionTable: function() { 539 var pos = []; 540 this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { 541 var loc = $(this).offset(); 542 loc.right = loc.left + $(this).outerWidth(); 543 loc.bottom = loc.top + $(this).outerHeight(); 544 loc.elm = this; 545 pos[i] = loc; 546 }); 547 this.pos = pos; 548 }, 549 550 dropItem: function() { 551 if (list.draggedItem == null) 552 return; 553 554 var orig = list.draggedItem.attr("data-origstyle"); 555 list.draggedItem.attr("style", orig); 556 if (orig == "") 557 list.draggedItem.removeAttr("style"); 558 list.draggedItem.removeAttr("data-origstyle").removeClass( opts.dragHandlerClass ); 559 560 list.placeHolderItem.before(list.draggedItem); 561 list.placeHolderItem.remove(); 562 563 $("[data-droptarget], .dragSortItem").remove(); 564 565 window.clearInterval(list.scroll.scrollY); 566 window.clearInterval(list.scroll.scrollX); 567 568 if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) 569 if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order 570 var pos = list.draggedItem.attr("data-origpos").split('-'); 571 var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); 572 if (nextItem.length > 0) 573 nextItem.before(list.draggedItem); 574 else if (pos[1] == 0) 575 $(lists[pos[0]].container).prepend(list.draggedItem); 576 else 577 $(lists[pos[0]].container).append(list.draggedItem); 578 } 579 list.draggedItem.removeAttr("data-origpos"); 580 581 list.draggedItem = null; 582 $(document).unbind("mousemove", list.swapItems); 583 $(document).unbind("mouseup", list.dropItem); 584 if (opts.scrollContainer != window) 585 $(window).unbind("wheel", list.wheel); 586 return false;
587 }, 588 589 swapItems: function(e) { 590 if (list.draggedItem == null) 591 return false; 592 593 list.setPos(e.pageX, e.pageY); 594 595 var ei = list.findPos(e.pageX, e.pageY); 596 var nlist = list; 597 for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { 598 ei = lists[i].findPos(e.pageX, e.pageY); 599 nlist = lists[i]; 600 } 601 602 if (ei == -1) 603 return false; 604 605 var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; 606 var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); 607 608 if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) 609 $(nlist.pos[ei].elm).before(list.placeHolderItem); 610 else 611 $(nlist.pos[ei].elm).after(list.placeHolderItem); 612 613 fixed.each(function() { 614 var elm = children().eq(this.idx).get(0); 615 if (this != elm && children().index(this) < this.idx) 616 $(this).insertAfter(elm); 617 else if (this != elm) 618 $(this).insertBefore(elm); 619 }); 620 621 $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); 622 lastPos = list.draggedItem.offset(); 623 return false; 624 }, 625 626 findPos: function(x, y) { 627 for (var i = 0; i < this.pos.length; i++) { 628 if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) 629 return i; 630 } 631 return -1; 632 }, 633 634 createDropTargets: function() { 635 if (!opts.dragBetween) 636 return; 637 638 $(lists).each(function() { 639 var ph = $(this.container).find("[data-placeholder]"); 640 var dt = $(this.container).find("[data-droptarget]"); 641 if (ph.length > 0 && dt.length > 0) 642 dt.remove(); 643 else if (ph.length == 0 && dt.length == 0) { 644 if (opts.tagName == "td") 645 $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); 646 else 647 $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").removeClass( opts.dragPlaceholderClass ).clone().attr("data-droptarget", true)); 648 649 list.placeHolderItem.attr("data-placeholder", true).addClass( opts.dragPlaceholderClass ); 650 } 651 }); 652 } 653 }; 654 655 newList.init(); 656 lists.push(newList); 657 }); 658 659 return this; 660 }; 661 662 $.fn.dragsort.defaults = { 663 itemSelector: "", 664 dragSelector: "", 665 dragSelectorExclude: "input, textarea", 666 dragEnd: function() { }, 667 dragBetween: false, 668 placeHolderTemplate: "", 669 scrollContainer: window, 670 scrollSpeed: 5, 671 dragHandlerClass: 'dragHandler', 672 dragPlaceholderClass: 'dragPlaceholder', 673 }; 674})(jQuery); 675 676 677$.fn.PageScrollToTop = function() { 678 var offsetGood = 20; 679 var scrollDiv = $(this); 680 681 scrollDiv.hide(); 682 if( $(window).scrollTop() > offsetGood ) { 683 scrollDiv.fadeIn(0); 684 } 685 $(window).scroll(function() { 686 if( $(window).scrollTop() <= offsetGood ) { 687 $(scrollDiv).fadeOut(100); 688 } else { 689 $(scrollDiv).fadeIn(200); 690 } 691 }); 692 scrollDiv.click(function() { 693 $('html,body').animate({scrollTop: 0}, 30); 694 }); 695 696 scrollDiv.on('mouseenter', '', function() { 697 $(this).addClass('H'); 698 }); 699 scrollDiv.on('mouseleave', '', function() { 700 $(this).removeClass('H'); 701 }); 702} 703 704String.prototype.formatMoney = function(c, d, t){ // в денежнÑй ÑоÑÐ¼Ð°Ñ ( пÑимеÑ: string = PRICE_VAL.formatMoney(0, '.', ' ') ) 705 var n = parseInt( String(this).replace(/[^0-9-]/g, '') ), 706 c = isNaN(c = Math.abs(c)) ? 2 : c, 707 d = d == undefined ? "." : d, 708 t = t == undefined ? " " : t, 709 s = n < 0 ? "-" : "", 710 i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 711 j = (j = i.length) > 3 ? j % 3 : 0; 712 return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); 713}; 714 715function changeQuotes( text ) { // Ðамена пÑÑмÑÑ ÐºÐ°Ð²ÑÑек на «ÑлоÑки» 716 var el = document.createElement("DIV"); 717 el.innerHTML = text; 718 for( var i=0, l=el.childNodes.length; i<l; i++ ) { 719 if( el.childNodes[i].hasChildNodes() && el.childNodes.length>1 ) { 720 el.childNodes[i].innerHTML = changeQuotes(el.childNodes[i].innerHTML); 721 } else { 722 el.childNodes[i].textContent = el.childNodes[i].textContent.replace(/\x27/g, '\x22').replace(/(\w)\x22(\w)/g, '$1\x27$2').replace(/(^)\x22(\s)/g, '$1»$2').replace(/(^|\s|\()"/g, "$1«").replace(/"(\;|\!|\?|\:|\.|\,|$|\)|\s)/g, "»$1"); 723 } 724 } 725 return el.innerHTML; 726} 727function str_replace(search, replace, subject) { 728 return subject.split(search).join(replace); 729} 730function str_ireplace( f_needle, f_replace, f_haystack ) { 731 var result = ''; 732 var index = 0; 733 var haystack = f_haystack.toLowerCase(); 734 var needle = f_needle.toLowerCase(); 735 while((index = haystack.indexOf(needle)) > -1){ 736 result += f_haystack.substring(0, index); 737 result += f_replace; 738 haystack = haystack.substring(index + f_needle.length); 739 f_haystack = f_haystack.substring(index + f_needle.length); 740 } 741 return result + f_haystack; 742} 743function strpos( haystack, needle, offset){ 744 var i = haystack.indexOf( needle, offset ); 745 return i >= 0 ? i : false;
746} 747function substr_count (haystack, needle, offset, length) { 748 var pos = 0, 749 cnt = 0; 750 751 haystack += ''; 752 needle += ''; 753 if (isNaN(offset)) { 754 offset = 0; 755 } 756 if (isNaN(length)) { 757 length = 0; 758 } 759 offset--; 760 761 while ((offset = haystack.indexOf(needle, offset + 1)) != -1) { 762 if (length > 0 && (offset + needle.length) > length) { 763 return false; 764 } else { 765 cnt++; 766 } 767 } 768 769 return cnt; 770} 771function checkmail(email, strict) { 772 if ( !strict ) email = email.replace(/^\s+|\s+$/g, ''); 773 return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2, 4}$/i).test(email); 774} 775function str_pad( input, pad_length, pad_string, pad_type ) { 776 var half = '', pad_to_go; 777 778 var str_pad_repeater = function(s, len){ 779 var collect = '', i; 780 781 while(collect.length < len) collect += s; 782 collect = collect.substr(0,len); 783 784 return collect; 785 }; 786 787 if (pad_type != 'STR_PAD_LEFT' && pad_type != 'STR_PAD_RIGHT' && pad_type != 'STR_PAD_BOTH') { pad_type = 'STR_PAD_RIGHT'; } 788 if ((pad_to_go = pad_length - input.length) > 0) { 789 if (pad_type == 'STR_PAD_LEFT') { input = str_pad_repeater(pad_string, pad_to_go) + input; } 790 else if (pad_type == 'STR_PAD_RIGHT') { input = input + str_pad_repeater(pad_string, pad_to_go); } 791 else if (pad_type == 'STR_PAD_BOTH') { 792 half = str_pad_repeater(pad_string, Math.ceil(pad_to_go/2)); 793 input = half + input + half; 794 input = input.substr(0, pad_length); 795 } 796 } 797 798 return input; 799} 800function count( mixed_var, mode ) { 801 var key, cnt = 0; 802 if( mode == 'COUNT_RECURSIVE' ) mode = 1; 803 if( mode != 1 ) mode = 0; 804 for(key in mixed_var){ 805 cnt++; 806 if( mode==1 && mixed_var[key] && (mixed_var[key].constructor === Array || mixed_var[key].constructor === Object) ){ 807 cnt += count(mixed_var[key], 1); 808 } 809 } 810 return cnt; 811} 812function explode( delimiter, string ) { 813 var emptyArray = { 0: '' }; 814 815 if ( arguments.length != 2 816 || typeof arguments[0] == 'undefined' 817 || typeof arguments[1] == 'undefined' ) 818 { 819 return null; 820 } 821 822 if ( delimiter === '' 823 || delimiter === false 824 || delimiter === null ) 825 { 826 return false; 827 } 828 829 if ( typeof delimiter == 'function' 830 || typeof delimiter == 'object' 831 || typeof string == 'function' 832 || typeof string == 'object' ) 833 { 834 return emptyArray; 835 } 836 837 if ( delimiter === true ) { 838 delimiter = '1'; 839 } 840 841 return string.toString().split ( delimiter.toString() ); 842} 843function implode( glue, pieces ) { 844 return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces ); 845} 846function in_array(needle, haystack, strict) { 847 var found = false, key, strict = !!strict; 848 for (key in haystack) { 849 if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { 850 found = true; 851 break; 852 } 853 } 854 return found; 855} 856function trim( str, charlist ) { 857 charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1'); 858 var re = new RegExp('^[' + charlist + ']+|[' + charlist + ']+$', 'g'); 859 return str.replace(re, ''); 860} 861function toFixed(a, n) { 862 a = a*1; 863 re = new RegExp('([0-9]+)(\.[0-9]*)?'); 864 arr = re.exec(a.toFixed(10).toString()); 865 if (!arr[2].length) { 866 arr[2]='.'; 867 } else { 868 arr[2]=arr[2].substr(0, n+1); 869 } 870 for (i=n-(arr[2].length-1); i--; ) { 871 arr[2]+='0'; 872 } 873 return arr[1]+arr[2]; 874} 875function array_unique(arr) { 876 var ret = Array(); 877 for(var i = 0; i < arr.length; i++) { // start loop at 1 as element 0 can never be a duplicate 878 if( !in_array(arr[i], ret) ) { 879 ret.push(arr[i]); 880 } 881 } 882 return ret; 883} 884function base64_encode( data ) { 885 // 886 // + original by: Tyler Akins (http://rumkin.com) 887 // + improved by: Bayron Guevara 888 889 var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 890 var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc=''; 891 892 do { // pack three octets into four hexets 893 o1 = data.charCodeAt(i++); 894 o2 = data.charCodeAt(i++); 895 o3 = data.charCodeAt(i++); 896 897 bits = o1<<16 | o2<<8 | o3; 898 899 h1 = bits>>18 & 0x3f; 900 h2 = bits>>12 & 0x3f; 901 h3 = bits>>6 & 0x3f; 902 h4 = bits & 0x3f; 903 904 // use hexets to index into b64, and append result to encoded string 905 enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); 906 } while (i < data.length); 907 908 switch( data.length % 3 ){ 909 case 1: 910 enc = enc.slice(0, -2) + '=='; 911 break; 912 case 2: 913 enc = enc.slice(0, -1) + '='; 914 break; 915 } 916 917 return enc; 918} 919function text_diff(first, second) { 920 var start = 0; 921 while (start < first.length && first[start] == second[start]) { 922 ++start; 923 } 924 var end = 0; 925 while (first.length - end > start && first[first.length - end - 1] == second[second.length - end - 1]) { 926 ++end; 927 } 928 end = second.length - end;
929 return second.substr(start, end - start); 930} 931function array_diff(array) { 932 var arr_dif = [], i = 1, argc = arguments.length, argv = arguments, key, key_c, found=false; 933 934 for ( key in array ){ 935 for (i = 1; i< argc; i++){ 936 found = false; 937 for (key_c in argv[i]) { 938 if (argv[i][key_c] == array[key]) { 939 found = true; 940 break; 941 } 942 } 943 if(!found){ 944 arr_dif[key] = array[key]; 945 } 946 } 947 } 948 949 return arr_dif; 950} 951function getUrlVars() { 952 // http://somesite.com/index.php?id=123&page=home 953 // var id = getUrlVars()["id"]; 954 var vars = {}; 955 var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { 956 vars[key] = value; 957 }); 958 return vars; 959} 960function parseDate(str) { 961 str = trim(str); 962 str = str_replace( '.', '|', str ); 963 str = str_replace( ' ', '|', str ); 964 str = str_replace( ':', '|', str ); 965 966 var dateParts = str.split("|"); 967 var year = 0, month = 0, day = 0, hours = 0, minutes = 0, seconds = 0; 968 969 if(dateParts.length < 3) { 970 return false; 971 } 972 973 year = dateParts[2];
974 month = dateParts[1] - 1; 975 day = dateParts[0]; 976 if( !isNaN(dateParts[3]) ) hours = dateParts[3]; 977 if( !isNaN(dateParts[4]) ) minutes = dateParts[4]; 978 if( !isNaN(dateParts[5]) ) seconds = dateParts[5]; 979 980 return new Date(year, month, day, hours, minutes, seconds); 981} 982function numMap( x, in_min, in_max, out_min, out_max ) { // оÑобÑажение ÑиÑлового диапазона на дÑÑгой 983 return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 984} 985function htmlspecialchars( string, quote_style, charset, double_encode ) { 986 var optTemp = 0,i = 0,noquotes = false; 987 if (typeof quote_style === 'undefined' || quote_style === null) { 988 quote_style = 2; 989 } 990 string = string+''; 991 if (double_encode !== false) { // Put this first to avoid double-encoding 992 string = string.replace(/&/g, '&'); 993 } 994 string = string.replace(/</g, '<').replace(/>/g, '>'); 995 996 var OPTS = { 997 'ENT_NOQUOTES': 0, 998 'ENT_HTML_QUOTE_SINGLE': 1, 999 'ENT_HTML_QUOTE_DOUBLE': 2, 1000 'ENT_COMPAT': 2, 1001 'ENT_QUOTES': 3, 1002 'ENT_IGNORE': 4 1003 }; 1004 if ( quote_style === 0 ) { 1005 noquotes = true; 1006 } 1007 if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags 1008 quote_style = [].concat(quote_style); 1009 for (i = 0; i < quote_style.length; i++) { 1010 // Resolve string input to bitwise e.g. 'ENT_IGNORE' becomes 4 1011 if (OPTS[quote_style[i]] === 0) { 1012 noquotes = true; 1013 } else if (OPTS[quote_style[i]]) { 1014 optTemp = optTemp | OPTS[quote_style[i]]; 1015 } 1016 } 1017 quote_style = optTemp; 1018 } 1019 if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { 1020 string = string.replace(/'/g, '''); 1021 } 1022 if (!noquotes) { 1023 string = string.replace(/"/g, '"'); 1024 } 1025 1026 return string; 1027} 1028function htmlspecialchars_decode( string, quote_style ) { 1029 var optTemp = 0, 1030 i = 0, 1031 noquotes = false; 1032 if (typeof quote_style === 'undefined') { 1033 quote_style = 2; 1034 } 1035 string = string.toString() 1036 .replace(/</g, '<') 1037 .replace(/>/g, '>'); 1038 var OPTS = { 1039 'ENT_NOQUOTES': 0, 1040 'ENT_HTML_QUOTE_SINGLE': 1, 1041 'ENT_HTML_QUOTE_DOUBLE': 2, 1042 'ENT_COMPAT': 2, 1043 'ENT_QUOTES': 3, 1044 'ENT_IGNORE': 4 1045 }; 1046 if (quote_style === 0) { 1047 noquotes = true; 1048 } 1049 if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags 1050 quote_style = [].concat(quote_style); 1051 for (i = 0; i < quote_style.length; i++) { 1052 // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4 1053 if (OPTS[quote_style[i]] === 0) { 1054 noquotes = true; 1055 } else if (OPTS[quote_style[i]]) { 1056 optTemp = optTemp | OPTS[quote_style[i]]; 1057 } 1058 } 1059 quote_style = optTemp; 1060 } 1061 if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { 1062 string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should 1063 // string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP 1064 } 1065 if (!noquotes) { 1066 string = string.replace(/"/g, '"'); 1067 } 1068 // Put this in last place to avoid escape being double-decoded 1069 string = string.replace(/&/g, '&'); 1070 1071 return string; 1072} 1073function time() { 1074 return Math.round(new Date().getTime()/1000); 1075} 1076 1077 1078function GoToFromPage(t, offsetPos) { 1079 var offsetPos = ( offsetPos == undefined ) ? 0 : offsetPos; 1080 if( t != "" && $("#"+t).offset() != undefined ) { 1081 $('html, body').animate({ 1082 scrollTop: $("#"+t).offset().top + offsetPos 1083 }, 600); 1084 } 1085} 1086function capchaUpdate() { 1087 var date = new Date(); 1088 var time = date.getTime(); 1089 1090 $('img.CCAPCHA').attr('src', '/capcha.php?t='+time); 1091} 1092 1093 1094MW = { 1095 IsOpen: 0, 1096 width: 385, 1097 height: 65, 1098 top: 128, 1099 left: 673, 1100 position: 'absolute', 1101 Hcont: '', 1102 cont: '', 1103 btn_close: 0, 1104 IssetOverlay: false, 1105 OverlayClickClose: false, 1106 1107 Show: function(data) { 1108 this.Close(); 1109 this.IsOpen = 1; 1110 var data = (data == undefined) ? 0 : data; 1111 var width = (data.width == undefined) ? this.width : data.width; 1112 var height = (data.height == undefined) ? this.height : data.height; 1113 var top = (data.top == undefined) ? this.top : data.top; 1114 var left = (data.left == undefined) ? this.left : data.left; 1115 var Hcont = (data.Hcont == undefined) ? this.Hcont : data.Hcont; 1116 var cont = (data.cont == undefined) ? this.cont : data.cont; 1117 var position = (data.position == undefined) ? this.position : data.position; 1118 var btn_close = (data.btn_close == undefined) ? this.btn_close : data.btn_close; 1119 var IssetOverlay = (data.IssetOverlay == undefined) ? this.IssetOverlay : data.IssetOverlay; 1120 var OverlayClickClose = (data.OverlayClickClose == undefined) ? this.OverlayClickClose : data.OverlayClickClose; 1121 1122 var all_width = window.innerWidth; 1123 var all_height = jQuery(window).height(); 1124 1125 if(left == 'center') { 1126 left = ((all_width/2)-(width/2)); 1127 } else if(left == 'left') { 1128 left = 14; 1129 } else if(left == 'right') { 1130 left = jQuery(window).width()-width-14; 1131 } 1132 1133 if(top == 'center') { 1134 top = ((all_height/2)-(height/2)); 1135 } else if(top == 'top') { 1136 top = 14; 1137 } else if(top == 'bottom') { 1138 top = jQuery(window).height()-height-14; 1139 } 1140 1141 var css_msie_top = ""; 1142 // if($.browser.msie && position == 'fixed') { 1143 // position = 'absolute'; 1144 // top = "expression(document.getElementsByTagName('body')[0].scrollTop)"+top; 1145 // } 1146 1147 if(btn_close) { 1148 btn_close = "<img src='/images/mw/ico_close.png' style='position: absolute; right: 6px; top: 6px; cursor: pointer;' id='mwClose'>"; 1149 } else btn_close = ""; 1150 1151 var new_MW = $('<div>', { 1152 'id': 'feedback_window', 1153 'html': "<div style='background: url(/images/mw/shadow_up.png) repeat-x; position: absolute; top: -9px; height: 9px; width: 100%; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_up_r.png) no-repeat; height: 9px; position: absolute; top: -9px; right: -9px; width: 9px; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_right.png) repeat-y; height: 100%; position: absolute; right: -9px; width: 9px; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_bottom_r.png) no-repeat; height: 9px; position: absolute; bottom: -9px; right: -9px; width: 9px; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_bottom.png) repeat-x; height: 9px; position: absolute; bottom: -9px; width: 100%; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_bottom_l.png) no-repeat; height: 9px; position: absolute; bottom: -9px; left: -9px; width: 9px; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_left.png) repeat-y; height: 100%; position: absolute; left: -9px; width: 9px; font-size: 1px;'></div> <div style='background: url(/images/mw/shadow_up_l.png) no-repeat; height: 9px; position: absolute; top: -9px; left: -9px; width: 9px; font-size: 1px;'></div> "+btn_close+"<div id='FWHeader' style='height: 29px; background: url(/images/mw/zag_fon.png) repeat-x; color: #333; font-weight: bold;'><div style='font-family: Arial; font-size: 14px; padding: 6px 0 0 14px; color: #333; letter-spacing: 0.3px; border-radius: 5px;' id='MWHead'>"+Hcont+"</div></div><div id='MWCont' style='clear: both;'>"+cont+"</div>", 1154 'css': { 1155 'width': width+'px', 1156 'height': height+'px', 1157 'top': top+'px', 1158 'left': left+'px', 1159 'position': position, 1160 'z-index': 2000, 1161 'border-radius': '5px', 1162 'background-color': '#fff' 1163 } 1164 }); 1165 1166 1167 if( IssetOverlay ) { 1168 var all_page_width = $(document).width(); 1169 var all_page_height = $(document).height(); 1170 1171 MWOverlay = $('<div>', { 1172 'id': 'feedback_overlay', 1173 'html': " ", 1174 'css': { 1175 'width': all_page_width+'px', 1176 'height': all_page_height+'px', 1177 'position': position, 1178 'z-index': 1000, 1179 'background-color': 'rgba(0,0,0,0.24)', 1180 } 1181 }); 1182 if( OverlayClickClose ) { 1183 MWOverlay.prependTo('body').click(function() { 1184 MW.Close(); 1185 }); 1186 } else { 1187 MWOverlay.prependTo('body'); 1188 } 1189 new_MW.prependTo('body'); 1190 } else new_MW.prependTo('body'); 1191 setTimeout(function() { 1192 if ($("#MWCont").length > 0) 1193 { 1194 if( $("#MWCont").offset().top < window.scrollY || $("#MWCont").offset().top > window.scrollY+$(window).height() ) { 1195 $('html, body').animate({ 1196 scrollTop: $("#MWCont").offset().top 1197 }, 600); 1198 } 1199 } 1200 }, 500); 1201 1202 $('#mwClose').hover( 1203 function () { 1204 $(this).attr('src', '/images/mw/ico_close_hover.png'); 1205 }, 1206 function () { 1207 $(this).attr('src', '/images/mw/ico_close.png'); 1208 } 1209 ).click(function() { 1210 MW.Close(); 1211 }); 1212 }, 1213 ScrollBlock: function() { 1214 var scrllTop = $(document).scrollTop(); 1215 1216 $(document).on('scroll.confirm', function(){ 1217 if( $('#feedback_overlay').length > 0 ) { 1218 $(document).scrollTop(scrllTop); 1219 return false;
1220 } 1221 }); 1222 }, 1223 AutoHeight: function() { 1224 if( this.IsOpen ) { 1225 $('#feedback_window').css({ 1226 'height': ( $('#MWCont').height() )+'px' 1227 }); 1228 } 1229 }, 1230 NewHeight: function(h, re) { 1231 if( this.IsOpen ) { 1232 $('#feedback_window').css({ 1233 'height': h+'px' 1234 }); 1235 1236 if( re != undefined ) this.ReHeight(); 1237 } 1238 }, 1239 NewWidth: function(w, re) { 1240 if( this.IsOpen ) { 1241 $('#feedback_window').css({ 1242 'width': w+'px' 1243 }); 1244 if( re != undefined ) this.ReWidth(); 1245 } 1246 }, 1247 ReCenter: function() { 1248 var all_width = jQuery(window).width(); 1249 var all_height = jQuery(window).height(); 1250 1251 if( this.IsOpen ) { 1252 var top = (all_height/2)-( $('#feedback_window').height()/2 ); 1253 var left = (all_width/2)-( $('#feedback_window').width()/2 ); 1254 1255 $('#feedback_window').css({ 1256 'top': top+'px', 1257 'left': left+'px' 1258 }); 1259 } 1260 }, 1261 ReWidth: function() { 1262 var all_width = jQuery(window).width(); 1263 1264 if( this.IsOpen ) { 1265 var left = (all_width/2)-( $('#feedback_window').width()/2 ); 1266 1267 $('#feedback_window').css({ 1268 'left': left+'px' 1269 }); 1270 } 1271 }, 1272 ReHeight: function() { 1273 var all_height = jQuery(window).height(); 1274 1275 if( this.IsOpen ) { 1276 var top = (all_height/2)-( $('#feedback_window').height()/2 ); 1277 1278 $('#feedback_window').css({ 1279 'top': top+'px' 1280 }); 1281 } 1282 }, 1283 NewTop: function(t) { 1284 $('#feedback_window').css({ 1285 'top': t+'px' 1286 }); 1287 }, 1288 NewLeft: function(l) { 1289 $('#feedback_window').css({ 1290 'left': l+'px' 1291 }); 1292 }, 1293 RePosition: function(pos) { 1294 $('#feedback_window').css({ 1295 'position': pos 1296 }); 1297 }, 1298 Close: function() { 1299 this.IsOpen = 0; 1300 $('#feedback_overlay').remove(); 1301 $('#feedback_window').remove(); 1302 } 1303} 1304ajax = { 1305 property: {}, 1306 1307 conf: function( options ) { 1308 this.property = $.extend({ 1309 contentType: 'application/x-www-form-urlencoded; charset=UTF-8', 1310 headers: {}, 1311 cache: true, 1312 type: 'GET', 1313 url: window.location.pathname, 1314 data: '', 1315 beforeSend: function( jqXHR ){}, 1316 success: function(res){}, 1317 complete: function( jqXHR, textStatus ){}, 1318 }, options); 1319 1320 return this; 1321 }, 1322 json: function( success ) { 1323 success = ( success == undefined ) ? this.property.success : success; 1324 1325 $.ajax({ 1326 contentType: this.property.contentType, 1327 headers: this.property.headers, 1328 cache: this.property.cache, 1329 type: this.property.type, 1330 url: this.property.url, 1331 data: this.property.data, 1332 dataType : "json", 1333 beforeSend: this.property.beforeSend, 1334 success: success, 1335 complete: this.property.complete, 1336 }); 1337 1338 return this; 1339 }, 1340 html: function( success ) { 1341 success = ( success == undefined ) ? this.property.success : success; 1342 1343 $.ajax({ 1344 contentType: this.property.contentType, 1345 headers: this.property.headers, 1346 cache: this.property.cache, 1347 type: this.property.type, 1348 url: this.property.url, 1349 data: this.property.data, 1350 dataType: 'html', 1351 beforeSend: this.property.beforeSend, 1352 success: success, 1353 complete: this.property.complete, 1354 }); 1355 1356 return this; 1357 }, 1358 loading: function(el) { 1359 $(el).html("<div style='width: 109px;' class='loading'><img src='/images/ajax-loader.gif'><span style='left: 10px; position: relative; top: -12px;'>загÑÑзка...</span></div>"); 1360 } 1361}; 1362stor = { 1363 issetStorage: 0, 1364 1365 set: function( key, value ) { 1366 if( this.issetStorage == 0 ) return false; 1367 if( !key ) return false; 1368 1369 if( typeof value === "object" ) { 1370 value = JSON.stringify(value); 1371 } 1372 localStorage.setItem(key, value); 1373 1374 return true; 1375 }, 1376 get: function( key ) { 1377 if( this.issetStorage == 0 ) return false; 1378 if( !key ) return false; 1379 1380 var value = localStorage.getItem(key); 1381 if (!value) return false; 1382 1383 // еÑли обÑекÑ, ÑаÑпаÑÑим его 1384 if (value[0] === "{") { 1385 value = JSON.parse(value); 1386 } 1387 1388 return value; 1389 }, 1390 isSupport: function() { 1391 try { 1392 if( 'localStorage' in window && window['localStorage'] !== null ) { 1393 this.issetStorage = 1; 1394 return true; 1395 } 1396 1397 return false; 1398 } catch (e) { 1399 return false; 1400 } 1401 }, 1402} 1403 1404 1405$(document).ready(function() { 1406 ajax.conf(); 1407 stor.isSupport(); 1408 1409 $('img.CCAPCHA').click(function() { 1410 capchaUpdate(); 1411 }); 1412 const 1413 popup = $("span.popup"), 1414 tooltip=$("span.tooltip"); 1415 popup.hover(function() { 1416 let pTitle = $(this).data("title"), 1417 pText = $(this).data("text"); 1418 $(this).append("<div class='pop'><div class='pop__title'>" + pTitle + "</div><div class='pop__text'>" + pText + "</div></div>"); 1419 function active() { 1420 $('.pop').addClass('active'); 1421 } 1422 setTimeout(active, 200) 1423 },function(){ 1424 $('.pop').removeClass('active'); 1425 function remove() { 1426 $('.pop').remove(); 1427 } 1428 setTimeout(remove, 200) 1429 }); 1430 var closeModal = function() { 1431 blocking = false;
1432 $('.tool').remove(); 1433 $('body').css('overflow-y', 'scroll'); 1434 } 1435 var blocking = false; 1436 if (blocking === false) { 1437 tooltip.on('click', function() { 1438 blocking = true; 1439 let tTitle = $(this).data("title"), 1440 tText = $(this).data("text"); 1441 tHref = $(this).data("href"); 1442 $('#layout').append("<div class='tool'><div class='tool__wrap'><div class='tool__element'><a href='javascript:void(0)' class='tool__close' id='modalClose'></a><div class='tool__content'><div class='tool__title'>" + tTitle + "</div><div class='tool__text'>" + tText + "</div><a target='_blank' rel='noreferrer' href='" + tHref + "' class='tool__uri'>ÐеÑейÑи</a></div></div></div></div>"); 1443 $('body').css('overflow-y', 'hidden'); 1444 $('#modalClose').on('click', closeModal); 1445 }); 1446 } 1447 $(document).keyup(function(e) { 1448 if (e.keyCode === 27) { 1449 blocking = false; 1450 $('.tool').remove(); 1451 $('body').css('overflow-y', 'scroll'); 1452 } 1453 }); 1454 $(document).mouseup(function (e) { 1455 var container = $(".tool__element"); 1456 if (container.has(e.target).length === 0){ 1457 blocking = false; 1458 $('.tool').remove(); 1459 $('body').css('overflow-y', 'scroll'); 1460 } 1461 }); 1462 setInterval(reloadAd, 30000); 1463 function reloadAd( ) 1464 { 1465 Ya.adfoxCode.reload(null); 1466 } 1467});
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.