Skip to content
Snippets Groups Projects
Commit b4351213 authored by Shelane French's avatar Shelane French
Browse files

Issue #3451440 by shelane: Attempt to fix lint issues

parent 047b47d7
No related branches found
No related tags found
1 merge request!16first lint fix pass
Pipeline #186677 passed
bettersocialsharingbuttons
bssb
digg
Evernote
evernote
flyke
googleplus
iconset
Joery
Lemmens
Pinterest
pinterest
printlink
Shelane
shelane
soical
stumbleupon
svgs
......@@ -46,7 +46,7 @@ include:
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
......
<svg version="1.1" viewBox="0 0 60 60" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g fill="none" fill-rule="evenodd" id="soical" stroke="none" stroke-width="1"><g id="social" transform="translate(-673.000000, -438.000000)"><g id="slices" transform="translate(173.000000, 138.000000)"/><g fill="#489951" id="square-flat" transform="translate(173.000000, 138.000000)"><path d="M502.995937,300 L557.004063,300 C558.658673,300 560,301.33731 560,302.995937 L560,357.004063 C560,358.658673 558.66269,360 557.004063,360 L502.995937,360 C501.341327,360 500,358.66269 500,357.004063 L500,302.995937 C500,301.341327 501.33731,300 502.995937,300 Z" id="square-36"/></g><g fill="#FFFFFF" id="icon" transform="translate(182.000000, 150.000000)"><path d="M535.149866,305.962256 C534.872317,304.488745 533.988691,303.762639 533.190028,303.477214 C532.328115,303.168595 530.580687,302.848617 528.38531,302.592065 C526.619001,302.385215 524.542574,302.402256 523.288409,302.440596 C523.137834,301.418652 522.414695,300.484276 521.606121,300.161457 C519.450393,299.301396 516.11933,299.508719 515.264024,299.746337 C514.584784,299.934727 513.83238,300.320973 513.413696,300.91549 C513.132842,301.313097 512.951586,301.821939 512.950169,302.532898 C512.950169,302.935238 512.961498,303.883341 512.971883,304.725415 C512.982267,305.57033 512.993124,306.326256 512.993124,306.331463 C512.992652,307.083602 512.378078,307.695633 511.616234,307.696579 L508.120906,307.696579 C507.37511,307.696579 506.805851,307.821068 506.370646,308.017032 C505.934969,308.213468 505.626266,308.478066 505.391671,308.790945 C504.924841,309.411969 504.843653,310.179255 504.845541,310.961689 C504.845541,310.961689 504.852621,311.601173 505.007917,312.838961 C505.137251,313.796531 506.184669,320.486738 507.179693,322.521633 C507.565335,323.313533 507.822116,323.642979 508.580184,323.991832 C510.268609,324.708471 514.125506,325.505578 515.933353,325.734675 C517.737423,325.963299 518.870277,326.444687 519.544798,325.04123 C519.547158,325.037916 519.680268,324.692377 519.862941,324.184955 C520.449193,322.424598 520.530381,320.862098 520.530381,319.732232 C520.530381,319.61721 520.700309,319.612003 520.700309,319.732232 C520.700309,320.530286 520.546902,323.354241 522.697909,324.11206 C523.547078,324.410739 525.309138,324.676757 527.09952,324.885027 C528.718086,325.070104 529.89295,325.701541 529.89295,329.819611 C529.89295,332.325008 529.361925,332.668654 526.587848,332.668654 C524.33866,332.668654 523.481467,332.726401 523.481467,330.954684 C523.481467,329.522826 524.909807,329.672876 525.968554,329.672876 C526.441049,329.672876 526.097888,329.324496 526.097888,328.440768 C526.097888,327.562246 526.652043,327.053877 526.128098,327.041097 C522.467562,326.941222 520.314195,327.036837 520.314195,331.575708 C520.314195,335.696619 521.904439,336.461538 527.09952,336.461538 C531.172604,336.461538 532.608496,336.329476 534.290313,331.154908 C534.623561,330.133437 535.427888,327.01601 535.915015,321.782274 C536.222774,318.471724 535.624249,308.483273 535.149866,305.962256 L535.149866,305.962256 Z M528.049702,317.002945 C527.546526,316.985432 527.062702,317.017146 526.611449,317.089094 C526.738423,316.072356 527.161827,314.823681 528.661915,314.875749 C530.322491,314.93255 530.555198,316.488897 530.560862,317.543028 C529.860381,317.232989 528.993747,317.035606 528.049702,317.002945 L528.049702,317.002945 Z M507.957114,306.689309 L507.959474,306.689309 L511.453858,306.689309 C511.653995,306.689309 511.815427,306.527426 511.815427,306.330516 C511.815427,306.329096 511.772945,303.359352 511.772945,302.533371 L511.772945,302.523431 C511.772945,301.845133 511.91644,301.253456 512.166612,300.758341 L512.286034,300.53587 C512.272817,300.538237 512.259128,300.544864 512.245912,300.557644 L505.455866,307.234598 C505.442649,307.245485 505.434153,307.259685 505.430377,307.273886 C505.570568,307.204778 505.762681,307.110583 505.790058,307.099223 C506.381502,306.834151 507.098505,306.689309 507.957114,306.689309 L507.957114,306.689309 Z" id="evernote"/></g></g></g></svg>
<svg version="1.1" viewBox="0 0 60 60" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g fill="none" fill-rule="evenodd" id="social" stroke="none" stroke-width="1"><g id="social" transform="translate(-673.000000, -438.000000)"><g id="slices" transform="translate(173.000000, 138.000000)"/><g fill="#489951" id="square-flat" transform="translate(173.000000, 138.000000)"><path d="M502.995937,300 L557.004063,300 C558.658673,300 560,301.33731 560,302.995937 L560,357.004063 C560,358.658673 558.66269,360 557.004063,360 L502.995937,360 C501.341327,360 500,358.66269 500,357.004063 L500,302.995937 C500,301.341327 501.33731,300 502.995937,300 Z" id="square-36"/></g><g fill="#FFFFFF" id="icon" transform="translate(182.000000, 150.000000)"><path d="M535.149866,305.962256 C534.872317,304.488745 533.988691,303.762639 533.190028,303.477214 C532.328115,303.168595 530.580687,302.848617 528.38531,302.592065 C526.619001,302.385215 524.542574,302.402256 523.288409,302.440596 C523.137834,301.418652 522.414695,300.484276 521.606121,300.161457 C519.450393,299.301396 516.11933,299.508719 515.264024,299.746337 C514.584784,299.934727 513.83238,300.320973 513.413696,300.91549 C513.132842,301.313097 512.951586,301.821939 512.950169,302.532898 C512.950169,302.935238 512.961498,303.883341 512.971883,304.725415 C512.982267,305.57033 512.993124,306.326256 512.993124,306.331463 C512.992652,307.083602 512.378078,307.695633 511.616234,307.696579 L508.120906,307.696579 C507.37511,307.696579 506.805851,307.821068 506.370646,308.017032 C505.934969,308.213468 505.626266,308.478066 505.391671,308.790945 C504.924841,309.411969 504.843653,310.179255 504.845541,310.961689 C504.845541,310.961689 504.852621,311.601173 505.007917,312.838961 C505.137251,313.796531 506.184669,320.486738 507.179693,322.521633 C507.565335,323.313533 507.822116,323.642979 508.580184,323.991832 C510.268609,324.708471 514.125506,325.505578 515.933353,325.734675 C517.737423,325.963299 518.870277,326.444687 519.544798,325.04123 C519.547158,325.037916 519.680268,324.692377 519.862941,324.184955 C520.449193,322.424598 520.530381,320.862098 520.530381,319.732232 C520.530381,319.61721 520.700309,319.612003 520.700309,319.732232 C520.700309,320.530286 520.546902,323.354241 522.697909,324.11206 C523.547078,324.410739 525.309138,324.676757 527.09952,324.885027 C528.718086,325.070104 529.89295,325.701541 529.89295,329.819611 C529.89295,332.325008 529.361925,332.668654 526.587848,332.668654 C524.33866,332.668654 523.481467,332.726401 523.481467,330.954684 C523.481467,329.522826 524.909807,329.672876 525.968554,329.672876 C526.441049,329.672876 526.097888,329.324496 526.097888,328.440768 C526.097888,327.562246 526.652043,327.053877 526.128098,327.041097 C522.467562,326.941222 520.314195,327.036837 520.314195,331.575708 C520.314195,335.696619 521.904439,336.461538 527.09952,336.461538 C531.172604,336.461538 532.608496,336.329476 534.290313,331.154908 C534.623561,330.133437 535.427888,327.01601 535.915015,321.782274 C536.222774,318.471724 535.624249,308.483273 535.149866,305.962256 L535.149866,305.962256 Z M528.049702,317.002945 C527.546526,316.985432 527.062702,317.017146 526.611449,317.089094 C526.738423,316.072356 527.161827,314.823681 528.661915,314.875749 C530.322491,314.93255 530.555198,316.488897 530.560862,317.543028 C529.860381,317.232989 528.993747,317.035606 528.049702,317.002945 L528.049702,317.002945 Z M507.957114,306.689309 L507.959474,306.689309 L511.453858,306.689309 C511.653995,306.689309 511.815427,306.527426 511.815427,306.330516 C511.815427,306.329096 511.772945,303.359352 511.772945,302.533371 L511.772945,302.523431 C511.772945,301.845133 511.91644,301.253456 512.166612,300.758341 L512.286034,300.53587 C512.272817,300.538237 512.259128,300.544864 512.245912,300.557644 L505.455866,307.234598 C505.442649,307.245485 505.434153,307.259685 505.430377,307.273886 C505.570568,307.204778 505.762681,307.110583 505.790058,307.099223 C506.381502,306.834151 507.098505,306.689309 507.957114,306.689309 L507.957114,306.689309 Z" id="evernote"/></g></g></g></svg>
......@@ -6,43 +6,43 @@
}
.social-sharing-buttons a,
.social-sharing-buttons__button {
.social-sharing-buttons-button {
display: flex;
align-items: center;
margin: 0 4px;
justify-content: center;
margin: 0 4px;
text-decoration: none;
}
.btnCopy {
.btn-copy {
position: relative;
padding: 0;
cursor: pointer;
}
.social-sharing-buttons__popup {
.social-sharing-buttons-popup {
position: absolute;
top: 0;
left: 50%;
padding: 4px;
overflow: hidden;
transform: translate(-50%, -100%);
color: white;
height: 0;
background-color: black;
padding: 4px;
transition: all .5s ease;
font-size: small;
transform: translate(-50%, -100%);
opacity: 0;
color: white;
border-radius: 3px;
background-color: black;
font-size: small;
}
.social-sharing-buttons__popup.visible {
.social-sharing-buttons-popup.visible {
overflow: unset;
height: auto;
opacity: 1;
}
.social-sharing-buttons__popup::before {
.social-sharing-buttons-popup::before {
position: absolute;
bottom: 0;
left: 50%;
......
(function () {
'use strict';
/* Main function, listens for a click event,
/* Main function, listens for a click event,
calls all the other functions upon element click */
Drupal.behaviors.copyButtonElements = {
attach: function (context) {
let btnCopies = document.querySelectorAll('.btnCopy.social-sharing-buttons__button');
attach(context) {
const btnCopies = document.querySelectorAll(
'.btn-copy.social-sharing-buttons-button',
);
btnCopies.forEach((btnCopy) => {
btnCopy.addEventListener('click', function (event) {
// Checks if page is using HTTPS
......@@ -20,21 +20,20 @@ calls all the other functions upon element click */
Drupal.showPopUpMessage(event.currentTarget);
});
});
}
},
};
// For HTTPS sites this is the function to copy current url to clipboard
Drupal.secureCopyToClipboard = function (valueToBeCopiedToClipboard) {
// Here we use the clipboardAPI to copy to clipboard
navigator.clipboard.writeText(valueToBeCopiedToClipboard)
.catch((err) => {
console.error('Error copying current URL to clipboard: ', err);
});
navigator.clipboard.writeText(valueToBeCopiedToClipboard).catch((err) => {
console.error('Error copying current URL to clipboard: ', err);
});
};
// For non-HTTPS sites this will be the fallback function
Drupal.unsecureCopyToClipboard = function (valueToBeCopiedToClipboard) {
const inputElem = document.createElement("input");
const inputElem = document.createElement('input');
inputElem.value = valueToBeCopiedToClipboard;
// Append the element to the body
document.body.append(inputElem);
......@@ -57,9 +56,11 @@ calls all the other functions upon element click */
Drupal.showPopUpMessage = function (clickedButton) {
// Find the parent container
let parentContainer = clickedButton.closest('.social-sharing-buttons');
const parentContainer = clickedButton.closest('.social-sharing-buttons');
if (parentContainer) {
let elemPopUpShow = parentContainer.querySelector('.social-sharing-buttons__popup');
const elemPopUpShow = parentContainer.querySelector(
'.social-sharing-buttons-popup',
);
if (elemPopUpShow) {
elemPopUpShow.classList.add('visible');
// Remove 'visible' from class after a certain time
......@@ -69,5 +70,4 @@ calls all the other functions upon element click */
}
}
};
})(Drupal);
......@@ -4,13 +4,11 @@
*/
(function () {
'use strict';
/**
* Set the print view of the page.
*/
Drupal.behaviors.printLink = {
attach: function (context) {
attach(context) {
const printLink = context.querySelector('.bssb-printlink');
printLink.addEventListener('click', function (e) {
const links = document.getElementsByTagName('link');
......@@ -21,7 +19,6 @@
e.preventDefault();
});
}
},
};
})(Drupal);
......@@ -6,7 +6,7 @@
<div class="social-sharing-buttons">
{# Facebook share button #}
{% if items.services.facebook %}
<a href="https://www.facebook.com/sharer/sharer.php?u={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Facebook" aria-label="{{ 'Share to'|t }} Facebook" class="social-sharing-buttons__button share-facebook" rel="noopener">
<a href="https://www.facebook.com/sharer/sharer.php?u={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Facebook" aria-label="{{ 'Share to'|t }} Facebook" class="social-sharing-buttons-button share-facebook" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#facebook" />
</svg>
......@@ -15,7 +15,7 @@
{# X share button #}
{% if items.services.x %}
<a href="https://twitter.com/intent/tweet?text={{ items.title }}+{{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} X" aria-label="{{ 'Share to'|t }} X" class="social-sharing-buttons__button share-x" rel="noopener">
<a href="https://twitter.com/intent/tweet?text={{ items.title }}+{{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} X" aria-label="{{ 'Share to'|t }} X" class="social-sharing-buttons-button share-x" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#x" />
</svg>
......@@ -24,7 +24,7 @@
{# WhatsApp share button #}
{% if items.services.whatsapp %}
<a href="https://wa.me/?text={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} WhatsApp" aria-label="{{ 'Share to'|t }} WhatsApp" class="social-sharing-buttons__button share-whatsapp" rel="noopener">
<a href="https://wa.me/?text={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} WhatsApp" aria-label="{{ 'Share to'|t }} WhatsApp" class="social-sharing-buttons-button share-whatsapp" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#whatsapp" />
</svg>
......@@ -33,7 +33,7 @@
{# Facebook Messenger share button #}
{% if items.services.facebook_messenger %}
<a href="https://www.facebook.com/dialog/send?app_id={{ items.facebook_app_id }}&amp;link={{ items.page_url }}&amp;redirect_uri={{ url('<current>') }}" target="_blank" title="{{ 'Share to'|t }} Facebook Messenger" aria-label="{{ 'Share to'|t }} Facebook Messenger" class="social-sharing-buttons__button share-facebook-messenger" rel="noopener">
<a href="https://www.facebook.com/dialog/send?app_id={{ items.facebook_app_id }}&amp;link={{ items.page_url }}&amp;redirect_uri={{ url('<current>') }}" target="_blank" title="{{ 'Share to'|t }} Facebook Messenger" aria-label="{{ 'Share to'|t }} Facebook Messenger" class="social-sharing-buttons-button share-facebook-messenger" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#messenger" />
</svg>
......@@ -42,7 +42,7 @@
{# Pinterest share button #}
{% if items.services.pinterest %}
<a href="https://pinterest.com/pin/create/link/?url={{ items.page_url }}&amp;description={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Pinterest" aria-label="{{ 'Share to'|t }} Pinterest" class="social-sharing-buttons__button share-pinterest" rel="noopener">
<a href="https://pinterest.com/pin/create/link/?url={{ items.page_url }}&amp;description={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Pinterest" aria-label="{{ 'Share to'|t }} Pinterest" class="social-sharing-buttons-button share-pinterest" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#pinterest" />
</svg>
......@@ -51,7 +51,7 @@
{# Linkedin share button #}
{% if items.services.linkedin %}
<a href="https://www.linkedin.com/sharing/share-offsite/?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Linkedin" aria-label="{{ 'Share to'|t }} Linkedin" class="social-sharing-buttons__button share-linkedin" rel="noopener">
<a href="https://www.linkedin.com/sharing/share-offsite/?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Linkedin" aria-label="{{ 'Share to'|t }} Linkedin" class="social-sharing-buttons-button share-linkedin" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#linkedin" />
</svg>
......@@ -60,7 +60,7 @@
{# Xing share button #}
{% if items.services.xing %}
<a href="https://www.xing.com/spi/shares/new?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Xing" aria-label="{{ 'Share to'|t }} Xing" class="social-sharing-buttons__button share-xing" rel="noopener">
<a href="https://www.xing.com/spi/shares/new?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Xing" aria-label="{{ 'Share to'|t }} Xing" class="social-sharing-buttons-button share-xing" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#xing" />
</svg>
......@@ -69,7 +69,7 @@
{# Tumblr share button #}
{% if items.services.tumblr %}
<a href="https://www.tumblr.com/share?v=3&amp;u={{ items.page_url }}&amp;t={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Tumblr" aria-label="{{ 'Share to'|t }} Tumblr" class="social-sharing-buttons__button share-tumblr" rel="noopener">
<a href="https://www.tumblr.com/share?v=3&amp;u={{ items.page_url }}&amp;t={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Tumblr" aria-label="{{ 'Share to'|t }} Tumblr" class="social-sharing-buttons-button share-tumblr" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#tumblr" />
</svg>
......@@ -78,7 +78,7 @@
{# Reddit share button #}
{% if items.services.reddit %}
<a href="https://www.reddit.com/submit?url={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Reddit" aria-label="{{ 'Share to'|t }} Reddit" class="social-sharing-buttons__button share-reddit" rel="noopener">
<a href="https://www.reddit.com/submit?url={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Reddit" aria-label="{{ 'Share to'|t }} Reddit" class="social-sharing-buttons-button share-reddit" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#reddit" />
</svg>
......@@ -87,7 +87,7 @@
{# Evernote share button #}
{% if items.services.evernote %}
<a href="https://www.evernote.com/clip.action?url={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Evernote" aria-label="{{ 'Share to'|t }} Evernote" class="social-sharing-buttons__button share-evernote" rel="noopener">
<a href="https://www.evernote.com/clip.action?url={{ items.page_url }}&amp;title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Evernote" aria-label="{{ 'Share to'|t }} Evernote" class="social-sharing-buttons-button share-evernote" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#evernote" />
</svg>
......@@ -96,7 +96,7 @@
{# Email share button #}
{% if items.services.email %}
<a href="mailto:?subject={{ items.title }}&amp;body={{ items.page_url }}" title="{{ 'Share to'|t }} Email" aria-label="{{ 'Share to'|t }} Email" class="social-sharing-buttons__button share-email" target="_blank" rel="noopener">
<a href="mailto:?subject={{ items.title }}&amp;body={{ items.page_url }}" title="{{ 'Share to'|t }} Email" aria-label="{{ 'Share to'|t }} Email" class="social-sharing-buttons-button share-email" target="_blank" rel="noopener">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#email" />
</svg>
......@@ -106,11 +106,11 @@
{# Copy link share button #}
{% if items.services.copy %}
{{ attach_library('better_social_sharing_buttons/copy-current-url') }}
<a class="btnCopy social-sharing-buttons__button share-copy">
<a class="btn-copy social-sharing-buttons-button share-copy">
<svg width="{{ items.width }}" height="{{ items.width }}" style="border-radius:{{ items.radius }};">
<use href="{{ social_buttons_sprite }}#copy" />
</svg>
<div class="social-sharing-buttons__popup">{{ 'Copied to clipboard'|t }}</div>
<div class="social-sharing-buttons-popup">{{ 'Copied to clipboard'|t }}</div>
</a>
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment