diff --git a/js/ebi-global-includes/script/5_ebiFrameworkNotificationBanner.js b/js/ebi-global-includes/script/5_ebiFrameworkNotificationBanner.js index dc211f8ebb5c5129976f6f2e1e97ade875ae12ff..95a52756a2056e69c609992ff5dfba3b749fa8dd 100644 --- a/js/ebi-global-includes/script/5_ebiFrameworkNotificationBanner.js +++ b/js/ebi-global-includes/script/5_ebiFrameworkNotificationBanner.js @@ -12,7 +12,7 @@ function ebiFrameworkCreateDataProtectionBanner() { banner.id = "data-protection-banner"; banner.className = "data-protection-banner"; - banner.style = "position: fixed; background-color: #111; width: 100%; padding: .75rem; left: 0; bottom: 0; color: #eee;" + banner.style = "position: fixed; background-color: #111; width: 98%; padding: .75rem 1%; left: 0; bottom: 0; color: #eee;" wrapper.className = "row"; wrapper.innerHTML = "" + "<div class='columns medium-8 large-9'>" + @@ -72,15 +72,30 @@ var dataProtectionSettings = new Object(); /** * The main 'brain' of the EBI Data Protection banner. * Further documentation at https://www.ebi.ac.uk/style-lab/websites/patterns/banner-data-protection.html - * @param {string} [targetedFrameworkVersion=generic] targeted Framework version; options: 1.1, 1.2, 1.3, compliance + * @param {string} [targetedFrameworkVersion=generic] targeted Framework version; options: 1.1, 1.2, 1.3, compliance, other */ function ebiFrameworkRunDataProtectionBanner(targetedFrameworkVersion) { try { if (typeof newDataProtectionNotificationBanner !== "undefined") { - targetedFrameworkVersion = targetedFrameworkVersion || newDataProtectionNotificationBanner.src.split('legacyRequest=')[1] || 'generic'; + targetedFrameworkVersion = newDataProtectionNotificationBanner.src.split('legacyRequest=')[1] || 'generic'; } + var compatibilityStyles = document.createElement('style'); + compatibilityStyles.innerHTML = ` + .data-protection-banner a, + .data-protection-banner a:hover { + color: #fff; + } + .data-protection-banner .medium-8 { + width: 75%; float: left; + } + .data-protection-banner .medium-4 { + width: 24%; float: right; text-align: right; + } + `; + document.body.appendChild(compatibilityStyles); + // remove any old style cookie banner switch (targetedFrameworkVersion) { case '1.1': @@ -95,12 +110,17 @@ function ebiFrameworkRunDataProtectionBanner(targetedFrameworkVersion) { document.getElementById("cookie-banner").remove(); } document.body.style.paddingTop = 0; + document.body.appendChild(compatibilityStyles); + break; + case 'other': + // If you're not using any fomally supported framework, we'll do our best to help out + document.body.appendChild(compatibilityStyles); break; default: - console.warn('You should specify the targeted FrameworkVersion (allowed values: 1.1, 1.2, 1.3, compliance). You sent: ' + targetedFrameworkVersion); + console.warn('You should specify the targeted FrameworkVersion (allowed values: 1.1, 1.2, 1.3, compliance, other). You sent: ' + targetedFrameworkVersion); } - + // Default global values dataProtectionSettings.message = 'This website requires cookies, and the limited processing of your personal data in order to function. By using the site you are agreeing to this as outlined in our <a target="_blank" href="https://www.ebi.ac.uk/data-protection/privacy-notice/embl-ebi-public-website" class="white-color">Privacy Notice</a> and <a target="_blank" href="https://www.ebi.ac.uk/about/terms-of-use" class="white-color">Terms of Use</a>.'; dataProtectionSettings.serviceId = 'ebi'; dataProtectionSettings.dataProtectionVersion = '1.0';