1// MANAGEMENT AND SCHOOLS PAGES' DYNAMIC POPUP LINK 2jQuery( document ).ready(function() { 3 4 jQuery('button.popupT1_btn').click(function() { 5 const nextURL = 'https://amit.org.il/staff/'; 6 const nextTitle = '×× ×©×× ×©×¨×××× ×¨×××§ - AMIT'; 7 const nextState = { additionalInformation: 'Updated the URL with JS' }; 8 window.history.replaceState(nextState, nextTitle, nextURL); 9 }); 10 11 jQuery('.page-template-template-stuff .cubeT6').click(function() { 12 var current_id = jQuery(this).get(0).id; 13 current_id = current_id.substr(current_id.indexOf("id_") + 3); 14 const nextURL = 'https://amit.org.il/staff/?id=' + current_id; 15 const nextTitle = '×× ×©×× ×©×¨×××× ×¨×××§ - AMIT'; 16 const nextState = { additionalInformation: 'Updated the URL with JS' }; 17 window.history.replaceState(nextState, nextTitle, nextURL); 18 19 jQuery('.page-template-template-stuff button.popupT1_btn').click(function() { 20 const nextURL = 'https://amit.org.il/staff/'; 21 const nextTitle = '×× ×©×× ×©×¨×××× ×¨×××§ - AMIT'; 22 const nextState = { additionalInformation: 'Updated the URL with JS' }; 23 window.history.replaceState(nextState, nextTitle, nextURL); 24 }); 25 }); 26 27 jQuery('.location_results.mapType').click(function(e) { 28 console.log(e.target); 29 var a = jQuery(e.target).closest('.location_item'); 30 var current_id = jQuery(a).get(0).id; 31 current_id = current_id.substr(current_id.indexOf("id_") + 3);
32 const nextURL = 'https://amit.org.il/institutes/?id=' + current_id; 33 const nextTitle = '××ס××ת - AMIT'; 34 const nextState = { additionalInformation: 'Updated the URL with JS' }; 35 window.history.replaceState(nextState, nextTitle, nextURL); 36 37 jQuery('button.popupT1_btn').click(function() { 38 const nextURL = 'https://amit.org.il/staff/'; 39 const nextTitle = '×× ×©×× ×©×¨×××× ×¨×××§ - AMIT'; 40 const nextState = { additionalInformation: 'Updated the URL with JS' }; 41 window.history.replaceState(nextState, nextTitle, nextURL); 42 }); 43 }); 44 45 jQuery('.page-template-template-career .cubeT7').click(function() { 46 var current_id = jQuery(this).get(0).id; 47 current_id = current_id.substr(current_id.indexOf("id_") + 3); 48 const nextURL = 'https://amit.org.il/career/?id=' + current_id; 49 const nextTitle = 'קר××ר×'; 50 const nextState = { additionalInformation: 'Updated the URL with JS' }; 51 window.history.replaceState(nextState, nextTitle, nextURL); 52 53 jQuery('.page-template-template-career button.popupT1_btn').click(function() { 54 const nextURL = 'https://amit.org.il/career/'; 55 const nextTitle = 'קר××ר×'; 56 const nextState = { additionalInformation: 'Updated the URL with JS' }; 57 window.history.replaceState(nextState, nextTitle, nextURL); 58 }); 59 }); 60 61 /* jQuery('.location_item').click(function() { 62 console.log('clicked'); 63 var current_id = jQuery(this).get(0).id; 64 current_id = current_id.substr(current_id.indexOf("id_") + 3);
65 const nextURL = 'https://amit.org.il/institutes/?id=' + current_id; 66 const nextTitle = '××ס××ת - AMIT'; 67 const nextState = { additionalInformation: 'Updated the URL with JS' }; 68 window.history.replaceState(nextState, nextTitle, nextURL); 69 }); */ 70 71}); 72 73 74if ('NodeList' in window && !NodeList.prototype.forEach) { 75 76 console.info('polyfill for IE11'); 77 78 var body = document.getElementsByTagName("body")[0]; 79 80 body.classList.add("ie"); 81 82 NodeList.prototype.forEach = function (callback, thisArg) { 83 84 thisArg = thisArg || window; 85 86 for (var i = 0; i < this.length; i++) { 87 88 callback.call(thisArg, this[i], i, this); 89 90 } 91 92 }; 93 94} else { 95 96 var body = document.getElementsByTagName("body")[0]; 97 98 body.classList.add("noie"); 99 100} 101 102if (/Edge\/\d./i.test(navigator.userAgent)) { 103 104 body.classList.add("edge"); 105 106} 107 108 109 110/*main container - youtube iframe option*/ 111 112var mainPlayer; 113 114function onYouTubeIframeAPIReady() { 115 116 if (document.getElementById('mainPlayer')) { 117 118 var videoId = document.getElementById('mainPlayer').getAttribute('index'); 119 120 mainPlayer = new YT.Player('mainPlayer', { 121 122 videoId: videoId, 123 124 playerVars: { 125 126 playlist: videoId, 127 128 loop: 1, 129 130 playsInline: 1, 131 132 mute: 1, 133 134 }, 135 136 events: { 'onReady': onPlayerReady } 137 138 }); 139 140 } 141 142} 143 144 145 146function onPlayerReady(event) { 147 148 event.target.playVideo(); 149 150} 151 152/*main container - youtube iframe option*/ 153 154 155 156var window_width, window_height = 0; 157 158var instanceScroll; 159 160var pos1 = 0; 161 162var header = document.querySelector('header'); 163 164var body = document.getElementsByTagName("body")[0]; 165 166document.addEventListener("DOMContentLoaded", function () { 167 168 window_width = document.body.clientWidth; 169 170 document.querySelector('body').classList.add('ready'); 171 172 // instanceScroll = OverlayScrollbars(document.querySelectorAll("body"), {}); 173 174 if (document.querySelector('.article_container') && document.querySelector('.article_container >p:first-of-type')) { 175 176 var firstParagraph = document.querySelector('.article_container >p:first-of-type'); 177 178 var firstParagraphText = firstParagraph.innerHTML; 179
180 var firstLetter = firstParagraphText.charAt(0); 181 182 firstParagraph.innerHTML = " <span class='firstLetter'>" + firstLetter + "</span>" + firstParagraphText.substr(1); 183 184 } 185 186 187 188 if (window_width > 1024) { 189 190 OverlayScrollbars(document.querySelectorAll(".scroll_container"), { className: "scrollT2 os-theme-dark" }); 191 192 193 194 } 195 196 if (!isMobile) { 197 198 OverlayScrollbars(document.querySelectorAll(".location_list_content"), { className: "scrollT2 os-theme-dark" }); 199 200 } 201 202 203 204 205 206 207 208 209 210 211 212 213 214}) 215 216 217 218 219 220 221 222 223 224function collect() { 225 226 var ret = {}; 227 228 var len = arguments.length; 229 230 for (var i = 0; i < len; i++) { 231 232 for (p in arguments[i]) { 233 234 if (arguments[i].hasOwnProperty(p)) { 235 236 ret[p] = arguments[i][p]; 237 238 } 239 240 } 241 242 } 243 244 return ret; 245 246}; 247 248function _(selector) { 249 250 return document.querySelectorAll(selector); 251 252} 253 254 255 256var app = angular.module('myapp', ['flow', 'ngSanitize']) 257 258 .config(['flowFactoryProvider', function (flowFactoryProvider) { 259 260 flowFactoryProvider.defaults = { 261 262 target: '/p/', 263 264 permanentErrors: [404, 500, 501], 265 266 singleFile: true, 267 268 testChunks: false, 269 270 maxChunkRetries: 0, 271 272 query: { 273 274 action: 'upload' 275 276 } 277 278 }; 279 280 flowFactoryProvider.on('catchAll', function (event) { 281 282 }); 283 284 285 286 287 288 }]) 289 290 291 292 .config(['$httpProvider', '$locationProvider', '$locationProvider', function ($httpProvider, $locationProvider, $locationProvider) { 293 294 $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 295 296 $locationProvider.html5Mode({ 297 298 enabled: true, 299 300 requireBase: false, 301 302 rewriteLinks: false 303 304 }); 305 306 307 308 }]).service('apiService', ['$http', function ($http) { 309 310 this.callApi = function (api, data, action, callBack) { 311 312 $http({ 313 314 method: 'POST', 315 316 url: api, 317 318 data: data, 319 320 headers: { 'Content-Type': 'application/x-www-form-urlencoded', "action": action } 321 322 }).then(function mySucces(response) { 323 324 if (callBack) callBack(response); 325 326 }, function myError(response) { 327 328 329 330 }); 331 332 } 333 334 }]).controller('myCtrl', ['$scope', '$document', '$http', 'apiService', '$timeout', '$location', '$window', function ($scope, $document, $http, apiService, $timeout, $location, $window) { 335 336 $scope.isMobile = isMobile; 337 338 $scope.swiper = []; 339 340 //menu header 341 342 $scope.menuEvent = function () { 343 344 $scope.toggleMenu = !$scope.toggleMenu; 345 346 } 347 348 $scope.innerMenuEvent = function ($event) { 349 350 if ($window.outerWidth > 1024) return false; 351 352 console.log($event.target.parentNode) 353 354 var parent = $event.target.parentNode; 355 356 var allItems = document.querySelectorAll('.menu_item'); 357 358 if (parent.classList.contains('open')) { 359 360 parent.classList.remove('open'); 361 362 } else { 363 364 angular.forEach(allItems, function (value, key) { 365 366 value.classList.remove('open'); 367 368 }); 369 370 371 372 parent.classList.add('open'); 373 374 } 375 376 } 377 378 379 380 $scope.showCategoriesList = function($type=false){ 381 382 383 384 $scope.popupShow = $type; 385 386 387 388 if( $type ){ 389 390 391 392 setTimeout(function(){ 393 394 395 396 var popupT1_btn = document.getElementById('popupT1_btn'); 397 398 399 400 popupT1_btn.focus(); 401 402 403 404 },100); 405 406 407 408 }else{ 409 410 411 412 setTimeout(function(){ 413 414 415 416 var showCategoriesListBtn = document.getElementById('showCategoriesListBtn'); 417 418 419 420 showCategoriesListBtn.focus(); 421 422 423 424 },100); 425 426 427 428 } 429 430 431 432 433 434 } 435 436 437 438 439 440 var check = document.querySelector('.popupT1_container'); 441 442 443 444 445 446 if ( 447 448 (typeof(check) != 'undefined' && check != null) 449 450 ){ 451 452 453 454 // place this line in the dialog show function - to only add the listener when the dialog is shown 455 456 window.addEventListener('keydown', handleKey); 457 458 459 460 // uncomment and place this in the dialog close/hide function to remove the listener when dialog is closed/hidden 461 462 // window.removeEventListener('keydown', handleKey); 463 464 465 466 function handleKey(e) { 467 468 469 470 if (e.keyCode === 9) { 471 472 let focusable = document.querySelector('.popupT1_container').querySelectorAll('input,button,select,textarea,a'); 473 474 475 476 477 478 if (focusable.length) { 479 480 let first = focusable[0]; 481 482 let last = focusable[focusable.length - 1]; 483 484 let shift = e.shiftKey; 485 486 487 488 489 490 491 492 if (shift) { 493 494 if (e.target === first) { // shift-tab pressed on first input in dialog 495 496 last.focus(); 497 498 e.preventDefault(); 499 500 } 501 502 } else { 503 504 if (e.target === last) { // tab pressed on last input in dialog 505 506 first.focus(); 507 508 e.preventDefault(); 509 510 } 511 512 513 514 } 515 516 } 517 518 } 519 520 } 521 522 523 524 } 525 526 527 528 529 530 var popupPlayer; 531 532 $scope.popupVideoEvent = function (videoId, videoName) { 533 534 535 536 $scope.videoName = false;
537 538 if (videoId) { 539 540 if (videoName) $scope.videoName = videoName; 541 542 console.log(videoId) 543 544 popupPlayer = new YT.Player('popupPlayer', { 545 546 width: "560", height: "315", 547 548 videoId: videoId, 549 550 events: { 551 552 'onReady': function (event) { 553 554 document.querySelector('.popup_video_wrap').classList.add('ready'); 555 556 //event.target.playVideo(); 557 558 } 559 560 } 561 562 }); 563 564 565 566 setTimeout(function(){ 567 568 569 570 var popup_btn_close = document.getElementById('popup_btn_close'); 571 572 573 574 popup_btn_close.focus(); 575 576 577 578 },100); 579 580 581 582 } else { 583 584 popupPlayer.destroy(); 585 586 document.querySelector('.popup_video_wrap').classList.remove('ready'); 587 588 } 589 590 $scope.popupVideoShow = !$scope.popupVideoShow; 591 592 } 593 594 595 596 597 598 599 600 /*management page*/ 601 602 $scope.membersfilter = false; 603 604 $scope.checkMember = function (value) { 605 606 if (!$scope.membersfilter) { 607 608 return true; 609 610 } else { 611 612 const found = value.includes($scope.membersfilter); 613 614 if (found) return true; 615 616 } 617 618 } 619 /*management page 2*/ 620 621 $scope.membersfilter_2 = false;
622 623 $scope.checkMember_2 = function (value) { 624 625 if (!$scope.membersfilter_2) { 626 627 return true; 628 629 } else { 630 631 const found = value.includes($scope.membersfilter_2); 632 633 if (found) return true; 634 635 } 636 637 } 638 /*management page 3*/ 639 640 $scope.membersfilter_3 = false; 641 642 $scope.checkMember_3 = function (value) { 643 644 if (!$scope.membersfilter_3) { 645 646 return true; 647 648 } else { 649 650 const found = value.includes($scope.membersfilter_3); 651 652 if (found) return true; 653 654 } 655 656 } 657 658 /*career page*/ 659 660 $scope.positionsfilter = false; 661 662 $scope.checkPosition = function (value) { 663 664 if (!$scope.positionsfilter) { 665 666 return true; 667 668 } else { 669 670 const found = value.includes($scope.positionsfilter); 671 672 if (found) return true; 673 674 } 675 676 } 677 678 $scope.popupData = []; 679 680 681 $scope.closePopupEvent = function(){ 682 683 $scope.popupShow = false; 684 685 document.body.classList.remove('hasPopup'); 686 687 } 688 689 $scope.popupShowEvent = function (dataName, id) { 690 691 692 693 // event.preventDefault(); 694 695 696 var data = 'action=' + dataName + '&postID=' + id; 697 698 apiService.callApi('/p/', data, dataName, function (response) { 699 700 $scope.popupData = response.data; 701 702 if (dataName == 'position') { 703 704 $scope.positionForm.form['positionName'] = $scope.popupData.name; 705 706 $scope.positionForm.form['positionID'] = id; 707 708 } 709 710 711 712 713 714 /* setTimeout(function(){ 715 716 717 718 var popupT1_btn = document.getElementById('popupT1_btn'); 719 720 721 722 popupT1_btn.focus(); 723 724 725 726 },100); */ 727 728 729 730 731 732 $scope.popupShow = true; 733 734 document.body.classList.add('hasPopup'); 735 736 }); 737 738 739 740 } 741 742 743 744 745 746 $scope.galleryT2Btn = 0; 747 748 749 750 751 752 }]).directive("leadForm", ["$httpParamSerializerJQLike", "apiService", "$location", function ($httpParamSerializerJQLike, apiService, $location) { 753 754 return { 755 756 restrict: "E", 757 758 link: function (scope, element, attrs) { 759 760 var formName = angular.element(element.find('form'))[0].getAttribute('name'); 761 762 763 764 scope[formName].formSent = false; 765 766 scope[formName].form = {}; 767 768 scope.filterValue = function ($event) { 769 770 if (isNaN(String.fromCharCode($event.keyCode)) && String.fromCharCode($event.keyCode) != '-') { 771 772 $event.preventDefault(); 773 774 } 775 776 }; 777 778 /*FILE*/ 779 780 scope.flowVal = false;
781 782 scope.fileUploaded = function (formName, msg, field, f) { 783 784 scope.flowVal = f; 785 786 msg = JSON.parse(msg); 787 788 scope[formName].form[field] = msg.file_name; 789 790 } 791 792 scope.removeUpload = function (formName, field) { 793 794 scope.flowVal.cancel(); 795 796 delete scope[formName].form[field]; 797 798 } 799 800 /*FILE*/ 801 802 scope.clearForm = function (formCurrentName) { 803 804 var fields = Array('email', 'fullname', 'phone', 'topic', 'message', 'positionId', 'positionName', 'file'); 805 806 angular.forEach(scope[formCurrentName], function (value, key) { 807 808 if (fields.indexOf(key) > -1) { 809 810 scope[formCurrentName].form[key] = ''; 811 812 } 813 814 }); 815 816 scope[formCurrentName].$setPristine(); 817 818 if (scope.flowVal) { scope.removeUpload(formCurrentName); } 819 820 821 822 } 823 824 scope.checkForm = function (formCurrentName) { 825 826 if (scope[formCurrentName].$valid) { 827 828 // scope.formSending=true; 829 830 var searchObject = $location.search(); 831 832 $formData = $httpParamSerializerJQLike(scope[formCurrentName].form) + '&' + $httpParamSerializerJQLike(searchObject); 833 834 console.log($formData); 835 836 apiService.callApi('/p/', $formData + '&formName=' + formCurrentName + '&action=submit', 'submit', function (response) { 837 838 switch (response.data.result) { 839 840 841 842 case 'ok': 843 844 scope[formCurrentName].formSent = true; 845 846 scope.clearForm(formCurrentName); 847 848 setTimeout(function () { 849 850 angular.element(document.querySelector('.msg_send')).addClass('fadeOut'); 851 852 scope.$apply(); 853 854 }, 3000) 855 856 setTimeout(function () { 857 858 scope[formCurrentName].formSent = false; 859 860 angular.element(document.querySelector('.msg_send')).removeClass('fadeOut'); 861 862 scope.$apply(); 863 864 }, 3500) 865 866 break; 867 868 869 870 871 872 } 873 874 // function clearForm(formCurrentName){} 875 876 877 878 }, null) 879 880 } else { 881 882 883 884 angular.forEach(scope[formCurrentName].$error.required, function (field) { 885 886 field.$setDirty(); 887 888 }) 889 890 891 892 setTimeout(function(){ 893 894 document.forms[0].elements[0].focus(); 895 896 },100); 897 898 899 900 } 901 902 } 903 904 905 906 907 908 } 909 910 }; 911 912 }]).directive("swiperContainer", [function () { 913 914 return { 915 916 restrict: "C", 917 918 link: function (scope, elm, attr) { 919 920 var defaults = { slidesPerView: 'auto', observer: true, observeSlideChildren: true, observeParents: true, } 921 922 var slides = elm[0].querySelectorAll('.swiper-slide').length; 923 924 var navigation = {}; 925 926 var pagination = {}; 927 928 var scrollbar = {}; 929 930 var options = (attr.options) ? options = JSON.parse(attr.options) : {}; 931 932 var doSwiper = true; 933 934 if (elm[0].querySelector('.swiper-pagination')) { 935 936 pagination = { pagination: { el: elm[0].querySelector('.swiper-pagination'), type: 'bullets', clickable: true, } } 937 938 } 939 940 if (elm[0].querySelector('.swiper-scrollbar')) { 941 942 scrollbar = { scrollbar: { el: elm[0].querySelector('.swiper-scrollbar'), draggable: true, hide: false, } } 943 944 } 945 946 947 948 if (elm[0].parentElement.querySelectorAll('[class^=swiper-button]').length) { 949 950 navigation = { 951 952 navigation: { 953 954 nextEl: elm[0].parentElement.querySelector('[class*=next]'), 955 956 prevEl: elm[0].parentElement.querySelector('[class*=prev]'), 957 958 } 959 960 } 961 962 } 963 964 965 966 /////CONDITIONS 967 968 969 970 971 if (elm[0].className.match('swiper_cubesT3')) { 972 973 defaults.autoHeight = true; 974 defaults.loop = true; 975 976 } 977 978 979 if (elm[0].className.match('section_cubesT5_gallery')) { 980 981 if (!scope.isMobile && slides <= 4) { 982 983 doSwiper = false;
984 985 } 986 987 } 988 989 if (elm[0].className.match('galleryT1')) { 990 991 if (!scope.isMobile) { 992 993 // options = { "loop": true, "centeredSlides": true }; 994 995 options = { 996 997 "loop": true, 998 999 "centeredSlides": true, 1000 1001 "preloadImages": false, 1002 1003 "lazy": { 1004 1005 loadPrevNext: true, 1006 1007 loadPrevNextAmount: 1 1008 1009 }, 1010 1011 }; 1012 1013 } 1014 1015 } 1016 1017 // if (elm[0].className.match('galleryT1')) { 1018 1019 // if (!scope.isMobile) { 1020 1021 // options = { "loop": true, "centeredSlides": true,"preloadImages": false,"lazy": true,"slidesPerView": 2 }; 1022 1023 // } 1024 1025 // } 1026 1027 if (elm[0].className.match('galleryT2')) { 1028 1029 if (slides == 3) { 1030 1031 document.querySelector('.galleryT2_btns_lines').classList.add('typeThree'); 1032 1033 } else if (slides == 2) { 1034 1035 document.querySelector('.galleryT2_btns_lines').classList.add('typeTwo'); 1036 1037 } else if (slides == 1) { 1038 1039 document.querySelector('.galleryT2_btns_lines').classList.add('noSwip'); 1040 1041 } 1042 1043 } 1044 1045 if (slides == 1) doSwiper = false; 1046 1047 if (attr.off == 'true') doSwiper = false;
1048 1049 ///// 1050 1051 if (doSwiper) { 1052 1053 1054 1055 elm[0].parentElement.classList.add('active'); 1056 1057 1058 1059 options.init = false; 1060 1061 1062 1063 scope.swiper[attr.name] = new Swiper(elm, collect(defaults, options, navigation, pagination, scrollbar)); 1064 1065 1066 1067 1068 1069 1070 1071 scope.swiper[attr.name].on('init', function () { 1072 1073 1074 1075 var elems = document.querySelectorAll('.swiper-button-prev'); 1076 1077 1078 1079 for (var i=0; i<elems.length; i++) { 1080 1081 elems[i].setAttribute("aria-label","××§×××").setAttribute("role","button"); 1082 1083 } 1084 1085 1086 1087 var elems = document.querySelectorAll('.swiper-button-next'); 1088 1089 1090 1091 for (var i=0; i<elems.length; i++) { 1092 1093 elems[i].setAttribute("aria-label","×××").setAttribute("role","button"); 1094 1095 } 1096 1097 1098 1099 }); 1100 1101 1102 1103 scope.swiper[attr.name].init(); 1104 1105 1106 1107 } 1108 1109 1110 1111 if (scope.swiper['galleryT2']) { 1112 1113 scope.swiper['galleryT2'].on('slideChangeTransitionStart', function () { 1114 1115 scope.galleryT2Btn = scope.swiper['galleryT2'].realIndex; 1116 1117 scope.$apply(); 1118 1119 }); 1120 1121 } 1122 1123 1124 1125 } 1126 1127 }; 1128 1129 }]).directive('lazyImg', [ 1130 1131 function () { 1132 1133 return { 1134 1135 restrict: 'A', 1136 1137 link: function (scope, element, attrs) { 1138 1139 1140 1141 var styletotest = "object-fit"; 1142 1143 if (styletotest in document.body.style) { } else { } 1144 1145 1146 1147 const observer = new IntersectionObserver(loadImg); 1148 1149 const img = angular.element(element)[0]; 1150 1151 observer.observe(img); 1152 1153 if (attrs.immediate != undefined) { setIMg(element, attrs); } 1154 1155 function loadImg(changes) { 1156 1157 1158
1159 changes.forEach(function (change) { 1160 1161 if (change.intersectionRatio > 0) { setIMg(element, attrs); } 1162 1163 }); 1164 1165 } 1166 1167 function setIMg(element, attrs) { 1168 1169 if (element[0].tagName == 'IMG') { 1170 1171 var imgl = new Image(); 1172 1173 imgl.onload = function () { 1174 1175 element[0].src = imgl.src; 1176 1177 element[0].classList.add('loaded'); 1178 1179 document.querySelectorAll('[lazy-img="' + attrs.lazyImg + '"]').forEach(function (e) { 1180 1181 if (!e.src) { setIMg(angular.element(e), attrs); } 1182 1183 }) 1184 1185 } 1186 1187 imgl.src = attrs.lazyImg; 1188 1189 } else { 1190 1191 element[0].style.backgroundImage = "url(" + attrs.lazyImg + ")"; 1192 1193 element[0].classList.add('loaded'); 1194 1195 } 1196 1197 observer.unobserve(img); 1198 1199 } 1200 1201 } 1202 1203 } 1204 1205 } 1206 1207 1208 1209 ]).directive('convertToNumber', function() { 1210 1211 return { 1212 1213 require: 'ngModel', 1214 1215 link: function(scope, element, attrs, ngModel) { 1216 1217 ngModel.$parsers.push(function(val) { 1218 1219 return val != null ? parseInt(val, 10) : null; 1220 1221 }); 1222 1223 ngModel.$formatters.push(function(val) { 1224 1225 return val != null ? '' + val : null; 1226 1227 }); 1228 1229 } 1230 1231 }; 1232 1233 }).directive('scrollTo', [function () { 1234 1235 return { 1236 1237 restrict: 'C', 1238 1239 link: function (scope, element, attr) { 1240 1241 element.bind('click', function () { 1242 1243 var elementToScroll = document.getElementById(attr.to); 1244 1245 var header = document.querySelector('header').clientHeight; 1246 1247 if (attr.duration) { 1248 1249 var duration = Number(attr.duration); 1250 1251 } else { 1252 1253 var duration = 500; 1254 1255 } 1256 1257 1258 1259 instanceScroll.scroll({ el: elementToScroll, scroll: { x: "never" }, margin: header }, duration); 1260 1261 1262 1263 }) 1264 1265 } 1266 1267 } 1268 1269 }]).directive("locationTemp", ["$httpParamSerializerJQLike", "apiService", function ($httpParamSerializerJQLike, apiService) { 1270 1271 return { 1272 1273 restrict: 'C', 1274 1275 link: function (scope, element, attrs) { 1276 1277 1278 1279 scope.currentArea = currentArea; 1280 1281 1282 1283 scope.locationForm = {}; 1284 1285 apiService.callApi('/p/', 'action=schoolsFilters', 'schoolsFilters', function (response) { 1286 1287 scope.fillterData = response.data; 1288 1289 scope.locationForm.area = "0"; 1290 1291 scope.locationForm.sector = "0"; 1292 1293 scope.locationForm.city = []; 1294 1295 if (!scope.isMobile) { 1296 1297 scope.fillterTemplate = template_directory_uri + '/templates/desktop_fillter_template.php'; 1298 1299 } else { 1300 1301 scope.fillterTemplate = template_directory_uri + '/templates/mobile_fillter_template.php'; 1302 1303 } 1304 1305 initMap(); 1306 1307 }, null) 1308 1309 1310 1311 var mapT1; 1312 1313 function initMap() { 1314 1315 if (isMobile) { 1316 1317 var zoomVal = 8; 1318 1319 var latVal = 32.171946; 1320 1321 var lngVal = 34.868644; 1322 1323 // ,gestureHandling: 'cooperative' 1324 1325 } else { 1326 1327 var zoomVal = 9; 1328 1329 var latVal = 32.181245; 1330 1331 var lngVal = 34.959282; 1332 1333 } 1334 1335 mapT1 = new google.maps.Map(document.getElementById('mapT1'), { zoom: zoomVal, center: { lat: latVal, lng: lngVal }, styles: style }); 1336 1337 } 1338 1339 1340 1341 scope.getData = function () { 1342 1343 var formData = $httpParamSerializerJQLike(scope.locationForm); 1344 1345 console.log('formData', formData); 1346 1347 apiService.callApi('/p/', formData + '&action=schools', 'schools', function (response) { 1348 1349 var data = response.data; 1350 console.log(data); 1351 data.sort(function (a, b) { 1352 1353 return a.cityId - b.cityId; 1354 1355 }); 1356 1357 scope.index = 0; 1358 1359 scope.schoolsArr = []; 1360 1361 angular.forEach(data, function (value, key) { 1362 1363 1364 1365 if (scope.currentCity == value.cityId) { 1366 1367 // scope.schoolsArr[scope.index - 1].schools.push(value); 1368 1369 scope.schoolsArr.push({ city: value.city, schools: [value] }); 1370 1371 } else { 1372 1373 scope.currentCity = value.cityId; 1374 1375 scope.schoolsArr.push({ city: value.city, schools: [value] }); 1376 1377 scope.index++; 1378 1379 } 1380 1381 }); 1382 1383 console.log('schools', scope.schoolsArr); 1384 1385 1386 1387 addMarkers(); 1388 1389 }, null) 1390 1391 } 1392 1393 scope.getData(); 1394 1395 1396 1397 scope.selectArea = function (area) { 1398 1399 if (area) { 1400 1401 if (area == scope.locationForm.area) { return false; } 1402 1403 scope.locationForm.area = area; 1404 1405 } 1406 1407 scope.locationForm.city = []; 1408 1409 scope.locationForm.sector = "0"; 1410 1411 scope.cityData = scope.fillterData.areas.filter(function (x) { 1412 1413 if( x.id == scope.locationForm.area ){ 1414 1415 return scope.locationForm.area; 1416 1417 } 1418 1419 // return x.id === scope.locationForm.area; 1420 1421 }).map(function (x) { 1422 1423 return x.cities; 1424 1425 })[0]; 1426 1427 1428 1429 if (scope.locationForm.area == '0') { 1430 1431 scope.sectorsData = false;
1432 1433 if (!isMobile) scope.getData(); 1434 1435 } else { 1436 1437 updateSectores(); 1438 1439 } 1440 1441 } 1442 1443 1444 1445 scope.selectCity = function (city) { 1446 1447 if (city) { 1448 1449 if (city == '0') { 1450 1451 scope.locationForm.city = []; 1452 1453 } else { 1454 1455 if (scope.locationForm.city.includes(city)) { 1456 1457 var index = scope.locationForm.city.indexOf(city); 1458 1459 scope.locationForm.city.splice(index, 1); 1460 1461 } else { 1462 1463 scope.locationForm.city.push(city); 1464 1465 } 1466 1467 } 1468 1469 } 1470 1471 // if (isMobile) { 1472 1473 // if (scope.locationForm.city.includes('0')) scope.locationForm.city = []; 1474 1475 // } 1476 1477 scope.locationForm.sector = "0"; 1478 1479 1480 1481 updateSectores(); 1482 1483 } 1484 1485 1486 1487 scope.selectSector = function (sector) { 1488 1489 if (sector) { 1490 1491 if (sector == scope.locationForm.sector) { return false; } 1492 1493 scope.locationForm.sector = sector; 1494 1495 scope.getData(); 1496 1497 } 1498 1499 } 1500 1501 function updateSectores() { 1502 1503 scope.sectorsData = []; 1504 1505 if (scope.locationForm.city.length > 0) { 1506 1507 var data = scope.cityData.filter(function (x) { return scope.locationForm.city.includes(x.id) }); 1508 1509 } else { 1510 1511 var data = scope.cityData; 1512 1513 } 1514 1515 angular.forEach(data, function (value, key) { 1516 1517 angular.forEach(value.sector, function (value, key) { 1518 1519 if (!scope.sectorsData.includes(value)) { 1520 1521 scope.sectorsData.push(value) 1522 1523 } 1524 1525 }); 1526 1527 }); 1528 1529 if (!isMobile) scope.getData(); 1530 1531 } 1532 1533 1534 1535 1536 1537 function addMarkers() { 1538 1539 document.querySelectorAll('.pinTarget').forEach(function (x) { x.remove(); }) 1540 1541 angular.forEach(scope.schoolsArr, function (value, key) { 1542 1543 angular.forEach(value.schools, function (v, k) { 1544 1545 if (isMobile) { 1546 1547 var contentTemp = '<div class="pinT1_wrap pinTarget" id="pin' + v.id + '"><button class="pinT1"></button><button class="pinT1_data"><div class="text"><span class="boldType textT3">' + v.name + '</span><span class="textT2">' + v.address + '</span><span class="textT2">' + v.sector + '</span></div><i class="arrow icon-arrowL2"></i></button></div>'; 1548 1549 } else { 1550 1551 var contentTemp = '<button class="pinT1 pinTarget" id="pin' + v.id + '"></button>'; 1552 1553 } 1554 1555 let richMarker = new RichMarker({ 1556 1557 marker_id: v.id, 1558 1559 position: new google.maps.LatLng(v.coordinates.lat, v.coordinates.lng), 1560 1561 map: mapT1, 1562 1563 content: contentTemp, 1564 1565 shadow: 0 1566 1567 }); 1568 1569 google.maps.event.addListener(richMarker, 'click', function (event) { 1570 1571 if (!isMobile) { 1572 1573 scope.locationEvent(this.marker_id); 1574 1575 scope.popupShowEvent('school', this.marker_id); 1576 1577 } else { 1578 1579 let currentElem = document.getElementById('pin' + this.marker_id); 1580 1581 if (!currentElem.classList.contains('flag')) { 1582 1583 document.querySelectorAll('.pinTarget').forEach(function (x) { x.classList.remove('flag'); }); 1584 1585 scope.locationEvent(this.marker_id); 1586 1587 currentElem.classList.add('flag'); 1588 1589 } else { 1590 1591 scope.popupShowEvent('school', this.marker_id); 1592 1593 } 1594 1595 } 1596 1597 1598 1599 }); 1600 1601 1602 1603 }); 1604 1605 }); 1606 1607 } 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 scope.locationEvent = function (location) { 1618 1619 document.querySelectorAll('.pinTarget').forEach(function (x) { x.classList.remove('on'); }); 1620 1621 document.getElementById('pin' + location).classList.add('on'); 1622 1623 scope.activeLocation = location; 1624 1625 } 1626 1627 1628 1629 1630 1631 1632 1633 } 1634 1635 }; 1636 1637 }]) 1638 1639//.directive("filterForm",["$httpParamSerializerJQLike","apiService","$location", function($httpParamSerializerJQLike,apiService,$location) { 1640 1641// return { 1642 1643// restrict : "E", 1644 1645// link:function(scope, element, attrs){ 1646 1647// var formName=angular.element(element.find('form'))[0].getAttribute('name'); 1648 1649// scope[formName].form={}; 1650 1651// scope.checkForm=function(formCurrentName){ 1652 1653// if (scope[formCurrentName].$valid) { 1654 1655// var searchObject = $location.search(); 1656 1657// var currentSearch = $httpParamSerializerJQLike(searchObject); 1658 1659// var newSearch = $httpParamSerializerJQLike(scope[formCurrentName].form); 1660 1661// if(currentSearch != newSearch){ 1662 1663// var newUrl = template_directory_uri+'/magazin.php?'+newSearch; 1664 1665// window.location=newUrl; 1666 1667// } 1668 1669// scope[formCurrentName].$setPristine(); 1670 1671// }else{ 1672 1673// angular.forEach(scope[formCurrentName].$error.required, function(field) { 1674 1675// field.$setDirty(); 1676 1677// }) 1678 1679// } 1680 1681// } 1682 1683// 1684 1685// 1686 1687// } 1688 1689// }; 1690 1691//}]).directive('mapTemp', ["$compile", function ($compile) { 1692 1693// return{ 1694 1695// restrict: 'A', 1696 1697// link: function (scope, element,attr) { 1698 1699// scope.locationData = locationData; 1700 1701// scope.O={activeLocation:0}; 1702 1703// return; 1704 1705// 1706 1707// 1708 1709// } 1710 1711// } 1712 1713// 1714 1715//}]).directive('teamTemp', ["$compile","$location", function ($compile,$location) { 1716 1717// return{ 1718 1719// restrict: 'A', 1720 1721// link: function (scope, element,attr) { 1722 1723// 1724 1725// var team = document.querySelectorAll('.teamMemberItem'); 1726 1727// scope.checkMember={}; 1728 1729// 1730 1731// scope.changeTeamData = function(){ 1732 1733// var disableMembers = 0; 1734 1735// team.forEach(function(member,i) { 1736 1737// 1738 1739// 1740 1741// if(scope.selectedName == undefined || scope.selectedName == "" || member.getAttribute('name').indexOf(scope.selectedName.toString()) >= 0){ 1742 1743// var fleg1 = true; 1744 1745// } 1746 1747// 1748 1749// if(fleg1){ 1750 1751// if(scope.selectedGroup == undefined || scope.selectedGroup == "" || member.getAttribute('group') == scope.selectedGroup){ 1752 1753// var fleg2 = true; 1754 1755// } 1756 1757// } 1758 1759// if(fleg2){ 1760 1761// var categoryArr=[]; 1762 1763// var categories = member.getAttribute('categories').split(','); 1764
1765// categories.forEach(function(cat) { 1766 1767// categoryArr.push(cat); 1768 1769// }); 1770 1771// 1772 1773// if(scope.selectedCategory == undefined || scope.selectedCategory == "" || categoryArr.indexOf(scope.selectedCategory) >= 0){ 1774 1775// var fleg3 = true; 1776 1777// } 1778 1779// } 1780 1781// if(fleg3){ 1782 1783// scope.checkMember[i] = false; 1784 1785// }else{ 1786 1787// scope.checkMember[i] = true; 1788 1789// disableMembers ++; 1790 1791// } 1792 1793// 1794 1795// }); 1796 1797// if(disableMembers == team.length){ 1798 1799// scope.disableMembers = true; 1800 1801// } 1802 1803// } 1804 1805// 1806 1807// var searchObject = $location.search(); 1808 1809// var categoryVal = searchObject.category; 1810 1811// if(categoryVal != undefined){ 1812 1813// scope.selectedCategory = categoryVal; 1814 1815// scope.changeTeamData(); 1816 1817// } 1818 1819// 1820 1821// } 1822 1823// } 1824 1825// 1826 1827//}]) 1828 1829//.directive('teamSwiper',["$httpParamSerializerJQLike","apiService","$location", function($httpParamSerializerJQLike,apiService,$location) { 1830 1831// return { 1832 1833// restrict: 'A', 1834 1835// link: function (scope, element, attr) { 1836 1837// var data = 'action=teamData'; 1838 1839// apiService.callApi('/p/',data,'teamData',function (response) { 1840 1841// scope.teamData=response.data; 1842 1843// }); 1844 1845// 1846 1847// 1848 1849// scope.localSearch = function(str, member) { 1850 1851// var matches = []; 1852 1853// member.forEach(function(member) { 1854 1855// if (member.name.toLowerCase().indexOf(str.toString().toLowerCase()) >= 0){ 1856 1857// matches.push(member); 1858 1859// } 1860 1861// }); 1862 1863// return matches; 1864 1865// }; 1866 1867// scope.changeName = function(member){ 1868 1869// window.location=member.description.href; 1870 1871// } 1872 1873// scope.createTeamData= function(){ 1874 1875// var newUrl = template_directory_uri+'/team.php?category='+scope.selectedCategory; 1876 1877// window.location=newUrl; 1878 1879// } 1880 1881// 1882 1883// 1884 1885// } 1886 1887// } 1888 1889// 1890 1891//}]) 1892 1893 1894 1895 1896 1897 1898 1899var body = document.querySelector('body'); 1900 1901body.addEventListener('keyup', checkTabPress); 1902 1903 1904 1905// event listener for keyup 1906 1907function checkTabPress(e) { 1908 1909 "use strict"; 1910 1911 // pick passed event or global event object if passed one is empty 1912 1913 e = e || event; 1914 1915 var activeElement; 1916 1917 if (e.keyCode == 9) { 1918 1919 // Here read the active selected link. 1920 1921 activeElement = document.activeElement; 1922 1923 // If HTML element is an anchor <a> 1924 1925 if( activeElement.parentElement.className.match('menu_item') ){ 1926 1927 1928 1929 var elems = document.querySelectorAll('.menu_item'); 1930 1931 1932 1933 for (var i=0; i<elems.length; i++) { 1934 1935 elems[i].classList.remove("active"); 1936 1937 } 1938 1939 1940 1941 activeElement.parentElement.classList.add('active'); 1942 1943 1944 1945 } 1946 1947 // if (activeElement.tagName.toLowerCase() == 'a') 1948 1949 // // get it's hyperlink 1950 1951 // alert(activeElement.href); 1952 1953 } 1954 1955} 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965/*-----------------------*/ 1966 1967/* Animation on scroll */ 1968 1969/*-----------------------*/ 1970 1971 1972 1973const fn = () => { 1974 1975 document.querySelectorAll('.scrollAnim').forEach(function (e) { 1976 1977 new Waypoint({ 1978 1979 element: e, 1980 1981 handler: function (direction) { 1982 1983 this.element.classList.add("on"); 1984 1985 }, 1986 1987 offset: '50%', 1988 1989 // context: document.querySelector('.os-content')[0] 1990 1991 }) 1992 1993 }) 1994 1995 1996 1997 document.querySelectorAll('.numCount').forEach(function (e) { 1998 1999 new Waypoint({ 2000 2001 element: e, 2002 2003 handler: function (direction) { 2004 2005 numCount(); 2006 2007 this.destroy(); 2008 2009 }, 2010 2011 offset: '99%', 2012 2013 // context: document.querySelector('.os-content')[0] 2014 2015 }) 2016 2017 }) 2018 2019 2020 2021 document.querySelectorAll('.scrollAnim2').forEach(function (e, i) { 2022 2023 new Waypoint({ 2024 2025 element: e, 2026 2027 handler: function (direction) { 2028 2029 this.element.classList.add("on"); 2030 2031 }, 2032 2033 offset: '99%', 2034 2035 // context: document.querySelector('.os-content')[0] 2036 2037 }) 2038 2039 }) 2040 2041 2042 2043 for (let i = 1; i <= 6; i++) { 2044 2045 document.querySelectorAll('.delayGroup' + i).forEach(function (e, i) { 2046 2047 new Waypoint({ 2048 2049 element: e, 2050 2051 handler: function (direction) { 2052 2053 this.element.classList.add("delay" + (i + 1)); 2054 2055 }, 2056 2057 offset: '99%', 2058 2059 // context: document.querySelector('.os-content')[0] 2060 2061 }) 2062 2063 }) 2064 2065 } 2066 2067 2068 2069 document.querySelectorAll('.delayGroup7').forEach(function (e, i) { 2070 2071 new Waypoint({ 2072 2073 element: e, 2074 2075 handler: function (direction) { 2076 2077 if (i >= 3){ 2078 2079 this.element.classList.add("delay" + ((i-3) + 1)); 2080 2081 } 2082 2083 else{ 2084 2085 this.element.classList.add("delay" + (i + 1)); 2086 2087 } 2088 2089 2090 2091 }, 2092 2093 offset: '99%', 2094 2095 // context: document.querySelector('.os-content')[0] 2096 2097 }) 2098 2099 }) 2100 2101} 2102 2103 2104 2105 2106 2107document.addEventListener('DOMContentLoaded', fn, false); 2108 2109// document.addEventListener('load', fn, false); 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119/*-----------------*/ 2120 2121/* Numbers Count */ 2122 2123/*-----------------*/ 2124 2125 2126 2127let show = document.querySelectorAll('.num'); 2128 2129 2130
2131function numCount() { 2132 2133 2134 2135 for (let i = 0; i <= 3; i++) { 2136console.log(i); 2137 let number = Number(show[i].innerHTML.replace(',', '')) + 1; 2138 2139 2140 2141 let counter = 0; 2142 2143 // delay = 1, 2144 2145 // x = number / 2, 2146 2147 // y = 0; 2148 2149 2150 2151 if (number > 1000) { 2152 2153 counter = number - 200; 2154 2155 } 2156 2157 2158 2159 let first; 2160 2161 first = counter + 1; 2162 2163 2164 2165 counter_js(); 2166 2167 2168 2169 function counter_js() { 2170 2171 // y++; 2172 2173 // delay = (x - y); 2174 2175 2176 2177 if (counter === (first - 1)) { 2178 2179 show[i].innerHTML = 0; 2180 2181 } 2182 2183 else { 2184 2185 show[i].innerHTML = counter.toString(); 2186 2187 } 2188 2189 counter++; 2190 2191 2192 2193 if (counter < number) { 2194 2195 if (counter === first) { 2196 2197 setTimeout(function () { 2198 2199 counter_js(); 2200 2201 }, 300) 2202 2203 } 2204 2205 else { 2206 2207 setTimeout(function () { 2208 2209 counter_js(); 2210 2211 }, 10) 2212 2213 } 2214 2215 2216 2217 } 2218 2219 } 2220 2221 } 2222 2223} 2224 2225 2226 2227 2228 2229 2230 2231/*------------------*/ 2232 2233/* Mouse Animation */ 2234 2235/*------------------*/ 2236 2237 2238 2239 2240 2241 2242 2243// var throttleOn = false; 2244 2245// var actionLock = false; 2246 2247// var throttleTimer = 100; 2248 2249 2250 2251// function throttle(e) { 2252 2253// if (throttleOn) { 2254 2255// actionLock = true; 2256 2257// }; 2258 2259// if (!actionLock) { 2260 2261// throttleOn = true; 2262 2263// setTimeout(function () { 2264 2265// throttleOn = false; 2266 2267// }, throttleTimer); 2268 2269// translate(e); 2270 2271// }; 2272 2273// actionLock = false; 2274 2275// }; 2276 2277 2278 2279 2280 2281// var threshold = 20; 2282 2283// var box = document.querySelectorAll(".mouseAnim")[0]; 2284 2285 2286 2287 2288 2289// document.addEventListener('mousemove', e => { 2290 2291// var xOrigin = box.offsetWidth / 2; 2292 2293// var yOrigin = box.offsetHeight / 2; 2294 2295// var xPivot = (e.clientY - yOrigin) / yOrigin * -threshold; 2296 2297// var yPivot = (e.clientX - xOrigin) / xOrigin * threshold; 2298 2299// box.style.transform = 'rotateX(' + xPivot + 'deg) rotateY(' + yPivot + 'deg)'; 2300 2301// }); 2302 2303 2304 2305 2306 2307function fb_share(argument) { 2308 2309 event.preventDefault(); 2310 2311 window.open(argument.getAttribute('href'), 'fbShareWindow', 'height=450, width=550, top=' + (document.body.innerHeight / 2 - 275) + ', left=' + (document.body.innerWidth / 2 - 225) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0'); 2312 2313 return false; 2314 2315} 2316 2317 2318// Scroll to a certain element 2319if( document.querySelector(".scrollto") ){ 2320 2321 document.querySelector(".scrollto").addEventListener("click",function(event){ 2322 2323 event.preventDefault(); 2324 2325 var elem = this.getAttribute('href'); 2326 2327 document.querySelector(elem).scrollIntoView({ 2328 behavior: 'smooth' 2329 }); 2330 2331 }); 2332 2333} 2334 2335// PAGINATION IN NEWS PAGE 2336jQuery( document ).ready(function() { 2337 if(jQuery('body').hasClass('page-template-template-news')) { 2338 var current_url = window.location.pathname; 2339 if(current_url.indexOf('/page/') >= 0) { 2340 jQuery('html, body').animate({ 2341 scrollTop: jQuery('.section_temp1').offset().top - 200 2342 }, 1000); 2343 } 2344 } 2345}); 2346 2347// NEWS POST NEWSLETTER SCROLL BUTTON 2348jQuery( document ).ready(function() { 2349 jQuery('.newsletter_scroll_button').click(function() { 2350 jQuery('html, body').animate({ 2351 scrollTop: jQuery('.footer_form_container').offset().top - 200 2352 }, 1000); 2353 }); 2354}); 2355 2356// MANAGEMENT PAGE POPUPS > EACH STAFF MEMBER'S TEXT (DOESN'T WORK IN POPUP TEMPLATE BECAUSE OF ANGULAR) 2357jQuery( document ).ready(function() { 2358 jQuery('.popupT1 .scroll_container.size3').empty(); 2359 setTimeout(function() { 2360 if(jQuery('.popupT1.open').length) { 2361 var current_id = jQuery('.popupT1.open').get(0).id; 2362 jQuery('.cubeT6').each(function() { 2363 var indexed_id = jQuery(this).get(0).id; 2364 if(indexed_id.substr(indexed_id.indexOf("_") + 1) == current_id) { 2365 var text2 = jQuery(this).find('.text2'); 2366 if(text2.length) { 2367 var text2_html = jQuery(text2).get(0).innerHTML; 2368 jQuery('.popupT1 .scroll_container.size3').empty().append(text2_html); 2369 } 2370 } 2371 }); 2372 } 2373 }, 2000); 2374 jQuery('.cubeT6').click(function() { 2375 jQuery('.popupT1 .scroll_container.size3').empty(); 2376 var text2 = jQuery(this).find('.text2'); 2377 if(text2.length) { 2378 var text2_html = jQuery(text2).get(0).innerHTML; 2379 jQuery('.popupT1 .scroll_container.size3').empty().append(text2_html); 2380 } 2381 }); 2382});
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.