From 257d03fecbc7e74745a153c10a8091e0e3c25bc0 Mon Sep 17 00:00:00 2001 From: rpnykanen Date: Wed, 4 Dec 2024 08:06:24 +0200 Subject: [PATCH] remove the rns localstorage cleaner --- assets/js/clear-localstorage.js | 37 ----------------------------- helfi_platform_config.libraries.yml | 8 ------- helfi_platform_config.module | 7 ------ 3 files changed, 52 deletions(-) delete mode 100644 assets/js/clear-localstorage.js diff --git a/assets/js/clear-localstorage.js b/assets/js/clear-localstorage.js deleted file mode 100644 index 142838d1d..000000000 --- a/assets/js/clear-localstorage.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file - * Clears certain localStorage items when cookie category approval is not given. - * - * Depends on EU Cookie Compliance module. - */ -(function ($, Drupal) { - 'use strict'; - - var clearLocalStorage = function () { - - if (!Drupal.cookieConsent.getConsentStatus(['statistics'])) { - var requireStatistics = [ - 'rnsbid', - 'rnsbid_ts', - ]; - - // Find localStorage keys that starts with rns_reaction_ and add those to - // items that are removed. - for (var i = 0; i < localStorage.length; i++) { - if (localStorage.key(i).substring(0,13) === 'rns_reaction_') { - requireStatistics.push(localStorage.key(i)); - } - } - - // Remove items that require approving statistics category. - for (var i = 0; i < requireStatistics.length; i++) { - localStorage.removeItem(requireStatistics[i]); - } - } - }; - - // Run after page is ready. - $(document).ready(function () { - clearLocalStorage(); - }); -})(jQuery, Drupal); diff --git a/helfi_platform_config.libraries.yml b/helfi_platform_config.libraries.yml index ac8b24338..552f2cb5f 100644 --- a/helfi_platform_config.libraries.yml +++ b/helfi_platform_config.libraries.yml @@ -3,14 +3,6 @@ react_and_share: js: assets/js/reactAndShareSettings.js: {} -clear_localstorage: - version: 1.0.x - js: - assets/js/clear-localstorage.js: {} - dependencies: - - core/jquery - - core/drupal - # This library is loaded via chat_leijuke.js. # Setting the preprocess to false will not affect this library. # See: ChatLeijuke.php::build(). diff --git a/helfi_platform_config.module b/helfi_platform_config.module index 8b0b45146..be48b6271 100644 --- a/helfi_platform_config.module +++ b/helfi_platform_config.module @@ -170,13 +170,6 @@ function helfi_platform_config_module_implements_alter(&$implementations, $hook) } } -/** - * Implements hook_page_attachments(). - */ -function helfi_platform_config_page_attachments(array &$attachments) : void { - $attachments['#attached']['library'][] = 'helfi_platform_config/clear_localstorage'; -} - /** * Implements hook_page_attachments_alter(). */