1// source --> https://met.gov.bs/wp-content/plugins/wp-megamenu/addons/wpmm-gridpost/wpmm-gridpost.js?ver=1 2jQuery(document).ready(function($){'use strict'; 3 4 5 $(document).on( 'click', '.wpmm-right,.wpmm-left', function( event ) { 6 var $that = $(this); 7 if( $that.hasClass('disablebtn') ){ return; } 8 9 var oderby = $that.data('oderby'), 10 column = $that.data('column'), 11 showcat = $that.data('showcat'), 12 type = $that.data('type'), 13 current = $that.attr('data-current'), 14 category = $that.data('category'), 15 total = $that.data('total'), 16 count = $that.data('count'); 17 18 19 if( $that.hasClass('wpmm-right') ){ 20 current = parseInt(current) + 1; 21 if( current == total ){ 22 $that.parent().find('.wpmm-left').removeClass('disablebtn'); 23 $that.addClass('disablebtn'); 24 }else{ 25 if( current == 2 ){ 26 $that.parent().find('.wpmm-left').removeClass('disablebtn'); 27 } 28 } 29 } else { 30 current = current - 1; 31 if( current == 1 ){ 32 $that.parent().find('.wpmm-right').removeClass('disablebtn'); 33 $that.addClass('disablebtn'); 34 }else{ 35 $that.parent().find('.wpmm-right').removeClass('disablebtn'); 36 } 37 } 38 39 40 //console.log( current ); 41 $that.parent().find('.wpmm-right').attr( 'data-current', current ); 42 $that.parent().find('.wpmm-left').attr( 'data-current', current ); 43 44 $.ajax({ 45 url: wpmm_object.ajax_url, 46 type: 'POST', 47 data: { action: 'gridpost_load_more_posts', oderby: oderby, column: column, current: current, category: category, type: type, showcat: showcat, count: count }, 48 beforeSend: function(){ 49 $that.parent().find( ".wpmm-grid-post-addons" ).addClass('spinwarp').append( '<div class="spinners"></div>' ); 50 } 51 }) 52 .done(function(data) { 53 $that.parent().find('.wpmm-grid-post-addons').removeClass('spinwarp').html( data ); 54 }) 55 .fail(function() { 56 console.log( "Failed" ); 57 }); 58 }); 59 60 61 // Tab JS 62 $('.wpmm-vertical-tabs').each(function(){ 63 var $tab = $(this), 64 $handlers = $tab.find('.wpmm-tab-btns').children(), 65 $tabs = $tab.find('.wpmm-tab-content').children(); 66 67 $handlers.each(function(index) { 68 $(this).on('mouseenter', function(event){ 69 event.preventDefault(); 70 $handlers.removeClass('active'); 71 $tabs.removeClass('active'); 72 $(this).addClass('active'); 73 $($tabs[index]).addClass('active'); 74 }); 75 // $(this).on('click', function(event){ event.preventDefault(); }); 76 }); 77 }); 78 79 80}); 81// source --> https://met.gov.bs/wp-content/plugins/mobile-menu/includes/js/mobmenu.js?ver=2.8.8 82 83 /* 84 * 85 * Javascript Functions 86 * ------------------------------------------------ 87 * WP Mobile Menu 88 * Copyright WP Mobile Menu 2018 - http://www.wpmobilemenu.com 89 * 90 */ 91 92 "use strict"; 93 function getSelector(el){ 94 var $el = jQuery(el); 95 96 var id = $el.attr("id"); 97 if (id) { //"should" only be one of these if theres an ID 98 return "#"+ id; 99 } 100 101 var selector = $el.parents() 102 .map(function() { return this.tagName; }) 103 .get().reverse().join(" "); 104 105 if (selector) { 106 selector += " "+ $el[0].nodeName; 107 } 108 109 var classNames = $el.attr("class"); 110 if (classNames) { 111 selector += "." + jQuery.trim(classNames).replace(/\s/gi, "."); 112 } 113 114 var name = $el.attr('name'); 115 if (name) { 116 selector += "[name='" + name + "']"; 117 } 118 if (!name){ 119 var index = $el.index(); 120 if (index) { 121 index = index + 1; 122 selector += ":nth-child(" + index + ")"; 123 } 124 } 125 return selector; 126 } 127 128 function enableMobileMenuElementPicker(){ 129 const p = new Picker({ 130 elm: document.getElementById('elm1'), 131 mode: 'cover', 132 excludeElmName: ['body'], 133 events: [{ 134 key: 'contextmenu', 135 fn(event) { 136 event.preventDefault(); 137 }, 138 }], 139 onInit() { 140 }, 141 onClick(event) { 142 var selector = getSelector(event.target).toLowerCase(); 143 window.parent.receivePickedElement(selector); 144 jQuery(selector).hide(); 145 }, 146 onHover(event) { 147 }, 148 }); 149 150 document.getElementById('m_on').addEventListener('click', () => { 151 p.on(); 152 }); 153 154 document.getElementById('m_off').addEventListener('click', () => { 155 p.off(); 156 }); 157 158 document.getElementById('m_cover').addEventListener('click', () => { 159 p.changeMode('cover'); 160 }); 161 162 document.getElementById('m_target').addEventListener('click', () => { 163 p.changeMode('target'); 164 }); 165 166 } 167 jQuery( document ).ready( function($) { 168
169 const urlParams = new URLSearchParams( window.location.search ); 170 171 if ( urlParams.get( 'mobmenu-action' ) == 'find-element' ) { 172 enableMobileMenuElementPicker(); 173 } 174 175 function mobmenuOpenSubmenus( menu ) { 176 var submenu = $(menu).parent().next(); 177 178 if ( $(menu).parent().next().hasClass( 'show-sub-menu' ) ) { 179 $(menu).find('.show-sub-menu' ).hide(); 180 $(menu).toggleClass( 'show-sub'); 181 } else { 182 if ( ! $( menu ).parents('.show-sub-menu').prev().hasClass('mob-expand-submenu') && submenu[0] !== $('.show-sub-menu')[0] && $( menu ).parent('.sub-menu').length <= 0 ) { 183 184 $(menu).parent().find( '.show-submenu' ).first().hide().toggleClass( 'show-sub-menu' ); 185 $(menu).toggleClass( 'show-sub'); 186 187 } 188 } 189 190 if ( !$( menu ).parent().next().hasClass( 'show-sub-menu' ) ) { 191 submenu.fadeIn( 'slow' ); 192 } else { 193 submenu.hide(); 194 } 195 196 if ( ! $('body').hasClass('mob-menu-sliding-menus') ) { 197 $( menu ).find('.open-icon').toggleClass('hide'); 198 $( menu ).find('.close-icon').toggleClass('hide'); 199 } 200 201 submenu.toggleClass( 'show-sub-menu'); 202 203 204 } 205 206 if ( $( 'body' ).find( '.mobmenu-push-wrap' ).length <= 0 && $( 'body' ).hasClass('mob-menu-slideout') ) { 207 208 $( 'body' ).wrapInner( '<div class="mobmenu-push-wrap"></div>' ); 209 $( '.mobmenu-push-wrap' ).after( $( '.mobmenu-left-alignment' ).detach() ); 210 $( '.mobmenu-push-wrap' ).after( $( '.mobmenu-right-alignment' ).detach() ); 211 $( '.mobmenu-push-wrap' ).after( $( '.mob-menu-header-holder' ).detach() ); 212 $( '.mobmenu-push-wrap' ).after( $( '.mobmenu-footer-menu-holder' ).detach() ); 213 $( '.mobmenu-push-wrap' ).after( $( '.mobmenu-overlay' ).detach() ); 214 $( '.mobmenu-push-wrap' ).after( $( '#wpadminbar' ).detach() ); 215 216 if ( $('.mob-menu-header-holder' ).attr( 'data-detach-el' ) != '' ) { 217 $( '.mobmenu-push-wrap' ).after( $( $('.mob-menu-header-holder' ).attr( 'data-detach-el' ) ).detach() ); 218 } 219 220 } 221 // Double Check the the menu display classes where added to the body. 222 var menu_display_type = $( '.mob-menu-header-holder' ).attr( 'data-menu-display' ); 223 224 if ( menu_display_type != '' && !$( 'body' ).hasClass( 'mob-menu-slideout' ) && !$( 'body' ).hasClass( 'mob-menu-slideout-over' ) && !$( 'body' ).hasClass( 'mob-menu-slideout-top' ) && !$( 'body' ).hasClass( 'mob-menu-overlay' ) ) { 225 $( 'body' ).addClass( menu_display_type ); 226 } 227 228 // Only force autoplay videos in desktop 229 if(! ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) ){ 230 $( 'video' ).each( function(){ 231 if( 'autoplay' === $( this ).attr('autoplay') ) { 232 $( this )[0].play(); 233 } 234 }); 235 } 236 237 var submenu_open_icon = $( '.mob-menu-header-holder' ).attr( 'data-open-icon' ); 238 var submenu_close_icon = $( '.mob-menu-header-holder' ).attr( 'data-close-icon' ); 239 240 $( '.mobmenu-content .sub-menu' ).each( function(){ 241 242 $( this ).prev().append('<div class="mob-expand-submenu"><i class="mob-icon-' + submenu_open_icon + ' open-icon"></i><i class="mob-icon-' + submenu_close_icon + ' close-icon hide"></i></div>'); 243 244 if ( 0 < $( this ).parents( '.mobmenu-parent-link' ).length ) { 245 $( this ).prev().attr('href', '#'); 246 } 247 248 }); 249 250 $( document ).on( 'click', '.mobmenu-parent-link .menu-item-has-children' , function ( e ) { 251 252 if ( e.target.parentElement != this) return; 253 254 e.preventDefault(); 255 $(this).find('a').find('.mob-expand-submenu').first().trigger('click'); 256 e.stopPropagation(); 257 258 }); 259 $( document ).on( 'click', '.show-nav-left .mobmenu-push-wrap, .show-nav-left .mobmenu-overlay', function ( e ) { 260 261 e.preventDefault(); 262 $( '.mobmenu-left-bt' ).first().trigger( 'click' ); 263 e.stopPropagation(); 264 265 }); 266 267 $( document ).on( 'click', '.mob-expand-submenu' , function ( e ) { 268 269 // Check if any menu is open and close it. 270 if ( 1 == $( '.mob-menu-header-holder' ).attr( 'data-autoclose-submenus' ) && ! $(this).parent().next().hasClass( 'show-sub-menu' ) ) { 271 if ( 0 < $( '.mob-expand-submenu.show-sub' ).length && $(this).parents('.show-sub-menu').length <= 0 ) { 272 mobmenuOpenSubmenus( $( '.mob-expand-submenu.show-sub' ) ); 273 } 274 } 275 276 mobmenuOpenSubmenus( $(this) ); 277 e.preventDefault(); 278 e.stopPropagation(); 279 280 }); 281 282 $( document ).on( 'keyup', '.mobmenu-left-bt', function(e){ 283 if( e.type != 'click' && e.which != 13 || e.which == 9 || jQuery(this).hasClass( 'mobmenu-trigger-action' ) ) { 284 return; 285 } 286 287 mobmenuClosePanel( 'mobmenu-left-panel' ); 288 e.stopPropagation(); 289 }); 290 291 $( document ).on( 'keyup', '.mobmenu-right-bt', function(e){ 292 if( e.type != 'click' && e.which != 13 || e.which == 9 || jQuery(this).hasClass( 'mobmenu-trigger-action' ) ) { 293 return; 294 } 295 296 mobmenuClosePanel( 'mobmenu-right-panel' ); 297 e.stopPropagation(); 298 }); 299 300 301 302 $( document ).on( 'click', '.mobmenu-panel.show-panel .mob-cancel-button, .show-nav-right .mobmenu-overlay, .show-nav-left .mobmenu-overlay', function ( e ) { 303 304 305 306 e.preventDefault(); 307 mobmenuClosePanel( 'show-panel' ); 308 if ( $('body').hasClass('mob-menu-sliding-menus') ) { 309 $( '.mobmenu-trigger-action .hamburger' ).toggleClass('is-active'); 310 } 311 312 }); 313 314 $( document ).on( 'click', '.mobmenu-trigger-action', function(e){ 315 e.preventDefault(); 316
317 var targetPanel = $( this ).attr( 'data-panel-target' ); 318 319 if ( ! $( 'body' ).hasClass( 'show-nav-left' ) && ! $( 'body' ).hasClass( 'show-nav-right' ) ) { 320 if ( 'mobmenu-filter-panel' !== targetPanel ) { 321 mobmenuOpenPanel( targetPanel ); 322 } 323 } 324 325 }); 326 327 $( document ).on( 'click', '.hamburger', function(e){ 328 var targetPanel = $(this).parent().attr('data-panel-target'); 329 e.preventDefault(); 330 e.stopPropagation(); 331 332 $(this).toggleClass( 'is-active' ); 333 334 setTimeout(function(){ 335 if ( $( 'body' ).hasClass('show-nav-left') ) { 336 if ( $('body').hasClass('mob-menu-sliding-menus') ) { 337 $( '.mobmenu-trigger-action .hamburger' ).toggleClass('is-active'); 338 } 339 mobmenuClosePanel( targetPanel ); 340 341 } else { 342 mobmenuOpenPanel( targetPanel ); 343 } 344 345 }, 400); 346 347 348 }); 349 350 $('.mobmenu a[href*="#"], .mobmenu-panel a[href*="#"]') 351 // Remove links that don't actually link to anything 352 .not('[href="#0"]') 353 .on( 'click', function(event) { 354 // On-page links 355 356 if ( 357 location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 358 && 359 location.hostname == this.hostname 360 && 361 $(this).parents('.mobmenu-content').length > 0 362 ) { 363 // Figure out element to scroll to. 364 var target; 365 366 try { 367 target = decodeURIComponent( this.hash ); 368 } catch(e) { 369 target = this.hash; 370 } 371 372 $( 'html' ).css( 'overflow', '' ); 373 374 // Does a scroll target exist? 375 if (target.length) { 376 377 378 if ( 0 < $(this).parents('.mobmenu-left-panel').length ) { 379 mobmenuClosePanel( 'mobmenu-left-panel' ); 380 } else { 381 mobmenuClosePanel( 'mobmenu-right-panel' ); 382 } 383 384 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 385 386 $('body,html').animate({ 387 scrollTop: target.offset().top - $(".mob-menu-header-holder").height() - 50 388 }, 1000); 389 } 390 } 391 }); 392 function mobmenuClosePanel( target ) { 393 394 $( '.' + target ).toggleClass( 'show-panel' ); 395 $( 'html' ).removeClass( 'show-mobmenu-filter-panel' ); 396 $( 'body' ).removeClass( 'show-nav-right' ); 397 $( 'body' ).removeClass( 'show-nav-left' ); 398 $( 'html' ).removeClass( 'mob-menu-no-scroll' ); 399 400 setTimeout(function(){ 401 $( '.mob-menu-sliding-menus [data-menu-level]' ).scrollTop( '0' ); 402 if ( 1 == $( '.mob-menu-header-holder' ).attr( 'data-autoclose-submenus' ) ) { 403 $( '.mob-expand-submenu.show-sub' ).click(); 404 $( '.mobmenu-content .show-sub-menu' ).removeClass( 'show-sub-menu' ); 405 } 406 407 }, 400); 408 409 } 410 411 function mobmenuOpenPanel( target) { 412 $( '.mobmenu-content' ).scrollTop(0); 413 $( 'html' ).addClass( 'mob-menu-no-scroll' ); 414 415 if ( $('.' + target ).hasClass( 'mobmenu-left-alignment' ) ) { 416 $('body').addClass('show-nav-left'); 417 } 418 if ( $('.' + target ).hasClass( 'mobmenu-right-alignment' ) ) { 419 $('body').addClass('show-nav-right'); 420 } 421 422 $('.' + target ).addClass( 'show-panel' ); 423 424 } 425 }); 426 427window.Picker = class Picker { 428 constructor(options = {}) { 429 this.elm = options.elm || document.querySelector('body'); 430 this.mode = options.mode || 'target'; 431 this.excludeElmName = options.excludeElmName || []; 432 this.switch = typeof options.switch === 'boolean' ? options.switch : true; 433 434 this.events = options.events || []; 435 this.onInit = options.onInit; 436 this.onClick = options.onClick ? options.onClick.bind(this) : null; 437 this.onHover = options.onHover ? options.onHover.bind(this) : null; 438 439 440 // Internal handler 441 this.fn_bind_clickHandle = null; 442 this.fn_bind_hoverHandle = null; 443 this.fn_bind_contextmenuHandle = null; 444 this._init(); 445 } 446 on() { 447 this.switch = true; 448 } 449 off() { 450 this.switch = false;
451 this._removeTargetShowPos(); 452 this._removeCoverShowPos(); 453 } 454 changeMode(mode) { 455 let modeArr = ['cover', 'target']; 456 if (modeArr.includes(mode)) { 457 this.mode = mode; 458 this._removeTargetShowPos(); 459 this._removeCoverShowPos(); 460 } else { 461 console.error(`Mode error, only includes [ ${modeArr.join(" | ")} ]`); 462 } 463 } 464 destroy() { 465 this.events.forEach((eo) => { 466 eo.fn_bind = eo.fn.bind(this); 467 this.elm.removeEventListener(eo.key, this[`_${eo.key}_Handle`], false); 468 }); 469 470 this.elm.removeEventListener('mouseover', this.fn_bind_hoverHandle, false); 471 this.elm.removeEventListener('click', this.fn_bind_clickHandle, false); 472 473 this._removeTargetShowPos(); 474 document.querySelector("#_picker_cover_wrap_box").remove(); 475 } 476 _init() { 477 let wrapDom = document.createElement('div'); 478 wrapDom.setAttribute("id", "_picker_cover_wrap_box"); 479 wrapDom.innerHTML = '<svg></svg>'; 480 document.body.appendChild(wrapDom); 481 this._initEvent(); 482 this.onInit && this.onInit(); 483 } 484 _initEvent() { 485 this.events.forEach((eo) => { 486 this[`_${eo.key}_Handle`] = (event) => { 487 if (this._triggerEvent(event) === false) return; 488 eo.fn && eo.fn(event); 489 }; 490 eo.fn_bind = this[`_${eo.key}_Handle`].bind(this); 491 this.elm.addEventListener(eo.key, this[`_${eo.key}_Handle`], false); 492 }); 493 494 this.fn_bind_hoverHandle = this._hoverHandle.bind(this); 495 this.fn_bind_clickHandle = this._clickHandle.bind(this); 496 497 this.elm.addEventListener('mouseover', this.fn_bind_hoverHandle, false); 498 this.elm.addEventListener('click', this.fn_bind_clickHandle, false); 499 500 } 501 _triggerEvent(event) { 502 let tipsDom = document.querySelector("#_pick_tips_content"); 503 if ( 504 this.switch && 505 !this.excludeElmName.includes(event.target.localName.toLocaleLowerCase()) && 506 !(tipsDom ? tipsDom.contains(event.target) : 0) 507 ) { 508 event.stopPropagation(); 509 event.preventDefault(); 510 return true; 511 } else { 512 return false; 513 } 514 } 515 _hoverHandle(event) { 516 if (this._triggerEvent(event) === false) return; 517 switch (this.mode) { 518 case 'cover': 519 this._coverShowPos(event); 520 break; 521 case 'target': 522 this._targetShowPos(event); 523 break; 524 } 525 this.onHover && this.onHover(event); 526 } 527 _clickHandle(event) { 528 if (this._triggerEvent(event) === false) return; 529 this.onClick && this.onClick(event); 530 } 531 _targetShowPos(event) { 532 this._removeTargetShowPos(); 533 if (event.target.localName === 'body') return; 534 event.target.classList.add("_picker_target_elm"); 535 } 536 _removeTargetShowPos() { 537 document.querySelectorAll("._picker_target_elm").forEach((elm) => { 538 elm.classList.remove("_picker_target_elm"); 539 }); 540 } 541 _coverShowPos(event) { 542 let elm = event.target; 543 let W_W = window.screen.availWidth; 544 let W_H = window.screen.availHeight; 545 let pos = elm.getBoundingClientRect(); 546 let p = { 547 tX: pos.left > 0 ? pos.left : 0, 548 tY: pos.top > 0 ? pos.top : 0, 549 w: pos.right - pos.left, 550 h: pos.bottom - pos.top, 551 }; 552 let path_W = `M 0 0 h ${W_W} v ${W_H} h -${W_W} Z`; 553 let path_box = `M ${p.tX} ${p.tY} h ${p.w} v ${p.h} h -${p.w} Z`; 554 let elm_path1 = `<path d="${path_W} ${path_box}"></path>`; 555 let elm_path2 = `<path d="${path_box}"></path>`; 556 document.querySelector("#_picker_cover_wrap_box svg").innerHTML = elm_path1 + elm_path2; 557 } 558 _removeCoverShowPos() { 559 document.querySelector("#_picker_cover_wrap_box svg").innerHTML = ''; 560 } 561};
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.