diff --git a/dist/js/embedded-content-cookie-compliance.min.js b/dist/js/embedded-content-cookie-compliance.min.js index e0054eaa9..05bd7cedd 100644 --- a/dist/js/embedded-content-cookie-compliance.min.js +++ b/dist/js/embedded-content-cookie-compliance.min.js @@ -1 +1 @@ -!function(e,Drupal,drupalSettings){const t=()=>{if(Drupal.cookieConsent.getConsentStatus(["preferences","statistics"])&&drupalSettings.embedded_media_attributes)for(const[t,n]of Object.entries(drupalSettings.embedded_media_attributes)){const a=document.createElement("iframe");a.classList.add("media-oembed-content"),a.src=n.src,a.title=n.title,n.height&&(a.height=n.height),n.width&&(a.width=n.width);const i=document.createElement("a");i.classList.add("focusable","skip-link"),i.href=`#${n.skipLinkAfterId}`,i.id=n.skipLinkBeforeId;const o=document.createElement("a");o.classList.add("focusable","skip-link"),o.href=`#${n.skipLinkBeforeId}`,o.id=n.skipLinkAfterId;const r=document.createElement("div");if(r.appendChild(a),"map"===n.type){const n=e(`.embedded-content-cookie-compliance.media-${t}`),a=n.parent().prevAll("h2").first().text().trim()||"";r.classList.add("responsive-map-container"),o.classList.add("skip-link--map--after"),i.classList.add("skip-link--map--before"),o.text=a?Drupal.t("Continue above the @map map",{"@map":a},{context:"Skip link after the map for the map paragraph"}):Drupal.t("Continue above the map",{},{context:"Skip link after the map for the map paragraph"}),i.text=a?Drupal.t("Continue below the @map map",{"@map":a},{context:"Skip link before the map for the map paragraph"}):Drupal.t("Continue below the map",{},{context:"Skip link before the map for the map paragraph"}),n.replaceWith(i,r,o)}else"journey_planner"===n.type&&(r.classList.add("journey-planner-container"),o.classList.add("skip-link--planner--after"),i.classList.add("skip-link--planner--before"),o.text=Drupal.t("Continue above the journey planner",{},{context:"Skip link after the journey planner for the journey planner paragraph"}),i.text=Drupal.t("Continue below the journey planner",{},{context:"Skip link before the journey planner for the journey planner paragraph"}),e(`.embedded-content-cookie-compliance.media-${t}`).replaceWith(i,r,o))}};e(".embedded-content-cookie-compliance .js-remove").remove(),Drupal.cookieConsent.initialized()?t():Drupal.cookieConsent.loadFunction(t)}(jQuery,Drupal,drupalSettings); \ No newline at end of file +!function(e,Drupal,drupalSettings){const t=()=>{if(Drupal.cookieConsent.getConsentStatus(["preferences","statistics"])&&drupalSettings.embedded_media_attributes)for(const[t,n]of Object.entries(drupalSettings.embedded_media_attributes)){const a=document.createElement("iframe");a.classList.add("media-oembed-content"),a.src=n.src,a.title=n.title,n.height&&(a.height=n.height),n.width&&(a.width=n.width);const i=document.createElement("a");i.classList.add("focusable","skip-link"),i.href=`#${n.skipLinkAfterId}`,i.id=n.skipLinkBeforeId;const o=document.createElement("a");o.classList.add("focusable","skip-link"),o.href=`#${n.skipLinkBeforeId}`,o.id=n.skipLinkAfterId;const r=document.createElement("div");if(r.appendChild(a),"video"===n.type)r.classList.add("responsive-video-container"),e(`.embedded-content-cookie-compliance.media-${t}`).empty().append(r).removeClass(`media-${t}`);else if("map"===n.type){const n=e(`.embedded-content-cookie-compliance.media-${t}`),a=n.parent().prevAll("h2").first().text().trim()||"";r.classList.add("responsive-map-container"),o.classList.add("skip-link--map--after"),i.classList.add("skip-link--map--before"),o.text=a?Drupal.t("Continue above the @map map",{"@map":a},{context:"Skip link after the map for the map paragraph"}):Drupal.t("Continue above the map",{},{context:"Skip link after the map for the map paragraph"}),i.text=a?Drupal.t("Continue below the @map map",{"@map":a},{context:"Skip link before the map for the map paragraph"}):Drupal.t("Continue below the map",{},{context:"Skip link before the map for the map paragraph"}),n.replaceWith(i,r,o)}else"journey_planner"===n.type&&(r.classList.add("journey-planner-container"),o.classList.add("skip-link--planner--after"),i.classList.add("skip-link--planner--before"),o.text=Drupal.t("Continue above the journey planner",{},{context:"Skip link after the journey planner for the journey planner paragraph"}),i.text=Drupal.t("Continue below the journey planner",{},{context:"Skip link before the journey planner for the journey planner paragraph"}),e(`.embedded-content-cookie-compliance.media-${t}`).replaceWith(i,r,o))}};e(".embedded-content-cookie-compliance .js-remove").remove(),Drupal.cookieConsent.initialized()?t():Drupal.cookieConsent.loadFunction(t)}(jQuery,Drupal,drupalSettings); \ No newline at end of file diff --git a/src/js/embedded-content-cookie-compliance.js b/src/js/embedded-content-cookie-compliance.js index d8d8691e6..a80947665 100644 --- a/src/js/embedded-content-cookie-compliance.js +++ b/src/js/embedded-content-cookie-compliance.js @@ -35,7 +35,13 @@ const containerElement = document.createElement('div'); containerElement.appendChild(iframeElement); - if (attributes.type === 'map') { + if (attributes.type === 'video') { + containerElement.classList.add('responsive-video-container'); + $(`.embedded-content-cookie-compliance.media-${id}`) + .empty() + .append(containerElement) + .removeClass(`media-${id}`); + } else if (attributes.type === 'map') { const $mapContainer = $(`.embedded-content-cookie-compliance.media-${id}`); // Extract the map name from the wrapping component element.