1// all ------------------ 2function initCitybook() { 3 "use strict"; 4 // loader ------------------ 5 $(".loader-wrap").fadeOut(300, function () { 6 $("#main").animate({ 7 opacity: "0.1" 8 }, 300); 9 }); 10 // Background image ------------------ 11 var a = $(".bg"); 12 a.each(function (a) { 13 if ($(this).attr("data-bg")) $(this).css("background-image", "url(" + $(this).data("bg") + ")"); 14 }); 15 // scrollToFixed------------------ 16 $(".fixed-bar").scrollToFixed({ 17 minWidth: 1064, 18 marginTop: 90, 19 removeOffsets: true, 20 limit: function () { 21 var a = $(".limit-box").offset().top - $(".fixed-bar").outerHeight() - 70; 22 return a; 23 } 24 }); 25 $(".back-to-filters").scrollToFixed({ 26 minWidth: 1224, 27 zIndex: 12, 28 marginTop: 130, 29 removeOffsets: true, 30 limit: function () { 31 var a = $(".limit-box").offset().top - $(".back-to-filters").outerHeight(true) - 10; 32 return a; 33 } 34 }); 35 $(".scroll-nav-wrapper").scrollToFixed({ 36 minWidth: 768, 37 zIndex: 12, 38 marginTop: 80, 39 removeOffsets: true, 40 limit: function () { 41 var a = $(".limit-box").offset().top - $(".scroll-nav-wrapper").outerHeight(true) - 10; 42 return a; 43 } 44 }); 45 // Isotope------------------ 46 function initIsotope() { 47 if ($(".gallery-items").length) { 48 var a = $(".gallery-items").isotope({ 49 singleMode: true, 50 columnWidth: ".grid-sizer, .grid-sizer-second, .grid-sizer-three", 51 itemSelector: ".gallery-item, .gallery-item-second, .gallery-item-three", 52 transformsEnabled: true, 53 transitionDuration: "700ms", 54 resizable: true 55 }); 56 a.imagesLoaded(function () { 57 a.isotope("layout"); 58 }); 59 $(".gallery-filters").on("click", "a.gallery-filter", function (b) { 60 var c = $(this).attr("data-filter"), 61 d = $(this).text(); 62 b.preventDefault(); 63 var c = $(this).attr("data-filter"); 64 a.isotope({ 65 filter: c 66 }); 67 $(".gallery-filters a.gallery-filter").removeClass("gallery-filter-active"); 68 $(this).addClass("gallery-filter-active"); 69 70 }); 71 } 72 } 73 initIsotope(); 74 // Slick------------------ 75 var sbp = $('.swiper-button-prev'), 76 sbn = $('.swiper-button-next'); 77 $('.fw-carousel').slick({ 78 dots: true, 79 infinite: true, 80 speed: 600, 81 slidesToShow: 1, 82 centerMode: false, 83 arrows: false, 84 variableWidth: true 85 }); 86 sbp.on("click", function () { 87 $('.fw-carousel').slick('slickPrev'); 88 }) 89 90 sbn.on("click", function () { 91 $('.fw-carousel').slick('slickNext'); 92 }) 93 $('.slideshow-container').slick({ 94 slidesToShow: 1, 95 autoplay: true, 96 autoplaySpeed: 5000, 97 arrows: false, 98 fade: true, 99 cssEase: 'ease-in', 100 infinite: true, 101 speed: 1000 102 }); 103 $('.single-slider').slick({ 104 infinite: true, 105 slidesToShow: 1, 106 dots: true, 107 arrows: false, 108 adaptiveHeight: true 109 }); 110 sbp.on("click", function () { 111 $(this).closest(".single-slider-wrapper").find('.single-slider').slick('slickPrev'); 112 }); 113 sbn.on("click", function () { 114 $(this).closest(".single-slider-wrapper").find('.single-slider').slick('slickNext'); 115 }); 116 117 $('.slider-container').slick({ 118 infinite: true, 119 slidesToShow: 1, 120 dots: true, 121 arrows: false, 122 }); 123 $('.slider-container').on('init', function(event, slick){ 124 initAutocomplete(); 125 }); 126 sbp.on("click", function () { 127 $(this).closest(".slider-container-wrap").find('.slider-container').slick('slickPrev'); 128 129 }); 130 sbn.on("click", function () { 131 $(this).closest(".slider-container-wrap").find('.slider-container').slick('slickNext'); 132 }); 133 $('.single-carousel').slick({ 134 infinite: true, 135 slidesToShow: 3, 136 dots: true,
137 arrows: false, 138 centerMode: true, 139 responsive: [{ 140 breakpoint: 1224, 141 settings: { 142 slidesToShow: 2, 143 centerMode: false, 144 } 145 }, 146 147 { 148 breakpoint: 768, 149 settings: { 150 slidesToShow: 1, 151 centerMode: true, 152 } 153 } 154 ] 155 156 }); 157 sbp.on("click", function () { 158 $(this).closest(".carousel ").find('.single-carousel').slick('slickPrev'); 159 }); 160 sbn.on("click", function () { 161 $(this).closest(".carousel").find('.single-carousel').slick('slickNext'); 162 }); 163 $('.listing-carousel').slick({ 164 infinite: true, 165 slidesToShow: 5, 166 dots: true, 167 arrows: false, 168 centerMode: true, 169 centerPadding: '0', 170 responsive: [{ 171 breakpoint: 1500, 172 settings: { 173 slidesToShow: 4, 174 } 175 }, 176 { 177 breakpoint: 1224, 178 settings: { 179 slidesToShow: 3, 180 } 181 }, 182 183 { 184 breakpoint: 1024, 185 settings: { 186 slidesToShow: 2, 187 } 188 }, 189 { 190 breakpoint: 800, 191 settings: { 192 slidesToShow: 1, 193 } 194 } 195 ] 196 197 }); 198 sbp.on("click", function () { 199 $(this).closest(".list-carousel").find('.listing-carousel').slick('slickPrev'); 200 }); 201 sbn.on("click", function () { 202 $(this).closest(".list-carousel").find('.listing-carousel').slick('slickNext'); 203 }); 204 $('.client-carousel').slick({ 205 infinite: true, 206 slidesToShow: 5, 207 dots: false, 208 arrows: false, 209 centerMode: true, 210 responsive: [{ 211 breakpoint: 1224, 212 settings: { 213 slidesToShow: 4, 214 centerMode: false, 215 } 216 }, 217 218 { 219 breakpoint: 768, 220 settings: { 221 slidesToShow: 2, 222 centerMode: true, 223 } 224 } 225 ] 226 227 }); 228 $('.sp-cont-prev').on("click", function () { 229 $(this).closest(".spons-list").find('.client-carousel').slick('slickPrev'); 230 }); 231 $('.sp-cont-next').on("click", function () { 232 $(this).closest(".spons-list").find('.client-carousel').slick('slickNext'); 233 }); 234 // Bubbles ------------------ 235 $('<div class="bubbles"></div>').appendTo(".bubble-bg"); 236 var bArray = []; 237 var sArray = [5, 10, 15, 20]; 238 for (var i = 0; i < $('.bubbles').width(); i++) { 239 bArray.push(i); 240 } 241 function randomValue(arr) { 242 return arr[Math.floor(Math.random() * arr.length)]; 243 } 244 setInterval(function () { 245 var size = randomValue(sArray); 246 $('.bubbles').append('<div class="individual-bubble" style="left: ' + randomValue(bArray) + 'px; width: ' + size + 'px; height:' + size + 'px;"></div>'); 247 $('.individual-bubble').fadeOut(5000, function () { 248 $(this).remove() 249 }); 250 }, 350); 251 // lightGallery------------------ 252 if ($.fn.lightGallery) { 253 try { 254 $(".image-popup").lightGallery({ 255 selector: "this", 256 cssEasing: "cubic-bezier(0.25, 0, 0.25, 1)", 257 download: false, 258 counter: false 259 }); 260 } catch (e) {} 261 try { 262 $(".lightgallery").each(function () { 263 var $g = $(this); 264 // Frontend gallery page uses its own lightbox (.fg-page) 265 if ($g.hasClass("fg-page") || $g.closest(".fg-page").length) { 266 return; 267 } 268 if ($g.data("lightGallery")) { 269 return; 270 } 271 $g.lightGallery({ 272 selector: "a.popup-image", 273 cssEasing: "cubic-bezier(0.25, 0, 0.25, 1)", 274 download: false, 275 loop: false, 276 counter: false 277 }); 278 }); 279 } catch (e) {} 280 } 281 // appear------------------ 282 $(".stats").appear(function () { 283 $(".num").countTo(); 284 }); 285 // Share ------------------ 286 $(".share-container").share({ 287 networks: ['facebook', 'pinterest', 'googleplus', 'twitter', 'linkedin'] 288 }); 289 var shrcn = $(".share-container"); 290 function showShare() { 291 shrcn.removeClass("isShare"); 292 shrcn.addClass("visshare"); 293 } 294 function hideShare() { 295 shrcn.addClass("isShare"); 296 shrcn.removeClass("visshare"); 297 } 298 $(".showshare").on("click", function () { 299 $(this).toggleClass("vis-butsh"); 300 $(this).find("span").text($(this).text() === 'Close' ? 'Share' : 'Close'); 301 if ($(".share-container").hasClass("isShare")) showShare(); 302 else hideShare(); 303 }); 304 // accordion ------------------ 305 $(".accordion a.toggle").on("click", function (a) { 306 a.preventDefault(); 307 $(".accordion a.toggle").removeClass("act-accordion"); 308 $(this).addClass("act-accordion"); 309 if ($(this).next('div.accordion-inner').is(':visible')) { 310 $(this).next('div.accordion-inner').slideUp(); 311 } else { 312 $(".accordion a.toggle").next('div.accordion-inner').slideUp(); 313 $(this).next('div.accordion-inner').slideToggle(); 314 } 315 }); 316 // tabs------------------ 317 $(".tabs-menu a").on("click", function (e) { 318 e.preventDefault(); 319 var $a = $(this); 320 var $scope = $a.closest("#loginReg, .bw-login"); 321 if (!$scope.length) { 322 $scope = $a.closest(".bw-login__tabs, #tabs-container").closest(".bw-login, .main-register, .tab").parent(); 323 } 324 if (!$scope.length) { 325 $scope = $(document); 326 } 327 $a.parent().addClass("current").siblings().removeClass("current"); 328 var b = $a.attr("href"); 329 $scope.find(".tab-content").not(b).css("display", "none"); 330 $scope.find(b).fadeIn(); 331 }); 332 // twitter ------------------ 333 if ($("#footer-twiit").length > 0) { 334 var config1 = { 335 "profile": { 336 "screenName": 'envatomarket' 337 }, 338 "domId": 'footer-twiit', 339 "maxTweets": 2, 340 "enableLinks": true, 341 "showImages": false 342 }; 343 twitterFetcher.fetch(config1); 344 } 345 // Contact form------------------ 346 $(document).on('submit','#contactform',function(){ 347 var a = $(this).attr("action"); 348 $("#message").slideUp(750, function () { 349 $("#message").hide(); 350 $("#submit").attr("disabled", "disabled"); 351 $.post(a, { 352 name: $("#name").val(), 353 email: $("#email").val(), 354 comments: $("#comments").val() 355 }, function (a) { 356 document.getElementById("message").innerHTML = a; 357 $("#message").slideDown("slow"); 358 $("#submit").removeAttr("disabled"); 359 if (null != a.match("success")) $("#contactform").slideDown("slow"); 360 }); 361 }); 362 return false;
363 }); 364 $(document).on('keyup', '#contactform input, #contactform textarea', function(){ 365 $("#message").slideUp(1500); 366 }); 367 // mailchimp------------------ 368 $("#subscribe").ajaxChimp({ 369 language: "eng", 370 url: "http://kwst.us18.list-manage.com/subscribe/post?u=42df802713d4826a4b137cd9e&id=815d11e811" 371 }); 372 $.ajaxChimp.translations.eng = { 373 submit: "Submitting...", 374 0: '<i class="fa fa-check"></i> We will be in touch soon!', 375 1: '<i class="fa fa-warning"></i> You must enter a valid e-mail address.', 376 2: '<i class="fa fa-warning"></i> E-mail address is not valid.', 377 3: '<i class="fa fa-warning"></i> E-mail address is not valid.', 378 4: '<i class="fa fa-warning"></i> E-mail address is not valid.', 379 5: '<i class="fa fa-warning"></i> E-mail address is not valid.' 380 }; 381 // Video------------------ 382 if ($(".background-youtube-wrapper").length) { 383 var v = $(".background-youtube-wrapper").data("vid"); 384 var f = $(".background-youtube-wrapper").data("mv"); 385 $(".background-youtube-wrapper").YTPlayer({ 386 fitToBackground: true, 387 videoId: v, 388 pauseOnScroll: true, 389 mute: f, 390 callback: function () { 391 var a = $(".background-youtube-wrapper").data("ytPlayer").player; 392 } 393 }); 394 } 395 396 if ($(".background-vimeo").length) { 397 var w = $(".background-vimeo").data("vim"), 398 bvc = $(".background-vimeo"), 399 bvmc = $(".media-container"), 400 bvfc = $(".background-vimeo iframe "), 401 vch = $(".video-container"); 402 bvc.append('<iframe src="//player.vimeo.com/video/' + w + '?background=1" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>'); 403 $(".video-holder").height(bvmc.height()); 404 if ($(window).width() > 1024) { 405 if ($(".video-holder").size() > 0) 406 if (bvmc.height() / 9 * 16 > bvmc.width()) { 407 bvfc.height(bvmc.height()).width(bvmc.height() / 9 * 16); 408 bvfc.css({ 409 "margin-left": -1 * $("iframe").width() / 2 + "px", 410 top: "-75px", 411 "margin-top": "0px" 412 }); 413 } else { 414 bvfc.width($(window).width()).height($(window).width() / 16 * 9); 415 bvfc.css({ 416 "margin-left": -1 * $("iframe").width() / 2 + "px", 417 "margin-top": -1 * $("iframe").height() / 2 + "px", 418 top: "50%" 419 }); 420 } 421 } else if ($(window).width() < 760) { 422 $(".video-holder").height(bvmc.height()); 423 bvfc.height(bvmc.height()); 424 } else { 425 $(".video-holder").height(bvmc.height()); 426 bvfc.height(bvmc.height()); 427 } 428 vch.css("width", $(window).width() + "px"); 429 vch.css("height", 720 / 1280 * $(window).width()) + "px"; 430 if (vch.height() < $(window).height()) { 431 vch.css("height", $(window).height() + "px"); 432 vch.css("width", 1280 / 720 * $(window).height()) + "px"; 433 } 434 } 435 // scroll to------------------ 436 $(".custom-scroll-link").on("click", function () { 437 var a = 70 + $(".scroll-nav-wrapper").height(); 438 if (location.pathname.replace(/^\//, "") === this.pathname.replace(/^\//, "") || location.hostname === this.hostname) { 439 var b = $(this.hash); 440 b = b.length ? b : $("[name=" + this.hash.slice(1) + "]"); 441 if (b.length) { 442 $("html,body").animate({ 443 scrollTop: b.offset().top - a 444 }, { 445 queue: false, 446 duration: 1200, 447 easing: "easeInOutExpo" 448 }); 449 return false; 450 } 451 } 452 }); 453 if ($(".scroll-init ul").length) { 454 $(".scroll-init ul ").singlePageNav({ 455 filter: ":not(.external)", 456 updateHash: false, 457 offset: 110, 458 threshold: 120, 459 speed: 1200, 460 currentClass: "act-scrlink" 461 }); 462 } 463 $(".to-top").on("click", function (a) { 464 a.preventDefault(); 465 $("html, body").animate({ 466 scrollTop: 0 467 }, 800); 468 return false;
469 }); 470 // scroll animation ------------------ 471 $(window).on("scroll", function (a) { 472 if ($(this).scrollTop() > 150) { 473 $(".to-top").fadeIn(500); 474 } else { 475 $(".to-top").fadeOut(500); 476 } 477 }); 478 // collage image position ------------------ 479 $(".images-collage-item").each(function () { 480 var tcp = $(this), 481 dpl = tcp.data("position-left"), 482 dpt = tcp.data("position-top"), 483 dzi = tcp.data("zindex"); 484 tcp.css({ 485 "top": dpt + "%" 486 }); 487 tcp.css({ 488 "z-index": dzi, 489 }); 490 tcp.css({ 491 "left": dpl + "%", 492 }); 493 }); 494 // modal ------------------ 495 var modal = {}; 496 modal.hide = function () { 497 $('.modal').fadeOut(); 498 $("html, body").removeClass("hid-body"); 499 }; 500 $('.modal-open').on("click", function (e) { 501 e.preventDefault(); 502 $('.modal').fadeIn(); 503 $("html, body").addClass("hid-body"); 504 }); 505 $('.close-reg').on("click", function () { 506 modal.hide(); 507 }); 508 // click ------------------ 509 $(".show-search-button").on("click", function () { 510 $(".vis-header-search").slideToggle(500); 511 }); 512 $(".listing-view-layout li a.list").on("click", function (e) { 513 e.preventDefault(); 514 $(".listing-view-layout li a").removeClass("active"); 515 $(".listing-item").addClass("list-layout"); 516 $(this).addClass("active"); 517 }); 518 $(".listing-view-layout li a.grid").on("click", function (e) { 519 e.preventDefault(); 520 $(".listing-view-layout li a").removeClass("active"); 521 $(".listing-item").removeClass("list-layout"); 522 $(this).addClass("active"); 523 }); 524 // Forms ------------------ 525 $(document).on('change', '.leave-rating input', function() { 526 var $radio = $(this); 527 $('.leave-rating .selected').removeClass('selected'); 528 $radio.closest('label').addClass('selected'); 529 }); 530 531 $('.chosen-select').not('.bw-shop-search select').not('#bnApp select').niceSelect(); 532 if ($.fn.niceSelect) { 533 $('.bw-shop-search select.bw-ss-select').each(function () { 534 var $sel = $(this); 535 if ($sel.next('.nice-select').length) { 536 try { 537 $sel.niceSelect('destroy'); 538 } catch (e) { 539 $sel.next('.nice-select').remove(); 540 $sel.css('display', ''); 541 } 542 } 543 if ($sel.is(':hidden')) { 544 $sel.show(); 545 } 546 }); 547 } 548 $('input[type="range"].distance-radius').rangeslider({ 549 polyfill: false, 550 onInit: function () { 551 this.output = $(".distance-title span").html(this.$element.val()); 552 }, 553 onSlide: function ( 554 position, value) { 555 this.output.html(value); 556 } 557 }); 558 $('input.datepicker').dateDropper(); 559 $("input.timepicker").timeDropper({ 560 setCurrentTime: false, 561 meridians: true, 562 primaryColor: "#4DB7FE", 563 borderColor: "#4DB7FE", 564 minutesInterval: '15' 565 }); 566 $(".eye").on("click touchstart", function () { 567 var epi = $(this).parent(".pass-input-wrap").find("input"); 568 if (epi.attr("type") === "password") { 569 epi.attr("type", "text"); 570 } else { 571 epi.attr("type", "password"); 572 } 573 }); 574 var datacountryw = $("#weather-widget").data("country"), 575 datacityw = $("#weather-widget").data("city"); 576 577 var example = $("#weather-widget").flatWeatherPlugin({ 578 location: datacityw, //city and region *required 579 country: datacountryw, //country *required 580 zmw : "02108.1.99999", 581 api: "yahoo", 582 view : "full", 583 lang: "en", //default: en only openweathermap supports translation (see below for supported languages) 584 timeformat: "12", //"24" or "12" default: "12" 585 displayCityNameOnly : false, //default: false (true/false) if you want to display only city name 586 forecast: 5, //default: 5 (0 -5) how many days you want forecast 587 render: true, //default: true (true/false) if you want plugin to generate markup 588 loadingAnimation: true, //default: true (true/false) if you want plugin to show loading animation 589 units : "metric", //"metric" or "imperial" to overide units default: "auto" 590 591 lang: "EN", 592 //translation strings, If you would like to use another language please replace these strings with your language 593 // strings : { //strings for translation 594 // days: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], 595 // min : "Min", 596 // max : "Max", 597 // direction : ["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW", "NNW"] 598 // }, 599 600 // See readme for lang codes supported by each api 601 }); 602 // Styles ------------------ 603 if ($("footer.main-footer").hasClass("fixed-footer")) { 604 $('<div class="height-emulator fl-wrap"></div>').appendTo("#main"); 605 } 606 function csselem() { 607 $(".height-emulator").css({ 608 height: $(".fixed-footer").outerHeight(true) 609 });
610 $(".slideshow-container .slideshow-item").css({ 611 height: $(".slideshow-container").outerHeight(true) 612 }); 613 $(".slider-container .slider-item").css({ 614 height: $(".slider-container").outerHeight(true) 615 }); 616 $(".map-container.column-map").css({ 617 height: $(window).outerHeight(true)-80+"px" 618 }); 619 620 } 621 csselem(); 622 // Mob Menu------------------ 623 $(".nav-button-wrap").on("click", function () { 624 $(".main-menu").toggleClass("vismobmenu"); 625 }); 626 function mobMenuInit() { 627 var ww = $(window).width(); 628 if (ww < 1064) { 629 $(".menusb").remove(); 630 $(".main-menu").removeClass("nav-holder"); 631 $(".main-menu nav").clone().addClass("menusb").appendTo(".main-menu"); 632 $(".menusb").menu(); 633 } else { 634 $(".menusb").remove(); 635 $(".main-menu").addClass("nav-holder"); 636 } 637 } 638 mobMenuInit(); 639 // css ------------------ 640 var $window = $(window); 641 $window.on("resize", function() { 642 csselem(); 643 mobMenuInit(); 644 }); 645 $(".box-cat").on({ 646 mouseenter: function () { 647 var a = $(this).data("bgscr"); 648 $(".bg-ser").css("background-image", "url(" + a + ")"); 649 }}); 650 $(".header-user-name").on("click", function () { 651 $(".header-user-menu ul").toggleClass("hu-menu-vis"); 652 $(this).toggleClass("hu-menu-visdec"); 653 }); 654 // Counter ------------------ 655 if ($(".counter-widget").length > 0) { 656 var countCurrent = $(".counter-widget").attr("data-countDate"); 657 $(".countdown").downCount({ 658 date: countCurrent , 659 offset: 0 660 }); 661 } 662} 663// Parallax ------------------ 664function initparallax() { 665 var a = { 666 Android: function () { 667 return navigator.userAgent.match(/Android/i); 668 }, 669 BlackBerry: function () { 670 return navigator.userAgent.match(/BlackBerry/i); 671 }, 672 iOS: function () { 673 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 674 }, 675 Opera: function () { 676 return navigator.userAgent.match(/Opera Mini/i); 677 }, 678 Windows: function () { 679 return navigator.userAgent.match(/IEMobile/i); 680 }, 681 any: function () { 682 return a.Android() || a.BlackBerry() || a.iOS() || a.Opera() || a.Windows(); 683 } 684 }; 685 trueMobile = a.any(); 686 if (null === trueMobile) { 687 var b = new Scrollax(); 688 b.reload(); 689 b.init(); 690 } 691 if (trueMobile) $(".bgvid , .background-vimeo , .background-youtube-wrapper ").remove(); 692} 693 // Star Raiting ------------------ 694function cardRaining() { 695 $.fn.duplicate = function (a, b) { 696 var c = []; 697 for (var d = 0; d < a; d++) $.merge(c, this.clone(b).get()); 698 return this.pushStack(c); 699 }; 700 var cr = $(".card-popup-raining"); 701 cr.each(function (cr) { 702 var starcount = $(this).attr("data-starrating"); 703 $("<i class='fa fa-star'></i>").duplicate(starcount).prependTo(this); 704 }); 705} 706cardRaining(); 707function renderRatingStars($el, rating) { 708 rating = parseFloat(rating); 709 if (isNaN(rating)) rating = 0; 710 if (rating > 5) rating = 5; 711 if (rating < 0) rating = 0; 712 $el.empty(); 713 for (var i = 1; i <= 5; i++) { 714 var diff = rating - (i - 1); 715 var icon = "fa-star-o"; 716 var cls = "pd-star-gray"; 717 if (diff >= 1) { 718 icon = "fa-star"; 719 cls = "pd-star-gold"; 720 } else if (diff >= 0.5) { 721 icon = "fa-star-half-o"; 722 cls = "pd-star-gold"; 723 } 724 $el.append($("<i class='fa " + icon + " " + cls + "'></i>")); 725 } 726} 727var cr2 = $(".card-popup-rainingvis"); 728cr2.each(function () { 729 if ($(this).find("i").length) return; 730 renderRatingStars($(this), $(this).attr("data-starrating2")); 731}); 732$(".location a , .loc-act").on("click", function (e) { 733 e.preventDefault(); 734$.get("http://ipinfo.io", function (response) { 735 $(".location input , .qodef-archive-places-search").val( response.city); 736 737}, "jsonp"); 738 }); 739 $('.quantity-item').each(function() { 740 var spinner = jQuery(this), 741 input = spinner.find('input[type="text"]'), 742 btnUp = spinner.find('.plus'), 743 btnDown = spinner.find('.minus'), 744 min = input.attr('min'), 745 max = input.attr('max'); 746 747 btnUp.click(function() { 748 var oldValue = parseFloat(input.val()); 749 if (oldValue >= max) { 750 var newVal = oldValue; 751 } else { 752 var newVal = oldValue + 1; 753 754 } 755 spinner.find("input.qty").val(newVal); 756 spinner.find("input.qty").trigger("change"); 757 }); 758 759 btnDown.click(function() { 760 var oldValue = parseFloat(input.val()); 761 if (oldValue <= min) { 762 var newVal = oldValue; 763 } else { 764 var newVal = oldValue - 1; 765 } 766 spinner.find("input.qty").val(newVal); 767 spinner.find("input.qty").trigger("change"); 768 }); 769 }); 770 function initAutocomplete() { 771 var input = document.getElementById('autocomplete-input'); 772 var autocomplete = new google.maps.places.Autocomplete(input); 773 autocomplete.addListener('place_changed', function() { 774 var place = autocomplete.getPlace(); 775 if (!place.geometry) {
776 window.alert("No details available for input: '" + place.name + "'"); 777 return; 778 } 779 }); 780 } 781$(".notification-close").on("click", function () { 782 $(this).parent(".notification").slideUp(500); 783}); 784 785function bwSyncShopSearchElevation($search) { 786 if (!$search || !$search.length) { 787 return; 788 } 789 var elevated = $search.find(".nice-select.open").length > 0 790 || $search.find(".bw-shop-search-display.is-open").length > 0; 791 var $section = $search.closest(".hp-home-section"); 792 $search.toggleClass("is-suggest-open", elevated); 793 if ($section.length) { 794 $section.toggleClass("is-suggest-open", elevated); 795 } 796} 797 798function bwCloseShopFilterPopovers($except) { 799 $(".bw-ss-filters-popover.bw-ss-open").each(function () { 800 var $panel = $(this); 801 if ($except && $except.length && $panel.is($except)) { 802 return; 803 } 804 $panel.removeClass("bw-ss-open"); 805 $panel.closest(".bw-ss-more-wrap").find(".bw-ss-more").attr("aria-expanded", "false").find("span").removeClass("mfilopact"); 806 }); 807} 808 809function bwToggleShopMoreFilters($btn) { 810 var $wrap = $btn.closest(".bw-ss-more-wrap"); 811 var $panel = $wrap.length 812 ? $wrap.find(".hidden-listing-filter").first() 813 : $btn.closest("form").find(".hidden-listing-filter").first(); 814 if (!$panel.length) { 815 $panel = $btn.siblings(".hidden-listing-filter").first(); 816 } 817 if (!$panel.length) { 818 $panel = $btn.parent().find(".hidden-listing-filter").first(); 819 } 820 if (!$panel.length) { 821 return; 822 } 823 if ($btn.closest(".bw-shop-search").length) { 824 if ($panel.hasClass("bw-ss-filters-popover")) { 825 var willOpen = !$panel.hasClass("bw-ss-open"); 826 bwCloseShopFilterPopovers($panel); 827 $panel.toggleClass("bw-ss-open", willOpen); 828 $btn.attr("aria-expanded", willOpen ? "true" : "false"); 829 $btn.find("span").toggleClass("mfilopact", willOpen); 830 return; 831 } 832 $panel.toggleClass("bw-ss-open"); 833 $btn.find("span").toggleClass("mfilopact", $panel.hasClass("bw-ss-open")); 834 return; 835 } 836 $panel.stop(true, true).slideToggle(500); 837 $btn.find("span").toggleClass("mfilopact"); 838} 839 840// Shop search â More Filters (delegated; survives initCitybook errors on shop pages) 841// Skip buttons that open the fullscreen facet sheet (handled by bw-shop-filters-sheet.js) 842$(document).on("click", ".more-filter-option, .bw-ss-more", function (e) { 843 if (this.hasAttribute && this.hasAttribute("data-bw-open-filters")) { 844 return; 845 } 846 e.preventDefault(); 847 e.stopPropagation(); 848 bwToggleShopMoreFilters($(this)); 849}); 850 851$(document).on("click", ".bw-shop-search .nice-select", function () { 852 var $search = $(this).closest(".bw-shop-search"); 853 setTimeout(function () { 854 bwSyncShopSearchElevation($search); 855 }, 0); 856}); 857 858$(document).on("click", function (e) { 859 if (!$(e.target).closest(".bw-ss-more-wrap").length) { 860 bwCloseShopFilterPopovers(); 861 } 862 $(".bw-shop-search").each(function () { 863 bwSyncShopSearchElevation($(this)); 864 }); 865}); 866$(document).on("keydown", ".more-filter-option, .bw-ss-more", function (e) { 867 if (this.hasAttribute && this.hasAttribute("data-bw-open-filters")) { 868 return; 869 } 870 if (e.key !== "Enter" && e.key !== " ") { 871 return; 872 } 873 e.preventDefault(); 874 bwToggleShopMoreFilters($(this)); 875}); 876 877// Init All ------------------ 878$(function () { 879 initCitybook(); 880 initparallax(); 881});
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.