From 400dce54f0fd11f983235ea4308b023a7d38cec4 Mon Sep 17 00:00:00 2001 From: ouidade Date: Fri, 10 Dec 2021 11:03:34 +0100 Subject: [PATCH] =?UTF-8?q?page=20mentions=20l=C3=A9gales?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/themes/custom/eql/css-compiled/styles.css | 20 ++ web/themes/custom/eql/eql.libraries.yml | 5 +- web/themes/custom/eql/eql.theme | 2 +- web/themes/custom/eql/scripts/extlink.js | 278 ++++++++++++++++++ web/themes/custom/eql/scripts/main.js | 42 +++ .../custom/eql/scss/pages/_actualite.scss | 1 + .../eql/scss/pages/_mentions-legales.scss | 33 +++ web/themes/custom/eql/scss/styles.scss | 1 + 8 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 web/themes/custom/eql/scripts/extlink.js create mode 100644 web/themes/custom/eql/scss/pages/_mentions-legales.scss diff --git a/web/themes/custom/eql/css-compiled/styles.css b/web/themes/custom/eql/css-compiled/styles.css index d55c3c7..3d2da09 100644 --- a/web/themes/custom/eql/css-compiled/styles.css +++ b/web/themes/custom/eql/css-compiled/styles.css @@ -971,6 +971,26 @@ a { text-decoration: underline; font-weight: 800; } +.node-id-6 { + background: url("../images/pictos/carre-contour-bleu_contact.svg"); + background-repeat: no-repeat; + background-position-y: 7rem; + max-width: 100vw; + background-size: contain; } + .node-id-6 .layout__region--top { + padding-bottom: 3rem; + height: 30vh; } + .node-id-6 .layout__region--top .block-region-top .block-entity-fieldnodefield-images { + display: none; + height: inherit; } + .node-id-6 .layout__region--top .block-region-top .block-entity-fieldnodetitle .field--name-title { + font-family: 'Source Code Pro'; + font-size: 2rem; + font-weight: 800; + color: white; + background-color: #009ee3; + text-transform: uppercase; } + /*partials*/ .layout-container { position: relative; } diff --git a/web/themes/custom/eql/eql.libraries.yml b/web/themes/custom/eql/eql.libraries.yml index 2ba82d2..11fbfde 100644 --- a/web/themes/custom/eql/eql.libraries.yml +++ b/web/themes/custom/eql/eql.libraries.yml @@ -5,4 +5,7 @@ global-css: global-js: js: scripts/main.js: {} - + +# dependencies: +# - core/jquery + diff --git a/web/themes/custom/eql/eql.theme b/web/themes/custom/eql/eql.theme index ecf627f..e59ab73 100644 --- a/web/themes/custom/eql/eql.theme +++ b/web/themes/custom/eql/eql.theme @@ -33,7 +33,7 @@ function eql_preprocess_node(&$variables){ // function eql_preprocess_field(&$variables) { // static $counter = 0; -// $variables['counter'] = $counter++; +// $variables['counter'] = $counter++;ext // } diff --git a/web/themes/custom/eql/scripts/extlink.js b/web/themes/custom/eql/scripts/extlink.js new file mode 100644 index 0000000..e9eb12e --- /dev/null +++ b/web/themes/custom/eql/scripts/extlink.js @@ -0,0 +1,278 @@ +/** + * @file + * External links js file. + */ + + (function ($, Drupal, drupalSettings) { + + 'use strict'; + + Drupal.extlink = Drupal.extlink || {}; + + Drupal.extlink.attach = function (context, drupalSettings) { + if (typeof drupalSettings.data === 'undefined' || !drupalSettings.data.hasOwnProperty('extlink')) { + return; + } + + // Define the jQuery method (either 'append' or 'prepend') of placing the + // icon, defaults to 'append'. + var extIconPlacement = 'append'; + if (drupalSettings.data.extlink.extIconPlacement && drupalSettings.data.extlink.extIconPlacement != '0') { + extIconPlacement = drupalSettings.data.extlink.extIconPlacement; + } + + // Strip the host name down, removing ports, subdomains, or www. + var pattern = /^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/; + var host = window.location.host.replace(pattern, '$2$3$6'); + var subdomain = window.location.host.replace(host, ''); + + // Determine what subdomains are considered internal. + var subdomains; + if (drupalSettings.data.extlink.extSubdomains) { + subdomains = '([^/]*\\.)?'; + } + else if (subdomain === 'www.' || subdomain === '') { + subdomains = '(www\\.)?'; + } + else { + subdomains = subdomain.replace('.', '\\.'); + } + + // Whitelisted domains. + var whitelistedDomains = false; + if (drupalSettings.data.extlink.whitelistedDomains) { + whitelistedDomains = []; + for (var i = 0; i < drupalSettings.data.extlink.whitelistedDomains.length; i++) { + whitelistedDomains.push(new RegExp('^https?:\\/\\/' + drupalSettings.data.extlink.whitelistedDomains[i].replace(/(\r\n|\n|\r)/gm,'') + '.*$', 'i')); + } + } + + // Build regular expressions that define an internal link. + var internal_link = new RegExp('^https?://([^@]*@)?' + subdomains + host, 'i'); + + // Extra internal link matching. + var extInclude = false; + if (drupalSettings.data.extlink.extInclude) { + extInclude = new RegExp(drupalSettings.data.extlink.extInclude.replace(/\\/, '\\'), 'i'); + } + + // Extra external link matching. + var extExclude = false; + if (drupalSettings.data.extlink.extExclude) { + extExclude = new RegExp(drupalSettings.data.extlink.extExclude.replace(/\\/, '\\'), 'i'); + } + + // Extra external link CSS selector exclusion. + var extCssExclude = false; + if (drupalSettings.data.extlink.extCssExclude) { + extCssExclude = drupalSettings.data.extlink.extCssExclude; + } + + // Extra external link CSS selector explicit. + var extCssExplicit = false; + if (drupalSettings.data.extlink.extCssExplicit) { + extCssExplicit = drupalSettings.data.extlink.extCssExplicit; + } + + // Find all links which are NOT internal and begin with http as opposed + // to ftp://, javascript:, etc. other kinds of links. + // When operating on the 'this' variable, the host has been appended to + // all links by the browser, even local ones. + // In jQuery 1.1 and higher, we'd use a filter method here, but it is not + // available in jQuery 1.0 (Drupal 5 default). + var external_links = []; + var mailto_links = []; + $('a:not([data-extlink]), area:not([data-extlink])', context).each(function (el) { + try { + var url = ''; + if (typeof this.href == 'string') { + url = this.href.toLowerCase(); + } + // Handle SVG links (xlink:href). + else if (typeof this.href == 'object') { + url = this.href.baseVal; + } + if (url.indexOf('http') === 0 + && ((!internal_link.test(url) && !(extExclude && extExclude.test(url))) || (extInclude && extInclude.test(url))) + && !(extCssExclude && $(this).is(extCssExclude)) + && !(extCssExclude && $(this).parents(extCssExclude).length > 0) + && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { + var match = false; + if (whitelistedDomains) { + for (var i = 0; i < whitelistedDomains.length; i++) { + if (whitelistedDomains[i].test(url)) { + match = true; + break; + } + } + } + if (!match) { + external_links.push(this); + } + } + // Do not include area tags with begin with mailto: (this prohibits + // icons from being added to image-maps). + else if (this.tagName !== 'AREA' + && url.indexOf('mailto:') === 0 + && !(extCssExclude && $(this).parents(extCssExclude).length > 0) + && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { + mailto_links.push(this); + } + } + // IE7 throws errors often when dealing with irregular links, such as: + // Empty tags. + // example User:pass syntax. + catch (error) { + return false; + } + }); + + if (drupalSettings.data.extlink.extClass !== '0' && drupalSettings.data.extlink.extClass !== '') { + Drupal.extlink.applyClassAndSpan(external_links, drupalSettings.data.extlink.extClass, extIconPlacement); + } + + if (drupalSettings.data.extlink.mailtoClass !== '0' && drupalSettings.data.extlink.mailtoClass !== '') { + Drupal.extlink.applyClassAndSpan(mailto_links, drupalSettings.data.extlink.mailtoClass, extIconPlacement); + } + + if (drupalSettings.data.extlink.extTarget) { + // Apply the target attribute to all links. + $(external_links).filter(function () { + // Filter out links with target set if option specified. + return !(drupalSettings.data.extlink.extTargetNoOverride && $(this).is('a[target]')); + }).attr({target: '_blank'}); + + // Add noopener rel attribute to combat phishing. + $(external_links).attr('rel', function (i, val) { + // If no rel attribute is present, create one with the value noopener. + if (val === null || typeof val === 'undefined') { + return 'noopener'; + } + // Check to see if rel contains noopener. Add what doesn't exist. + if (val.indexOf('noopener') > -1) { + if (val.indexOf('noopener') === -1) { + return val + ' noopener'; + } + // Noopener exists. Nothing needs to be added. + else { + return val; + } + } + // Else, append noopener to val. + else { + return val + ' noopener'; + } + }); + } + + if (drupalSettings.data.extlink.extNofollow) { + $(external_links).attr('rel', function (i, val) { + // When the link does not have a rel attribute set it to 'nofollow'. + if (val === null || typeof val === 'undefined') { + return 'nofollow'; + } + var target = 'nofollow'; + // Change the target, if not overriding follow. + if (drupalSettings.data.extlink.extFollowNoOverride) { + target = 'follow'; + } + if (val.indexOf(target) === -1) { + return val + ' nofollow'; + } + return val; + }); + } + + if (drupalSettings.data.extlink.extNoreferrer) { + $(external_links).attr('rel', function (i, val) { + // When the link does not have a rel attribute set it to 'noreferrer'. + if (val === null || typeof val === 'undefined') { + return 'noreferrer'; + } + if (val.indexOf('noreferrer') === -1) { + return val + ' noreferrer'; + } + return val; + }); + } + + Drupal.extlink = Drupal.extlink || {}; + + // Set up default click function for the external links popup. This should be + // overridden by modules wanting to alter the popup. + Drupal.extlink.popupClickHandler = Drupal.extlink.popupClickHandler || function () { + if (drupalSettings.data.extlink.extAlert) { + return confirm(drupalSettings.data.extlink.extAlertText); + } + }; + + $(external_links).off("click.extlink"); + $(external_links).on("click.extlink", function (e) { + return Drupal.extlink.popupClickHandler(e, this); + }); + }; + + /** + * Apply a class and a trailing to all links not containing images. + * + * @param {object[]} links + * An array of DOM elements representing the links. + * @param {string} class_name + * The class to apply to the links. + * @param {string} icon_placement + * 'append' or 'prepend' the icon to the link. + */ + Drupal.extlink.applyClassAndSpan = function (links, class_name, icon_placement) { + var $links_to_process; + if (drupalSettings.data.extlink.extImgClass) { + $links_to_process = $(links); + } + else { + var links_with_images = $(links).find('img, svg').parents('a'); + $links_to_process = $(links).not(links_with_images); + } + + if (class_name !== '0') { + $links_to_process.addClass(class_name); + } + + // Add data-extlink attribute. + $links_to_process.attr('data-extlink', ''); + + var i; + var length = $links_to_process.length; + for (i = 0; i < length; i++) { + var $link = $($links_to_process[i]); + if (drupalSettings.data.extlink.extUseFontAwesome) { + if (class_name === drupalSettings.data.extlink.mailtoClass) { + $link[icon_placement](''); + } + else { + $link[icon_placement](''); + } + } + else { + if (class_name === drupalSettings.data.extlink.mailtoClass) { + $link[icon_placement]('' + drupalSettings.data.extlink.mailtoLabel + ''); + } + else { + $link[icon_placement]('' + drupalSettings.data.extlink.extLabel + ''); + } + } + } + }; + + Drupal.behaviors.extlink = Drupal.behaviors.extlink || {}; + Drupal.behaviors.extlink.attach = function (context, drupalSettings) { + // Backwards compatibility, for the benefit of modules overriding extlink + // functionality by defining an "extlinkAttach" global function. + if (typeof extlinkAttach === 'function') { + extlinkAttach(context); + } + else { + Drupal.extlink.attach(context, drupalSettings); + } + }; + + })(jQuery, Drupal, drupalSettings); + \ No newline at end of file diff --git a/web/themes/custom/eql/scripts/main.js b/web/themes/custom/eql/scripts/main.js index 0c061a2..22331ab 100644 --- a/web/themes/custom/eql/scripts/main.js +++ b/web/themes/custom/eql/scripts/main.js @@ -31,3 +31,45 @@ function toggleFaq(event) { answer.classList.toggle('opened');} } +// open external link in new window +// $(".ext").each( +// function(i,e){ +// window.open(e, '_blank'); +// } +// ); +// var target = document.getElementsByClassName("ext"); + +// document.addEventListener("click", function(e) { +// if (e.target == true ) +// { +// e.target.setAttribute("target", "_blank"); +// } +// }); + +// add id to field + + // Add data-extlink attribute. +// $links_to_process.attr('data-extlink', ''); + +// var i; +// var length = $links_to_process.length; +// for (i = 0; i < length; i++) { +// var $link = $($links_to_process[i]); +// if (drupalSettings.data.extlink.extUseFontAwesome) { +// if (class_name === drupalSettings.data.extlink.mailtoClass) { +// $link[icon_placement](''); +// } +// else { +// $link[icon_placement](''); +// } +// } +// else { +// if (class_name === drupalSettings.data.extlink.mailtoClass) { +// $link[icon_placement]('' + drupalSettings.data.extlink.mailtoLabel + ''); +// } +// else { +// $link[icon_placement]('' + drupalSettings.data.extlink.extLabel + ''); +// } +// } +// } +// }; \ No newline at end of file diff --git a/web/themes/custom/eql/scss/pages/_actualite.scss b/web/themes/custom/eql/scss/pages/_actualite.scss index 889cd03..594a23f 100644 --- a/web/themes/custom/eql/scss/pages/_actualite.scss +++ b/web/themes/custom/eql/scss/pages/_actualite.scss @@ -14,6 +14,7 @@ display: grid; grid-template-columns: 1fr repeat(8, 1fr) 1fr; padding-top: 2rem; + .block-entity-fieldnodefield-actu-type{ grid-column: 2; diff --git a/web/themes/custom/eql/scss/pages/_mentions-legales.scss b/web/themes/custom/eql/scss/pages/_mentions-legales.scss new file mode 100644 index 0000000..343690f --- /dev/null +++ b/web/themes/custom/eql/scss/pages/_mentions-legales.scss @@ -0,0 +1,33 @@ +.node-id-6{ + + background: url('../images/pictos/carre-contour-bleu_contact.svg'); + background-repeat: no-repeat; + background-position-y: 7rem; + max-width: 100vw; + background-size: contain; + + .layout__region--top{ //bandeau titre page static + padding-bottom: 3rem; + height: 30vh; + + .block-region-top{ + .block-entity-fieldnodefield-images{ + display: none; + height: inherit; + + } + .block-entity-fieldnodetitle{ + + .field--name-title{ + font-family: 'Source Code Pro'; + font-size: 2rem; + font-weight: 800; + color: $white; + background-color: $blue-light; + text-transform: uppercase; + } + } + } + + } +} \ No newline at end of file diff --git a/web/themes/custom/eql/scss/styles.scss b/web/themes/custom/eql/scss/styles.scss index 3bf1aa4..8c3279e 100644 --- a/web/themes/custom/eql/scss/styles.scss +++ b/web/themes/custom/eql/scss/styles.scss @@ -28,6 +28,7 @@ @import "pages/_programme"; @import "pages/_contact"; @import "pages/_faq"; +@import "pages/_mentions-legales"; /*partials*/