1/****************************************************************** 2Site Name: OPW 2018 3Base Javascript 4******************************************************************/ 5 6/********************* 7JS FUNCTIONS 8*********************/ 9 10// hoverIntent functions 11function navShow() { 12 jq3(this).addClass('active'); 13 jq3(this).children('ul.sub-menu').slideDown(100); 14} 15 16function navHide() { 17 jq3(this).removeClass('active'); 18 jq3(this).children('ul.sub-menu').stop(true).slideUp(0); 19} 20 21function subnavShow() { 22 jq3(this).addClass('active'); 23 jq3(this).children('ul.sub-menu').fadeIn(100); 24} 25 26function subnavHide() { 27 jq3(this).removeClass('active'); 28 jq3(this).children('ul.sub-menu').stop(true).fadeOut(0); 29} 30 31// function detailShow() { 32// jq3(this).addClass('active'); 33// jq3(this).children('.detail-menu').fadeIn(200); 34// } 35 36// function detailHide() { 37// jq3(this).removeClass('active'); 38// jq3(this).children('.detail-menu').stop(true).fadeOut(0); 39// } 40 41// functions when width resizes 42function responsive() { 43 44 // jq3(window).scroll(); 45 46 // Unbind all menu functions on resize 47 jq3('document, body, #nav-container, #menu, #site-container, ul.primary-nav li, ul.primary-nav li span, ul.sub-menu').off(); 48 49 // Viewport width smaller than Bootstrap lg (< 992px) 50 if (jq3('#site-wrap').outerWidth() < 976) { 51 52 // Reset navigation active classes and open selected 53 jq3('document, body, #nav-container, #menu, #site-container, ul.primary-nav li, ul.primary-nav li span').removeClass('active'); 54 jq3('ul.primary-nav li span').removeClass('open'); 55 jq3('#site-container').css('right', '0px'); 56 57 // Hamburger menu 58 jq3('#menu').on('click', function () { 59 60 // window.scrollTo(0, 1); 61 jq3(this).toggleClass('active'); 62 jq3('#nav-container').toggleClass('active'); 63 64 // Slide drawer open witdth of nav-container 65 var navWidth = jq3('#nav-container').outerWidth(true); 66 var slideDiv = jq3('#site-container'); 67 if (slideDiv.hasClass('active')) { 68 slideDiv.animate({ 69 'right': '0px' 70 }, 200).removeClass('active'); 71 } else { 72 slideDiv.animate({ 73 'right': navWidth 74 }, 200).addClass('active'); 75 } 76 77 }); 78 79 // Hide all sub-menu items and reset nav classes 80 jq3('ul.primary-nav li ul.sub-menu').hide(); 81 jq3('ul.primary-nav li').removeClass('active'); 82 83 // Basic mobile navigation functionality 84 jq3('ul.primary-nav li span').on('click tap', function () { 85 jq3(this).toggleClass('open'); 86 jq3(this).parent('li').toggleClass('active'); 87 jq3(this).parent('li').children('ul.sub-menu').slideToggle(200); 88 }); 89 90 } 91 92 // Viewport width larger than Bootstrap lg (> 992px) 93 if (jq3('#site-wrap').outerWidth() > 975) { 94 95 // Reset navigation active classes and open selected 96 jq3('document, body, #nav-container, #menu, #site-container, ul.primary-nav li, ul.primary-nav li span').removeClass('active'); 97 jq3('ul.primary-nav li span').removeClass('open'); 98 jq3('ul.primary-nav li ul.sub-menu, ul.primary-nav li ul.sub-menu .detail-menu').hide(); 99 jq3('#site-container').css('right', '0px'); 100 101 // Basic navigation functionality -- calls hoverIntent 102 jq3('ul.primary-nav li').not('ul.primary-nav ul.sub-menu li').hoverIntent({ 103 over: navShow, 104 out: navHide, 105 timeout: 200, 106 sensitivity: 7, 107 interval: 100 108 }); 109 110 // Basic sub-menu navigation functionality -- calls hoverIntent 111 jq3('ul.primary-nav ul.sub-menu li').hoverIntent({ 112 over: subnavShow, 113 out: subnavHide, 114 timeout: 200, 115 sensitivity: 7, 116 interval: 100 117 }); 118 119 // jq3('ul.primary-nav ul.sub-menu li.has-detail').hoverIntent({ 120 // over: detailShow, 121 // out: detailHide, 122 // timeout: 200, 123 // sensitivity: 7, 124 // interval: 100 125 // }); 126 127 } 128 129} 130 131// Function for tabs -> accordions Sitefinity TabStrip 132function tabFunctions() { 133 134 if (jq3(window).width() < 750) { 135 136 jq3('a.rtsLink').on('click', function () { 137 jq3('html:not(:animated), body:not(:animated)').animate({ 138 scrollTop: jq3('.tab-page.active').offset().top 139 }, 'fast'); 140 }); 141 142 } 143 144}; 145 146 147// check for a resize of width 148function resizeWidth() { 149 var existingWidth = jq3(document).data('resize-width'); 150 var newWidth = jq3(document).width(); 151 if (existingWidth !== newWidth) { 152 responsive(); 153 jq3(document).data('resize-width', newWidth); 154 } 155} 156 157// Document Ready Function 158jq3(document).ready(function (jq3) { 159 160 // Mega menu -- show menu based on data attribute 161 jq3('ul.primary-nav.mega li.has-children a').on('click', function (e) { 162 e.preventDefault(); 163 var showMega = jq3(this).parent('li').attr('data-mega'); 164 console.log(showMega); 165 // Open currently selected mega menu 166 if (jq3(this).parent('li').hasClass('open')) { 167 jq3('ul.primary-nav.mega li.has-children').removeClass('open'); 168 jq3('.mega-wrap, .mega-products').fadeOut(); 169 jq3('.mega-overlay').hide(); 170 jq3('ul.mega-sub-menu li.has-mega').each(function () { 171 jq3(this).removeClass('open'); 172 }); 173 // Close other mega menus on click of navigation 174 } else { 175 jq3('ul.primary-nav.mega li.has-children').not(jq3(this).parent('li')).each(function () { 176 jq3(this).removeClass('open'); 177 jq3('ul.mega-sub-menu li.has-mega').each(function () { 178 jq3(this).removeClass('open'); 179 }); 180 }); 181 jq3(this).parent('li').addClass('open'); 182 jq3('.mega-wrap, .mega-products').hide(); 183 jq3('#' + showMega + '.mega-wrap, .mega-products.default').fadeIn(200); 184 jq3('.mega-overlay').show(); 185 } 186 }); 187 188 // Mega menu - functionality of sub-menu mega menus 189 jq3('ul.mega-sub-menu li.has-mega a').on('click', function (e) { 190 e.preventDefault(); 191 var openMega = jq3(this).parent('li').attr('data-mega'); 192 console.log(openMega); 193 jq3('ul.mega-sub-menu li.has-mega').not(jq3(this).parent('li')).each(function () { 194 jq3(this).removeClass('open'); 195 }); 196 jq3(this).parent('li').addClass('open'); 197 jq3('.mega-products').not(openMega).hide(); 198 jq3('.mega-products.' + openMega).fadeIn(200); 199 }); 200 201 // Build search box for banners and add placeholder text 202 jq3('.search-wrap, .search-banner').append('<span class="fas fa-search"></span>'); 203 jq3('#ContentAreaCPh_T28432038004_ctl00_ctl00_searchTextBox').attr('placeholder', 'Search Site'); 204 jq3('.sfsearchTxt').each(function () { 205 jq3(this).attr('placeholder', 'Search...'); 206 }); 207 208 // Build custom pretty dropdown box 209 // $('select.primary').prettyDropdown({ 210 // height: 38, 211 // customClass: 'primary' 212 // // selectedMarker: '<i class="fas fa-caret-down"></i>' 213 // }); 214 215 // Build page banner background based on supplied image 216 var bannerImg = jq3('.banner img.full-banner').prop('src'); 217 if (bannerImg) { 218 jq3('.banner .img-wrap').css('background-image', 'url(' + bannerImg + ')'); 219 } 220 221 // Expand all functionality for Bootstrap collapse 222 jq3('#allExpand').on('click', function () { 223 $('.collapse').collapse('show'); 224 jq3(this).hide(); 225 jq3('#allCollapse').show(); 226 }); 227 228 // Collapse all functionality for Bootstrap collapse 229 jq3('#allCollapse').on('click', function () { 230 $('.collapse').collapse('hide'); 231 jq3(this).hide(); 232 jq3('#allExpand').show(); 233 }); 234 235 // Add product title above list of products on category pages 236 var productTitle = jq3('h1.product-title').html(); 237 if (productTitle) { 238 jq3('#productSection').html(productTitle); 239 } 240 241 // Toggle functionality for product list cards 242 jq3('.list-toggle').on('click', function () { 243 var listToggle = jq3(this).attr('data-listToggle'); 244 jq3(this).toggleClass('active'); 245 jq3('#' + listToggle).slideToggle(100); 246 }); 247 248 // Remove dropdown icon for product lists with empty sub categories 249 jq3('ul.link-list.cat-list').each(function () { 250 if (!jq3(this).has('li').length) { 251 jq3(this).parents('.text-wrap').find('.title-wrap .trigger').remove(); 252 } 253 }); 254 255 // Hover animation for featured news cards 256 jq3('.feature-card').on('mouseover', function () { 257 jq3(this).children('.text-wrap').addClass('active'); 258 jq3(this).on('mouseleave', function () { 259 jq3(this).children('.text-wrap').removeClass('active'); 260 }); 261 }); 262 263 // Dropdown functionality for Corp homepage panels 264 jq3('.trigger.home').on('click', function () { 265 var homeTrigger = jq3(this).find('.trigger.data'); 266 var panelOpen = jq3(homeTrigger).attr('data-panel'); 267 jq3('.content-card').not(jq3(this).children('.content-card')).removeClass('active'); 268 jq3(this).children('.content-card').toggleClass('active'); 269 jq3('.collapse-panel').not('#' + panelOpen).hide().removeClass('active'); 270 jq3('#' + panelOpen).slideToggle(200).toggleClass('active'); 271 }); 272 273 // Hide no events text if Events exist 274 if (!jq3('.sub-banner ul.news-list.event').length) { 275 jq3('.btn-primary.events').remove(); 276 } else { 277 jq3('p.no-events').remove(); 278 } 279 280 // Hide language select if only English
281 if(jq3('.sflanguagesDropDown').length) { 282 var testLength = jq3('.sflanguagesDropDown option').length; 283 if(testLength < 2) { 284 jq3('.sflanguagesDropDown').parents('.lang-switch').css('display', 'none'); 285 } 286 } 287 288 // Wrap all download tables in responsive class 289 jq3('.sfdownloadTable').addClass('table-responsive'); 290 291 // Youtube video modal construction 292 jq3('.modal-toggle.video').on('click', function (e) { 293 e.preventDefault(); 294 var videoCode = jq3(this).attr('data-video'); 295 console.log(videoCode); 296 //jq3('#video-player').attr('src', 'https://www.youtube.com/embed/' + videoCode + '?rel=0&autoplay=1'); 297 var videoFrame = '<iframe src="https://www.youtube.com/embed/' + videoCode + '?rel=0&autoplay=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'; 298 jq3('#videoModal').find('.vidwrap').html(videoFrame); 299 }); 300 301 // Removes Youtube video source on modal close 302 jq3('#videoModal').on('hidden.bs.modal', function () { 303 console.log('Hidden'); 304 //jq3('#video-player').removeAttr('src'); 305 jq3('#videoModal').find('iframe').remove(); 306 }); 307 308 // Engineered Systems image map 309 if (jq3(window).width() < 976) { 310 jq3('.map-btn').on('tap click', function (event) { 311 event.stopPropagation(); 312 jq3('.caret, .map-tooltip').hide(); 313 jq3(this).children('.caret, .map-tooltip').toggle(); 314 }); 315 jq3(document).on('tap click', function () { 316 jq3('.map-btn').children('.caret, .map-tooltip').hide(); 317 }); 318 } else { 319 jq3('.map-btn').on('mouseenter', function (e) { 320 jq3(this).children('.caret, .map-tooltip').show(); 321 jq3(this).on('mouseleave', function () { 322 jq3(this).children('.caret, .map-tooltip').hide(); 323 }); 324 e.preventDefault(); 325 }); 326 } 327 328 // Adding target="_blank" to Event lists 329 if (jq3('ul.event-details').length) { 330 jq3(this).find('[data-sf-field="ContactWeb"] a').attr('target', '_blank'); 331 } 332 333 // Document click functions -- removing classes when clicking off elements 334 jq3(document).click(function (event) { 335 if (!jq3(event.target).closest('.list-toggle').length) { 336 jq3('body').find('.nav-list').slideUp(100); 337 jq3('body').find('.list-toggle.active').removeClass('active'); 338 } 339 if (!jq3(event.target).closest('ol.map-list li a, .map-indicator, .map-product').length) { 340 jq3('body').find('.map-product').hide(); 341 jq3('ol.map-list li a, ol.map-list li, .map-indicator').removeClass('active'); 342 } 343 if (!jq3(event.target).closest('.mega-menu-nav, .mega-wrap').length) { 344 jq3('ul.primary-nav.mega li.has-children').each(function () { 345 jq3(this).removeClass('open'); 346 }); 347 jq3('ul.mega-sub-menu li.has-mega').each(function () { 348 jq3(this).removeClass('open'); 349 }); 350 jq3('.mega-wrap, .mega-products').fadeOut(); 351 jq3('.mega-overlay').hide(); 352 } 353 }); 354 355 // ---- Sticky sidebar functionality 356 // Cache selectors 357 var lastId, 358 topMenu = jq3(".sticky"), 359 topMenuHeight = topMenu.outerHeight() + 15, 360 // All list items 361 menuItems = topMenu.find("a"), 362 // Anchors corresponding to menu items 363 scrollItems = menuItems.map(function () { 364 var item = jq3(jq3(this).attr("href")); 365 if (item.length) { 366 return item; 367 } 368 }); 369 // Bind to scroll 370 jq3(window).scroll(function () { 371 // Get container scroll position 372 var fromTop = jq3(this).scrollTop() + topMenuHeight; 373 374 // Get id of current scroll item 375 var cur = scrollItems.map(function () { 376 if (jq3(this).offset().top < fromTop) 377 return this; 378 }); 379 // Get the id of the current element 380 cur = cur[cur.length - 1]; 381 var id = cur && cur.length ? cur[0].id : ""; 382 383 if (lastId !== id) { 384 lastId = id; 385 // Set/remove active class 386 menuItems 387 .parent().removeClass("active") 388 .end().filter("[href='#" + id + "']").parent().addClass("active"); 389 } 390 }); 391 // Jump buffer 392 jq3('.sticky').parent('.sf_cols').css('align-items', 'flex-start'); 393 jq3('.sticky a').click(function (e) { 394 e.preventDefault(); 395 var jumpId = jq3(this).attr('href'); 396 jq3('body,html').animate({ 397 scrollTop: $(jumpId).offset().top - 50 398 }, 'slow'); 399 }); 400 401 // Jump button animation 402 jq3('.jump-btn').click(function (e) { 403 e.preventDefault(); 404 var jumpId = jq3(this).attr('href'); 405 jq3('body,html').animate({ 406 scrollTop: $(jumpId).offset().top - 50 407 }, 'slow'); 408 }); 409 410 // Remove jump button if ID doesn't exist 411 if(!jq3('#contactOPWES').length) { 412 jq3('.jump-btn').hide(); 413 } 414 415 // Remove all items with remove-empty class 416 jq3('.remove-empty').remove(); 417 418 // Fire tab functionality 419 jq3(tabFunctions); 420 421 // Fire resize function on window resize 422 jq3(resizeWidth); 423 424}); 425 426// Digital Resource Center Image Gallery Page Fix 427jq3('.sfimagesTmbList.sfTmbDetailsMode .sfimagesTmb').each(function() { 428 var href = jq3(this).find('h4 a').attr('href'); 429 jq3(this).find('.drc-image').attr('href', href); 430 jq3(this).find('h4 a').attr('target', '_blank'); 431 jq3(this).find('.drc-image').attr('target', '_blank'); 432}); 433 434// Window on Load function 435jq3(window).on('load', function (e) { 436 437 // add language classes to French and German sites to adjust language-specific issues 438 if (window.location.href.indexOf("/ru") != -1) { 439 jq3('html').addClass('ru'); 440 } 441 442 jq3('#downloads').addClass('no-anchor'); 443 jq3('.page-anchor').addClass('no-anchor'); 444 445}); 446 447// Resize Window Function 448jq3(window).resize(resizeWidth);
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.