1var posturl = appRoot + '/data-l'; 2var postanonymous = appRoot + '/data-a'; 3var getlist = appRoot + '/data-list-l'; 4var get_autocomplete = appRoot + '/data-autocomplete-list-l'; 5var ctl = 'main_PH_'; 6 7 8// ------------------------------------------------------------------------ gf 9 10var gf = {}; 11 12// ------------ gf - do alert (title - optional) 13 14gf.alert = function (msg, title, do_after) { 15 if (msg == "" || msg === undefined || msg === null) { 16 msg = " "; 17 } 18 bootbox.alert({ 19 title: title, 20 message: msg, 21 callback: function () { 22 if (do_after != null) { 23 if (do_after = 'parent.closeModal') { 24 parent.closeModal(); 25 } 26 } 27 } 28 }) 29} 30 31// ------------ gf - show vi 32gf.vi_show = function () { 33 $(".vi").fadeIn('slow').delay(1000).fadeOut('slow'); 34} 35 36// ------------ gf - show loader 37gf.loader_show = function () { 38 $(".loader").show(); 39} 40 41gf.loader_hide = function () { 42 setTimeout(function () { $(".loader").hide(); }, 500); 43} 44 45// ------------ gf - toastr 46toastr.options = { 47 "closeButton": false, 48 "debug": false, 49 "newestOnTop": false, 50 "progressBar": true, 51 "rtl": false, 52 "positionClass": "toast-bottom-right", 53 "preventDuplicates": false, 54 "onclick": null, 55 "showDuration": 300, 56 "hideDuration": 1000, 57 "timeOut": 5000, 58 "extendedTimeOut": 1000, 59 "showEasing": "swing", 60 "hideEasing": "linear", 61 "showMethod": "fadeIn", 62 "hideMethod": "fadeOut" 63} 64 65gf.toastr_vi = function (msg) { 66 toastr["success"](msg); 67} 68 69gf.toastr_info = function (msg) { 70 toastr["info"](msg); 71} 72 73gf.toastr_warning = function (msg) { 74 toastr["warning"](msg); 75} 76 77gf.toastr_error = function (msg) { 78 toastr["error"](msg); 79} 80 81gf.toastr_html = function (msg) { 82 toastr.options = { 83 toastClass: 'toast-html-class', 84 "progressBar": true, 85 "positionClass": "toast-bottom-right", 86 "onclick": null, 87 "timeOut": 5000, 88 "hideDuration": 300, 89 } 90 toastr["info"](msg); 91 $('.toast-html-class').removeClass('toast-info'); 92} 93 94// ------------ gf - blink 95gf.blink = function (id) { 96 $('#' + id).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200); 97} 98 99// ------------ gf - display splash screen 100 101gf.display_splash_screen = function (txt, hide_time) { 102 if (hide_time == undefined) { hide_time = 10000; } 103 $('.splash-screen-content').hide(); 104 $('.splash-screen-content').html(txt); 105 setTimeout(function () { 106 splash_screen_show(txt); 107 }, 1000); 108 setTimeout(function () { 109 splash_screen_hide(); 110 }, hide_time); 111} 112 113function splash_screen_show() { 114 $('.splash-screen').show(); 115 $('.splash-screen-content').fadeIn(1000); 116} 117 118$('.splash-screen').click(function (e) { 119 splash_screen_hide() 120}) 121 122function splash_screen_hide() { 123 $('.splash-screen-content').fadeOut(500); 124 setTimeout(function () { 125 $('.splash-screen').hide(); 126 }, 600); 127} 128 129// ------------------------------------------------------------------------ msg 130$(document).ready(function () { 131 if (js_msg != '') { 132 if (js_msg == 'v') { 133 gf.vi_show(); 134 } 135 else { 136 gf.alert(js_msg); 137 } 138 js_msg = ''; 139 } 140}); 141 142// ------------------------------------------------------------------------ list of rows items 143 144// highlight row 145$('body').on('click', '[id^=row-]', function () { 146 var id = $(this).data('id'); 147 highlight_row(id); 148}); 149 150function highlight_row(id) { 151 $('[id^=row-]').removeClass("highlight-color"); 152 var rowId = 'row-' + id; 153 $('#' + rowId).addClass('highlight-color'); 154} 155 156function blink_row(id) { 157 $('#row-' + id).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200); 158} 159 160function blink_and_remove_row(id) { 161 blink_row(id); 162 setTimeout(function () { 163 $('#row-' + id).remove(); 164 }, 2000); 165} 166 167 168// ------------------------------------------------------------------------ misc 169// number format to commas 170function number_format_to_commas(number) { 171 if (number == null || number === '') return ''; 172 var num = Number(String(number).replace(/,/g, '')); 173 if (isNaN(num)) return number; // ××××ר ×ת ××§×× ×××§××¨× ×× ×× ×ספר תק××
174 return num.toLocaleString('he-IL'); 175} 176 177// isMobile 178function isMobile() { 179 let check = false; 180 (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera); 181 return check; 182} 183 184// ------------------------------------------------------------------------ date picker 185$(function () { 186 $('.dateBox').datepicker({ 187 width: 200, 188 dateFormat: 'dd/mm/yy', 189 changeMonth: true, 190 changeYear: true, 191 showOtherMonths: true, 192 selectOtherMonths: true 193 }); 194}); 195 196$(function () { 197 $('.dateBox-birth').datepicker({ 198 width: 200, 199 dateFormat: 'dd/mm/yy', 200 yearRange: '1930:2005', 201 defaultDate: '01/01/1990', 202 changeMonth: true, 203 changeYear: true, 204 showOtherMonths: true, 205 selectOtherMonths: true 206 }); 207}); 208 209 210// ------------------------------------------------------------------------ multi-select component 211// multi-select click event 212$('.multi-select .list-group-item').click(function (e) { 213 var clicked_id = $(this).data('id'); 214 var select_id = $(this).parent().attr('id'); 215 216 set_multi_select(select_id, clicked_id) 217}) 218 219// set the multi-select 220function set_multi_select(multi_select_id, clicked_id) { 221 var values = ''; 222 var old_values = $('#' + multi_select_id).data('velues'); 223 var hidden_text_box = $('#' + multi_select_id).data('textbox'); 224 hidden_text_box = ctl + hidden_text_box; 225 226 if (clicked_id != null) { 227 var arr = old_values.split(','); 228 229 if (arr.includes(clicked_id.toString(), 0)) { 230 arr.splice(arr.indexOf(clicked_id.toString()), 1); 231 } else { 232 arr.push(clicked_id.toString()); 233 } 234 235 values = arr.join().replace(/^,|,$/g, '').toString(); 236 $('#' + multi_select_id).data('velues', values) 237 } else { 238 values = old_values.toString(); 239 } 240 241 $('#' + multi_select_id).data('velues', values) 242 $('#' + hidden_text_box).val(values); 243 244 var arr = values.split(','); 245 246 var list = $('#' + multi_select_id + ' li'); 247 list.each(function (idx, li) { 248 var li = $(li); 249 var li_id = li.data('id'); 250 var flag = false; 251 252 arr.forEach(function (val) { 253 if (li_id==val) {flag = !flag} 254 }); 255 256 if (flag ==true) { 257 li.addClass('bg-light'); 258 li.find('i').addClass('fa-check'); 259 } else { 260 li.removeClass('bg-light'); 261 li.find('i').removeClass('fa-check'); 262 } 263 });
264} 265 266// ------------------------------------------------------------------------ item-line - close 267$('.item-line__close').click(function () { 268 var item = $(this).parent(); 269 var type = item.attr('data-type'); 270 271 var do_anim = true; 272 273 if (type == 'fav-link') { 274 remove_from_fav($(this)); 275 } 276 277 if (do_anim == true) { 278 var animationType = item.attr('data-anim'); // flash, shake, pulse 279 280 if (animationType == undefined) { 281 animationType = 'shake'; 282 } 283 284 item.addClass('animated ' + animationType); 285 item.on('animationend', function () { 286 $(this).remove(); 287 }) 288 } 289}) 290 291// ------------------------------------------------------------------------ save-to-fav 292$('.save-to-fav').on('click', function (e) { 293 294 $.cookie.json = true; 295 296 var isNewLink = true; 297 var links = $.cookie("personal.links"); 298 if (links === undefined) { 299 links = []; 300 } 301 302 var pageName = ($('header h1').length > 0) ? $.trim($('header h1').eq(0).text()) : $.trim($('title').text()); 303 var url = location.href; 304 if (url[url.length - 1] == "/") { 305 url = url.substr(0, url.length - 1) 306 } 307 308 link = { url: url, pageName: pageName, saveDate: new Date().toJSON().slice(0, 10) + ' ' + new Date().toJSON().slice(11, 19), order: links.length }; 309 310 $.each(links, function (key, value) { 311 if (value.url == url) { 312 isNewLink = false; 313 return; 314 } 315 }); 316 317 if (isNewLink) { 318 links.push(link); 319 $.cookie('personal.links', links, { path: '/', expires: 365 }); 320 gf.toastr_vi(); 321 } 322}); 323 324 325function remove_from_fav(obj) { 326 $.cookie.json = true; 327 328 var $item = $(obj).closest('li'); 329 var url = decodeURI($item.find('a').eq(0).attr('href')); 330 331 var oldLinks = $.cookie("personal.links"); 332 var newLinks = []; 333 334 $.each(oldLinks, function (key, value) { 335 if (decodeURI(value.url) != decodeURI(url)) { 336 newLinks.push(value) 337 } 338 }); 339 340 $.cookie('personal.links', newLinks, { path: '/', expires: 365 }); 341} 342 343$('.del-from-fav').on('click', function (e) { 344 345 346}) 347 348$('.del-all-from-fav').on('click', function () { 349 $('.personalLinks li').remove(); 350 $.cookie('personal.links', "", { path: '/', expires: -1 }); 351 $(this).css('display', 'none'); 352}); 353 354// ------------------------------------------------------------------------ lazy load 355document.addEventListener("DOMContentLoaded", function () { 356 var lazyloadImages = document.querySelectorAll("img.lazy"); 357 var lazyloadThrottleTimeout; 358 359 function lazyload() { 360 if (lazyloadThrottleTimeout) { 361 clearTimeout(lazyloadThrottleTimeout); 362 } 363 364 lazyloadThrottleTimeout = setTimeout(function () { 365 var scrollTop = window.pageYOffset; 366 lazyloadImages.forEach(function (img) { 367 if (img.offsetTop < (window.innerHeight + scrollTop)) { 368 img.src = img.dataset.src; 369 img.classList.remove('lazy'); 370 } 371 }); 372 if (lazyloadImages.length == 0) { 373 document.removeEventListener("scroll", lazyload); 374 window.removeEventListener("resize", lazyload); 375 window.removeEventListener("orientationChange", lazyload); 376 } 377 }, 20); 378 } 379 380 document.addEventListener("scroll", lazyload); 381 window.addEventListener("resize", lazyload); 382 window.addEventListener("orientationChange", lazyload); 383 $('.wsmenu > .wsmenu-list > li').mouseover(function () { 384 lazyload(); 385 }); 386}); 387 388 389// ------------------------------------------------------------------------ social 390 391$('.fb-share').click(function (e) { 392 e.preventDefault(); 393 var url = "https://www.facebook.com/sharer/sharer.php?u=" + getCanonical(true); 394 openShareWindow(url); 395}); 396 397$('.twitter-share').click(function (e) { 398 e.preventDefault(); 399 var text = getTitle(); 400 var url = getCanonical(); 401 if (text.length + url.length > 139) { 402 text = text.substr(0, 136 - url.length) + "..."; 403 } 404 url = "https://twitter.com/share?text=" + encodeURI(text) + "%0a&url=" + url; 405 openShareWindow(url); 406}); 407 408if (isMobile()) { 409 $('.whatsapp-share').attr('href', "whatsapp://send?text=" + getCanonical(true) + " - " + getTitle(true)); 410} 411else { 412 $('.whatsapp-share').attr('href', "javascript:alert(mobileOnlyMsg)"); 413} 414 415function getTitle(encode) { 416 var title = $.trim($('title').text()); 417 title = (title === undefined) ? "" : title; 418 419 if (encode == true) { 420 title = encodeURI(title); 421 } 422 423 return title; 424} 425 426function getCanonical(encode) { 427 var url = appRoot + window.location.pathname; 428 if (encode == true) { 429 url = encodeURI(url); 430 } 431 return url; 432} 433 434var openShareWindow = function (url) { 435 window.open(url, 'popup', 'width=635,height=342,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no'); 436 return false; 437}; 438 439 440// ------------------------------------------------------------------------ serge 441 442const small_screen_size = '600px'; 443const medium_screen_size = '960px'; 444 445// page-hero 446////////////////////////////// 447const hero_class = 'c-hero'; 448 449function initHero() { 450 const $hero_class = $(`.${hero_class}`) 451 452 $hero_class.slick({ 453 infinite: true, 454 dots: true,
455 arrows: false 456 }); 457} 458 459initHero() 460 461// c-mosaic-gallery 462////////////////////////////// 463 464const mosaic_silder_class = 'c-mosaic-gallery__carousel'; 465const $mosaic_silder = $(".".concat(mosaic_silder_class)); 466let hasMosaicCarouselInit = false; 467 468function initMosaicCarousel() { 469 const mq = window.matchMedia("(max-width: ".concat(small_screen_size, ")")); 470 mq.addListener(WidthChange); 471 WidthChange(mq); 472 473 function WidthChange(mq) { 474 if (mq.matches) { 475 displayMosaicCarusel(); 476 } else { 477 destroyMosaicCarusel(); 478 } 479 } 480} 481 482function displayMosaicCarusel() { 483 $mosaic_silder.slick({ 484 infinite: true, 485 dots: true, 486 arrows: false 487 }); 488 hasMosaicCarouselInit = true; 489} 490 491function destroyMosaicCarusel() { 492 if (hasMosaicCarouselInit) { 493 $mosaic_silder.slick('unslick'); 494 } 495} 496 497initMosaicCarousel(); 498 499// c-static-gallery 500////////////////////////////// 501const static_carousel_class = 'c-static-gallery__carousel'; 502const $static_carousel = $('.'.concat(static_carousel_class)); 503let hasStaticCarouselInit = false; 504 505function initStaticCarousel() { 506 const mq = window.matchMedia("(max-width: ".concat(small_screen_size, ")")); 507 mq.addListener(WidthChange); 508 WidthChange(mq); 509 510 function WidthChange(mq) { 511 if (mq.matches) { 512 displayStaticCarousel(); 513 } else { 514 destroyStaticCarousel(); 515 } 516 } 517} 518 519function displayStaticCarousel() { 520 $static_carousel.slick({ 521 infinite: true, 522 dots: true, 523 arrows: false, 524 }); 525 526 hasStaticCarouselInit = true; 527} 528 529function destroyStaticCarousel() { 530 if (hasStaticCarouselInit) { 531 $static_carousel.slick('unslick'); 532 hasStaticCarouselInit = false; 533 } 534} 535 536initStaticCarousel(); 537 538// c-sliding-gallery 539////////////////////////////// 540const sliding_carousel_class = 'c-sliding-gallery__carousel'; 541const $sliding_carousel = $('.'.concat(sliding_carousel_class)); 542let hasSlidingCarouselInit = false; 543 544function initSlidingCarousel() { 545 const mq = window.matchMedia("(max-width: ".concat(small_screen_size, ")")); 546 mq.addListener(WidthChange); 547 WidthChange(mq); 548 549 function WidthChange(mq) { 550 if (mq.matches) { 551 destroySlidingCarousel(); 552 } else { 553 displaySlidingCarousel(); 554 } 555 } 556} 557 558function displaySlidingCarousel() { 559 $sliding_carousel.slick({ 560 infinite: true, 561 dots: true, 562 arrows: true, 563 slidesToShow: 4, 564 }); 565 566 hasSlidingCarouselInit = true; 567} 568 569function destroySlidingCarousel() { 570 if (hasSlidingCarouselInit) { 571 $sliding_carousel.slick('unslick'); 572 hasSlidingCarouselInit = false; 573 } 574} 575 576initSlidingCarousel(); 577 578$('.lazy').slick({ 579 lazyLoad: 'ondemand', 580}); 581 582// c-search 583////////////////////////////// 584const search_form_id = 'search' 585const search_class = 'c-search' 586const search_input_class = 'c-search__input' 587const search_open_button_class = 'c-search__button' 588const search_close_button_class = 'c-search__close' 589 590function initSearch() { 591 const $form = $(`#${search_form_id}`) 592 const $search = $(`.${search_class}`) 593 const $searchButton = $(`.${search_open_button_class}`) 594 const $search_close_button_class = $(`.${search_close_button_class}`) 595 const $search_input_class = $(`.${search_input_class}`) 596 597 const mq = window.matchMedia("(max-width: ".concat(small_screen_size, ")")); 598 mq.addListener(WidthChange); 599 WidthChange(); 600 601 $form.submit(function (e) { 602 const searchValue = $search_input_class.val(); 603 if (searchValue) { 604 e.preventDefault(); 605 var url; 606 var _lang = ''; 607 if (lang != 'he') { _lang = lang + '/' }; 608 url = appRoot + '/' + _lang + 'search/' + searchValue; 609 window.location.href = url; 610 } 611 }); 612 613 function WidthChange() { 614 if (mq.matches) { 615 $(document).off('click'); 616 } else { 617 $(document).on('click', function (e) { 618 $search.removeClass('active') 619 }); 620 } 621 } 622 623 function handleOpen() { 624 $search.addClass('active') 625 //$search_input_class.focus() 626 } 627 628 function handleClose() { 629 $search.removeClass('active') 630 $search_input_class.blur() 631 $search_input_class.val('') 632 } 633 634 $searchButton.click(handleOpen) 635 $search_close_button_class.click(handleClose) 636 637 $search.click(function (e) { 638 e.stopPropagation(); 639 }) 640 641 return { 642 open: handleOpen, 643 close: handleClose, 644 } 645} 646 647const Search = initSearch() 648 649// c-nav 650////////////////////////////// 651const nav_class = 'c-nav'; 652const nav_item_class = 'c-nav__item'; 653 654function initNavigation() {
655 const $nav_class = $(`.${nav_class}`); 656 const $document = $(document); 657 const $nav_item_class = $(`.${nav_item_class}`); 658 659 const mq = window.matchMedia("(max-width: ".concat(medium_screen_size, ")")); 660 mq.addListener(WidthChange); 661 WidthChange(); 662 663 function WidthChange() { 664 if (mq.matches) { 665 $(document).off('click'); 666 Search.open(); 667 } else { 668 $document.click(hideSubMenus); 669 $('.wsmenu-list li').mouseenter(hideSubMenus); 670 } 671 } 672 673 $nav_item_class.click(displaySubMenu) 674 675 function displaySubMenu(e) { 676 const $item = $(this) 677 const $openItems = $item.parents(`.${nav_class}`).find(`.${nav_item_class}--open`); 678 const isItemOpen = $item.hasClass(`${nav_item_class}--open`); 679 680 if (isItemOpen) { 681 if (e.type === 'click') { 682 $item.removeClass(`${nav_item_class}--open`); 683 } 684 return 685 } 686 687 $openItems.removeClass(`${nav_item_class}--open`); 688 $item.addClass(`${nav_item_class}--open`); 689 } 690 691 function hideSubMenus(e) { 692 const neighbours = $(e.target).closest(`.${nav_item_class}`).length 693 694 if (neighbours) { 695 return 696 } 697 698 const $openItems = $(`.${nav_item_class}--open`); 699 $openItems.removeClass(`${nav_item_class}--open`); 700 } 701} 702 703initNavigation() 704 705// c-site-header 706///////////////////////////// 707const site_header_class = 'c-site-header'; 708const hide_class = 'hide' 709 710function initSiteHeader() { 711 const $site_header_class = $(`.${site_header_class}`) 712 const headerHeight = 124; 713 let prevScroll = window.scrollY || document.documentElement.scrollTop; 714 let curScroll; 715 let direction = 0; 716 let prevDirection = 0; 717 718 const checkScroll = function () { 719 // Find the direction of scroll 720 // 0 - initial, 1 - up, 2 - down 721 curScroll = window.scrollY || document.documentElement.scrollTop; 722 723 if (curScroll > prevScroll) { 724 //scrolled up 725 direction = 2; 726 } 727 else if (curScroll < prevScroll) { 728 //scrolled down 729 direction = 1; 730 } 731 732 if (direction !== prevDirection) { 733 toggleHeader(direction, curScroll); 734 } 735 736 prevScroll = curScroll; 737 }; 738 739 const toggleHeader = function (direction, curScroll) { 740 if (direction === 2 && curScroll > headerHeight) { 741 $site_header_class.addClass(hide_class); 742 prevDirection = direction; 743 } 744 else if (direction === 1) { 745 $site_header_class.removeClass(hide_class); 746 prevDirection = direction; 747 } 748 }; 749 750 const mq = window.matchMedia("(max-width: ".concat(medium_screen_size, ")")); 751 mq.addListener(WidthChange); 752 WidthChange(); 753 754 function WidthChange() { 755 if (mq.matches) { 756 window.removeEventListener('scroll', checkScroll); 757 } else { 758 window.addEventListener('scroll', checkScroll); 759 } 760 } 761} 762 763initSiteHeader() 764 765 766// c-modal-gallery 767////////////////////////////// 768const thumbnail_carousel_class = 'c-thumbnail-gallery'; 769const $thumbnail_carousel = $('.'.concat(thumbnail_carousel_class)); 770const $bizModal = $('#bizModal') 771 772const modal_carousel_class = 'c-modal-gallery'; 773const $modal_carousel = $('.'.concat(modal_carousel_class)); 774 775function initModalCarousel() { 776 $thumbnail_carousel.slick({ 777 infinite: true, 778 dots: true, 779 arrows: false, // due to layout 780 slidesToShow: 1, 781 // asNavFor: '.'.concat(modal_carousel_class), 782 }); 783 784 $($bizModal).on('shown.bs.modal', function (e) { 785 $modal_carousel.slick({ 786 infinite: true, 787 dots: true, 788 slidesToShow: 1, 789 lazyLoad: 'ondemand', 790 asNavFor: '.'.concat(thumbnail_carousel_class), 791 }); 792 }) 793 794 $($bizModal).on('hidden.bs.modal', function (e) { 795 796 }) 797 798} 799 800initModalCarousel(); 801 802// c-info 803////////////////////////////// 804const biz_readmore_class = 'c-readmore--biz'; 805const category_readmore_class = 'c-readmore--category'; 806 807function initReadmore() { 808 if (!window.Readmore) { 809 return 810 } 811 812 const dir = $('html').attr('dir'); 813 const readMoreText = dir === 'rtl' ? '×§×¨× ×¢××' : 'Read more' 814 const readLessText = dir === 'rtl' ? 'צ×צ×' : 'Read less' 815 816 new Readmore(`.${biz_readmore_class}`, { 817 speed: 200, 818 collapsedHeight: 115, 819 moreLink: `<a href="#">${readMoreText}</a>`, 820 lessLink: `<a href="#">${readLessText}</a>`, 821 });
822 823 new Readmore(`.${category_readmore_class}`, { 824 speed: 200, 825 collapsedHeight: 115, 826 moreLink: `<a href="#">${readMoreText}</a>`, 827 lessLink: `<a href="#">${readLessText}</a>`, 828 }); 829} 830 831//initReadmore(); 832 833 834// c-button 835////////////////////////////// 836const button_class = 'c-button__inner' 837const button_circle_class = 'c-button__circle' 838const explode_class = 'explode-circle' 839const desplode_class = 'desplode-circle' 840const $button = $(`.${button_class}`) 841 842function initButton() { 843 $button.mouseenter(function (e) { 844 const parentOffset = $(this).offset(); 845 const relX = e.pageX - parentOffset.left; 846 const relY = e.pageY - parentOffset.top; 847 $(this).prev(`.${button_circle_class}`).css({ 'left': relX, 'top': relY }); 848 $(this).prev(`.${button_circle_class}`).removeClass(desplode_class); 849 $(this).prev(`.${button_circle_class}`).addClass(explode_class); 850 851 }); 852 853 $button.mouseleave(function (e) { 854 const parentOffset = $(this).offset(); 855 const relX = e.pageX - parentOffset.left; 856 const relY = e.pageY - parentOffset.top; 857 $(this).prev(`.${button_circle_class}`).css({ 'left': relX, 'top': relY }); 858 $(this).prev(`.${button_circle_class}`).removeClass(explode_class); 859 $(this).prev(`.${button_circle_class}`).addClass(desplode_class); 860 }); 861} 862 863initButton(); 864 865 866// ------------------------------------------------------------------------ jQuery Cookie 867/*! 868 * jQuery Cookie Plugin v1.4.1 869 * https://github.com/carhartl/jquery-cookie 870 * 871 * Copyright 2013 Klaus Hartl 872 * Released under the MIT license 873 */ 874(function (factory) { 875 if (typeof define === 'function' && define.amd) { 876 // AMD 877 define(['jquery'], factory); 878 } else if (typeof exports === 'object') { 879 // CommonJS 880 factory(require('jquery')); 881 } else { 882 // Browser globals 883 factory(jQuery); 884 } 885}(function ($) { 886 887 var pluses = /\+/g; 888 889 function encode(s) { 890 return config.raw ? s : encodeURIComponent(s); 891 } 892 893 function decode(s) { 894 return config.raw ? s : decodeURIComponent(s); 895 } 896 897 function stringifyCookieValue(value) { 898 return encode(config.json ? JSON.stringify(value) : String(value)); 899 } 900 901 function parseCookieValue(s) { 902 if (s.indexOf('"') === 0) { 903 // This is a quoted cookie as according to RFC2068, unescape... 904 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 905 } 906 907 try { 908 // Replace server-side written pluses with spaces. 909 // If we can't decode the cookie, ignore it, it's unusable. 910 // If we can't parse the cookie, ignore it, it's unusable. 911 s = decodeURIComponent(s.replace(pluses, ' ')); 912 return config.json ? JSON.parse(s) : s; 913 } catch (e) { } 914 } 915 916 function read(s, converter) { 917 var value = config.raw ? s : parseCookieValue(s); 918 return $.isFunction(converter) ? converter(value) : value; 919 } 920 921 var config = $.cookie = function (key, value, options) { 922 923 // Write 924 925 if (value !== undefined && !$.isFunction(value)) { 926 options = $.extend({}, config.defaults, options); 927 928 if (typeof options.expires === 'number') { 929 var days = options.expires, t = options.expires = new Date(); 930 t.setTime(+t + days * 864e+5); 931 } 932 933 return (document.cookie = [ 934 encode(key), '=', stringifyCookieValue(value), 935 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 936 options.path ? '; path=' + options.path : '', 937 options.domain ? '; domain=' + options.domain : '', 938 options.secure ? '; secure' : '' 939 ].join('')); 940 } 941 942 // Read 943 944 var result = key ? undefined : {}; 945 946 // To prevent the for loop in the first place assign an empty array 947 // in case there are no cookies at all. Also prevents odd result when 948 // calling $.cookie(). 949 var cookies = document.cookie ? document.cookie.split('; ') : []; 950 951 for (var i = 0, l = cookies.length; i < l; i++) { 952 var parts = cookies[i].split('='); 953 var name = decode(parts.shift()); 954 var cookie = parts.join('='); 955 956 if (key && key === name) { 957 // If second argument (value) is a function it's a converter... 958 result = read(cookie, value); 959 break; 960 } 961 962 // Prevent storing a cookie that we couldn't decode. 963 if (!key && (cookie = read(cookie)) !== undefined) { 964 result[name] = cookie; 965 } 966 } 967 968 return result; 969 }; 970 971 config.defaults = {}; 972 973 $.removeCookie = function (key, options) { 974 if ($.cookie(key) === undefined) { 975 return false; 976 } 977
978 // Must not alter options, thus extending a fresh object... 979 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 980 return !$.cookie(key); 981 }; 982 983}));
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.