1/** 2 * This will be the first script executed on every page load. 3 * Perfect place for storing variables and executing JS stuff, which 4 * is independant of document.ready. 5 * 6 * @author Kim-Christian Meyer <[email protected]> 7 */ 8;"use strict"; 9 10(function (document, navigator, ph) { 11 12 ph.isIos = navigator.userAgent.match(/(iPhone|iPad|iPod|iOS)/i) !== null; 13 ph.isAndroid = navigator.userAgent.match(/Android/i) !== null; 14 ph.isWp = navigator.userAgent.match(/IEMobile/i) !== null; 15 ph.isWebkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1 && 16 navigator.userAgent.toLowerCase().indexOf('iemobile') < 0 && 17 navigator.userAgent.toLowerCase().indexOf('edge') < 0; 18 ph.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; 19 20// todo needs to be determined. 21 ph.breakpointSmartphone = 500; 22 ph.breakpointTablet = 980; 23 ph.breakpointDesktop = 980; 24 ph.breakpointFireplace = ph.breakpointDesktop + 2 * 150; 25 26 27 // Add mobile os classes 28 if (ph.isIos) { 29 document.documentElement.className += ' is-ios'; 30 } 31 if (ph.isAndroid) { 32 document.documentElement.className += ' is-android'; 33 } 34 if (ph.isWp) { 35 document.documentElement.className += ' is-wp'; 36 } 37 38 39 ph.isMobile = function () { 40 return document.documentElement.clientWidth < ph.breakpointTablet; 41 }; 42 43 44 ph.hasGetParameters = function (string) { 45 return string.indexOf('?') !== -1; 46 }; 47 48 49 // Assume we have a mouse-only environment ONLY if Modernizr does not detect 50 // touchevents AND if it is a webkit or moz browser 51 /*ph.isMouseOnly = !Modernizr.touchevents && (ph.isWebkit || ph.isFirefox); 52 if (ph.isMouseOnly) { 53 document.documentElement.className += ' is-mouse-only'; 54 }*/ 55 56 ph.menuEventListener = function () { 57 var menu = document.getElementById('primary-menu'); 58 var submenuButtons = menu.getElementsByClassName('js-toggle-submenu'); 59 for (var i = 0, len = submenuButtons.length; i < len; i++) { 60 var subButton = submenuButtons[i], 61 subMenu = subButton.nextElementSibling; 62 subButton.onclick = function () { 63 var subButton = this; 64 var subMenu = subButton.nextElementSibling; 65 if (-1 !== subMenu.className.indexOf('toggled')) { 66 subMenu.className = subMenu.className.replace(' toggled', ''); 67 subButton.setAttribute('aria-expanded', 'false'); 68 subMenu.setAttribute('aria-expanded', 'false'); 69 } else { 70 subMenu.className += ' toggled'; 71 subButton.setAttribute('aria-expanded', 'true'); 72 subMenu.setAttribute('aria-expanded', 'true'); 73 } 74 } 75 } 76 } 77 78 ph.initEventAllWorkgroupFacet = function(){ 79 //only on event archive page 80 if(!$('body').hasClass('post-type-archive-event')){ 81 return; 82 } 83 84 var $all_checkbox = $('.facetwp-checkbox-all'); 85 86 $all_checkbox.on('click', function() { 87 88 // console.log("click"); 89 90 $(this).toggleClass('checked'); 91 92 //.facetwp-facet-hasworkgroup.facetwp-type-checkboxes .facetwp-checkbox:not(.disabled):not(.facetwp-checkbox-all) 93 94 $('.facetwp-facet-hasworkgroup.facetwp-type-checkboxes .facetwp-checkbox:not(.disabled):not(.facetwp-checkbox-all)').toggleClass('checked'); 95 FWP.autoload(); 96 }); 97 98 $(document).on('facetwp-loaded', function() { 99 100 var $all_facets = $('.facetwp-facet-hasworkgroup.facetwp-type-checkboxes .facetwp-checkbox:not(.disabled):not(.facetwp-checkbox-all) .facetwp-counter'); 101 var counter = 0; 102 103 jQuery.each($all_facets, function(index, facet){ 104 var value = $(facet).text(); 105 value = value.substring(1, value.length-1); 106 counter = counter + parseInt(value); 107 }); 108 109 110 $all_checkbox.find('.facetwp-counter').text('('+counter+')'); 111 112 }); 113 } 114 115 ph.initMembersShowSubFilter = function(){ 116 //only on event archive page 117 if(!$('body').hasClass('post-type-archive-institutionalmember')){ 118 return; 119 } 120 121 $(document).on('facetwp-loaded', function() { 122 123 //show all sub filter 124 $('.facetwp-depth').addClass('visible'); 125 126 }); 127 } 128 129 ph.initSort = function(){ 130 //only on event archive page 131 if(!$('body').hasClass('post-type-archive-job')){ 132 return; 133 } 134 135 //set values in change sort radio 136 jQuery(document).on('change', 'input[name=sort]', function() { 137 FWP.extras.sort = $(this).val(); 138 FWP.soft_refresh = true; 139 FWP.autoload(); 140 }); 141 } 142 143 144 145})(document, navigator, window.ph = window.ph || {});
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.