From 2cd524b93f0687be222006795747843870956ccd Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Fri, 23 Jun 2023 12:24:49 +0100 Subject: [PATCH 1/2] Added javascript injector snippet for closing tableau cookies consent dialog box --- javascript-injectors/README.md | 7 +++++++ .../examples/googlemaps-cookies-consent-closing.js | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 javascript-injectors/examples/googlemaps-cookies-consent-closing.js diff --git a/javascript-injectors/README.md b/javascript-injectors/README.md index e4180206e..618236440 100644 --- a/javascript-injectors/README.md +++ b/javascript-injectors/README.md @@ -186,6 +186,13 @@ $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" ``` +## Google Maps cookies consent closing + +```bash +* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/googlemaps-cookies-consent-closing.js' +$ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" +``` + ## Sign in to Jenkins via credentials Jenkins logo diff --git a/javascript-injectors/examples/googlemaps-cookies-consent-closing.js b/javascript-injectors/examples/googlemaps-cookies-consent-closing.js new file mode 100644 index 000000000..af3a2e7e5 --- /dev/null +++ b/javascript-injectors/examples/googlemaps-cookies-consent-closing.js @@ -0,0 +1,4 @@ +const acceptCookie = document.querySelector('button[aria-label="Accept all"]') +if (acceptCookie) { + acceptCookie.click() +} From 64d21d82835f0c9dba51d11144cce962ce74d933 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Mon, 10 Jul 2023 15:49:07 +0100 Subject: [PATCH 2/2] Fixed js injector snippet for google maps consent closing --- javascript-injectors/README.md | 14 +++++++------- .../examples/googlemaps-cookies-consent-closing.js | 9 ++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/javascript-injectors/README.md b/javascript-injectors/README.md index 618236440..aef1ea68f 100644 --- a/javascript-injectors/README.md +++ b/javascript-injectors/README.md @@ -186,13 +186,6 @@ $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" ``` -## Google Maps cookies consent closing - -```bash -* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/googlemaps-cookies-consent-closing.js' -$ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" -``` - ## Sign in to Jenkins via credentials Jenkins logo @@ -220,3 +213,10 @@ $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" * Download [cyfe-sign-in-via-credentials.js](https://github.com/Screenly/Playground/tree/master/javascript-injectors/examples/cyfe-sign-in-via-credentials.js) and modify it with your credentials. * Run `screenly asset inject-js "$ASSET_ID" /path/to/script.js` to add the JavaScript + +## Google Maps cookies consent closing + +```bash +* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/googlemaps-cookies-consent-closing.js' +$ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" +``` diff --git a/javascript-injectors/examples/googlemaps-cookies-consent-closing.js b/javascript-injectors/examples/googlemaps-cookies-consent-closing.js index af3a2e7e5..686853004 100644 --- a/javascript-injectors/examples/googlemaps-cookies-consent-closing.js +++ b/javascript-injectors/examples/googlemaps-cookies-consent-closing.js @@ -1,4 +1,7 @@ -const acceptCookie = document.querySelector('button[aria-label="Accept all"]') -if (acceptCookie) { - acceptCookie.click() +function closeConsentbox () { + const acceptCookie = document.querySelector('button[aria-label="Accept all"]') + if (acceptCookie) { + acceptCookie.click() + } } +setInterval(closeConsentbox(), 2000)