1/* TABLE OF CONTENTS 21. Global functions 32. Menu 4 2.1 Menu split 5 2.2 Mobile menu trigger 6 2.3 I want to 7 2.4 Hover intent 8 2.5 Related links 93. Components 10 3.1 Accordions 11 3.2 Scrollable tables 12 3.3 Hidden sidebar 13 3.4 Tiny Slider 14 3.5 Categorized tiles 15 3.6 Tabs 16 3.7 Link icons 17 3.8 Events - Future Dates 18 3.9 Parks 19 3.10 Alerts 20 3.11 Mayor & Council Bio 21 3.12 Search 22 3.13 Anon Events 234. Window resize 24 4.1 Scrollable tables 25 4.2 Cookie Consent banner 26 4.3 Mobile menu 275. Map Handle 28*/ 29 30(function ($) { 31 32 /* [ 1. Global functions ] ----------*/ 33 34 function delayAdd(elem,className,transition) { 35 setTimeout( 36 function removeAddFunc() { 37 elem.addClass(className); 38 }, 39 transition); 40 } 41 function delayRemove(elem,className,transition) { 42 setTimeout( 43 function removeDelayFunc() { 44 elem.removeClass(className); 45 }, 46 transition); 47 } 48 49 /* [ 2. Menu ] ----------*/ 50 51 /* [ 2.1 Menu split ] ----------*/ 52 $('.m-menu--main nav > .m-menu > .m-menu__item > .m-menu__item-link-wrapper a').html(function(index, currentHtml) { 53 54 var n = currentHtml.indexOf("&"); 55 var j = currentHtml.indexOf(" "); 56 if (n > 0) {// If there is an ampersand 57 if (n == j+1){//if it's after the first space 58 //then add break after the ampersand 59 return currentHtml.replace(' & ', ' & <br />'); 60 } else { 61 //else break after the first space 62 return currentHtml.replace(' ', ' <br />'); 63 } 64 } else { 65 return currentHtml.replace(' ', ' <br />'); 66 } 67 68 }); 69 70 /* [2.2 Mobile menu trigger ] ----------*/ 71 $('.m-mobile-menu__trigger').on('click',function(){ 72 if($(window).width() <= 800) { 73 $(this).attr('aria-expanded',function(index,attr){ 74 return attr == 'true' ? 'false' : 'true'; 75 }).attr('aria-label',function(index,attr){ 76 return attr == 'Expand the menu' ? 'Collapse the menu' : 'Expand the menu'; 77 }); 78 $('#mobile-menu').attr('aria-hidden',function(index,attr){ 79 return attr == 'true' ? 'false' : 'true'; 80 }).slideToggle(); 81 } 82 }); 83 $('.t-sidebar .m-menu__title a').click(function(event){ 84 if($(window).width() <= 900) { 85 event.preventDefault(); 86 $(this).toggleClass('active'); 87 $(this).parent().next().slideToggle(function(){ 88 $(this).css('overflow','visible'); 89 }); 90 } 91 }); 92 93 /* [ 2.3 I want to ] ---------- */ 94 $('.o-i-want-to__trigger').on('click',function(){ 95 $(this).attr('aria-expanded',function(index,attr){ 96 return attr == "true" ? "false" : "true"; 97 }); 98 if($(this).attr('aria-expanded') == true) { 99 $(this).attr('aria-label',function(index,attr){ 100 return attr.replace('Expand','Collapse'); 101 }); 102 } else { 103 $(this).attr('aria-label',function(index,attr){ 104 return attr.replace('Collapse','Expand'); 105 }); 106 $('.o-i-want-to').removeClass('o-i-want-to--active'); 107 $('.o-i-want-to__section').each(function(){ 108 $(this).attr('aria-label',function(index,attr){ 109 return attr.replace('Collapse','Expand'); 110 }).attr('aria-expanded',false); 111 }); 112 } 113 $('.o-i-want-to__wrapper').attr('aria-hidden',function(index,attr){ 114 return attr == "true" ? "false" : "true"; 115 }).slideToggle(); 116 $('.o-i-want-to').toggleClass('o-i-want-to--on'); 117 }); 118 $('.o-i-want-to__section').on('click',function(){ 119 $(this).attr('aria-expanded',function(index,attr){ 120 return attr == 'true' ? 'false' : 'true'; 121 }).parent().siblings().find('.o-i-want-to__section').attr('aria-expanded',false).attr('aria-label',function(index,attr){ 122 return attr.replace('Collapse','Expand'); 123 }); 124 if($(this).attr('aria-expanded') == true) { 125 $(this).attr('aria-label',function(index,attr){ 126 return attr.replace('Collapse','Expand'); 127 }); 128 $('.o-i-want-to').removeClass('o-i-want-to--active'); 129 } else { 130 $(this).attr('aria-label',function(index,attr){ 131 return attr.replace('Expand','Collapse'); 132 }); 133 $('.o-i-want-to').addClass('o-i-want-to--active'); 134 } 135 }); 136 137 /* [ 2.4 HoverIntent ] ---------- */ 138 $('.m-menu--main.desktop nav > .m-menu > .m-menu__item').hoverIntent({ 139 interval: 50, 140 over: mainmenuOn, 141 timeout: 100, 142 out: mainmenuOff 143 }); 144 function mainmenuOn() { 145 if($(window).width() > 800) { 146 $(this).addClass('m-menu__item--active'); 147 } 148 } 149 function mainmenuOff() { 150 $(this).removeClass('m-menu__item--active'); 151 } 152 153 /* [ 2.5 Related links ] ----------*/ 154 if($('.related-views .a-related-link').length) { 155 $('.related-views .view-content > .views-row').each(function(){ 156 var section = $(this).attr('class').split(' ')[0].replace('-','/'); 157 var sectionLinks = $(this).find('.item-list ul').html(); 158 if($('[data-mlid="'+section+'"]').length) { 159 $('[data-mlid="'+section+'"] .m-menu__flyout .m-related-links__links').append(sectionLinks); 160 } 161 }); 162 } 163 164 /* [ 3. Components ] ----------*/ 165 166 /* [ 3.1 Accordions ] ----------*/ 167 $('.field--name-field-accordion > .field__item').each(function(){ 168 var itemIndex = $(this).index(); 169 $(this).find('*[data-acc-id]').each(function(){ 170 var currentID = $(this).attr('id'); 171 $(this).attr('id','accordion__group-'+itemIndex+'-'+currentID); 172 }); 173 }); 174 $('.o-accordion-group > li').each(function(){ 175 var itemIndex = $(this).index(); 176 $(this).find('*[data-acc-id]').each(function(){ 177 var currentID = $(this).attr('id'); 178 $(this).attr('id',currentID+itemIndex); 179 }); 180 }); 181 $('.m-accordion__trigger').on('click',function(){ 182 $(this).toggleClass('is-open').attr('aria-expanded',function(index,attr){ 183 return attr == 'true' ? 'false' : 'true'; 184 }); 185 $(this).siblings('.m-accordion__content').slideToggle().attr('aria-hidden',function(index,attr){ 186 return attr == 'true' ? 'false' : 'true'; 187 }); 188 $(this).parents('.o-accordion-group__list-row').siblings().find('.m-accordion__trigger').removeClass('is-open').attr('aria-expanded',false).siblings().slideUp(); 189 if($('div[id*="block-views-block-fields-courts-lists-block"]').length) { 190 $(this).parents('div[id*="block-views-block-fields-courts-lists-block"]').siblings('div[id*="block-views-block-fields-courts-lists-block"]').find('.m-accordion__trigger').removeClass('is-open').attr('aria-expanded',false).siblings().attr('aria-hidden', true).slide
190Up(); 191 } 192 }); 193 if($('.o-accordion-group__list-row').length) { 194 $('.o-accordion-group__list-row').each(function(){ 195 if(!$(this).find('.m-accordion__trigger').length){ 196 $(this).hide(); 197 } 198 }); 199 } 200 if($('.field--name-field-accordion > .field__item').length) { 201 $('.field--name-field-accordion > .field__item').each(function(){ 202 if(!$(this).find('.m-accordion__trigger').length){ 203 $(this).hide(); 204 } 205 }); 206 } 207 208 /* [ 3.2 Scrollable tables ] ----------*/ 209 $('.t-content table').each(function() { 210 var element = $(this); 211 // Create the wrapper element 212 var scrollWrapper = $('<div />', { 213 'class': 'scrollable', 214 'html': '<div tabindex="0" role="region" />' // The inner div is needed for styling 215 }).insertBefore(element); 216 // Store a reference to the wrapper element 217 element.data('scrollWrapper', scrollWrapper); 218 // Move the scrollable element inside the wrapper element 219 element.appendTo(scrollWrapper.find('div')); 220 }); 221 /* [ 3.4 Tiny Slider ] ----------*/ 222 if($('.o-homepage-banner__images .o-homepage-banner__image').length > 0) { 223 var homepage_banner = tns({ 224 container: '.o-homepage-banner__images', 225 nav: false, 226 controlsContainer: '.o-homepage-banner__nav', 227 controls: true, 228 prevButton: '.o-homepage-banner__nav-button--prev', 229 nextButton: '.o-homepage-banner__nav-button--next', 230 autoHeight:true, 231 autoplay:true, 232 loop:false, 233 mode: 'carousel' 234 }); 235 var homepage_banner_content = tns({ 236 container: '.o-homepage-banner__content-carousel', 237 nav:false, 238 controlsContainer: '.o-homepage-banner__nav', 239 controls: true, 240 prevButton: '.o-homepage-banner__nav-button--prev', 241 nextButton: '.o-homepage-banner__nav-button--next', 242 autoHeight:false, 243 autoplay:true, 244 loop:false, 245 mode: 'carousel' 246 }); 247 } 248 249 if($('#block-views-block-photo-album-block-1').length) { 250 var photo_album = tns({ 251 container: '#block-views-block-photo-album-block-1 .view-content', 252 nav: true, 253 navContainer: '#block-views-block-photo-album-block-1 .attachment .view-content', 254 controls: false, 255 autoHeight:false, 256 autoplay:true, 257 autoplayButtonOutput: false, 258 loop:false, 259 mode: 'gallery', 260 speed: 750 261 }); 262 } 263 264 if($('#block-index-banner .o-index-banner__image-carousel > *').length > 1) { 265 $('.o-index-banner__nav').show(); 266 var index_banner_image = tns({ 267 container: '#block-index-banner .o-index-banner__image-carousel', 268 nav:false, 269 controlsContainer: '.o-index-banner__nav', 270 controls: true, 271 prevButton: '.o-index-banner__nav-button--prev', 272 nextButton: '.o-index-banner__nav-button--next', 273 autoHeight:false, 274 autoplay:true, 275 autoplayButtonOutput: false, 276 loop:false, 277 mode: 'gallery', 278 speed: 500 279 }); 280 } 281 if($('#block-index-banner .o-index-banner__title-carousel > *').length > 1) { 282 $('.o-index-banner__nav').show(); 283 var index_banner_title = tns({ 284 container: '#block-index-banner .o-index-banner__title-carousel', 285 nav:false, 286 controlsContainer: '.o-index-banner__nav', 287 controls: true, 288 prevButton: '.o-index-banner__nav-button--prev', 289 nextButton: '.o-index-banner__nav-button--next', 290 autoHeight:false, 291 autoplay:true, 292 autoplayButtonOutput: false, 293 loop:false, 294 mode: 'carousel', 295 speed: 500 296 }); 297 } 298 if($('#block-index-banner .o-index-banner__content-carousel > div').length > 1) { 299 $('.o-index-banner__nav').show(); 300 var index_banner_content = tns({ 301 container: '#block-index-banner .o-index-banner__content-carousel', 302 nav:false, 303 controlsContainer: '.o-index-banner__nav', 304 controls: true, 305 prevButton: '.o-index-banner__nav-button--prev', 306 nextButton: '.o-index-banner__nav-button--next', 307 autoHeight:false, 308 autoplay:true, 309 autoplayButtonOutput: false, 310 loop:false, 311 mode: 'carousel', 312 speed: 500 313 }); 314 } 315 316 /* [ 3.5 Header search ] ----------*/ 317 $('.region-header-top .block-google-cse .form-text').focusin(function(){ 318 $(this).parent().addClass('active'); 319 $('.region-header-top .block-menu').addClass('inactive'); 320 }); 321 $('.region-header-top .block-google-cse .form-text').focusout(function(){ 322 $(this).parent().removeClass('active'); 323 setTimeout(function(){ 324 $('.region-header-top .block-menu').removeClass('inactive'); 325 },200); 326 }); 327 328 /* [ 3.6 Tabs ] ----------*/ 329 $('.m-tab-wrap .m-tabs').each(function(){ 330 var $active, $content, $links = $(this).find('a'); 331 $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]); 332 $active.addClass('active'); 333 $content = $($active[0].hash); 334 $links.not($active).each(function () { 335 $(this.hash).hide(); 336 }); 337 $(this).on('click', 'a', function(e){ 338 $active.removeClass('active'); 339 $content.hide(); 340 $active = $(this); 341 $content = $(this.hash); 342 $active.addClass('active'); 343 $content.show(); 344 e.preventDefault(); 345 }); 346 }); 347 348 /* [ 3.7 Link Icons ] ----------*/ 349 $("a[href$='.pdf'],a[href$='.PDF']").attr({"target":"_blank"}).addClass('icon pdf').not('.m-tile__image a').append('<span class="fa fa-file-pdf-o"></span>'); 350 $("a[href$='.xml'],a[href$='.XML']").addClass('icon rss').append('<span class="fa fa-rss-square"></span>'); 351 $("a[href$='.zip'],a[href$='.ZIP']").attr({"target":"_blank"}).addClass('icon zip').append('<span class="fa fa-file-archive-o"></span>'); 352 $("a[href$='.jpg'],a[href$='.JPG'],a[href$='.jpeg'],a[href$='.JPEG']").attr({"target":"_blank"}).addClass('icon download').append('<span class="fa fa-download"></span>'); 353 $("a[href$='.doc'],a[href$='.docx'],a[href$='.DOC'],a[href$='.DOCX']").attr({"target":"_blank"}).addClass('icon doc').append('<span class="fa fa-file-word-o"></span>'); 354 $("a[href$='.xls'],a[href$='.xlsx'],a[href$='.XLS'],a[href$='.XLSX']").attr({"target":"_blank"}).addClass('icon sheet').append('<span class="fa fa-file-excel-o"></span>'); 355 $("a[href^='mailto:']").addClass('icon email').not('#footer a').append('<span class="fa fa-envelope-o"></span>'); 356 $("a[href*='http://']:not([href*='"+location.hostname+"']),a[href*='https://']:not([href*='"+location.hostname+"'])").each( function() { 357 var dataPath = $(this).attr("href"); 358 $(this).attr({ 359 target: "_blank", 360 onclick: "trackOutboundLink('" + dataPath + "');" 361 }).addClass("icon ext").not("#footer a, .m-menu--main a, .m-tile__image a").append('<span class="fa fa-external-link"></span>'); 362 }) 363 364 /* [ 3.8 Events - Future Dates ] ----------*/ 365 if($('#block-views-block-event-dates-block-1').length) { 366 var nextDate = $('#block-views-block-event-dates-block-1 .views-row:not(.m-accordion .views-row) .upcoming').text(); 367 if($('#block-views-block-event-dates-block-1 .m-accordion .view-content .views-row').length <= 1) { 368 var futureDate = $('#block-views-block-event-dates-block-1 .m-accordion .view-content .views-row').text(); 369 if(nextDate == futureDate) { 370 $('#block-views-block-event-dates-block-1 .m-accordion').hide(); 371 } 372 } 373 } 374 375 if($('.t-sidebar--second #block-address').length) { 376 $('#block-contactaddresscityprov').insertAfter('#block-address .field--name-field-street
376-address'); 377 if($('#block-contactaddresscityprov').length) { 378 $('#block-postal-code').appendTo('#block-contactaddresscityprov .field--name-body p'); 379 } else { 380 $('#block-postal-code').insertAfter('#block-address .field--name-field-street-address'); 381 } 382 } 383 384 /* [ 3.9 Parks ] ---------- */ 385 if($('body').attr('class').indexOf('parks-recreation') > 0) { 386 $('.a-footer-link__snippet').each(function(){ 387 if($(this).text().indexOf('Check out opportunities with the City of Vernon.') > -1) { 388 $(this).text('Check out opportunities with Rectreation Services.'); 389 } 390 }); 391 $('.a-footer-link__link a').each(function(){ 392 if($(this).text().indexOf('Contact the City of Vernon') > -1) { 393 $(this).text('Contact Recreation Services'); 394 } 395 if($(this).text().indexOf('Careers') > -1) { 396 $(this).attr('href', '/parks-recreation/recreation-join-our-team'); 397 } 398 }); 399 } 400 401 /* [ 3.10 Alerts ] ----------*/ 402 $('.o-alerts-banner--main .close').click(function(){ 403 $('.o-alerts-banner--main').slideUp(); 404 }); 405 406 if(!$('.p-type--section_landing_page').length) { 407 if(!$('.o-alerts-banner--secondary #block-views-block-alerts-park-and-recreation-block-1 .views-row').length) { 408 $('.o-alerts-banner--secondary').hide(); 409 } 410 } 411 412 /* [ 3.11 Mayor & Council Bios ] ----------*/ 413 $('#block-views-block-mayor-and-council-block-1 .views-more-link').click(function(event){ 414 event.preventDefault(); 415 $(this).parent().hide(); 416 $(this).parent().next().show(); 417 }); 418 $('#block-views-block-mayor-and-council-block-1 .view-less-link').click(function(event){ 419 event.preventDefault(); 420 $(this).parent().hide(); 421 $(this).parent().prev().show(); 422 }); 423 424 /* [ 3.12 Search ] ----------*/ 425 // TEMP override: module form action is failing, this forces the issue for now 426 $('.region-header-top .google-cse-search-box-form').attr('action','/search/google'); 427 428 if($('.t-sidebar__wrapper .m-menu__wrapper > .m-menu').outerHeight() === 2) { 429 $('.t-sidebar__footer').css('margin-top', '4.9rem'); 430 $('.t-sidebar .block-menu .m-menu__wrapper>.m-menu').css('border', 'none') 431 } 432 433 /* [ 3.13 Anon Events ] ----------*/ 434 if($('.node-add-event:not(.user-logged-in)').length) { 435 $('#edit-group-event-location, #edit-group-event-contact').attr('open', ''); 436 } 437 438 /* [ 3.14 Webform Disable Submit if URL ] ----------*/ 439 if ($('.t-main form > .js-form-item #edit-message').length) { 440 $('.js-form-item #edit-message').after('<em class="webform-msg">This form cannot be submitted with a URL in the message.</em>'); 441 $('.webform-msg').hide(); 442 $('.js-form-item #edit-message').on('keyup', function() { 443 var message = $('#edit-message'); 444 var https = 'https'; 445 var http = 'http'; 446 var www = 'www'; 447 var messageValue = message.val(); 448 if ((messageValue.indexOf(https)!=-1) || (messageValue.indexOf(http)!=-1) || (messageValue.indexOf(www)!=-1)) { 449 $('#edit-actions .webform-button--submit').prop('disabled', true); 450 $('.webform-msg').show(); 451 } 452 else { 453 $('#edit-actions .webform-button--submit').prop('disabled', false); 454 $('.webform-msg').hide(); 455 } 456 }); 457 } 458 459 /* [ 4. Window resize ] ----------*/ 460 461 var resizeTimer; 462 function resizeFunction() { 463 /* [ 4.1 Scrollable tables ] ----------*/ 464 if($('.scrollable').length) { 465 $('.scrollable').each(function(){ 466 if ($(this).find('> div > table').not('table.sticky-header').outerWidth() > $(this).find('> div > table').not('table.sticky-header').parent().outerWidth()) { 467 $(this).find('> div > table').not('table.sticky-header').data('scrollWrapper').addClass('has-scroll'); 468 } else { 469 $(this).find('> div > table').not('table.sticky-header').data('scrollWrapper').removeClass('has-scroll'); 470 } 471 }); 472 } 473 /* [ 4.2 Cookie Consent banner ] ----------*/ 474 if($('.cc_banner-wrapper').length) { 475 $('body').css('padding-bottom',$('.cc_banner-wrapper').outerHeight()); 476 } 477 /* [ 4.3 Mobile menu ] ----------*/ 478 if($(window).width() > 1024) { 479 $('.a-menu-trigger').attr('aria-expanded',false) 480 $('.m-menu-wrapper').show().attr('style',''); 481 } 482 /* [ 4.4 Tiny Slider ] ----------*/ 483 if($('.m-carousel--multiple').length) { 484 setTimeout(function(){
485 carousel_controls_position = ($('.m-carousel--multiple .tns-slide-active img').height() - $('.m-carousel--multiple .a-carousel-controls').outerHeight()); 486 $('.m-carousel--multiple .a-carousel-controls').attr('style','top:'+carousel_controls_position+'px').addClass('a-carousel-controls--visible'); 487 },200); 488 } 489 490 if($('.p-type--section_landing_page').length) { 491 var sidebar = $('.t-sidebar'); 492 var sidebarPosition = sidebar.offset(); 493 var sidebarWidth = sidebar.outerWidth(); 494 var titleCarouselContainerPosition = sidebarPosition.left + sidebarWidth; 495 $('.o-index-banner__title-carousel-container').css('left', 'calc(' + titleCarouselContainerPosition + 'px + 5.25rem)'); 496 $('.o-index-banner__title-carousel-container').css('max-width', 'calc(100vw - ' + titleCarouselContainerPosition + 'px)'); 497 if($(window).width() < 1030) { 498 $('.o-index-banner__title-carousel-container').css('left', 'calc(' + titleCarouselContainerPosition + 'px + 4rem)'); 499 } 500 if($(window).width() < 900) { 501 $('.o-index-banner__title-carousel-container').css({ 502 'left': '', 503 'max-width': '' 504 }); 505 } 506 507 var bannerHeight = $('.o-index-banner').outerHeight(); 508 $('.o-index-banner .o-index-banner__image-carousel').children().attr('style', 'height: ' + bannerHeight + 'px !important'); 509 } 510 511 if($('#block-vernon-views-block-events-calendar-block-1').length) { 512 if($(window).width() <= 600) { 513 $('.fc-listMonth-button').click(); 514 } 515 } 516 517 }; 518 $(window).on('load resize',function() { 519 clearTimeout(resizeTimer); 520 resizeTimer = setTimeout(resizeFunction, 250); 521 }); 522 resizeFunction(); 523 524 /* [ 5. Storage ] ----------*/ 525 526 if ('sessionStorage' in window && typeof sessionStorage == 'object') { 527 $(document).ready(function() { 528 /* [ 5.1 Alerts banner ] ----------*/ 529 if($('.o-alerts-banner').length) { 530 if(sessionStorage['alerts'] == 'collapsed') { 531 $('.o-alerts-banner__carousel-wrapper').hide().attr('aria-hidden',true); 532 $('.a-alerts-trigger').attr({ 533 title:'Expand the Alerts carousel', 534 'aria-expanded':false 535 }).text('Expand'); 536 if($('.o-alerts-banner .views-row').length > 1) { 537 $('.o-alerts-banner .a-carousel-controls').addClass('a-carousel-controls--hidden'); 538 } 539 } else { 540 sessionStorage['alerts'] = 'expanded'; 541 $('.o-alerts-banner__carousel-wrapper').show().attr('aria-hidden',true); 542 $('.a-alerts-trigger').attr({ 543 title:'Collapse the Alerts carousel', 544 'aria-expanded':true 545 }).text('Collapse'); 546 if($('.o-alerts-banner .views-row').length > 1) { 547 $('.o-alerts-banner .a-carousel-controls').removeClass('a-carousel-controls--hidden'); 548 } 549 } 550 $('.a-alerts-trigger').on('click',function(){ 551 $(this).attr({ 552 'title':function(index,attr) { 553 return attr == 'Expand the Alerts carousel' ? 'Collapse the Alerts carousel' : 'Expand the Alerts carousel'; 554 }, 555 'aria-expanded':function(index,attr) { 556 return attr == 'true' ? 'false' : 'true'; 557 } 558 }).text(function(index,text){ 559 return text == 'Collapse' ? 'Expand' : 'Collapse'; 560 }); 561 $('.o-alerts-banner__carousel-wrapper').slideToggle().attr('aria-hidden',function(index,attr){ 562 return attr == 'true' ? 'false' : 'true'; 563 }); 564 if($('.o-alerts-banner .views-row').length > 1) { 565 $('.o-alerts-banner .a-carousel-controls').toggleClass('a-carousel-controls--hidden'); 566 } 567 if($(this).attr('aria-expanded') == 'true') { 568 sessionStorage['alerts'] = 'expanded'; 569 } else { 570 sessionStorage['alerts'] = 'collapsed'; 571 } 572 }); 573 } 574 575 /* [ 5.2 Grey menus ] ----------*/ 576 if($('.a-grey-menu-trigger').length && $('.t-sidebar .m-menu__wrapper').length) { 577 if(sessionStorage['grey_menu'] == 'true') { 578 $('.a-grey-menu-trigger').attr('aria-label','Disable grey menu colours').attr('data-toggle','on'); 579 $('.t-sidebar .m-menu__wrapper').addClass('m-menu__wrapper--grey'); 580 $('.m-menu--main').addClass('m-menu--main--grey'); 581 } else { 582 sessionStorage['grey_menu'] = 'false'; 583 $('.a-grey-menu-trigger').attr('aria-label','Enable grey menu colours').attr('data-toggle','off'); 584 $('.t-sidebar .m-menu__wrapper').removeClass('m-menu__wrapper--grey'); 585 $('.m-menu--main').removeClass('m-menu--main--grey'); 586 } 587 $('.a-grey-menu-trigger').on('click',function(){ 588 $(this).attr('aria-label',function(index,attr){ 589 return attr == 'Enable grey menu colours' ? 'Disable grey menu colours' : 'Enable grey menu colours'; 590 }).attr('data-toggle',function(index,attr){ 591 return attr == 'on' ? 'off' : 'on'; 592 }); 593 $('.t-sidebar .m-menu__wrapper').toggleClass('m-menu__wrapper--grey'); 594 $('.m-menu--main').toggleClass('m-menu--main--grey'); 595 if($(this).attr('data-toggle') == 'off') {
596 sessionStorage['grey_menu'] = 'false'; 597 } else { 598 sessionStorage['grey_menu'] = 'true'; 599 } 600 }); 601 } 602 }); 603 }; 604 605})(jQuery); 606 607/* [ 5. Map Handle ] ----------*/ 608/** 609 * Open (Fire) a marker popup by clicking a link outside of the Leaflet map 610 * https://www.drupal.org/node/1998596 611 */ 612(function($, Drupal) { 613 /*** Define some context general variables ***/ 614 var mapCount = 0; 615 616 var markers = []; // Associative Markers list object 617 var markersList = []; // Unassociative Markers ordinated list array 618 var features = []; // Associative Features list object 619 var featuresList = []; // Associative Features ordinated list array 620 621 markers[mapCount] = {}; 622 features[mapCount] = {}; 623 624 //retrieve the Leaflet Markers and Leaflet Features data from the Leaflet (or Leaflet Markeclusterer) module 625 $(document).bind('leaflet.feature', function(e, lFeature, feature) { 626 markers[mapCount][feature.feature_id] = lFeature; 627 features[mapCount][feature.feature_id] = feature; 628 markersList.push(lFeature); 629 featuresList.push(feature); 630 }); 631 632 Drupal.behaviors.my_main_leaflet_map = { 633 attach: function(context, settings) { 634 635 $.each(settings.leaflet, function(m, data) { 636 $('#' + data.mapid, context).each(function() { 637 $('.map-handle').each(function() { 638 $(this).click(function(e){ 639 e.preventDefault(); 640 var $handle = $(this); 641 var _markers = markersList; 642 $.each(_markers, function(index, marker){ 643 var dni = $handle.attr('data-node-id'); 644 if(marker._popup._content.indexOf('data-node-id="'+dni+'"') > -1) { 645 if(marker._icon) { 646 //Popup marker 647 marker.openPopup(); 648 } else { 649 // Popup on ClusterGroup 650 var m = marker; 651 var content = m._popup._content; 652 while (m && !m._icon) { 653 m = m.__parent; 654 } 655 if(m) { 656 m.bindPopup(content).openPopup(); 657 } 658 } 659 } 660 }); 661 }); 662 }); 663 }); 664 }); 665 $(document).ajaxComplete(function () { 666 $.each(settings.leaflet, function(m, data) { 667 $('#' + data.mapid, context).each(function() { 668 $('.map-handle').each(function() { 669 $(this).click(function(e){ 670 e.preventDefault(); 671 var $handle = $(this); 672 var _markers = markersList; 673 $.each(_markers, function(index, marker){ 674 var dni = $handle.attr('data-node-id'); 675 if(marker._popup._content.indexOf('data-node-id="'+dni+'"') > -1) { 676 if(marker._icon) { 677 //Popup marker 678 marker.openPopup(); 679 } else { 680 // Popup on ClusterGroup 681 var m = marker; 682 var content = m._popup._content; 683 while (m && !m._icon) { 684 m = m.__parent; 685 } 686 if(m) { 687 m.bindPopup(content).openPopup(); 688 } 689 } 690 } 691 }); 692 }); 693 }); 694 }); 695 }); 696 }); 697 } 698 } 699})(jQuery, Drupal);
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.