1$(document).ready(function(){ 2 $('.fancybox').fancybox({ 3 maxWidth : 800, 4 width : '70%', 5 autoHeight : true, 6 autoWidth : false, 7 fitToView : true 8 }); 9 $(".various").fancybox({ 10 maxWidth : 800, 11 maxHeight : 600, 12 fitToView : false, 13 width : '70%', 14 height : '70%', 15 autoSize : false, 16 closeClick : false, 17 openEffect : 'none', 18 closeEffect : 'none', 19 helpers : { media: true } 20 }); 21 $.ajaxSetup({ cache: false }); 22 $(".nav-toggle").on("click", function(){ 23 $(this).toggleClass("active"); 24 $(".mobile-menu").slideToggle(); 25 if ($(".search-toggle").hasClass("active")) { 26 $(".search-toggle").removeClass("active"); 27 $(".mobile-search").slideToggle(); 28 } 29 return false; 30 }); 31 32 $('.city-list').niceScroll({ 33 autohidemode: false, 34 cursorwidth: "4px", 35 cursorcolor: "#ca2017", 36 cursorborder: "none", 37 cursorborderradius: "none", 38 background: "url('/img/scroll-pane-bg.png') repeat-y" 39 }); 40 41 /*var fixed = $('.fixed'), 42 offset = fixed.offset(), 43 fixed_parent = fixed.parent().next(), 44 fixed_parent_offset = fixed.parent().offset(), 45 fixed_parent_offset_top = fixed_parent.offset().top, 46 last_position = $(window).scrollTop(); 47 48 fixedAD = function(){ 49 var windowpos = $(window).scrollTop(); 50 var fixed_parent_height = fixed_parent.outerHeight(); 51 if (windowpos > offset.top && fixed.outerHeight()+50 < fixed_parent_height) { 52 if (windowpos <= fixed_parent_height + fixed_parent_offset_top - fixed.outerHeight()){ 53 fixed.css({position: 'fixed', top:0}); 54 last_position = windowpos; 55 } else { 56 fixed.css({position: 'absolute', top: fixed.outerHeight() > fixed_parent_height ? 0 : fixed_parent_height-fixed.outerHeight()-20}); 57 } 58 } else { 59 fixed.css({position: 'relative', top: 0}); 60 } 61 }; 62 fixedAD();*/ 63 $(window).scroll(function(){ 64 //fixedAD(); 65 66 if ($(window).width() > 1000) { 67 $(".toggle").removeClass("active"); 68 $(".mobile-menu").hide(); 69 } 70 }); 71 $('.choose a').on("click", function(){ 72 $('.regions').slideToggle(function(){ offset = fixed.offset(); }); 73 }); 74 75 $('.close').bind('click', function(){ $.cookie('adaptad', true, {expires: 1, path: '/'}); $(this).parent().hide()}); 76 77 var current = 0, 78 $preview = $('.photo img'), 79 $descr = $('.photo-descr'), 80 $carouselEl = $( '#carousel' ), 81 $carouselItems = $carouselEl.children(), 82 carousel = $carouselEl.elastislide( { 83 current : current, 84 minItems : 4, 85 onClick : function( el, pos, evt ) { 86 changeImage( el, pos ); 87 evt.preventDefault(); 88 }, 89 onReady : function() { 90 changeImage( $carouselItems.eq( current ), current ); 91 } 92 } ); 93 94 carousel2 = $( '#carousel2' ).elastislide( { 95 current : current, 96 minItems : 4, 97 onClick: function( el, pos, evt ) { 98 VideoBox( el, pos ); 99 evt.preventDefault(); 100 } 101 } ); 102 103 function changeImage( el, pos ) { 104 if (el.data('preview')){ 105 $('.photo-img').addClass('imgloading'); 106 var tmp_img = new Image(); 107 $(tmp_img).load(function () { 108 $('.photo img').attr( 'src', $(this).attr('src') ); 109 $('.photo-img').removeClass('imgloading'); 110 }).attr( 'src', el.data('preview') ); 111 $descr.html(el.data('descr')); 112 $carouselItems.removeClass( 'current-img' ); 113 el.addClass( 'current-img' ); 114 carousel.setCurrent( pos ); 115 } else { 116 window.open(el.find('a').attr('href'), '_blank'); 117 } 118 } 119 120 function VideoBox( el, pos ) { 121 if (el.find('div').hasClass('yvid')) 122 return true; 123 var href = el.find('a').attr('href'); 124 if ((rez = href.match(/(youtube\.com|youtu\.be)\/(v\/|u\/|embed\/|watch\?v=)?([^#\&\?]*).*/i))) 125 href = '//www.youtube.com/embed/' + rez[3] + '?autoplay=1&autohide=1&fs=1&rel=0&enablejsapi=1'; 126 else if ((rez = href.match(/vimeo.com\/(\d+)\/?(.*)/))) 127 href = '//player.vimeo.com/video/' + rez[1] + '?hd=1&autoplay=1&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1'; 128 129 $(".video-box").find("iframe").attr("src", href); 130 $.fancybox({ 131 href: '#video-box', 132 afterClose: function(){ $(".video-box").find("iframe").attr("src", '')}, 133 maxWidth : 800, 134 width : 600, 135 height : 350, 136 autoHeight : false, 137 autoWidth : false, 138 fitToView : true, 139 autoSize: false 140 }); 141 carousel2.setCurrent( pos ); 142 //evt.preventDefault(); 143 } 144 145 //$('.list-layout .region-box').alignCenter(0,1); 146 147 $('.subscribe-form form').submit(function() { 148 $('.subscribe-form .result').html(""); 149 $('.subscribe-form .loading').show(); 150 $.post('/ajax?action=subscribe', 151 {email: $('.subscribe-form input[name=email]').val(), id: $('.
151subscribe-form input[name=id]').val()}, 152 function(data) { 153 $('.subscribe-form .loading').hide(); 154 if (data == 'ok') { 155 $('.subscribe-form .result').html("ÐÑ ÑÑпеÑно подпиÑалиÑÑ Ð½Ð° обновление пÑогÑÐ°Ð¼Ð¼Ñ Ð¼ÐµÑопÑиÑÑий."); 156 $('.subscribe-form form').get(0).reset(); 157 } else 158 $('.subscribe-form .result').html(data); 159 }); 160 return false; 161 }); 162 $('#respond form').submit(function() { 163 $('#respond .result').html(""); 164 $('#respond .loading').show(); 165 $.post('/ajax?action=add_comment', 166 {comment: $('#respond textarea[name=comment]').val(), name: $('#respond input[name=name]').val(), email: $('#respond input[name=email]').val(), page: $('#respond input[name=page]').val(), rating: $('#respond input[name=rating]').val(), subscribe: $('#respond input[name=subscribe]').is(':checked') ? 1 : 0, captcha: $('#respond input[name=captcha]').val()}, 167 function(data) { 168 $('#respond .loading').hide(); 169 $('.captcha').attr('src', '/ajax?action=captcha&t=' + (new Date().getTime())); 170 if (data.result == 'ok') { 171 if ($('.comments-container').is(':hidden')) 172 $('.comments-container').show(); 173 $(data.comment).prependTo('.commentlist'); 174 $('#respond textarea[name=comment]').val(""); 175 $('.comments-count').text(data.comments_count); 176 location.href='#comments'; 177 } else 178 $('#respond .result').html(data.error); 179 $('#respond input[name=captcha]').val(""); 180 }, "json"); 181 return false; 182 }); 183 184 $('.feedback-box form').submit(function() { 185 $('.feedback-box .result').html(""); 186 $('.feedback-box .loading').show(); 187 $.post('/ajax?action=feedback', 188 {name: $('.feedback-box input[name=name]').val(), email: $('.feedback-box input[name=email]').val(), text: $('.feedback-box textarea[name=text]').val(), page: $('.feedback-box input[name=page]').val()}, 189 function(data) { 190 $('.feedback-box .loading').hide(); 191 if (data == 'ok') { 192 $('.feedback-box .result').html("ÐаÑе ÑообÑение ÑÑпеÑно оÑпÑавлено"); 193 $('.feedback-box form').get(0).reset(); 194 } else 195 $('.feedback-box .result').html(data); 196 }); 197 return false; 198 }); 199 200 $('#file').change(function() { 201 $('#file').each(function() { 202 var name = this.value; 203 reWin = /.*\\(.*)/; 204 var fileTitle = name.replace(reWin, "$1"); 205 reUnix = /.*\/(.*)/; 206 fileTitle = fileTitle.replace(reUnix, "$1"); 207 $(this).parent().parent().find('.file-name').html(fileTitle); 208 }); 209 }); 210 211 $('.upload-box form').ajaxForm({ 212 beforeSubmit: function(a,f,o) { 213 $('.upload-box .loading').show(); 214 $('.upload-box .result').html(""); 215 }, 216 success: function(data) { 217 $('.upload-box .loading').hide(); 218 var res = jQuery.parseJSON(data); 219 if (res['success']) { 220 $('.upload-box .result').html("ФоÑогÑаÑÐ¸Ñ ÑÑпеÑно загÑÑжена, поÑле пÑовеÑки она бÑÐ´ÐµÑ Ð¾Ð¿Ñбликована на ÑайÑе"); 221 $('.upload-box .file-name').html("ÐÑбÑаÑÑ Ñайл"); 222 $('.upload-box form').get(0).reset(); 223 } else 224 $('.upload-box .result').html(res['error']); 225 } 226 }); 227 228 $('.event-box form').ajaxForm({ 229 data: {'hash': new Date().getTime()}, 230 beforeSubmit: function(a,f,o) { 231 $('.event-box .loading').show(); 232 $('.event-box .result').html(""); 233 }, 234 success: function(data) { 235 $('.event-box .loading').hide(); 236 var res = jQuery.parseJSON(data); 237 if (res['success']) { 238 $('.event-box .result').html("ÐнÑоÑмаÑÐ¸Ñ Ð¾ пÑедложенном Ðами меÑопÑиÑÑии оÑпÑавлена, поÑле пÑовеÑки она бÑÐ´ÐµÑ Ð¾Ð¿Ñбликована."); 239 $('.event-box .file-name').html("ÐÑбÑаÑÑ Ñайл"); 240 $('.event-box form').get(0).reset(); 241 } else 242 $('.event-box .result').html(res['error']); 243 } 244 }); 245 246 $('.feedback-box a.submit').click(function(){ 247 $('.feedback-box form').submit(); 248 }); 249 250 $('.subscribe-form a.submit').click(function(){ 251 $('.subscribe-form form').submit(); 252 }); 253 $('.comments a.submit').click(function(){ 254 $('.comments form').submit(); 255 }); 256 257 $('.telluslink a').click(function(){ 258 if ($('.region-box .close').length) 259 toggle_region(); 260 //$(".region-box").css({height: '600px'}); 261 262 toggle_feedback(); 263 }) 264 265 resizeImage(); 266 267}); 268 269function resizeImage(){ 270 //Resize Bottom Right Image 271 var image = $(".fill"); 272 image.each(function(){ 273 var widthRatio = 120 / $(this).width(); 274 var heightRatio = 80 / $(this).height(); 275 var ratio = Math.max(widthRatio, heightRatio); 276 $(this).css({ 277 width: Math.ceil(ratio*$(this).width()) ,
278 height: Math.ceil(ratio*$(this).height()) 279 }); 280 }); 281} 282 283function load_comments(page) { 284 $('<div class="loading"></div>').appendTo('.commentlist').show(); 285 $.post('/ajax?action=get_comment', 286 {page: page}, 287 function(data) { 288 $('.commentlist .loading').remove(); 289 if (!data.comments) { 290 $('.comments-container').hide(); 291 } else { 292 $('.commentlist').prepend(data.comments); 293 $('.comments-count').text(data.comments_count); 294 } 295 }, 'json'); 296} 297 298function toggle_region() { 299 if ($(".region-box").css("display") == "none") { 300 $(".opacity").show(); 301 $(".region-box").alignCenter(1,1); 302 $(".region-box").show() 303 $('.region-list').niceScroll({autohidemode: false, 304 cursorwidth: "9px", 305 cursorcolor: "#00a2e6", 306 cursorborder: "none", 307 cursorborderradius: "none", 308 background: "url('/img/region-scroll-pane-bg.png') repeat-y"}).show().resize(); 309 } else { 310 $('.region-list').niceScroll().hide(); 311 $('.region-city-list').niceScroll().hide(); 312 $(".region-box").hide(); 313 $(".opacity").hide(); 314 } 315 return false; 316} 317 318$.fn.pie = function(a){ 319 if (window.PIE && $.browser.msie) { 320 if(a === 'remove') 321 { 322 this.each(function() { 323 PIE.detach(this); 324 }); 325 } else 326 { 327 this.each(function() { 328 PIE.attach(this); 329 }); 330 } 331 } 332 return this; 333} 334 335;(function($) { 336 $.fn.alignCenter = function(v,h) { 337 var marginLeft = $(window).width() > $(this).width() ? ($(window).width() - $(this).width())/2 + 'px' : '10px'; 338 var marginTop = $(window).height() > $(this).height() ? $(window).scrollTop() + ($(window).height()-$(this).height())/2 + 'px' : $(window).scrollTop() + 10 + 'px'; //- $(this).height()/2 + 'px'; 339 if (h) 340 $(this).css({'margin-left':marginLeft}); 341 if (v) 342 $(this).css({'margin-top':marginTop}); 343 344 return true; 345 }; 346})(jQuery); 347 348$.fn.help = function(){ 349 if (!$(".tooltip").length) 350 $("body").append("<div class='tooltip'></div>"); 351 352 var tip_arr = new Array(); 353 354 $(this).each(function(i){ 355 var my_tooltip = $(".tooltip"); 356 if($(this).attr("title") != "" && $(this).attr("title") != "undefined" ){ 357 tip_arr["t"+i] = $(this).attr('title'); 358 $(this).attr('id', "t"+i); 359 $(this).removeAttr("title").mouseover(function(kmouse){ 360 my_tooltip.html(tip_arr[$(this).attr("id")]); 361 var border_top = $(window).scrollTop(); 362 var border_right = $(window).width(); 363 var left_pos; 364 var top_pos; 365 var offset = 25; 366 if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){ 367 left_pos = kmouse.pageX+offset; 368 } else{ 369 left_pos = border_right-my_tooltip.width()-offset; 370 } 371 372 if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){ 373 top_pos = border_top + offset; 374 } else{ 375 top_pos = kmouse.pageY-my_tooltip.height()-offset; 376 } 377 378 my_tooltip.css({left:left_pos, top:top_pos}); 379 my_tooltip.show();//css({opacity:0.8, display:"none"}).fadeIn(400); 380 }).mouseout(function(){ 381 my_tooltip.css({left:"-9999px"}); 382 }).click(function(){ return false;}); 383 } 384 }); 385} 386 387/*! 388 * function PLACEHOLDER 389 * $('input[placeholder], textarea[placeholder]').placeholder(); 390 */ 391function Placeholder(input) { 392 this.input = input; 393 if (input.attr('type') == 'password') { 394 this.handlePassword(); 395 } 396 $(input[0].form).submit(function() { 397 if (input.hasClass('placeholder') && input[0].value == input.attr('placeholder')) { 398 input[0].value = ''; 399 } 400 }); 401} 402Placeholder.prototype = { 403 show : function(loading) { 404 if (this.input[0].value === '' || (loading && this.valueIsPlaceholder())) { 405 if (this.isPassword) { 406 try { 407 this.input[0].setAttribute('type', 'text'); 408 } catch (e) { 409 this.input.before(this.fakePassword.show()).hide(); 410 } 411 } 412 this.input.addClass('placeholder'); 413 this.input[0].value = this.input.attr('placeholder'); 414 } 415 }, 416 hide : function() { 417 if (this.valueIsPlaceholder() && this.input.hasClass('placeholder')) { 418 this.input.removeClass('placeholder'); 419 this.input[0].value = ''; 420 if (this.isPassword) { 421 try { 422 this.input[0].setAttribute('type', 'password'); 423 } catch (e) { } 424 this.input.show(); 425 this.input[0].focus(); 426 } 427 } 428 }, 429 valueIsPlaceholder : function() { 430 return this.input[0].value == this.input.attr('placeholder'); 431 }, 432 handlePassword: function() { 433 var input = this.input; 434 input.attr('realType', 'password'); 435 this.isPassword = true; 436 if ($.browser.msie && input[0].outerHTML) { 437 var fakeHTML = $(input[0].outerHTML.replace(/type=(['"])?password\1
437/gi, 'type=$1text$1')); 438 this.fakePassword = fakeHTML.val(input.attr('placeholder')).addClass('placeholder').focus(function() { 439 input.trigger('focus'); 440 $(this).hide(); 441 }); 442 $(input[0].form).submit(function() { 443 fakeHTML.remove(); 444 input.show(); 445 }); 446 } 447 } 448}; 449var NATIVE_SUPPORT = !!("placeholder" in document.createElement( "input" )); 450$.fn.placeholder = function() { 451 return NATIVE_SUPPORT ? this : this.each(function() { 452 var input = $(this); 453 var placeholder = new Placeholder(input); 454 placeholder.show(true); 455 input.focus(function() { 456 placeholder.hide(); 457 }); 458 input.blur(function() { 459 placeholder.show(false); 460 }); 461 462 if ($.browser.msie) { 463 $(window).load(function() { 464 if(input.val()) { 465 input.removeClass("placeholder"); 466 } 467 placeholder.show(true); 468 }); 469 input.focus(function() { 470 if(this.value == "") { 471 var range = this.createTextRange(); 472 range.collapse(true); 473 range.moveStart('character', 0); 474 range.select(); 475 } 476 }); 477 } 478 }); 479} 480 481function em(box, server, zone, img) 482{ 483 var at = String.fromCharCode(64); 484 if (img == 1) 485 return '<a href="'+'mai'+'lto'+':'+box+at+server+'.'+zone+'">'; 486 else 487 return '<a href="'+'mai'+'lto'+':'+box+at+server+'.'+zone+'">'+box+at+server+'.'+zone+'<'+'/a>'; 488}
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.