PageSourceSearch

https://www.royalsurrey.nhs.uk/js/plugins.js?99411EB6771843CCAAF67D841CF5D51F

js royalsurrey.nhs.uk collected 2026-10-02 03:58:43 UTC 37,831 bytes, 1,033 lines download raw bytes

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  "use strict"
10
11  // You can pass options to your placements here as below, the
12  // settings for a cycle slide show. You should remove this if you
13  // are not using it :)
14
15  $(".cycle-slideshow").each(function () {
16    var nextSlide = $(this).find(".slider-controls .next")
17    var prevSlide = $(this).find(".slider-controls .previous")
18    var playPause = $(this).find(".slider-controls .play-pause")
19    var pagerSpace = $(this).find(".decoration-left")
20    var $this = this
21    $(this).find(".slider").cycle({
22      speed: 800,
23      timeout: 8000,
24      fx: "fade",
25      next: nextSlide,
26      prev: prevSlide,
27      pager: pagerSpace
28    })
29
30    playPause.bind("click", function (ev) {
31      ev.preventDefault()
32      playPause = $(this)
33      // btnText = playPause.text();
34      if (!playPause.hasClass("paused")) {
35        //$this.cycle("pause");
36        $($this).find(".slider").cycle("pause")
37        // setText = "Play";
38        playPause.addClass("paused")
39      } else {
40        $($this).find(".slider").cycle("resume")
41        // setText = "Pause";
42        playPause.removeClass("paused")
43      }
44    })
45  })
46
47  /* -- tabs slideshow -- */
48  app.placementOptions["tabslideshow"] = {
49    ".tabs-slider": {}
50  }
51  /* -------------- */
52
53  /* -- carousel slideshow -- */
54  app.placementOptions["carouselslideshow"] = {
55    ".carousel-slideshow": {
56      visible: 1,
57      wrap: "circular",
58      scroll: 1,
59      buttonNextHTML:
60        '<div class="carousel-control-wrap"><div class="carousel-control no-select"></div></div>',
61      buttonPrevHTML:
62        '<div class="carousel-control-wrap"><div class="carousel-control no-select"></div></div>',
63      itemFallbackDimension: "500"
64    }
65  }
66
67  /* -- carousel gallery slideshow --
68    Customizable options:
69    (This gallery is using two instances of the same jQ plugin therefore you have
70    the option to customize them separately)
71    -- for full list of options please visit: http://caroufredsel.dev7studios.com/configuration.php
72    MAIN IMAGE SLIDER:
73      - option name: mainImageSliderSettings
74      - example: mainImageSliderSettings:{ scroll:{fx: 'crossfade'} }
75    THUMBNAIL IMAGE SLIDER:
76      - option name: thumbnailSliderSettings
77      ! It has three sub-option containers!
78        - plugin: This is for plugin customization! (anything but 'scroll' can be used)
79        - scrollItems (separate option as 'scroll' is prohibited in plugin)
80        - scrollDuration (separate option as 'scroll' is prohibited in plugin)
81        - changeImageByNextPrev (true/false can define if next/prev clicks change main image)
82      - example: thumbnailSliderSettings:{
83            plugin:{
84              items: {visible: {min: 3,max: 3}}
85            },
86            scrollItems:3,
87            scrollDuration:400,
88            changeImageByNextPrev:true
89          }
90    */
91  app.placementOptions["carouselgallery"] = {
92    ".carousel-gallery": {
93      mainImageSliderSettings: {
94        /* eg.: scroll: {fx: 'directscroll'} */
95      },
96      thumbnailSliderSettings: {
97        /* eg.: plugin:{},scrollItems:3,scrollDuration:400,changeImageByNextPrev:true */
98      }
99    }
100  }
101
102  /*
103      - `topSpacing`: Pixels between the page top and the element's top.
104      - `bottomSpacing`: Pixels between the page bottom and the element's bottom.
105      - `className`: CSS class added to the element and its wrapper when "sticked".
106      - `wrapperClassName`: CSS class added to the wrapper.
107      - `getWidthFrom`: Selector of element referenced to set fixed width of "sticky" element.
108
109    */
110
111  app.placementOptions["stickyMenu"] = {
112    selector: ".top-navigation",
113    topSpacing: 0,
114    bottomSpacing: 0,
115    className: "",
116    wrapperClassName: "",
117    getWidthFrom: ""
118  }
119
120  /*
121    
122      Please put your plugin initialisation and any other
123      code within this function.
124      
125      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
126        DO NOT put any document.ready ( $(function() {}) )
127        code here, this is handled by the framework.
128      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
129    
130    */
131  app.atPageLoad(function () {
132    /*
133          Actions awaiting Login JS Automatic Redirect code
134        */
135    if ($("[data-action-await-login-type]").length) {
136      var $aalItem = $("[data-action-await-login-type]")
137      var redirectTime = parseInt($aalItem.data("aal-redirect-time"))
138      setTimeout(function () {
139        if ($aalItem.data("action-await-login-type") == "form") {
140          $aalItem.find("form").submit()
141        } else if ($aalItem.data("action-await-login-type") == "url") {
142          window.location.href = $aalItem.find("a").attr("href")
143        }
144      }, redirectTime)
145    }
146    //End actions awaiting login JS
147
148    /*  --------------  \/ add your code here \/  ----------------- */
149    // maternity functions
150    app.maternityFunctionality()
151
152    if ($(".fee-page-activator .fee-mode-on").length) {
153      $("html").addClass("fee-active")
154    }
155
156    $(".page-placement .fee-controls-wrapper").each(function () {
157      $(this).closest(".page-placement").addClass("has-edit-controls")
158    })
159
160    if ($(".fee-page-activator .fee-mode-on").length) {
161      $("html").addClass("fee-active")
162    }
163
164    $(".page-placement .fee-controls-wrapper").each(function () {
165      $(this).closest(".page-placement").addClass("has-edit-controls")
166    })
167
168    $(".picture-placement-tall")
169      .closest(".placement-row-wrapper")
170      .addClass("picture-row-tall")
171    $(".picture-placement-short")
172      .closest(".placement-row-wrapper")
173      .addClass("picture-row-short")
174    $(".blue-row-placement")
175      .closest(".placement-row-wrapper")
176      .addClass("blue-row")
177    $(".purple-row-placement")
178      .closest(".placement-row-wrapper")
179      .addClass("purple-row")
180
181    $(".light-blue-row-placement")
182      .closest(".placement-row-wrapper")
183      .addClass("blue-row-light")
184    $(".grey-row-placement")
185      .closest(".placement-row-wrapper")
186      .addClass("grey-row")
187
188    // Allows the row to be full color - then use Addtional CSS placement to select the actual color.
189    //        $('.fullstripe-base').closest('.placement-row-wrapper').addClass('fullstripe-row');
190
191    //        $(".submit-wrap").hover(function() {
192    //            $(".search-inputs").css("width","30%")
193    //        });
194
195    $(
196      ".site-banner-row .site-search #site-search-form input[type='search']"
197    ).attr("placeholder", "Search our website")
198
199    /*Mobile Nav Toggle*/
200    $('<div class="mobile-nav-toggle-wrap"><a class="mobile-nav-toggle" aria-label="Open menu" href="#"><span class="nav-icon"></span><span class="nav-caret"></span></a></div>'
201    ).appendTo(".site-header-row-inner .content-container")
202    $(".mobile-nav-toggle").click(function (e) {
203      e.preventDefault()
204      $(".mobile-nav-toggle-wrap").toggleClass("open")
205      $(".mega-menu-wrapper").toggleClass("menu-open")
206      $(".site-header-row").toggleClass("menu-open")
207      $(".site-banner-row").toggleClass("menu-open")
208      $(".site-nav-row").toggleClass("menu-open") //page style 1
209      $(".main-content").toggleClass("menu-open")
210      $("html").toggleClass("slideout-open")
211    })
212    /*End mobile nav toggle*/
213
214    $(".mega-menu-top-level.has-children").each(function () {
215      const label = $(this).find("> a").text().trim()
216      $(this)
217        .find("> a")
218        .after(
219          `<button class='mobile-megamenu-viewer' aria-label="open/close ${label} submenu"></button>`
220        )
221    })
222
223    // $("<div class='mobile-megamenu-viewer' role='button' aria-label='open/close submenu'></div>").prependTo(
224    //   ".mega-menu-top-level.has-children"
225    // )
226    $(".mega-menu-top-level.has-children .mega-menu").addClass("closed")
227    $(".mobile-megamenu-viewer").click(function (ev) {
228      ev.preventDefault()
229      $(this).toggleClass("open")
230      $(this).parent().find(".mega-menu").toggleClass("show")
231    })
232
233    /*Mobile search Toggle*/ 
234    // RT - doesn't seem to do anything, even if the target set to display
235    $(
236      '<div class="mobile-search-toggle-wrap"><a class="mobile-search-toggle" aria-label="Search" href="#"><span class="search-icon"></span><span class="search-caret"></span></a></div>'
237    ).insertBefore(".mobile-nav-toggle-wrap")
238    $(".mobile-search-toggle").click(function (e) {
239      e.preventDefault()
240      $(".mobile-search-toggle-wrap").toggleClass("open")
241      $(".mobile-search").toggleClass("open")
242      //            $('.mobile-search').fadeToggle("slow", "linear");
243    })
244    /*End search nav toggle*/
245
246    /* page style mobile nav */
247    $("<div class='mobile-megamenu-viewer'></div>").prependTo(
248      ".page-style-1 #site-nav-row .type-menuplacement .menu > .menu-item.has-children"
249    ),
250      $(
251        "#site-nav-row .type-menuplacement .menu > .menu-item.has-children .output-level-2"
252      ).addClass("closed"),
253      $(".mobile-megamenu-viewer").click(function (t) {
254        t.preventDefault()
255        $(this).toggleClass("open")
256        $(this).parent().toggleClass("open")
257        $(this).parent().find(".output-level-2").toggleClass("open closed")
258      })
259
260    $(".type-consultantdirectoryplacement .profile-location h3").each(
261      function () {
262        var text = $(this).text()
263        $(this).text(text.replace("Main location", "Practice Location"))
264      }
265    )
266
267    //        /*Desktop search Toggle*/
268    $(
269      '<div class="desktop-search-toggle-wrap"><button aria-expanded="false" class="desktop-search-toggle" aria-label="Search" href="#"><span class="search-icon"></span><span class="search-caret"></span></button></div>'
270    ).insertAfter(".site-banner-row .site-search")
271    $(".desktop-search-toggle").click(function (e) {
272      e.preventDefault()
273      $(".desktop-search-toggle-wrap").toggleClass("open")
274      $(".desktop-search").toggleClass("open")
275      $(".site-banner-row .site-search").fadeToggle(400)
276      $(".site-banner-row .site-search").toggleClass("open")
277
278      if ($(".site-search").hasClass("open")) {
279        $(".site-banner-row #site-search-index-search-1").focus()
280      }
281
282      $(".site-banner-row .placement-row").toggleClass("open")
283      $(".access-button").toggleClass("open")
284
285      //            $(this).parent().nextAll(".site-search").first().slideToggle();
286      //            $('.desktop-search-toggle-wrap').parent().nextAll(".site-search").first().slideToggle();
287      //		    $(this).parent().toggleClass("open");
288      //		    $(this).toggleClass('open');
289    })
290    /*End desktop search toggle*/
291
292    // RT - disabling bx slider on homepage hospital menu for accessibility GDS reasons
293    // $(".home-page .hospital-links .content-items-list").bxSlider({
294    //   minSlides: 5,
295    //   maxSlides: 100,
296    //   slideWidth: 290,
297    //   slideMargin: 0,
298    //   moveSlides: 1,
299    //   swipeThreshold: 150,
300    //   touchEnabled: false,
301    //   oneToOneTouch: false,
302    //   infiniteLoop: false
303    // })
304    //END disabled bx slider
305
306    // OLDER bx slider
307    //        $('.home-page .blog-posts-list .blog-posts-post').bxSlider({
308    //                    minSlides: 5, /*3*/
309    //                    maxSlides: 100,
310    //                    slideWidth: 310, /*450*/
311    //                    slideMargin: 0,
312    ////                    pager: !1,
313    //                    moveSlides: 1,
314    //                    swipeThreshold: 150
315    //                });
316
317    //$("[aria-hidden='false']").first().prev().css("opacity", "0")
318
319    /*Accessibility Toggle*/
320
321    $("#accessibility-controls").insertAfter(".site-banner-row")
322    //        $(".access-controls-wrapper").wrap('<div class="dropdown"><a href="##" class="acc-dropdown-toggle" id="access-dropdown" data-toggle="dropdown">Accessibility<span class="caret"></span></a>');
323    $(
324      '<div class="access-button"><button aria-expanded="false" class="acc-dropdown-toggle" id="access-dropdown" data-toggle="dropdown">Accessibility<span class="caret"></span></button>'
325    ).insertBefore(".site-banner-row .site-search")
326    $(".acc-dropdown-toggle").click(function (e) {
327      e.preventDefault()
328      //            $('.access-controls-wrapper').fadeToggle(400);
329      $(this).toggleClass("open")
330      if ($(this).attr("aria-expanded") === "true") {
331        $(this).attr("aria-expanded", "false")
332      } else {
333        $(this).attr("aria-expanded", "true")
334        $(".site-tools.site-map").focus()
335      }
336      $("#accessibility-controls").fadeToggle(400)
337      $("#accessibility-controls").toggleClass("open")
338    })
339    /*End Accessibility toggle*/
340
341    /*Accordion placements*/
342    $(".accordion-base .content-headline").click(function (e) {
343      e.preventDefault()
344      $(this).nextAll(".content-wrapper-inner").first().slideToggle()
345      $(this).toggleClass("open")
346    })
347
348    //        $(".accordion-services .service-header").click(function (e) {
349    //            e.preventDefault();
350    //            $(this).nextAll(".content-item-container").first().slideToggle();
351    //            $(this).toggleClass('open');
352    //        });
353
354    $(".page-style-1 .content-container.breadcrumb").insertAfter("#site-nav-row");
355
356    $('<btn class="accessibility-toggle-wrap"><a class="accessibility-toggle" href="#"><span class="closed-text">Accessibility tools</span><span class="open-text">Close accessibility tools</span></a></btn>'
357    ).insertBefore(".page-style-1 .access-controls-wrapper");
358    $(".accessibility-toggle").click(function (t) {
359      t.preventDefault()
360      $(this).toggleClass("open")
361      //$(this).parent().toggleClass("open");
362      $(".access-controls-wrapper").toggleClass("open")
363    })
364
365    $(".page-style-1 #google_translate_element").prependTo("#accessibility-controls .access-controls-wrapper")
366    $(".page-style-1 .site-header-row .logo-container #logo")
367      .not(
368        ".page-style-1.page-style-1-home .site-header-row .logo-container #logo"
369      )
370      .attr("href", "/royal-surrey-maternity")
371    // Birth and Beyond mat hub pages - update logo link
372    $(
373      "html.birth-and-beyond .logo-container #logo, html.birth-and-beyond .breadcrumb-item.go-home a"
374    ).attr("href", "/patient-maternity-hub")
375
376    // external links
377    $("p a[target=_blank]")
378      .attr("title", "Opens in a new window")
379      .addClass("newindow")
380
381    // Blog Archives Toggle
382    $(".archives-list.month:gt(0)").hide()
383    $(".archives-list.month:eq(0)").parent().find("a").addClass("open")
384    $(".archive-list-item-year-toggle").click(function (ev) {
385      ev.preventDefault()
386      $(this).toggleClass("open")
387      $(this).next(".archives-list").slideToggle()
388    })
389
390    // Add a class to the last menu item in the top nav
391    $("#top-nav li").last().addClass("last-menu-item")
392
393    // Terms and Conditions toggle
394    $(".terms-and-condition-link").click(function (ev) {
395      var tandc = $(".t-and-c-wrapper")
396      tandc.slideToggle("slow", function () {})
397    })
398
399    // function for maternity Birth and Beyond term timeline
400    var matMonthFilter = "initial month"
401    $(".timeline-item-link").click(function (ev) {
402      ev.preventDefault()
403      console.log("timeline month switch")
404      if ($(this).closest(".mat-timeline-item").hasClass("month-selected")) {
405        console.log("Close this")
406        matMonthFilter = $(this)
407          .closest(".mat-timeline-item")
408          .attr("class")
409          .split(" ")[1]
410        console.log(matMonthFilter)
411        $(".birth-and-beyond").removeClass(matMonthFilter)
412        $(".mat-timeline-item").removeClass("month-selected")
413      } else {
414        console.log("Open this")
415        $(".birth-and-beyond").removeClass(matMonthFilter)
416        $(".mat-timeline-item").removeClass("month-selected")
417        matMonthFilter = $(this)
418          .closest(".mat-timeline-item")
419          .attr("class")
420          .split(" ")[1]
421        console.log(matMonthFilter)
422        $(this).closest(".mat-timeline-item").addClass("month-selected")
423        $(".birth-and-beyond").addClass(matMonthFilter)
424      }
425    })
426    // ++ Birth and Beyond expand advanced search filters (keep it in the B and B page style)
427    if ($("html").hasClass("birth-and-beyond")) {
428      $('<div class="adv-search-container"></div>').insertAfter(
429        ".type-recurringeventsearch .event-name-filter"
430      )
431      $(
432        '<a class="show-adv-search" href="#">Show extra options</a>'
433      ).insertAfter(".type-recurringeventsearch .event-name-filter")
434      $(
435        ".event-type-filter, .event-venue-filter, .event-term-filter, .date-search-filter"
436      ).appendTo(".adv-search-container")
437      $(".show-adv-search").click(function (e) {
438        e.preventDefault()
439        $(".adv-search-container, .show-adv-search").toggleClass(
440          "adv-search-open"
441        )
442        if ($(".show-adv-search").hasClass("adv-search-open")) {
443          $(".show-adv-search").text("Close extra options")
444        } else {
445          $(".show-adv-search").text("Show extra options")
446        }
447      })
448    }
449
450    //=== GDS Fixes ====
451    // Add/remove class on menu hover/focus
452
453    //------------ Updated - RT - focus handling for desktop
454    var mediaQuery = window.matchMedia("(min-width: 900px)");
455    function handleMenuBehavior(e) {
456      if (e.matches) {
457        $("#site-banner-row .page-placement[data-placement-class='SiteSearch']").insertAfter("#site-banner-row .page-placement[data-placement-class='MegaMenu']");
458        $("#accessibility-controls").insertAfter("#site-banner-row");
459        // Enable hover/focus behavior for desktop (700px and up)
460        $("#site-banner-row .mega-menu-top-level")
461          .on("mouseenter focusin", function () {
462            $(this).find("> .mega-menu").addClass("focus-open").removeClass("focus-closed");
463          })
464          .on("mouseleave", function () {
465            $(this).find("> .mega-menu").removeClass("focus-open").addClass("focus-closed");
466          })
467          .on("focusout", function (e) {
468            if (!$(this).has(e.relatedTarget).length) {
469              $(this).find("> .mega-menu").removeClass("focus-open").addClass("focus-closed");
470            }
471          });
472      } else {
473        // Disable event listeners on mobile (less than 700px)
474        console.log("Mobile user, removing desktop menu focus behavior");
475        //$("#site-banner-row .mega-menu-top-level").off("mouseenter focusin mouseleave focusout");
476        $("#site-banner-row .page-placement[data-placement-class='SiteSearch']").prependTo("#site-banner-row .top-navigation");
477        $("#accessibility-controls").insertBefore("#site-banner-row .top-nav");
478      }
479    }
480    // Run on load
481    handleMenuBehavior(mediaQuery);
482    // Listen for changes (ensures dynamic switching between mobile & desktop behavior)
483    mediaQuery.addListener(handleMenuBehavior);
484    // ...Depricated for ES5 limitations
485    //------------ End - Updated - RT
486
487    // Making the 'view all' text in the mega menu different to address accessibilty audit flag
488    $(".menu-column .submenu-item").each(function () {
489      // Store the text content from a.default
490      var megaMenuMoreText = $(this).find("> a.default").text().trim();
491    
492      // Check if .submenu-wrap contains li > a.megamenu-show-children
493      var submenuWrap = $(this).find(".submenu-wrap");
494      if (submenuWrap.find(".subsubmenu-item > a.megamenu-show-children").length > 0) {
495        // Add the text "View all - [insert .default text]"
496        submenuWrap.find(".subsubmenu-item > a.megamenu-show-children").each(function () {
497          // Adding the text to each matching element
498          var newText = "View all - " + megaMenuMoreText;
499          $(this).text(newText);  // Set the new text
500        });
501      }
502    });
503
504    // Escape key handling
505    $(document).on("keydown", function (event) {
506      if (event.key === "Escape" || event.keyCode === 27) {
507        // Close sub menu if open
508        if ($(".mega-menu").hasClass("focus-open")) {
509          $(".mega-menu").removeClass("focus-open").addClass("focus-closed")
510        }
511        // Close mobile menu if open
512        if ($("#site-banner-row").hasClass("menu-open")) {
513          console.log("Mobile menu was open, closing it");
514          $(".mobile-nav-toggle-wrap").removeClass("open")
515          $(".mega-menu-wrapper").removeClass("menu-open")
516          $(".site-header-row").removeClass("menu-open")
517          $(".site-banner-row").removeClass("menu-open")
518          $(".site-nav-row").removeClass("menu-open") //page style 1
519          $(".main-content").removeClass("menu-open")
520          $("html").removeClass("slideout-open")
521        }
522        // Close GTranslate if open
523        if ($(".gt_black_overlay").css("display") === "block") {
524          $(".gt_black_overlay").css("display", "none")
525          $(".gt_white_content").css("display", "none")
526        }
527      }
528    })
529
530    // Change slideshow controls to semantic list
531    $(".decoration-left")
532      .children()
533      .each(function () {
534        $(this).wrap("<li>")
535      })
536    $(".decoration-left").children().wrapAll("<ul>")
537
538    // Add a legend to the blog search fieldset
539    $(".type-blogsearch fieldset").prepend(
540      '<legend style="font-size:0">Search articles</legend>'
541    )
542
543    // Add a skip to content link
544    $(
545      '<a class="skip-to-content" href="#main-content">Skip to content</a>'
546    ).prependTo("#container")
547
548    // Add GTranslate wrapper
549    $('<div class="gtranslate_wrapper"></div>').appendTo(
550      "#accessibility-controls .content-container"
551    )
552
553    // Load GTranslate script after wrapper is added
554    var gtScript = document.createElement("script")
555    gtScript.text =
556      'window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}'
557    document.head.appendChild(gtScript)
558
559    var gtPopupScript = document.createElement("script")
560    gtPopupScript.src = "https://cdn.gtranslate.net/widgets/latest/dropdown.js"
561    gtPopupScript.defer = true
562    document.head.appendChild(gtPopupScript)
563
564    /*=== END GDS Fixes ===*/
565
566    // FAQ accordion fields
567    var $accordionFAQHeadline = $(".birth-and-beyond .faq-single .faq-question")
568    $accordionFAQHeadline.wrap(
569      '<button type="button" class="actn-btn actn-show-content actn-show-faq faq-closed"></button>'
570    )
571    $(".actn-show-faq").click(function (e) {
572      e.preventDefault()
573      $(this).nextAll(".faq-answer").first().slideToggle()
574      $(this).toggleClass("faq-closed")
575    })
576
577    //Discount field recurring events expanding div
578    //  $('body').on("click", ".actn-show-discount-code", function(e) {
579    //     e.preventDefault();
580    //     $(this).nextAll('div').first().slideToggle();
581    //     $(this).toggleClass('code-closed');
582    // });
583
584    // on the maternity homepage, on mobile the logo switches to the maternity image and must not then take you back to the main trust site
585    $(window).on("resize", function () {
586      var win = $(this) //this = window
587
588      if (win.width() <= 700) {
589        $(".page-style-1-home .logo-container #logo").attr(
590          "href",
591          "/maternity-page-style"
592        )
593      }
594      if (win.width() >= 701) {
595        $(".page-style-1-home .logo-container #logo").attr("href", "/")
596      }
597    })
598
599    $(window).load(function () {
600      var winload = $(this)
601      if ($(this).width() < 700) {
602        $(".page-style-1-home .logo-container #logo").attr(
603          "href",
604          "/maternity-page-style"
605        )
606      }
607    })
608
609    //        $(".accordion-base.type-textcontent .content-headline h2").wrap('<button type="button" class="actn-btn actn-show-content"></button>');
610
611    //        $(".accordion-base.type-textcontent .content-headline").wrap('<button type="button" class="actn-btn actn-show-content"></button>');
612
613    /*Accordion placements*/
614    var $accordionHeadline = $(".accordion-base .content-headline")
615    $accordionHeadline.wrap(
616      '<button type="button" class="actn-btn actn-show-content"></button>'
617    )
618    var $collectionHeadline = $(".accordion-base .item-headline")
619    $collectionHeadline.wrap(
620      '<button type="button" class="actn-btn actn-show-content"></button>'
621    )
622    var $accordionHeadlineWards = $(
623      ".accordion-base.type-warddirectoryplacement .main-location-header"
624    )
625    $accordionHeadlineWards.wrap(
626      '<button type="button" class="actn-btn actn-show-content"></button>'
627    )
628    $(".accordion-base").each(function () {
629      if ($(this).is(".type-contentcollection")) {
630        $(this)
631          .find(".actn-show-content")
632          .click(function (e) {
633            e.preventDefault()
634            $(this).nextAll(".content-wrapper-inner").first().slideToggle()
635            $(this).toggleClass("open")
636          })
637      } else if ($(this).is(".type-warddirectoryplacement")) {
638        $(this)
639          .find(".actn-show-content")
640          .click(function (e) {
641            e.preventDefault()
642            $(this).nextAll(".content-item-container").first().slideToggle()
643            $(this).toggleClass("open")
644          })
645      } else {
646        $(this)
647          .find(".actn-show-content")
648          .click(function (e) {
649            e.preventDefault()
650            $(this).nextAll(".content-wrapper-inner").first().slideToggle()
651            $(this).toggleClass("open")
652          })
653      }
654    })
655
656    $('<div class="stripe-div"></div>').appendTo(
657      ".cta-placement .content-wrapper-inner .content-main-image"
658    )
659    $('<div class="banner-stripe-div"></div>').appendTo(
660      ".maternity-banner .content-wrapper-inner .content-main-image"
661    )
662
663    $(".mobile-menu-cta").appendTo(
664      "#site-banner-row .mega-menu-wrapper .top-nav"
665    )
666
667    $(".side-tab-1").prependTo("body")
668    $(".side-tab-2").prependTo("body")
669
670    // if ($("html").hasClass('crf-page-style')) {
671
672    //     // Logo link change
673    //     $(".logo-container #logo").attr("href", "/crf-home-testing");
674    //     $(".breadcrumb-item a").attr("href", "/crf-home-testing");
675
676    //     // Replacing menu page
677    //     // $("#site-banner-row .clearfix #top-nav li").hide(); // NOw hising with CSS Only //
678    //     $(".crf-top-navigation-menu .menu").children().appendTo("#site-banner-row .clearfix #top-nav");
679    //     $('#site-banner-row .top-navigation').addClass('menu-loaded');
680    //     // $(".bwc-top-menu-placement").hide();
681    // }
682
683    // ========= Clinical Research Start ===========
684    if ($("html").hasClass("crf-page-style")) {
685      // Logo link change
686      $(".logo-container #logo").attr("href", "/crf-home")
687      console.log("1")
688      $(".breadcrumb-item.go-home a").attr("href", "/crf-home")
689      console.log("2")
690      // Replacing menu page
691      // $("#site-banner-row .clearfix #top-nav li").hide();
692      $(".crf-top-navigation-menu .menu")
693        .children()
694        .appendTo("#site-banner-row .clearfix #top-nav")
695      // $(".bwc-top-menu-placement").hide();
696    }
697    // ========= Clinical Research End =============
698
699    /*! npm.im/object-fit-images 3.2.4 */
700    var objectFitImages = (function () {
701      "use strict"
702
703      function t(t, e) {
704        return (
705          "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" +
706          t +
707          "' height='" +
708          e +
709          "'%3E%3C/svg%3E"
710        )
711      }
712
713      function e(t) {
714        if (t.srcset && !p && window.picturefill) {
715          var e = window.picturefill._
716          ;(t[e.ns] && t[e.ns].evaled) ||
717            e.fillImg(t, {
718              reselect: !0
719            }),
720            t[e.ns].curSrc ||
721              ((t[e.ns].supported = !1),
722              e.fillImg(t, {
723                reselect: !0
724              })),
725            (t.currentSrc = t[e.ns].curSrc || t.src)
726        }
727      }
728
729      function i(t) {
730        for (
731          var e, i = getComputedStyle(t).fontFamily, r = {};
732          null !== (e = u.exec(i));
733
734        )
735          r[e[1]] = e[2]
736        return r
737      }
738
739      function r(e, i, r) {
740        var n = t(i || 1, r || 0)
741        b.call(e, "src") !== n && h.call(e, "src", n)
742      }
743
744      function n(t, e) {
745        t.naturalWidth ? e(t) : setTimeout(n, 100, t, e)
746      }
747
748      function c(t) {
749        var c = i(t),
750          o = t[l]
751        if (((c["object-fit"] = c["object-fit"] || "fill"), !o.img)) {
752          if ("fill" === c["object-fit"]) return
753          if (!o.skipTest && f && !c["object-position"]) return
754        }
755        if (!o.img) {
756          ;(o.img = new Image(t.width, t.height)),
757            (o.img.srcset = b.call(t, "data-ofi-srcset") || t.srcset),
758            (o.img.src = b.call(t, "data-ofi-src") || t.src),
759            h.call(t, "data-ofi-src", t.src),
760            t.srcset && h.call(t, "data-ofi-srcset", t.srcset),
761            r(t, t.naturalWidth || t.width, t.naturalHeight || t.height),
762            t.srcset && (t.srcset = "")
763          try {
764            s(t)
765          } catch (t) {
766            window.console && console.warn("https://bit.ly/ofi-old-browser")
767          }
768        }
769        e(o.img),
770          (t.style.backgroundImage =
771            'url("' +
772            (o.img.currentSrc || o.img.src).replace(/"/g, '\\"') +
773            '")'),
774          (t.style.backgroundPosition = c["object-position"] || "center"),
775          (t.style.backgroundRepeat = "no-repeat"),
776          (t.style.backgroundOrigin = "content-box"),
777          /scale-down/.test(c["object-fit"])
778            ? n(o.img, function () {
779                o.img.naturalWidth > t.width || o.img.naturalHeight > t.height
780                  ? (t.style.backgroundSize = "contain")
781                  : (t.style.backgroundSize = "auto")
782              })
783            : (t.style.backgroundSize = c["object-fit"]
784                .replace("none", "auto")
785                .replace("fill", "100% 100%")),
786          n(o.img, function (e) {
787            r(t, e.naturalWidth, e.naturalHeight)
788          })
789      }
790
791      function s(t) {
792        var e = {
793          get: function (e) {
794            return t[l].img[e ? e : "src"]
795          },
796          set: function (e, i) {
797            return (
798              (t[l].img[i ? i : "src"] = e),
799              h.call(t, "data-ofi-" + i, e),
800              c(t),
801              e
802            )
803          }
804        }
805        Object.defineProperty(t, "src", e),
806          Object.defineProperty(t, "currentSrc", {
807            get: function () {
808              return e.get("currentSrc")
809            }
810          }),
811          Object.defineProperty(t, "srcset", {
812            get: function () {
813              return e.get("srcset")
814            },
815            set: function (t) {
816              return e.set(t, "srcset")
817            }
818          })
819      }
820
821      function o() {
822        function t(t, e) {
823          return t[l] && t[l].img && ("src" === e || "srcset" === e)
824            ? t[l].img
825            : t
826        }
827        d ||
828          ((HTMLImageElement.prototype.getAttribute = function (e) {
829            return b.call(t(this, e), e)
830          }),
831          (HTMLImageElement.prototype.setAttribute = function (e, i) {
832            return h.call(t(this, e), e, String(i))
833          }))
834      }
835
836      function a(t, e) {
837        var i = !y && !t
838        if (((e = e || {}), (t = t || "img"), (d && !e.skipTest) || !m))
839          return !1
840        "img" === t
841          ? (t = document.getElementsByTagName("img"))
842          : "string" == typeof t
843          ? (t = document.querySelectorAll(t))
844          : "length" in t || (t = [t])
845        for (var r = 0; r < t.length; r++)
846          (t[r][l] = t[r][l] || {
847            skipTest: e.skipTest
848          }),
849            c(t[r])
850        i &&
851          (document.body.addEventListener(
852            "load",
853            function (t) {
854              "IMG" === t.target.tagName &&
855                a(t.target, {
856                  skipTest: e.skipTest
857                })
858            },
859            !0
860          ),
861          (y = !0),
862          (t = "img")),
863          e.watchMQ &&
864            window.addEventListener(
865              "resize",
866              a.bind(null, t, {
867                skipTest: e.skipTest
868              })
869            )
870      }
871      var l = "bfred-it:object-fit-images",
872        u = /(object-fit|object-position)\s*:\s*([-.\w\s%]+)/g,
873        g =
874          "undefined" == typeof Image
875            ? {
876                style: {
877                  "object-position": 1
878                }
879              }
880            : new Image(),
881        f = "object-fit" in g.style,
882        d = "object-position" in g.style,
883        m = "background-size" in g.style,
884        p = "string" == typeof g.currentSrc,
885        b = g.getAttribute,
886        h = g.setAttribute,
887        y = !1
888      return (a.supportsObjectFit = f), (a.supportsObjectPosition = d), o(), a
889    })()
890
891    //objectFitImages();
892    $(function () {
893      objectFitImages()
894    })
895
896    //        $("<div class='mobile-megamenu-viewer'></div>").prependTo("#site-nav-row .type-menuplacement .menu > .menu-item.has-children"),
897    //        $("#site-nav-row .type-menuplacement .menu > .menu-item.has-children .output-level-2").addClass("closed"),
898    //        $(".mobile-megamenu-viewer").click(function (t) {
899    //            t.preventDefault();
900    //            $(this).toggleClass("open");
901    //            $(this).parent().toggleClass("open");
902    //            $(this).parent().find(".output-level-2").toggleClass("open closed");
903    //        });
904
905    // DO NOT REMOVE: apply styling classes to aligned images
906    // embedded into CKEditor. This is not the most efficient
907    //method, but it works until we have something better
908
909    // Left aligned images
910    $("img")
911      .filter(function () {
912        return $(this).css("float") === "left"
913      })
914      .addClass("content-image-aligned-left")
915
916    // Right aligned images
917    $("img")
918      .filter(function () {
919        return $(this).css("float") === "right"
920      })
921      .addClass("content-image-aligned-right")
922
923    /* ---------------------  /\ /\ /\ /\ /\   -------------------- */
924
925    if ($("html").hasClass("cc-page-style")) {
926      // Logo link change
927      $(".logo-container #logo").attr("href", "/cc-home")
928      $(".breadcrumb-item.go-home a").attr("href", "/cc-home")
929      $("#logo img").attr(
930        "src",
931        "/base-install/images/main-logo/rs-cancer-logo.png"
932      )
933      $("#site-header-row .care-image .content-main-image img").attr(
934        "src",
935        "/base-install/images/main-logo/company-logo.png"
936      )
937
938      $(".cps-checkerboard-component").each(function (index) {
939        $(this).addClass("Checker" + (index + 1))
940      })
941
942      $(".cps-content-collection .content-items-list").bxSlider({
943        minSlides: 1,
944        maxSlides: 100,
945        pause: 1000,
946        slideMargin: 500,
947        pager: true,
948        moveSlides: 1,
949        touchEnabled: false,
950        onSliderLoad: function (currentIndex) {
951          $(
952            ".content-items-list .list-content-item[aria-hidden='false']:first"
953          ).addClass("active-slide")
954          $(".list-content-item").addClass("loaded")
955        },
956        onSlideAfter: function ($slideElement) {
957          $(".content-items-list").children().removeClass("active-slide")
958          $slideElement.addClass("active-slide")
959        }
960      })
961
962      $(".type-feedbackmessaging .content-headline h2").text(
963        "Patient experience poll feedback. Was this page helpful?"
964      )
965    }
966  })
967
968  app.maternityFunctionality = function () {
969    $("#maternity-change-duedate-form").submit(function (ev) {
970      ev.preventDefault()
971      var parentWrapper = $(this).parent()
972
973      var feedback = parentWrapper.find(".feedback")
974      // add loading class to the wrapper
975      parentWrapper.addClass("loading")
976
977      // disable button
978      parentWrapper.find("button").attr("disabled", true)
979      // remove any classes from previous request and remove the text on submission
980      feedback.removeClass("error")
981      feedback.removeClass("success")
982      feedback.text("")
983
984      var day = $('select[name="due_date_day"]').val()
985      var month = $('select[name="due_date_month"]').val()
986      var year = $('select[name="due_date_year"]').val()
987
988      var firstName = parentWrapper.find('input[name="first_name"]').val()
989      var lastName = parentWrapper.find('input[name="last_name"]').val()
990      var email = parentWrapper.find('input[name="email_address"]').val()
991
992      var feedback = parentWrapper.find(".feedback")
993
994      var requestType = "POST" // define reqest type, change for certain events
995      var data = {
996        due_day: day,
997        due_month: month,
998        due_year: year,
999        firstName: firstName,
1000        lastName: lastName,
1001        email: email
1002      }
1003
1004      data.action = "updateDueDate"
1005      data.xsrfpf = app.options.xsrfkey // CSRF protection
1006
1007      $.ajax({
1008        url: "/handlers/maternity/maternityHandler.cfm",
1009        data: data,
1010        success: function (json) {
1011          parentWrapper.removeClass("loading")
1012          parentWrapper.find("button").attr("disabled", false)
1013          // feedback here
1014          console.log(json)
1015          if (json.SUCCESS) {
1016            feedback.addClass("success")
1017            feedback.text("You have updated your personal details")
1018            location.reload()
1019          } else {
1020            feedback.addClass("error")
1021            var message = json.MESSAGE.length
1022              ? json.MESSAGE
1023              : "An error has occured. Please try again. If the problem persits please get in contact with one of the team."
1024            feedback.text(message)
1025          }
1026        },
1027        type: requestType,
1028        noLoader: false,
1029        dataType: "JSON"
1030      })
1031    })
1032  }
1033})(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.