1 2function playVastuullisuusVideo(e,youtube_id,track_name){ 3 4 e.preventDefault(); 5 e.stopPropagation(); 6 if(ANALYTICS_ALLOWED){ 7 8 _gaq.push(['_trackEvent', 'vastuullisuus',track_name]) 9 } 10 if(MARKETING_ALLOWED){ 11 12 13 14 if(ytplayer){ 15 ytplayer.loadVideoById(youtube_id); 16 } 17 18 e.currentTarget.querySelector("[data-overlay-button]").click(); 19 20 21 }else{ 22 23 24 window.open("https://www.youtube.com/watch?v="+youtube_id); 25 26 } 27 28 29 //e.currentTarget.querySelector("[data-overlay-button]").click(); 30 /*if(overlay){ 31 32 overlay.close(); 33 }*/ 34 35} 36function isRinnakkaisVisible(){ 37 38 39 return !$("#show_rinnakkais").hasClass("hide"); 40} 41 42$(document).ready(function(){ 43 44 45 $("#select_rinnakkais").change(function(){ 46 47 48 if(isRinnakkaisVisible()){ 49 50 if($(this).attr("data-clear-form")=="true"){ 51 52 53 $("#show_rinnakkais").find("input").each(function(){ 54 55 if($(this).attr("type")=="text"){ 56 $(this).val(""); 57 } 58 }); 59 $("#show_rinnakkais").find("select").each(function(){ 60 61 $(this).val([0]); 62 $(this).trigger("click"); 63 $(this).trigger("onchange"); 64 $(this).trigger("change"); 65 66 }); 67 $("#huoltajan-tiedot-rinnakkais").hide(); 68 $("#huoltajan-tiedot-rinnakkais").removeClass("check-age"); 69 70 } 71 72 $("#show_rinnakkais").hide(); 73 $("#show_rinnakkais").addClass("hide"); 74 75 76 77 }else{ 78 79 80 $("#show_rinnakkais").show(); 81 $("#show_rinnakkais").removeClass("hide"); 82 } 83 84 }); 85}); 86 87function checkRinnakkaisIka(func){ 88 89 //alert($.trim($("#etunimi2").val())); 90 91 if($("#huoltajan-tiedot-rinnakkais").attr("id")=="huoltajan-tiedot-rinnakkais"){ 92 93 if(hasSelectedAllDates(func)){ 94 var d=getDateValue(func); 95 console.log("nyt "+d.getTime()); 96 console.log("limit "+getAgeLimit("#huoltajan-tiedot-rinnakkais").getTime()); 97 if(d.getTime()<=getAgeLimit("#huoltajan-tiedot-rinnakkais").getTime()){ 98 $("#huoltajan-tiedot-rinnakkais").hide(); 99 100 $("#huoltajan-tiedot-rinnakkais").removeClass("check-age"); 101 102 }else{ 103 $("#huoltajan-tiedot-rinnakkais").show(); 104 105 $("#huoltajan-tiedot-rinnakkais").addClass("check-age"); 106 107 } 108 109 110 } 111 } 112 113 114 } 115 116 function checkKorttiIka(func){ 117 118 if($("#huoltajan-tiedot").attr("id")=="huoltajan-tiedot"){ 119 120 if(hasSelectedAllDates(func)){ 121 122 var d=getDateValue(func); 123 124 //alert(d.getTime()+" <= "+getAgeLimit("#huoltajan-tiedot").getTime()); 125 if(d.getTime()<=getAgeLimit("#huoltajan-tiedot").getTime()){ 126 $("#huoltajan-tiedot").hide(); 127 128 $("#huoltajan-tiedot").removeClass("check-age"); 129 130 }else{ 131 $("#huoltajan-tiedot").show(); 132 133 $("#huoltajan-tiedot").addClass("check-age"); 134 135 } 136 137 return true; 138 139 } 140 return false; 141 } 142 143 144 } 145 function getDateValue(f){ 146 var o=new Object(); 147 148 var d=["day","month","year"]; 149 for(var i in d){ 150 $("[data-form-"+d[i]+"]").each(function(){ 151 152 if($(this).attr("data-validator-func")==f){ 153 154 o[d[i]]=$(this).val(); 155 156 } 157 }); 158 159 } 160 161 162 163 164/* o.day=$("[data-form-day]").val(); 165 o.month=$("[data-form-month]").val(); 166 o.year=$("[data-form-year]").val();*/ 167 168 169 170 171 172 173 174 175 var d = new Date(); 176 d.setDate(parseInt(o.day)); 177 d.setMonth(parseInt(o.month-1)); 178 d.setYear(parseInt(o.year)); 179 180 181 return d; 182 } 183 function getAgeLimit(id){ 184 185 186 if($(id).attr("id")==undefined ||$(id).attr("id")==false ||Â $(id).attr("id")==null ){ 187 188 return false; 189 }else{ 190 var limit=$(id).attr("data-age-limit"); 191 192 var limits=limit.split("."); 193 var o=new Object(); 194 o.day=limits[0]; 195 o.month=limits[1]-1; 196 o.year=limits[2]; 197 var d = new Date(); 198 199 200 d.setDate(parseInt(o.day)); 201 d.setMonth(parseInt(o.month)); 202 d.setYear(parseInt(o.year)); 203 return d; 204 } 205 206 } 207 208 function hasSelectedAllDates(f){ 209 var v=true; 210 $("[data-form-day],[data-form-month],[data-form-year]").each(function(){ 211 212 if($(this).attr("data-validator-func")==f){ 213 214 if($(this).val()=="0"){ 215 v=false; 216 } 217 } 218 }); 219 return v; 220 } 221 222 223function playYoutube(youtubevideo) { 224 $("#youtube-layer").remove(); 225 226 227 228 if(MARKETING_ALLOWED==true){ 229 230 231 232 $("body").append('<div id="youtube-layer" class="layer" role="dialog"><button class="layer-close">×</button><div class="youtube-container"><iframe width="1000" height="563" src="//www.youtube-nocookie.com/embed/'+youtubevideo+'" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></div></div>'); 233 $D.layer.openLayer("youtube-layer"); 234 235 236 }else{ 237 238 var url="https://www.youtube.com/watch?v="+youtubevideo; 239 240 window.open(url); 241 242 243 244 245 } 246} 247 248$(function() { 249
250 if(isMobile.apple.device || isMobile.android.device || isMobile.windows.device) { 251 $("body").addClass("mobile"); 252 } 253 254 // Top logo 255 $(window).on("scroll", function(e) { 256 $D.log($(this).scrollTop()); 257 if($(this).scrollTop() > 70) 258 $(".top-logo").addClass("visible") 259 else 260 $(".top-logo").removeClass("visible") 261 }); 262 263 // Deep nav 264 deepNavigation("#main-nav", ".parent", ".active"); 265 266 // IE 8-9 placeholder fix 267 if(!Modernizr.input.placeholder) { 268 $("[placeholder]").focus(function() { 269 var input = $(this); 270 if (input.val() == input.attr("placeholder")) { 271 input.val(""); 272 input.removeClass("placeholder"); 273 } 274 }).blur(function() { 275 var input = $(this); 276 if (input.val() == "" || input.val() == input.attr("placeholder")) { 277 input.addClass("placeholder"); 278 input.val(input.attr("placeholder")); 279 } 280 }).blur(); 281 } 282 283 // Dropdown 284 $(".dropdown-nav").on("click", function(e) { 285 e.stopPropagation(); 286 287 var target = $(this).find("ul"); 288 289 if($(target).is(":visible")) 290 $(target).parent().removeClass("active"); 291 else 292 $(target).parent().addClass("active"); 293 294 }); 295 296 function closeDropdown() { 297 $(".dropdown-nav").removeClass("active"); 298 } 299 300 $(".search-icon").on("click", function(e) { 301 e.preventDefault(); 302 e.stopPropagation(); 303 304 toggleSearch(this); 305 }); 306 307 /**/ 308 // $(".bonus-icon button").on("click", function(e) { 309 // e.preventDefault(); 310 // e.stopPropagation(); 311 312 // toggleBonus(this); 313 // }); 314 315 $("#search input").on("click", function(e) { 316 e.preventDefault(); 317 e.stopPropagation(); 318 }); 319 320 // Table 321 $(".table-container .inner").on("scroll", $.throttle(100, function() { 322 updatetable(this); 323 })); 324 325 function updatetable(target) { 326 var pos = $(target).scrollLeft(); 327 328 if(pos > 0) 329 $(target).parent().find(".arrows").addClass("scroll-left"); 330 else 331 $(target).parent().find(".arrows").removeClass("scroll-left"); 332 333 if(pos >= $(target)[0].scrollWidth - $(target).width()) 334 $(target).parent().find(".arrows").removeClass("scroll-right"); 335 else 336 $(target).parent().find(".arrows").addClass("scroll-right"); 337 } 338 339 $(".table-container .inner").each(function() { 340 updatetable(this); 341 }); 342 343 $(window).on("resize", $.throttle(100, function() { 344 $(".table-container .inner").each(function() { 345 updatetable(this); 346 }); 347 })); 348 349 $(".table-container .arrow-left").on("click", function(e) { 350 var target = $(this).parent().parent().find(".inner"); 351 var pos = $(target).scrollLeft(); 352 353 $(target).animate({scrollLeft: pos - 200}, 200); 354 }); 355 356 $(".table-container .arrow-right").on("click", function(e) { 357 var target = $(this).parent().parent().find(".inner"); 358 var pos = $(target).scrollLeft(); 359 360 $(target).animate({scrollLeft: pos + 200}, 200); 361 }); 362 363 // Mobile campaign 364 var campaign = $(".kamppis").clone().appendTo("#campaign-mobile"); 365 $(campaign).removeAttr("id").removeClass(); 366 367 // GPS 368 369 $("#gps-box").on("click", function() { 370 371 if(navigator.geolocation) { 372 var options = { timeout: 15000 }; 373 navigator.geolocation.getCurrentPosition(startGpsSearch, gpsError, options); 374 startGpsAnimation() 375 } 376 else 377 setGpsMessage(D_TRANSLATE.ei_tue_paikannusta); 378 }); 379 380 $("#gps-list-container .close").on("click", function(e) { 381 e.preventDefault(); 382 383 hideGpsList(); 384 }); 385 386 /*function hasSelectedAllDates(){ 387 var v=true; 388 $("[data-form-day],[data-form-month],[data-form-year]").each(function(){ 389 390 391 if($(this).val()=="0"){ 392 v=false; 393 } 394 }); 395 return v; 396 }*/ 397 398 /*function runAgeCheck(){ 399 400 if(hasSelectedAllDates()){ 401 var d=getDateValue(); 402 if(d.getTime()<=getAgeLimit().getTime()){ 403 $("[data-age-limit]").hide(); 404 $("[data-age-limit]").removeClass("check-age"); 405 406 }else{ 407 $("[data-age-limit]").show(); 408 409 $("[data-age-limit]").addClass("check-age"); 410 411 } 412 413 414 415 } 416 } 417 */ 418 419 // Form 420 $("[data-form-day],[data-form-month],[data-form-year]").change(function(){ 421 //runAgeCheck(); 422 var f=($(this).attr("data-validator-func")); 423 window[f]($(this).attr("data-validator-func")); 424 425 //window[f]($(this).attr("data-validator-func")); 426 }); 427 $("[data-form-send]").on("click", function(e) { 428 429 // $(this).after('<div class="form-message hide"></div>'); 430 431 432 433 434 if(!validateForm($(this).closest("form"))) { 435 e.preventDefault(); 436 e.stopPropagation(); 437 }else{ 438 var submitting=$(this).attr("data-submitting"); 439 440 if(submitting && submitting=="true"){ 441 e.preventDefault(); 442 e.stopPropagation(); 443 444 445 return false;
446 } 447 448 449 var loadingDivId=$(this).attr("data-form-loading"); 450 451 if(loadingDivId && loadingDivId!=undefined && loadingDivId!=""){ 452 453 $(loadingDivId).show(); 454 $(this).hide(); 455 456 //$(this).after('<div class="form-message">'+loadingText+'</div>'); 457 //$(this).attr("value",loadingText); 458 $(this).attr("data-submitting","true"); 459 460 } 461 } 462 }); 463 464 $("[data-form-required]").each(function() { 465 var classes = ""; 466 var target = this; 467 468 if($(this).prop("tagName") == "SELECT") 469 classes = " full"; 470 471 if($(this).attr("type") == "checkbox") 472 target = $(this).closest(".checkbox"); 473 474 $(target).after('<p class="form-error' + classes + ' hide" id="error_'+$(this).attr("name")+'"></p>'); 475 }); 476 477 // Youtube 478 $("[data-youtube]").each(function(i) { 479 480 481 482 if($(this).attr("data-youtube")!="" && $(this).attr("data-youtube")!=undefined){ 483 var val=$(this).attr("data-youtube"); 484 485if($(this).attr("data-youtube-parent")=="true"){ 486 $(this).parent().css("cursor","pointer"); 487 $(this).parent().click(function(e) { 488 playYoutube(val); 489 }); 490 491}else{ 492 493 494 if($(this).attr("data-youtube-nolink")=="true"){ 495 $(this).css("cursor","pointer"); 496 $(this).click(function(e) { 497 playYoutube(val); 498 }); 499 500 }else{ 501 $(this).parent().after('<div class="youtube-link"></div>'); 502 503 504 505 $(this).parent().parent().find(".youtube-link").click(function(e) { 506 playYoutube(val); 507 }); 508 } 509 } 510 511} 512 513 514 515 }); 516 517}); 518 519function startGpsSearch(position) { 520 // Call search function 521 stopGpsAnimation(); 522 setGpsMessage(""); 523 updateGpsList(position.coords.latitude, position.coords.longitude); 524 showGpsList(); 525 526 // $D.log("lat " + position.coords.latitude); 527 // $D.log("lon " + position.coords.longitude); 528} 529 530function startGpsAnimation() { 531 $("#gps-animation").show(); 532} 533 534function stopGpsAnimation() { 535 $("#gps-animation").hide(); 536} 537 538function setGpsMessage(msg) { 539 $("#gps-message").html(msg); 540} 541 542function showGpsList() { 543 $("#gps-list-container").slideDown(); 544} 545 546function hideGpsList() { 547 $("#gps-list-container").slideUp(); 548 setGpsMessage(""); 549} 550 551function gpsError(error) { 552 stopGpsAnimation(); 553 // $D.log("GPS error " + error.code); 554 555 switch(error.code) { 556 case error.PERMISSION_DENIED: 557 setGpsMessage(D_TRANSLATE.paikannus_estetty); 558 559 break; 560 case error.POSITION_UNAVAILABLE: 561 setGpsMessage(D_TRANSLATE.paikka_tietoja_ei_loytynyt); 562 break; 563 case error.TIMEOUT: 564 setGpsMessage(D_TRANSLATE.error); 565 break; 566 case error.UNKNOWN_ERROR: 567 setGpsMessage(D_TRANSLATE.error); 568 break; 569 } 570 571 showGpsList(); 572} 573 574var input = $("#search").find("input"); 575 576// Mobile nav 577function toggleMobileNav(target) { 578 $("#mobile-search").hide(); 579 $(".nav-toggle").removeClass("active"); 580 581 if($("#main-nav").is(":visible")) 582 $(target).removeClass("active"); 583 else 584 $(target).addClass("active"); 585 586 $D.toggle('#main-nav'); 587} 588 589function toggleMobileSearch(target) { 590 $("#main-nav").hide(); 591 $(".nav-toggle").removeClass("active"); 592 593 if($("#mobile-search").is(":visible")) 594 $(target).removeClass("active"); 595 else 596 $(target).addClass("active"); 597 598 $D.toggle('#mobile-search', 200); 599} 600 601function deepNavigation(element, parent, active) { 602 // $(element + " " + parent + ":not(" + active + ") ul").hide(); 603 // $(element + " " + parent + ":not(" + active + ") > a").before('<span class="deep-nav-toggle"></span>'); 604 // $(element + " " + parent + ":not(" + active + ")").addClass("relative"); 605 $(element + " " + parent + " ul").hide(); 606 $(element + " " + parent + " > a").before('<span class="deep-nav-toggle"></span>'); 607 $(element + " " + parent).addClass("relative"); 608 $(element + " " + parent + active + " > a").before('<span class="deep-nav-toggle active"></span>'); 609 $(element + " " + parent + active).addClass("relative"); 610 611 $(element + " .deep-nav-toggle").click(function(e) { 612 var target = $(e.target).parent().children("ul"); 613 614 if($(target).is(":visible")) { 615 $(e.target).parent().children("ul").slideUp(); 616 // $(e.target).html('+'); 617 $(e.target).removeClass("active-nav"); 618 } 619 else { 620 $(e.target).parent().children("ul").slideDown(); 621 // $(e.target).html('-'); 622 $(e.target).addClass("active-nav"); 623 } 624 }); 625} 626 627// Top bar nav 628function toggleSearch(target) { 629 $D.toggle("#search", 0); 630 631 if(!$("#search").is(":visible")) 632 $(target).removeClass("active"); 633 else 634 $(target).addClass("active"); 635 636 $(input).on("keyup", function(e) { 637 if(e.which == 27) { 638 closeSearch(); 639 $(".search-nav span").removeClass("active"); 640 } 641 }); 642 643 $(window).trigger("resize"); 644 645 closeBonus(); 646 $(document).on("click", closeSearch); 647} 648 649function toggleBonus(target) { 650 $D.toggle("#bonus", 0); 651 652 if(!$("#bonus").is(":visible")) 653 $(target).removeClass("active"); 654 else 655 $(target).addClass("active"); 656 657 closeSearch(); 658 $(document).on("click", closeBonus); 659} 660 661function closeBonus(e) { 662 if(e && $(e.target).closest(".bonus-login").get(0)) 663 return false;
664 665 $("#bonus").hide(); 666 $(".bonus-icon button").removeClass("active"); 667 $(document).off("click", closeBonus); 668} 669 670function closeSearch() { 671 $(input).off("keyup"); 672 $("#search").hide(); 673 $(".search-icon").removeClass("active"); 674 $(document).off("click", closeSearch); 675} 676 677// Ingredients 678 679function toggleIngredients(target) { 680 $(target).toggleClass("open"); 681 $("#ingredients-calculator").slideToggle(); 682} 683 684// Product label 685 686function toggleProductLabel(target) { 687 $(target).toggleClass("open"); 688 toggle("#product-label"); 689} 690 691function toggle(target) { 692 $(target).slideToggle(); 693} 694 695function getScreenSize() { 696 if(Modernizr.mq("(max-width: " + $D.breakpoints.smallMax + ")")) 697 return "small"; 698 else if(Modernizr.mq("(max-width: " + $D.breakpoints.mediumMax + ")")) 699 return "medium"; 700 else if(Modernizr.mq("(max-width: " + $D.breakpoints.largeMax + ")")) 701 return "large"; 702 else if(Modernizr.mq("(min-width: " + $D.breakpoints.xlarge + ")")) 703 return "xlarge"; 704} 705 706// Sub nav 707 708function selectSubNavItem(id, target, parent) { 709 $D.scrollTo(id, 500, -20); 710 711 $(parent).find("li").removeClass("active"); 712 $(target).addClass("active"); 713} 714 715// Form 716 717var errors; 718function validateEmailHuoltaja(email) { 719 // var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 720 var re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; 721 722 return re.test(email); 723} 724function validateForm(target) { 725 errors = new Array(); 726 $(target).find(".form-error").html(""); 727 $(target).find(".form-message-target").hide(); 728 729 // Non empty value required 730 731 732 /*$(target).find("[data-form-required-if-names-given]").each(function(){ 733 734 if($(this).val() == "" || $(this).val() == 0) { 735 addFormError(this, "data-form-required-if-names-given"); 736 } 737 738 });*/ 739 $(target).find("[data-form-require-email-if-visible]").each(function(){ 740 741 742 743 if($(this).parent().hasClass("check-age")){ 744 745 //addFormError(this, "data-form-pwd-tooshort"); 746 if(validateEmailHuoltaja($(this).val())==false){ 747 748 749 750 751 addFormError(this, "data-form-require-email-if-visible"); 752 } 753 754 } 755 756 757 758 }); 759 $(target).find("[data-form-required]").each(function() { 760 761 //console.log($(this).attr("name"),$(this).attr("data-onlywhen-visible"),$(this).is(":visible"),$(this).hasClass("date"),$(this).parent().is(":visible")); 762 if($(this).attr("data-onlywhen-visible")){ 763 //console.log($(this).attr("name",$(this).is(":visible")); 764 } 765 //var valli=$(this).attr("data-validator-func"); 766 767 if($(this).attr("data-onlywhen-visible")!="true" || ($(this).is(":visible") || ($(this).hasClass("date") && $(this).parent().is(":visible")))){ 768 769 770 if($(this).hasClass("radiogroup")) { 771 if($(this).find("input:checked").length == 0) 772 addFormError(this, "data-form-required"); 773 } 774 else if($(this).attr("type") == "checkbox") { 775 if(!$(this).prop("checked")) 776 addFormError(this, "data-form-required"); 777 } 778 else if($(this).val() == "" || $(this).val() == 0) { 779 addFormError(this, "data-form-required"); 780 } 781 } 782 }); 783 784 // Number 785 $(target).find("[data-form-only-numbers]").each(function() { 786 787 if($(this).attr("data-onlywhen-visible")!="true" || $(this).is(":visible")){ 788 789 if(!isNaN($(this).val())) { 790 addFormError(this, "data-form-only-numbers"); 791 } 792 } 793 }); 794 795 $(target).find("[data-form-ccphone]").each(function() { 796 //if($(this).attr("data-onlywhen-visible")!="true" || $(this).is(":visible")){ 797 var regex = /^\+\d{3,18}$/; 798 799 800 /*if(/[^+\(\)\ 0-9-]/.test($(this).val().toString())) { 801 addFormError(this, "data-form-ccphone"); 802 }*/ 803 var number=$(this).val().toString(); 804 805 if(!regex.test(number)){ 806 addFormError(this, "data-form-ccphone"); 807 } 808 809 //} 810 }); 811 812 813 // Phone number 814 $(target).find("[data-form-phonenumber]").each(function() { 815 if($(this).attr("data-onlywhen-visible")!="true" || $(this).is(":visible")){ 816 817 if(/[^+\(\)\ 0-9-]/.test($(this).val().toString())) { 818 addFormError(this, "data-form-phonenumber"); 819 } 820 } 821 }); 822 823 // Password too short 824 $(target).find("[data-form-pwd-tooshort]").each(function() { 825 826 if($(this).val().length < 8) { 827 addFormError(this, "data-form-pwd-tooshort"); 828 } 829 }); 830 831 // Passwords don't match 832 $(target).find("[data-form-compare]").each(function() { 833 if($(this).val() != $("[name=" + $(this).attr('data-form-compare-target') + "]").val()) { 834 addFormError(this, "data-form-compare"); 835 } 836 }); 837 838 // Must not have only small letters 839 $(target).find("[data-form-onlysmallletters]").each(function() { 840if($(this).attr("data-onlywhen-visible")!="true" || $(this).is(":visible")){ 841 842 var fullcase = $(this).val().toString(); 843 var lowercase = fullcase.toLowerCase(); 844 845 if(fullcase == lowercase) { 846 addFormError(this, "data-form-onlysmallletters"); 847 } 848 849} 850 }); 851 852 // Must not have only capital letters 853 $(target).find("[data-form-onlylargeletter]").each(function() { 854 855 if($(this).attr("data-onlywhen-visible")!="true" || $(this).is(":visible")){ 856 857 var fullcase = $(this).val().toString(); 858 var uppercase = fullcase.toUpperCase(); 859 860 if(fullcase == uppercase) { 861 addFormError(this, "data-form-onlylargeletter"); 862 } 863 } 864 }); 865 866 if(errors.length > 0) { 867 var message = $(target).find(".form-message-target"); 868 // $(message).html(""); 869 $(message).show(); 870 871 $D.scrollTo(message, 0, -50); 872 873 return false;
874 } 875 876 return true; 877} 878 879function scrollToMessage(target) { 880 var message = $(target).closest(".form-message-target"); 881 $D.scrollTo(message, 0, -50); 882} 883 884function addFormError(target, id) { 885 // $D.log("Error " + id); 886 if($.inArray($(target).attr("name"), errors) != -1) 887 return false; 888 889 $("#error_" + $(target).attr("name")).html($(target).attr(id)).show(); 890 891 errors.push($(target).attr("name")); 892 893 $(target).on("focus", function(e) { 894 $(target).closest(".form").find(".form-message-target").hide(); 895 $("#error_" + $(this).attr("name")).hide(); 896 }); 897 if($(target).attr("type")=="checkbox"){ 898 $(target).on("change", function(e) { 899 $("#error_" + $(this).attr("name")).hide(); 900 }); 901 } 902} 903 904function toggleFilter(target) { 905 $D.toggle("#product-filter"); 906 $(target).toggleClass("open"); 907} 908 909function toggleRestaurantFilter(target) { 910 $D.toggle("#restaurant-filter"); 911 $(target).toggleClass("open"); 912} 913 914/* isMobile js */ 915!function(a){var b=/iPhone/i,c=/iPod/i,d=/iPad/i,e=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,f=/Android/i,g=/IEMobile/i,h=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,i=/BlackBerry/i,j=/Opera Mini/i,k=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,l=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),m=function(a,b){return a.test(b)},n=function(a){var n=a||navigator.userAgent;this.apple={phone:m(b,n),ipod:m(c,n),tablet:m(d,n),device:m(b,n)||m(c,n)||m(d,n)},this.android={phone:m(e,n),tablet:!m(e,n)&&m(f,n),device:m(e,n)||m(f,n)},this.windows={phone:m(g,n),tablet:m(h,n),device:m(g,n)||m(h,n)},this.other={blackberry:m(i,n),opera:m(j,n),firefox:m(k,n),device:m(i,n)||m(j,n)||m(k,n)},this.seven_inch=m(l,n),this.any=this.apple.device||this.android.device||this.windows.device||this.other.device||this.seven_inch,this.phone=this.apple.phone||this.android.phone||this.windows.phone,this.tablet=this.apple.tablet||this.android.tablet||this.windows.tablet},o=new n;o.Class=n,"undefined"!=typeof module&&module.exports?module.exports=o:"function"==typeof define&&define.amd?define(o):a.isMobile=o}(this); 916 917// NodeList.forEach 918window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(o,t){t=t||window;for(var i=0;i<this.length;i++)o.call(t,this[i],i,this)}); 919 920// CustomEvent 921!function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,r;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();
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.