1/////////////////////////////// PLUGINS ///////////////////////////// 2 3// please compress and add non product plugins here until the build 4// tool is up and running, thanks 5 6///////////////////////////////////////////////////////////////////// 7 8(function (w, app) { 9 10 "use strict" 11 12 // You can pass options to your placements here as below, the 13 // settings for a cycle slide show. You should remove this if you 14 // are not using it :) 15 16 app.placementOptions["cycleslideshow"] = { 17 ".cycle-slideshow": { 18 speed: 800, 19 timeout: 10000, 20 fx: "fade", 21 fit: 1, 22 pager: '.decoration-right', 23 before: "", 24 after: "" 25 } 26 }; 27 28 /* -- tabs slideshow -- */ 29 app.placementOptions["tabslideshow"] = { 30 ".tabs-slider": {} 31 }; 32 /* -------------- */ 33 34 /* -- carousel slideshow -- */ 35 app.placementOptions["carouselslideshow"] = { 36 ".carousel-slideshow": { 37 visible: 1, 38 wrap: 'circular', 39 scroll: 1, 40 buttonNextHTML: '<div class="carousel-control-wrap"><div class="carousel-control no-select"></div></div>', 41 buttonPrevHTML: '<div class="carousel-control-wrap"><div class="carousel-control no-select"></div></div>', 42 itemFallbackDimension: '500' 43 } 44 }; 45 46 /* -- carousel gallery slideshow -- 47 Customizable options: 48 (This gallery is using two instances of the same jQ plugin therefore you have 49 the option to customize them separately) 50 -- for full list of options please visit: http://caroufredsel.dev7studios.com/configuration.php 51 MAIN IMAGE SLIDER: 52 - option name: mainImageSliderSettings 53 - example: mainImageSliderSettings:{ scroll:{fx: 'crossfade'} } 54 THUMBNAIL IMAGE SLIDER: 55 - option name: thumbnailSliderSettings 56 ! It has three sub-option containers! 57 - plugin: This is for plugin customization! (anything but 'scroll' can be used) 58 - scrollItems (separate option as 'scroll' is prohibited in plugin) 59 - scrollDuration (separate option as 'scroll' is prohibited in plugin) 60 - changeImageByNextPrev (true/false can define if next/prev clicks change main image) 61 - example: thumbnailSliderSettings:{ 62 plugin:{ 63 items: {visible: {min: 3,max: 3}} 64 }, 65 scrollItems:3, 66 scrollDuration:400, 67 changeImageByNextPrev:true 68 } 69 */ 70 app.placementOptions["carouselgallery"] = { 71 ".carousel-gallery": { 72 mainImageSliderSettings: { 73 /* eg.: scroll: {fx: 'directscroll'} */ 74 }, 75 thumbnailSliderSettings: { 76 /* eg.: plugin:{},scrollItems:3,scrollDuration:400,changeImageByNextPrev:true */ 77 } 78 } 79 }; 80 81 /* 82 - `topSpacing`: Pixels between the page top and the element's top. 83 - `bottomSpacing`: Pixels between the page bottom and the element's bottom. 84 - `className`: CSS class added to the element and its wrapper when "sticked". 85 - `wrapperClassName`: CSS class added to the wrapper. 86 - `getWidthFrom`: Selector of element referenced to set fixed width of "sticky" element. 87 88 */ 89 90 app.placementOptions["stickyMenu"] = { 91 selector: ".top-navigation", 92 topSpacing: 0, 93 bottomSpacing: 0, 94 className: "", 95 wrapperClassName: '', 96 getWidthFrom: '' 97 98 }; 99 100 101 102 /* 103 104 Please put your plugin initialisation and any other 105 code within this function. 106 107 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 108 DO NOT put any document.ready ( $(function() {}) ) 109 code here, this is handled by the framework. 110 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 111 112 */ 113 app.atPageLoad(function () { 114 115 /* 116 Actions awaiting Login JS Automatic Redirect code 117 */ 118 if ($('[data-action-await-login-type]').length) { 119 var $aalItem = $('[data-action-await-login-type]'); 120 var redirectTime = parseInt($aalItem.data("aal-redirect-time")); 121 setTimeout(function () { 122 if ($aalItem.data("action-await-login-type") == "form") { 123 $aalItem.find("form").submit(); 124 } else if ($aalItem.data("action-await-login-type") == "url") { 125 window.location.href = $aalItem.find("a").attr('href'); 126 } 127 }, redirectTime); 128 } 129 //End actions awaiting login JS 130 131 /* -------------- \/ add your code here \/ ----------------- */ 132 133 //Report tree quiz 134 135 // Find the first .rt-node-head within an element whose ID contains "_first" 136 var firstRtNodeHead = $(".type-reporttree.quiz-tree .rt-node-head").filter(function() { 137 return $(this).parent().closest("[id*='_first']").length > 0; 138 }).first(); 139 140 // Simulate a click on the firstRtNodeHead element 141 firstRtNodeHead.click().off('click'); 142 143 // Loop through each .rt-node-head element 144 $(".type-reporttree.quiz-tree .rt-node-head").each(function() { 145 // Find the immediate child .rt-node-name element 146 var rtNodeName = $(this).children(".rt-node-thumb").first(); 147 148 // Check if rtNodeName exists
149 if (rtNodeName.length > 0) { 150 // Remove rtNodeName from its current position (prevents duplicates) 151 rtNodeName.detach(); 152 153 // Move rtNodeName as a sibling after the current rt-node-head 154 $(this).before(rtNodeName); 155 } 156 }); 157 158 $(".type-reporttree.quiz-tree .rt-node-thumb:has(img)").each(function() { 159 // Get the current .rt-node-thumb element 160 var rtNodeThumb = $(this); 161 162 // Find the img element within the current rtNodeThumb (redundant here) 163 var imgElement = rtNodeThumb.find("img"); 164 165 // Get the current image src attribute 166 var currentSrc = imgElement.attr("src"); 167 168 // Replace "thumbs/" with "img94joktmu7" (or your desired change) 169 var newSrc = currentSrc.replace("thumbs/", "img94joktmu7"); 170 171 // Update the image src attribute with the modified path 172 imgElement.attr("src", newSrc); 173 }); 174 175 $(' .type-reporttree.quiz-tree .rt-node-head').each(function() { 176 $(this).next().before($('<div class="steps"></div>')); 177 }); 178 179 180 $(' .type-reporttree.quiz-tree .rt-node-head').click(function() { 181 // Get the clicked rt-node-head element 182 var clickedHead = $(this); 183 184 // Get the text content of the .rt-node-name within the clicked head 185 var nodeName = clickedHead.find('.type-reporttree.quiz-tree .rt-node-name').text().trim(); 186 187 if (clickedHead.parent().parent().hasClass('rt-node-top-level')) { 188 return; // Exit the function if it's a top-level node 189 } 190 191 // Check if the clicked head is now a direct child of .rt-node-expanded 192 if (clickedHead.parent().hasClass('rt-node-expanded')) { 193 // Loop through all .steps divs 194 $('.steps').each(function() { 195 var stepsDiv = $(this); 196 197 // Find exact matching li item with the nodeName 198 var existingItem = stepsDiv.find('li').filter(function() { 199 return $(this).text().trim() === nodeName; 200 }); 201 202 // If the nodeName exists, remove the li item 203 if (existingItem.length) { 204 existingItem.remove(); 205 } else { 206 // If it doesn't exist, create a new li item with the nodeName 207 stepsDiv.append('<li>' + nodeName + '</li>'); 208 } 209 }); 210 } else { 211 // Loop through all .steps divs 212 $('.steps').each(function() { 213 var stepsDiv = $(this); 214 215 // Find exact matching li item with the nodeName 216 var existingItem = stepsDiv.find('li').filter(function() { 217 return $(this).text().trim() === nodeName; 218 }); 219 220 // If the nodeName exists, remove the li item 221 if (existingItem.length) { 222 existingItem.remove(); 223 } else { 224 // If it doesn't exist, create a new li item with the nodeName 225 stepsDiv.append('<li>' + nodeName + '</li>'); 226 } 227 }); 228 } 229 230 }); 231 232 var top_level_head = $('.type-reporttree.quiz-tree .rt-node-top-level > .rt-node > .rt-node-head').find('.rt-node-name').text().trim(); 233 234 $('.steps').each(function() { 235 var stepsDiv = $(this); 236 237 // If it doesn't exist, create a new li item with the nodeName 238 stepsDiv.append('<li>' + top_level_head + '</li>'); 239 }); 240 241 //End of Report tree quiz 242 243 if ($(".media-no-banner .file-listings")[0]) { 244 // Do something if class exists 245 $("html").addClass("lose-banner"); 246 } 247 248 $('.jump-to-submission-form').click(function (e) { 249 e.preventDefault(); 250 $('.forum-submission-form').slideToggle('fast'); 251 }); 252 if ($('.display-forum-thread').length > 0) { 253 $(".forum-submission-form").show(); 254 } 255 256 // Move forum submissino and replies into a side column // 257 // $('.type-forum').each(function () { 258 // var forumSubmission = $(this).find('.forum-submission-form'); 259 // var forumSubmissionTarget = $(this).closest('.main-cols-container').find('.col .type-droplet .content-wrapper-inner'); 260 // forumSubmissionTarget.append(forumSubmission); 261 // var forumReply = $(this).find('#forum-reply-attempt-success'); 262 // forumSubmissionTarget.append(forumReply); 263 // $(this).closest('.main-cols-container').find('.col .type-droplet').addClass('type-forum'); 264 // }); 265 266 $('form[data-placement-classic-form]').submit(function (ev) { 267 var formThis = $(this); 268 var pastDateInput = formThis.find('.no-past-date'); 269 var futureDateInput = formThis.find('.no-future-date'); 270 271 pastDateInput.each(function () { 272 var dateInputted = ''; 273 if ($(this).find('select').length) { 274 // dropdowns 275 var day = $(this).find('select[data-fieldtype="date-day"]').val();
276 var month = $(this).find('select[data-fieldtype="date-month"]').val(); 277 var year = $(this).find('input[data-fieldtype="date-year"]').val(); 278 279 if (year.length && !month.length && !day.length) { 280 $(this).find('input[data-fieldtype="date-year"]').val("") 281 } 282 283 dateInputted = new Date(year + '-' + month + '-' + day); 284 } else { 285 dateInputted = new Date($(this).find('input').val()); 286 } 287 288 if ($(this).find('.form-date-collection').length) { 289 $(this).find('.form-date-collection').remove(); 290 } 291 292 var dateNow = new Date(); 293 294 // date is less than now, so we stop the form from being submitted and show an an error 295 if (dateInputted < dateNow) { 296 ev.preventDefault(); 297 var submitButton = formThis.find('.button_row input[type="submit"]'); 298 setTimeout(function () { $(submitButton).css("pointer-events", "auto"); }, 500); 299 300 $("<p class='form-date-collection'>You cannot submit a date in the past</p>").insertAfter($(this)); 301 // show feedback message 302 return; 303 } 304 305 306 }); 307 308 futureDateInput.each(function () { 309 var dateInputted = ''; 310 if ($(this).find('select').length) { 311 // dropdowns 312 var day = $(this).find('select[data-fieldtype="date-day"]').val(); 313 var month = $(this).find('select[data-fieldtype="date-month"]').val(); 314 var year = $(this).find('input[data-fieldtype="date-year"]').val(); 315 316 if (year.length && !month.length && !day.length) { 317 $(this).find('input[data-fieldtype="date-year"]').val("") 318 } 319 320 dateInputted = new Date(year + '-' + month + '-' + day); 321 } else { 322 dateInputted = new Date($(this).find('input').val()); 323 } 324 325 if ($(this).find('.form-date-collection').length) { 326 $(this).find('.form-date-collection').remove(); 327 } 328 329 var dateNow = new Date(); 330 331 // date is less than now, so we stop the form from being submitted and show an an error 332 if (dateInputted > dateNow) { 333 ev.preventDefault(); 334 var submitButton = formThis.find('.button_row input[type="submit"]'); 335 setTimeout(function () { $(submitButton).css("pointer-events", "auto"); }, 500); 336 337 $("<p class='form-date-collection'>You cannot submit a date in the future</p>").insertAfter($(this)); 338 // show feedback message 339 return; 340 } 341 342 343 }); 344 345 }); 346 347 /*Sticky nav - NEED TO ADJUST HEIGHTS OF WHEN IT KICKS IN*/ 348 // var accHeight = $("#accessibility-controls").outerHeight(true); 349 // var headerHeight = $("#site-header-row").outerHeight(true); 350 // var accHeaderHeight = headerHeight + accHeight; 351 // var navHeight = $("#site-nav-row").innerHeight(); 352 // $(window).scroll(function () { 353 // if ($(window).scrollTop() > accHeaderHeight) { 354 // $('#site-nav-row').addClass('navbar-fixed-top'); 355 // $('html').addClass('navbar-is-fixed'); 356 // if ($(window).width() > 1024) { 357 // $("#main-content").css("margin-top", (navHeight + "px")); 358 // } 359 // } 360 // if ($(window).scrollTop() < accHeaderHeight) { 361 // $('.site-nav-row').removeClass('navbar-fixed-top'); 362 // $('html').removeClass('navbar-is-fixed'); 363 // if ($(window).width() > 1024) { 364 // $("#main-content").css("margin-top", ""); 365 // } 366 // } 367 // }); 368 369 // Left aligned images 370 $('img').filter(function () { 371 return $(this).css('float') === 'left'; 372 }).addClass('content-image-aligned-left'); 373 374 // Right aligned images 375 $('img').filter(function () { 376 return $(this).css('float') === 'right'; 377 }).addClass('content-image-aligned-right'); 378 379 // external links 380 $('p a[target=_blank]') 381 .attr('title', 'Opens in a new window') 382 .addClass('newindow'); 383 384 // Blog Archives Toggle 385 $('.archives-list.month:gt(0)').hide(); 386 387 $('.archives-list.month:eq(0)').parent().find('a').addClass('open'); 388 389 $('.archive-list-item-year-toggle').click(function (ev) { 390 ev.preventDefault(); 391 $(this).toggleClass('open'); 392 $(this).next('.archives-list').slideToggle(); 393 }); 394 395 // Add a class to the last menu item in the top nav 396 $('#top-nav li').last().addClass('last-menu-item'); 397 398 // Terms and Conditions toggle 399 $('.terms-and-condition-link').click(function (ev) { 400 var tandc = $('.t-and-c-wrapper'); 401 tandc.slideToggle('slow', function () { }); 402 }); 403 404 $("iframe").wrap("<div class='aspect-ratio'/>"); 405 $('iframe[src*="youtube"]').addClass("youtube"); 406 407 var src = $('.fullwidth-banner').find('img').attr('src'); 408 $('.fullwidth-banner').css('backgroundImage', 'url(' + src + ')'); 409 410 if (!$("html").hasClass("ie8")) { 411 $('.mini-news-slideshow .blog-posts-list').bxSlider({ 412 mode: 'fade' 413 }); 414 415 if ($(window).width() > 580) { 416 $('.home-page .application-status-wrapper .content-items-list').bxSlider({ 417 minSlides: 1, 418 maxSlides: 5, 419 slideWidth: 84, 420 moveSlides: 1, 421 slideMargin: 10 422 }); 423 } 424 425 } 426 427 if ($("html").hasClass("ie8")) { 428 $(".mini-news-slideshow .blog-posts-post").not(":first").remove(); 429 } 430 431 if ($('.home-page .main-article-area-7 #logon-horizon').length) { 432 $("html").addClass("password-reset"); 433 } 434 435 //When you click away from the popup, it will close. 436 $(document).mouseup(function (e) { 437 var container = $(".feedback-popup .placement-inner"); 438 if (!container.is(e.target) && container.has(e.target).length === 0) { 439 $(".feedback-popup").fadeOut().removeClass("show"); 440 } 441 }); 442 443 /*Mobile Nav Toggle*/ 444 // $('.mobile-nav-toggle').click(function (e) { 445 // e.preventDefault(); 446 // $('.top-navigation').slideToggle(400); 447 // $('.mobile-nav-toggle-wrap').toggleClass('open'); 448 // }); 449 /*End mobile nav toggle*/ 450 451 /* from barts*/ 452 453 $('<div class="close-menu-wrap"><a href="#" class="close-menu"><span class="button-text">Close</span></a></div>').prependTo("#site-nav-row > .content-container.top-navigation"); 454 $('#site-nav-row .close-menu-wrap .close-menu').click(function (e) { 455 e.preventDefault(); 456 $("#site-nav-row").fadeToggle(500).toggleClass("menu-open"); 457 $("html").toggleClass("nav-open"); 458 }); 459 $('.nav-row-switch .nav-switch').click(function (e) { 460 e.preventDefault();
461 //$('#top-nav').toggleClass("menu-open").slideToggle(400); 462 $("#site-nav-row").fadeToggle(500).toggleClass("menu-open"); 463 $("html").toggleClass("nav-open"); 464 $(this).toggleClass('open'); 465 }); 466 // $("<div class='mobile-megamenu-viewer'></div>").prependTo(".mega-menu-top-level.has-children"); 467 // $(".mega-menu-top-level.has-children .mega-menu").addClass("closed"); 468 // $('.mobile-megamenu-viewer').click(function (ev) { 469 // ev.preventDefault(); 470 // $(this).toggleClass('open'); 471 // $(this).parent().find('.mega-menu').toggleClass("show"); 472 // }); 473 474 475 $("<div class='mobile-megamenu-viewer'></div>").prependTo(".mega-menu-top-level.has-children"); 476 $(".mega-menu-top-level.has-children .mega-menu").addClass("closed"); 477 $('.mobile-megamenu-viewer').click(function (ev) { 478 ev.preventDefault(); 479 if ($(this).is(".open")) { 480 $(".mega-menu-top-level.has-children .mega-menu").addClass("closed").removeClass("show"); 481 $(".mega-menu").slideUp(); 482 $(".mobile-megamenu-viewer").removeClass("open"); 483 $(".mega-menu-top-level").removeClass("open"); 484 } else { 485 $(".mega-menu-top-level.has-children .mega-menu").addClass("closed").removeClass("show"); 486 $(".mega-menu").slideUp(); 487 $(".mobile-megamenu-viewer").removeClass("open"); 488 $(".mega-menu-top-level").removeClass("open"); 489 $(this).toggleClass('open'); 490 $(this).parent().toggleClass("open"); 491 $(this).parent().find('.mega-menu').slideToggle().toggleClass("show"); 492 } 493 }); 494 495 /*End from barts*/ 496 497 // /* barts scroll top */ 498 // $(window).scroll(function () { 499 // if ($(window).scrollTop() > 110) { 500 // $("#site-header-row").addClass("scrolled"); 501 // } else { 502 // $("#site-header-row").removeClass("scrolled"); 503 // } 504 // }); 505 // /* end - Barts scroll top */ 506 507 508 /* barts scroll top */ 509 $(window).scroll(function () { 510 if ($(window).scrollTop() > 110) { 511 $("#site-header-row").addClass("scrolled"); 512 } else if ($(window).scrollTop() < 100) { 513 $("#site-header-row").removeClass("scrolled"); 514 } 515 }); 516 /* end - Barts scroll top */ 517 518 /*Togglable Blog Comments Form*/ 519 $('.blog-comment-toggle').on('click', function (e) { 520 e.preventDefault(); 521 $("#blg-cmt-frm").slideToggle('fast'); 522 $('.blog-comment-toggle .blog-comment-toggle-icon').toggleClass('open'); 523 }); 524 /*End Togglable Comments Form*/ 525 526 /*Accordion placements*/ 527 $(".accordion .content-headline").click(function (e) { 528 e.preventDefault(); 529 $(this).next(".content-wrapper-inner").slideToggle(); 530 $(this).toggleClass('open'); 531 }); 532 533 /*Accordion placements*/ 534 var $accordionHeadline = $('.accordion-base .content-headline'); 535 $accordionHeadline.wrap('<button type="button" class="actn-btn actn-show-content"></button>'); 536 var $collectionHeadline = $('.accordion-base .item-headline'); 537 $collectionHeadline.wrap('<button type="button" class="actn-btn actn-show-content"></button>'); 538 var $accordionHeadlineWards = $('.accordion-base.type-warddirectoryplacement .main-location-header'); 539 $accordionHeadlineWards.wrap('<button type="button" class="actn-btn actn-show-content"></button>'); 540 $('.accordion-base').each(function () { 541 if ($(this).is(".type-contentcollection")) { 542 $(this).find(".actn-show-content").click(function (e) { 543 e.preventDefault(); 544 $(this).nextAll(".content-wrapper-inner").first().slideToggle(); 545 $(this).toggleClass('open'); 546 }); 547 } else if ($(this).is(".type-warddirectoryplacement")) { 548 $(this).find(".actn-show-content").click(function (e) { 549 e.preventDefault(); 550 $(this).nextAll(".content-item-container").first().slideToggle(); 551 $(this).toggleClass('open'); 552 }); 553 } else { 554 $(this).find(".actn-show-content").click(function (e) { 555 e.preventDefault(); 556 $(this).nextAll(".content-wrapper-inner").first().slideToggle(); 557 $(this).toggleClass('open'); 558 }); 559 } 560 }); 561 562 $('.page-feedback-placement-wrapper').on('click', function () { 563 $('.page-feedback-placement-wrapper .row').slideDown(); 564 }); 565 566 $("#site-content-top-row .placement-row-wrapper").each(function (i, obj) { 567 $(this).addClass("placement-row-wrapper-" + (i + 1)); 568 }); 569 570 $('.site-credits-container').wrapInner('<div class="credits-wrap"></div>'); 571 572 //$(".home-page .site-search .content-headline h2").replaceWith("<h2 class='loaded'>Search our website</h2"); 573 $(".home-page #site-content-top-row .site-search #site-search-form .search-inputs input[type='search']").attr("placeholder", "Search our website"); 574 575 $('.blogs-carousel.type-blogsminilist .blog-posts-list').bxSlider({ 576 minSlides: 3, 577 slideWidth: 378, 578 slideMargin: 0, 579 pager: true, 580 maxSlides: 100,
581 moveSlides: 1, 582 touchEnabled: false, 583 onSliderLoad: function (currentIndex) { 584 $(".news-slider .blog-posts-post[aria-hidden='false']:first").addClass("active-slide"); 585 $(".news-slider").addClass("loaded"); 586 }, 587 onSlideAfter: function ($slideElement) { 588 $('.blog-posts-list').children().removeClass('active-slide'); 589 $slideElement.addClass('active-slide'); 590 } 591 }); 592 593 // $('.type-blogsminilist .bx-controls-direction .bx-prev').clone().prependTo('.type-blogsminilist .bx-default-pager'); 594 // $('.type-blogsminilist .bx-controls-direction .bx-next').clone().appendTo('.type-blogsminilist .bx-default-pager'); 595 596 // 597 // $('.accessibility-controls .page-placement[data-placement-class="SiteSearch"]').wrap('<div class="mobile-search-toggle"></div>'); 598 // 599 // $('.accessibility-controls #placement-20-2 #site-search-form').wrap('<div class="mobile-search-toggle"></div>'); 600 // 601 // 602 // $('#placement-20-2').wrap('<div class="mobile-search-toggle"></div>'); 603 604 605 $("#site-banner-row .type-slideshow .individual-slides").append("<div class='hover-pseudo'><a href='#main-content'></a></div>"); 606 607 $('#site-banner-row .type-slideshow').closest('#site-banner-row').siblings('#site-header-row').addClass('has-slideshow'); 608 609 610 $(".hover-pseudo a").on("click", function (e) { 611 if ("" !== this.hash) { 612 e.preventDefault(); 613 var t = this.hash; 614 $("html, body").animate({ 615 scrollTop: $(t).offset().top - 82 616 }, 800, function () { 617 window.location.hash = t 618 }) 619 } 620 }); 621 622 623 $('<div class="mobile-search-toggle"></div>').insertBefore('#placement-20-4'); 624 625 $('.col .main-editor-output p > a:contains("@")').addClass('has-email'); 626 627 $('.mobile-search-toggle').on('click', function (e) { 628 e.preventDefault(); 629 $(this).next(".page-placement").slideToggle(); 630 $(this).toggleClass('open'); 631 }); 632 633 //ACCORDION MAGIC 634 $("h3 strong").parent().addClass("accordion-switch"); 635 $('.accordion-switch').each(function () { 636 $(this).nextUntil(".accordion-switch").wrapAll('<div class="accordion-content" />'); 637 }); 638 $('.accordion-switch').on('click', function (e) { 639 e.preventDefault(); 640 $(this).next(".accordion-content").slideToggle(); 641 $(this).toggleClass('open'); 642 }); 643 644 $('dt').each(function () { 645 $(this).next('dd').add(this).wrapAll('<div class="sd-detail-wrapper">'); 646 }); 647 648 function slideshowResize() { 649 var sliderHeight = $('.type-slideshow .slider .individual-slides').map(function () { 650 return $(this).height(); 651 }).get(); 652 var maxHeight = Math.max.apply(null, sliderHeight); 653 $('.type-slideshow .slider').css("height", maxHeight); 654 } 655 656 if ($('.type-slideshow').length > 0) { 657 if ($(window).width() < 1025) { 658 slideshowResize(); 659 $(window).resize(function () { 660 slideshowResize(); 661 }); 662 } 663 } 664 665 var $megaAllMenuKids = $('.mega-menu'); 666 // $(function () { 667 // var timer; 668 // $('.mega-menu-top-level').hover(function () { 669 // var self = $(this); 670 // timer = setTimeout(function () { 671 // $megaAllMenuKids.hide(); 672 // self.find('.mega-menu').fadeIn("slow"); 673 // }, 250); 674 // }, function () { 675 // clearTimeout(timer); 676 // $(this).find('.mega-menu').fadeOut("fast"); 677 // }); 678 // }); 679 680 if ($('.file-list-wrap #document').length > 0) { 681 $('html, body').animate({ 682 scrollTop: $("#document").offset().top 683 }, 500); 684 } 685 686 //VENUE - SERVICE LOCATOR 687 // Expand venue options 688 $(".has-sub-options").find('span.expand').click(function () { 689 $(this).closest('.has-sub-options').toggleClass('open').find('.sub-options').slideToggle('fast') 690 }); 691 692 //Venues to Services on search 693 $(".input-name-site-search-index-type-venue").replaceWith('<label class="input-label input-name-site-search-index-type-venue" for="site-search-index-type-venue-7">Services</label>'); 694 $(".entity-type.venue").replaceWith('<span class="entity-type venue">Service</span>'); 695 696 697 if (!$(".form table").hasClass("matrixQuestions")) { 698 $(".form table").addClass("group-question"); 699 } 700 701 //content-collection START 702 // $('.features .list-content-item:lt(8)').addClass("show-features"); 703 $('.features .list-content-item').addClass("show-features"); 704 $("<div class='expand-feature'><a href='##' class='expand-all'>See more options</a></div>").insertAfter(".features .list-content-item:nth-child(8)"); 705 706 // $('.expand-all').on('click', function (e) { 707 // e.preventDefault(); 708 // $('.features .list-content-item').toggleClass('expand'); 709 // }); 710 711 // $('.features .main-editor-output').each(function (i) { 712 // $(this).wrapInner("<div class='overlay'><div class='overlay-inner'><div class='popup'/><div class='close'><span>X</span></div></div></div></div>"); 713 // }); 714 715 $('.features .main-editor-output').each(function (i) { 716 $(this).wrapInner("<div class='overlay'><div class='overlay-inner'><div class='popup'/></div></div></div>"); 717 }); 718 719 $('.features .main-editor-output .popup').each(function (i) { 720 $(this).append("<div class='close'><span>X</span></div>"); 721 }); 722 723 // $('.features pre').on('click', function (e) { 724 // e.preventDefault(); 725 // $(this).nextAll('.overlay').fadeToggle(); 726 // }); 727 728 // $('.features .show-features').on('click', function (e) { 729 // e.preventDefault(); 730 // $(this).nextAll('.overlay').fadeToggle(); 731 // }); 732 733 // this works 734 // $('.features .show-features').on('click', function (e) { 735 // e.preventDefault(); 736 // $(this).find('.overlay').fadeToggle(); 737 // $("html").toggleClass("content-col-open"); 738 // 739 // }); 740 741 $('.features .show-features .item-headline').on('click', function (e) { 742 e.preventDefault(); 743 $(this).parent().find('.overlay').fadeToggle(); 744 $("html").addClass("content-col-open"); 745 746 }); 747 748 $('.features .overlay .close').on('click', function (e) { 749 e.preventDefault(); 750 $(this).closest('.overlay').fadeToggle(); 751 $("html").removeClass("content-col-open"); 752 753 }); 754 755 $('.expand-all').on('click', function (e) { 756 e.preventDefault(); 757 $('.features .list-content-item').toggleClass('expand'); 758 $(this).toggleClass('open'); 759 $(this).closest('.content-items-list').toggleClass('show-all'); 760 }); 761 762 $('.features').each(function() { 763 var $thisFeature = $(this); 764 if ($thisFeature.find('.content-items-list .expand-feature').nextAll('.list-content-item').length > 0) { 765 $thisFeature.find('.content-items-list').addClass('has-options'); 766 } 767 }); 768 769 //content-collection END 770 771 //Code for interactive image 772 $(".interactive-image .type-contentcollection").parent().parent().addClass("collection-row"); 773 774 $('.collection-row .list-content-item .content-wrapper-inner').each(function (i) { 775 $(this).append("<a href='#' class='close' tab-index='0'><span>X</span></a>"); 776 }); 777 778 var dialogInteractive; 779 var disabledInteractive; 780 781 function openInteractive() { 782 disabledInteractive = ally.maintain.disabled({ 783 filter: dialogInteractive, 784 }); 785 dialogInteractive.hidden = false;
786 } 787 788 function closeInteractive() { 789 disabledInteractive.disengage(); 790 dialogInteractive.hidden = true; 791 } 792 793 function spot(clicked_href) { 794 var href = clicked_href; //store info from spot on click 795 var removableUrl = '#'; //store section of url to remove on variable 796 var removableUrl2 = 'https://www.nhft.nhs.uk/'; //store section of url to remove on variable 2 797 798 if (href.includes(removableUrl)) { 799 href = href.substring(removableUrl.length); //update href variable 800 } 801 if (href.includes(removableUrl2)) { 802 href = href.substring(removableUrl2.length); //update href variable 2 803 } 804 $('.list-content-item[id="' + href + '"]').addClass("open"); //select item with id = to href value 805 $('.collection-row').addClass("open"); //add class to content collection 806 dialogInteractive = $('.list-content-item[id="' + href + '"]'); 807 //openInteractive(); 808 } 809 810 // $('.spot').on('click', function(event) { 811 // event.preventDefault(); 812 // spot(event.target.href); 813 // }); 814 815 // V2(5) interactive image svg 816 $('svg a').on('click', function (event) { 817 if ($(this).attr("xlink:href") != undefined && $(this).attr("xlink:href").length > 0) { 818 event.preventDefault(); 819 spot($(this).attr("xlink:href")); 820 } else if ($(this).attr("href").length > 0 && $(this).attr("id") != undefined) { 821 event.preventDefault(); 822 spot($(this).attr("href")); 823 } 824 }); 825 826 $('.close').on('click', function (event) { 827 event.preventDefault(); 828 $('.list-content-item').removeClass("open"); 829 $('.collection-row').removeClass("open"); 830 closeInteractive(); 831 }); 832 833 //code for interactive image finishes 834 835 //code for digital evetn page style 836 $(".digital-event #site-header-row #logo img").attr("src", "/base-install/images/_site/ics-logo.png"); 837 838 $('.digital-event .type-textcontent .content-wrapper:not(.no-main-image-display)').closest('.placement-row-wrapper').addClass('has-image-textcontent'); 839 840 // $(".pop-up-box").parent().parent().addClass("pop-up-box-row"); 841 842 // $('.pop-up-box .content-item-inner').each(function (i) { 843 // $(this).append("<div class='close' tab-index='0' ><span>X</span></div>"); 844 // }); 845 846 $('.pop-up-box').each(function (i) { 847 var tittlePop = ""; 848 $(this).parent().parent().addClass("pop-up-box-row"); 849 $(this).find('.content-item-inner').append("<a href='#' class='close' tab-index='0' ><span>X</span></a>"); 850 tittlePop = $(this).find('.content-headline h2').prop('innerHTML'); 851 852 if (tittlePop === "Marketplace") { 853 $(this).addClass("marketplace"); 854 $(this).parent().parent().addClass("marketplace"); 855 } else { 856 $(this).addClass("wellbeing"); 857 $(this).parent().parent().addClass("wellbeing"); 858 } 859 }); 860 861 $(".pop-up-box-row").appendTo(".image-map-wrapper"); 862 863 var dialogMarket = $('.pop-up-box.marketplace'); 864 var dialogWellbeing = $('.pop-up-box.wellbeing'); 865 var disabledHandleMarket; 866 var disabledHandleWellbeing; 867 868 function openDialogMarket() { 869 disabledHandleMarket = ally.maintain.disabled({ 870 filter: dialogMarket, 871 }); 872 dialogMarket.hidden = false; 873 } 874 function closeDialogMarket() { 875 disabledHandleMarket.disengage(); 876 dialogMarket.hidden = true; 877 } 878 function openDialogWellbeing() { 879 disabledHandleWellbeing = ally.maintain.disabled({ 880 filter: dialogWellbeing, 881 }); 882 dialogWellbeing.hidden = false; 883 } 884 function closeDialogWellbeing() { 885 disabledHandleWellbeing.disengage(); 886 dialogWellbeing.hidden = true; 887 } 888 889 function pop(s) { 890 var hrefPop = s; 891 var removableUrlPop = "https://www.nhft.nhs.uk/"; 892 var length = removableUrlPop.length; 893 hrefPop = hrefPop.substring(length); 894 if (hrefPop === "marketplace") { 895 $('.pop-up-box.marketplace').addClass("open"); 896 $('.pop-up-box-row.marketplace').addClass("open"); 897 openDialogMarket(); 898 } else if (hrefPop === "wellbeing") { 899 $('.pop-up-box.wellbeing').addClass("open"); 900 $('.pop-up-box-row.wellbeing').addClass("open"); 901 openDialogWellbeing(); 902 } else { 903 904 } 905 } 906 907 $('#marketplace-link').on('click', function (event) { 908 event.preventDefault(); 909 pop(event.currentTarget.href.baseVal); 910 }); 911 912 $('#wellbeing-link').on('click', function (event) { 913 event.preventDefault(); 914 pop(event.currentTarget.href.baseVal); 915 }); 916 917 $('.image-map-wrapper .pop-up-box-row.marketplace .close').on('click', function (event) { 918 event.preventDefault(); 919 $('.pop-up-box').removeClass("open"); 920 $('.pop-up-box-row').removeClass("open"); 921 closeDialogMarket(); 922 }); 923 924 $('.image-map-wrapper .pop-up-box-row.wellbeing .close').on('click', function (event) { 925 event.preventDefault(); 926 $('.pop-up-box').removeClass("open"); 927 $('.pop-up-box-row').removeClass("open"); 928 closeDialogWellbeing(); 929 }); 930 931 932 //console.log(linkTest[0].href.baseVal); 933 934 //code for digital event finishes. 935 936 $("select[data-fieldtype='date-month']").each(function () { 937 var tmpMonthVal = $(this).val(); 938 $(this).find("option[value='']").replaceWith("<option value=''>Month</option>"); 939 if (!tmpMonthVal) { 940 $(this).val(''); 941 } 942 }); 943 944 $("select[data-fieldtype='date-day']").each(function () { 945 var tmpMonthVal = $(this).val(); 946 $(this).find("option[value='']").replaceWith("<option value=''>Day</option>"); 947 if (!tmpMonthVal) { 948 $(this).val(''); 949 } 950 }); 951 952 953 $(".important-notice .content-items-list").bxSlider({ 954 minSlides: 1, 955 maxSlides: 1, 956 slideMargin: 10, 957 ticker: true, 958 speed: 40000 959 }); 960 961 // Adding tabbed blogs lists 962 // To add jQuery in the Chrome console, paste: 963 // var script=document.createElement('script');script.src='https://code.jquery.com/jquery-3.6.0.min.js';document.head.appendChild(script); 964 965 $('#site-content-bottom-row .srr-categorised-blog-collection').each(function(i) { 966 if (i == 0){ 967 $(this).find('.content-item.list-content').prepend('<ul class="tabindex"></ul>'); 968 $(this).addClass('primary-tabbed-container'); 969 $(this).find('.content-item-inner').attr('id', 'tab-'+ (i + 1) +''); 970 var tabTitleName = $(this).find('.content-headline h2').text(); 971 $("<li><a href='#tab-"+ (i + 1) +"'>" + tabTitleName + "</a></li>").appendTo('.primary-tabbed-container .tabindex'); 972 973 } else{ 974 var tabTitleName = $(this).find('.content-headline h2').text(); 975 $("<li><a href='#tab-"+ (i + 1) +"'>" + tabTitleName + "</a></li>").appendTo('.primary-tabbed-container .tabindex'); 976 $(this).find('.content-item-inner') 977 .attr('id', 'tab-'+ (i + 1) +'') 978 .appendTo($('.primary-tabbed-container .content-item.list-content')); 979 980 } 981 }); 982 983 $(function() { 984 $(".primary-tabbed-container .content-item.list-content").tabs(); 985 }); 986 987 $('.primary-tabbed-container .list-content-item').each(function () { 988 var $item = $(this); 989 var $container = $item.find('.content-item-container'); 990 var $figure = $item.children('figure.content-main-image'); 991 var $title = $item.find('h3'); 992 var $date = $item.find('.footer-date'); 993 994 if ($figure.length) { 995 $container.prepend($figure); 996 } 997 998 if ($title.length) { 999 if ($figure.length) { 1000 $figure.after($title); 1001 } else { 1002 $container.prepend($title); 1003 } 1004 } 1005 1006 if ($date.length) { 1007 $container.append($date); 1008 } 1009 }); 1010 1011 $('.placement-row:has(.primary-tabbed-container)').append('<div class="decorations"></div>'); 1012 1013 // Reorganize grid-view-list items: move figure to top, wrap p content 1014 $('.grid-view-list li.list-content-item').each(function () { 1015 var $item = $(this); 1016 var $figure = $item.find('figure.content-main-image'); 1017 var $contentContainer = $item.find('.content-item-container'); 1018 var $paragraph = $contentContainer.children('p'); 1019 1020 // Move figure to the top (first child) 1021 if ($figure.length) { 1022 $item.prepend($figure); 1023 } 1024 1025 // Wrap paragraph content in a div if it exists 1026 if ($paragraph.length) { 1027 $paragraph.wrap('<div></div>'); 1028 } 1029 }); 1030 1031 /* --------------------- /\ /\ /\ /\ /\ -------------------- */ 1032 1033 // simlpemediabrowser - toggle the folder list 1034 app.SMB = {}; 1035 app.SMB.setupCollapsibleFolderList = function ($parent) { 1036 $parent.find('button[data-smbfolderlisttoggle]') 1037 .click( 1038 function (ev) { 1039 if (!$(this).hasClass('expanded')) { 1040 $('div[data-smbfolderlist]').slideDown(function (ev) { 1041 $('button[data-smbfolderlisttoggle]').addClass('expanded'); 1042 }); 1043 } else {
1044 $('div[data-smbfolderlist]').slideUp(function (ev) { 1045 $('button[data-smbfolderlisttoggle]').removeClass('expanded'); 1046 }); 1047 } 1048 }); // end of smb folder show hide 1049 }; 1050 1051 // enablePaginationCalls on SMB 1052 app.SMB.enablePaginationCalls = function ($parent) { 1053 // simple media browser uses a handler for 1054 // pagination 1055 $parent.find('div[data-smbpaginationbuttons] a') 1056 .click(function (ev) { 1057 ev.preventDefault(); 1058 1059 // store the element we are going to replace 1060 var $wrapper = $(this).closest('[data-listwrapper]'); 1061 1062 // build url from pagination link 1063 var type = 'type=' + $(this).closest('[data-smbpaginationbuttons]').data('smbpaginationbuttons'); 1064 var rootFolderId = "&rootFolderId=" + $(this).closest('[data-smbrootfolder]').data('smbrootfolder'); 1065 var url = this.href.split('?'); 1066 if (url.length == 1) { 1067 url = ""; 1068 } else { 1069 url = "&" + url[1]; 1070 } 1071 url = "/handlers/simple-media-browser.cfm?" + type + rootFolderId + url 1072 1073 // go get it 1074 $.getJSON( 1075 url, 1076 function (json) { 1077 if (json.HTML) { 1078 // remove the existing table 1079 $wrapper.empty(); 1080 $wrapper.html(json.HTML.replace('style="display:none"', '')); 1081 // attach JS 1082 app.SMB.setupCollapsibleFolderList($wrapper); // no effect on file list so safe to call 1083 app.SMB.enablePaginationCalls($wrapper); 1084 } 1085 } 1086 ); 1087 1088 }); // end simple media browser pagination handler call 1089 }; 1090 1091 // setup SMB on pageload 1092 app.SMB.setupCollapsibleFolderList($('[data-listwrapper=folders]')); 1093 app.SMB.enablePaginationCalls($('[data-listwrapper=folders]')); 1094 app.SMB.enablePaginationCalls($('[data-listwrapper=files]')); 1095 1096 //NN-55 check if locationAPI is enabled 1097 var locationDisabled = function (reason) { 1098 // show postcode control for directions in maps 1099 $('.map-directions-manual-start').slideDown(); 1100 }; 1101 //nowtest 1102 if (navigator && navigator.geolocation) { 1103 // locationDisabled if errors 1104 navigator.geolocation.getCurrentPosition(function (p, i) { }, locationDisabled); 1105 } else { 1106 //not supported by browser 1107 locationDisabled("not enabled"); 1108 } 1109 1110 1111 }); 1112 1113}(window, Atlas));
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.