1(function ($, Drupal, drupalSettings) { 2 3 let removeAdminHref; 4 5 Drupal.behaviors.disableAdminHref = { 6 attach: function (context, settings) { 7 if (typeof drupalSettings !== 'undefined' && drupalSettings.mok_core ) { 8 removeAdminHref = drupalSettings.mok_core.removeAdminHref; 9 if(removeAdminHref) { 10 once('disable-admin-href', 'a[href="/admin"]', context).forEach((el) => { 11 el.removeAttribute('href'); 12 el.classList.add('admin-link-disabled'); 13 }); 14 } 15 16 } 17 } 18 19 } 20 21 22 $(document).ready(function() { 23 24 function checkAndRemove() { 25 if (window.innerWidth > 1024) { 26 $('#ad-marquee-03-mobile').remove(); // Remove mobile ad on desktop 27 } else { 28 $('#ad-marquee-03-desktop').remove(); // Remove desktop ad on mobile 29 } 30 } 31 32 checkAndRemove(); 33 34 $(window).on('resize', function() { 35 checkAndRemove(); 36 }); 37 38 // document.querySelectorAll('img').forEach(img => { 39 // let src = img.getAttribute('src'); 40 // if (src.includes('?itok=')) { 41 // let newSrc = src.split('?itok=')[0]; 42 // img.setAttribute('src', newSrc); 43 // } 44 // }); 45 // Helper functions for cross-browser persistent popup dismissal (LocalStorage + SessionStorage + 1-Year Cookie) 46 function setMarketingDismissed(siteKey) { 47 var keys = [ 48 'amgeeMarketingHidden-' + siteKey, 49 'amgeeMarketingHidden-pbp', 50 'amgeeMarketingHidden-wnp', 51 'amgeeMarketingHidden-bbr' 52 ]; 53 54 keys.forEach(function(key) { 55 try { 56 if (window.localStorage) { 57 window.localStorage.setItem(key, 'true'); 58 } 59 } catch (e) {} 60 61 try { 62 if (window.sessionStorage) { 63 window.sessionStorage.setItem(key, 'true'); 64 } 65 } catch (e) {} 66 67 try { 68 var d = new Date(); 69 d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000)); // 1 year 70 var expires = "expires=" + d.toUTCString(); 71 document.cookie = key + "=true; " + expires + "; path=/; SameSite=Lax"; 72 } catch (e) {} 73 }); 74 } 75 76 function isMarketingDismissed(siteKey) { 77 var key = 'amgeeMarketingHidden-' + siteKey; 78 79 try { 80 if (window.localStorage && window.localStorage.getItem(key) === 'true') { 81 return true; 82 } 83 } catch (e) {} 84 85 try { 86 if (window.sessionStorage && window.sessionStorage.getItem(key) === 'true') { 87 return true; 88 } 89 } catch (e) {} 90 91 try { 92 if (document.cookie && document.cookie.indexOf(key + '=true') !== -1) { 93 return true; 94 } 95 } catch (e) {} 96 97 return false; 98 } 99 100 Drupal.behaviors.marketingInterstitialPopup = { 101 attach: function (context, settings) { 102 var sites = ['bbr', 'wnp', 'pbp']; 103 104 sites.forEach(function(siteKey) { 105 var isDismissed = isMarketingDismissed(siteKey); 106 var selector = '[id^="block-amgeemarketinginterstitial' + siteKey + '"]'; 107 var $blocks = $(selector, context); 108 109 if (isDismissed) { 110 $blocks.remove(); 111 $('#popup', context).remove(); 112 } 113 }); 114 115 $(once('marketing-popup-close', '.amgeeMarketingNoThanks, #closeButton, #closePopup, .amgeeMktgClose, .amgeeMktgCloseWrap', context)).on('click', function(e) { 116 var $btn = $(this); 117 var $block = $btn.closest('[id^="block-amgeemarketinginterstitial"], #popup, .amgeeMktgSupport'); 118 119 var siteKey = 'pbp'; 120 var id = $block.attr('id') || ''; 121 if (id.indexOf('bbr') !== -1) { 122 siteKey = 'bbr'; 123 } else if (id.indexOf('wnp') !== -1) { 124 siteKey = 'wnp'; 125 } else if (id.indexOf('pbp') !== -1) { 126 siteKey = 'pbp'; 127 } else { 128 var currentUrl = window.location.href; 129 if (currentUrl.indexOf('boothbayregister.com') !== -1) { 130 siteKey = 'bbr'; 131 } else if (currentUrl.indexOf('wiscassetnewspaper.com') !== -1) { 132 siteKey = 'wnp'; 133 } else if (currentUrl.indexOf('penbaypilot.com') !== -1) { 134 siteKey = 'pbp'; 135 } 136 } 137 138 setMarketingDismissed(siteKey); 139 140 $block.remove(); 141 $('[id^="block-amgeemarketinginterstitial"]').remove(); 142 $('#popup').remove(); 143 }); 144 } 145 }; 146 147 // Check if .view-rows contains any .views-row elements for event date listing view 148 if ($('.view-id-affiliate_post_gallery_style.view-display-id-block_9 .view-content.view-rows .views-row .date-recur-date').length === 0) { 149 // Hide the view title if there are no rows 150 $('.view-id-affiliate_post_gallery_style.view-display-id-block_9 .view-header h3.field__label').hide(); 151 } 152 153 // ////////// Move Main Street block after police for block ////////// 154 let is_pbp = jQuery('body').hasClass('bbr'); 155 let is_pbp_home = jQuery('body').hasClass('path-frontpage') && is_pbp; 156 let is_small_screen = jQuery(window).width() < 768; 157 let is_pbp_home_small_screen = is_pbp_home && is_small_screen; 158 159 if (is_pbp_home_small_screen) { 160 // Move the Main Street block after the Police and Fire block 161 let main_street_block = jQuery('.block-plugin-id--views-block-main-street
161-shop-block-1'); 162 let police_fire_block = jQuery('.block-plugin-id--views-block-news-police-subpanel-block-1'); 163 164 if (main_street_block.length && police_fire_block.length) { 165 main_street_block.insertAfter(police_fire_block); 166 } 167 } 168 // ////////// END ////////// 169 170 }); 171 172 // Make the local tasks vertical on user pages in drupal10 173 Drupal.behaviors.verticalLocalTasks = { 174 attach: function (context, settings) { 175 // Use .once() to ensure the code runs only once per element 176 // when AJAX content is loaded. 177 $(once('vertical-tasks', 'body.path-user .tabs--primary', context)).each(function () { 178 var $tabs = $(this); 179 if ($tabs.closest('nav').hasClass('is-horizontal')) { 180 $tabs.closest('nav').removeClass('is-horizontal').addClass('is-vertical'); 181 } 182 }); 183 } 184 }; 185 186 Drupal.behaviors.groupAudienceSelectCheckbox = { 187 attach: function (context, settings) { 188 once('groupAudienceChange', '.node-affiliate-post-form #edit-field-group-audience', context).forEach(function (element) { 189 $(element).on('change', function () { 190 // Wait for the AJAX load to complete before applying changes 191 $(document).one('ajaxComplete', function () { 192 // Now the new DOM has loaded 193 $('#amgee_domain .amgee-domain-domain.form-checkbox').each(function () { 194 $(this).prop('checked', true); // Check the checkbox 195 }); 196 }); 197 }); 198 }); 199 } 200 }; 201 202 // Fix Facebook video iframes by applying height and width from query parameters 203 Drupal.behaviors.fbIframeFixer = { 204 attach: function (context, settings) { 205 // 1. Target the iframes 206 $('iframe[src*="facebook.com/plugins/video.php"]', context).each(function () { 207 const $iframe = $(this); 208 const fullSrc = $iframe.attr('src'); 209 210 // 2. Extract ONLY the part after the '?' 211 if (fullSrc.indexOf('?') !== -1) { 212 const queryString = fullSrc.split('?')[1].replace(/&/g, '&'); 213 214 // 3. Parse the clean query string 215 const urlParams = new URLSearchParams(queryString); 216 217 const fbHeight = urlParams.get('height'); 218 const fbWidth = urlParams.get('width'); 219 220 // 4. Logic: If style is missing height/width, apply them 221 const currentStyle = $iframe.attr('style') || ""; 222 223 if (!currentStyle.includes('height') && fbHeight) { 224 $iframe.css('height', fbHeight + 'px'); 225 } 226 227 if (!currentStyle.includes('width') && fbWidth) { 228 $iframe.css('width', fbWidth + 'px'); 229 } 230 231 // 5. Cleanup for appearance 232 $iframe.css({ 233 'border': 'none', 234 'overflow': 'hidden', 235 'display': 'block' 236 }); 237 238 console.log('FB Fix Applied:', { width: fbWidth, height: fbHeight }); 239 } 240 }); 241 } 242 }; 243 244 // Additional fix to set the height of the parent container of Facebook video iframes in a specific Drupal View field 245 Drupal.behaviors.fbGalleryHeightFix = { 246 attach: function (context, settings) { 247 // 1. Target the specific Drupal View field container 248 $('.views-field-field-gallery-video .video-embed-field-provider-facebook', context) 249 .each(function () { 250 const $container = $(this); 251 // 2. Find the iframe inside this specific container 252 const $iframe = $container.find('iframe'); 253 254 if ($iframe.length) { 255 // 3. Get the height attribute (e.g., "476") 256 let attrHeight = $iframe.attr('height'); 257 // Increase the height by 10px 258 attrHeight = parseInt(attrHeight) + 10; 259 260 if (attrHeight) { 261 // 4. Set the height to the parent container 262 $container.css({ 263 'height': attrHeight + 'px', 264 'display': 'block', 265 'overflow': 'hidden' 266 }); 267 268 // Optional: Ensure the iframe fills the now-sized container 269 $iframe.css({ 270 'width': '100%', 271 'height': '100%' 272 }); 273 } 274 } 275 }); 276 } 277 }; 278 279 // Membership SignIn button on mobile scroll bridge 280 Drupal.behaviors.mobileLoginScrollBridge = { 281 attach: function (context) { 282 283 // Sync the mobile button text with the desktop button text automatically 284 const desktopBtn = document.querySelector('#amgee_membership_login_block_home_page .signInButton'); 285 const mobileBtn = document.querySelector('.mobileSignInButton a'); 286 if (desktopBtn && mobileBtn) { 287 mobileBtn.textContent = desktopBtn.textContent; 288 if( desktopBtn.textContent == 'Sign Out' ) { 289 mobileBtn.textContent = 'Member Sign Out'; 290 } 291 } 292 293 once('mobileScrollBridge', '.mobileSignInButton', context).forEach(mobileBtn => { 294 mobileBtn.addEventListener('click', e => { 295 e.preventDefault(); 296 297 const loginBlock = document.querySelector('#amgee_membership_login_block_home_page'); 298 299 if (loginBlock) { 300 // Smoothly scroll the block into view 301 loginBlock.scrollIntoView({ behavior: 'smooth', block: 'center' }); 302 303 // Find the specific sign-in button wrapper inside the block 304 const buttonTarget = loginBlock.querySelector('.signinWrapper') || loginBlock.querySelector('.signInButton'); 305 306 if (buttonTarget) { 307 showTooltip(buttonTarget); 308 } 309 } else { 310 console.warn('Login block not found on this page.'); 311 window.location.href = '/#amgee_membership_login_block_home_page'; 312 } 313 }); 314 }); 315 316 // Updated: Appends directly to the button element's wrapper 317 function showTooltip(targetElement) { 318 const oldTooltip = document.querySelector('.login-scroll-tooltip'); 319 if (oldTooltip) oldTooltip.remove(); 320 321 const tooltip = document.createElement('div'); 322 tooltip.className = 'login-scroll-tooltip'; 323 tooltip.innerText = 'ð Tap here!'; 324 325 // Ensure the button container can hold an absolute positioned element 326 targetElement.style.position = 'relative'; 327 targetElement.appendChild(tooltip); 328 329 setTimeout(() => { 330 tooltip.style.opacity = '0'; 331 setTimeout(() => tooltip.remove(), 500); 332 }, 6000); 333 } 334 335 } 336 }; 337 338})(jQuery, Drupal, drupalSettings); 339 340
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.