Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into UHF-X_linters_and_updates
  • Loading branch information
teroelonen committed Feb 17, 2025
2 parents 4dbbaad + 34cda49 commit 17f36e3
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 37 deletions.
1 change: 0 additions & 1 deletion dist/js/disable-genesys-button.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/js/matomo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/nav-toggle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/toggle-widgets.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions hdbt.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ environment-indicator:
minified: true
}

disable_genesys_button:
version: 1.x
js:
src/js/disable-genesys-button.js: {}
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings

nav-toggle:
version: 1.x
js:
Expand Down
3 changes: 0 additions & 3 deletions hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ function hdbt_preprocess_html(&$variables): void {
$variables['#attached']['library'][] = 'hdbt/matomo';
}

// Disable Genesys button if the chat element does not exist.
$variables['#attached']['library'][] = 'hdbt/disable_genesys_button';

// Toggle between global and local navigation libraries for CSS and JS.
$navigation_enabled = \Drupal::moduleHandler()->moduleExists('helfi_navigation');
$variables['#attached']['library'][] = $navigation_enabled ? 'hdbt/nav-global' : 'hdbt/nav-local';
Expand Down
12 changes: 0 additions & 12 deletions src/js/disable-genesys-button.js

This file was deleted.

18 changes: 10 additions & 8 deletions src/js/matomo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// eslint-disable-next-line func-names
(function ($, Drupal) {
function loadMatomoAnalytics() {

/**
* If the queryparameter is found, the script will be loaded
* regardless of cookie consents etc.
* Temporary hard-coded value for using Matomo js client.
* This will be reworked into a general feature, for now use this for testing.
*
* @todo implement a general feature
*/
const useJSAPI = window.location.search === '?9mt5bfb2bGk=';
if (useJSAPI) {
console.info('Using JavaScript Tracking');
const instanceName = drupalSettings.helfi_instance_name;
if (instanceName === 'asuminen' && Drupal.cookieConsent.getConsentStatus(['statistics'])) {
const getViewportWidth = () => window.innerWidth;
const getViewportHeight = () => window.innerHeight;
const getLanguage = () => document.querySelector('html')?.attributes?.lang?.value || 'unkown';
Expand All @@ -33,14 +35,14 @@
const u='//webanalytics.digiaiiris.com/js/';
_paq.push(['setTrackerUrl', `${u}tracker.php`]);
_paq.push(['setSiteId', '141']);
_paq.push(['addTracker', `${u}tracker.php`, '1098']);
const d=document; const g=d.createElement('script'); const s=d.getElementsByTagName('script')[0];
// Consider integrity hash check
g.async=true; g.src=`${u}piwik.min.js`; s.parentNode.insertBefore(g,s);
})();
}

// Load Matomo only if statistics cookies are allowed.
if (!useJSAPI && Drupal.cookieConsent.getConsentStatus(['statistics'])) {
// Use Matomo tag manager if statistics cookies are allowed.
else if (Drupal.cookieConsent.getConsentStatus(['statistics'])) {
// Matomo Tag Manager
// eslint-disable-next-line no-multi-assign
const _mtm = (window._mtm = window._mtm || []);
Expand Down
1 change: 0 additions & 1 deletion src/js/nav-toggle/toggle-widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

const HIDE_SELECTORS = [
'.si-toggle-container', // Siteimprove accessibility tool
'.cx-theme-helsinki-blue', // Genesys chat in sote
'.aca--button--desktop, .aca--button--mobile, .aca--widget--mobile, .aca--widget--desktop, #aca--widget-button-close', // Watson chatbot in asuminen
'#telia-ace-leijuke', // Telia ACE chat leijuke
'.humany-trigger, .humany-widget', // Telia ACE chat button and widget
Expand Down

0 comments on commit 17f36e3

Please sign in to comment.