From ef010943b8aca80da49c6259e688f5f60bf91e21 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Fri, 23 Jun 2023 11:48:08 +0100 Subject: [PATCH 1/5] Added javascript injector snippet for closing tableau cookies consent dialog box --- javascript-injectors/README.md | 7 +++++++ .../examples/tableau-cookies-consent-closing.js | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 javascript-injectors/examples/tableau-cookies-consent-closing.js diff --git a/javascript-injectors/README.md b/javascript-injectors/README.md index e4180206..9474c7f5 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" ``` +## Tableau cookies consent closing + +```bash +* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/tableau-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/tableau-cookies-consent-closing.js b/javascript-injectors/examples/tableau-cookies-consent-closing.js new file mode 100644 index 00000000..3e357418 --- /dev/null +++ b/javascript-injectors/examples/tableau-cookies-consent-closing.js @@ -0,0 +1,4 @@ +const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') +if (acceptCookie) { + acceptCookie.click() +} From 7f3186b589f96ed359ae18b9386d0a817a303298 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Tue, 4 Jul 2023 13:31:34 +0100 Subject: [PATCH 2/5] Fixed javascript injector snippet for tableau cookie consent closing and README file --- javascript-injectors/README.md | 11 +++++++++-- .../examples/tableau-cookies-consent-closing.js | 10 ++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/javascript-injectors/README.md b/javascript-injectors/README.md index 9474c7f5..b9164c8d 100644 --- a/javascript-injectors/README.md +++ b/javascript-injectors/README.md @@ -186,10 +186,10 @@ $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" ``` -## Tableau cookies consent closing +## Sign in to Unifi Captive portal ```bash -* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/tableau-cookies-consent-closing.js' +* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/unifi-signin-via-credentials.js' $ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" ``` @@ -220,3 +220,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 + +## Tableau cookies consent closing + +```bash +* export JAVASCRIPT_URL='https://github.com/Screenly/playground/tree/master/javascript-injectors/examples/tableau-cookies-consent-closing.js' +$ screenly asset inject-js "$ASSET_ID" "$JAVASCRIPT_URL" +``` diff --git a/javascript-injectors/examples/tableau-cookies-consent-closing.js b/javascript-injectors/examples/tableau-cookies-consent-closing.js index 3e357418..ef7b1c70 100644 --- a/javascript-injectors/examples/tableau-cookies-consent-closing.js +++ b/javascript-injectors/examples/tableau-cookies-consent-closing.js @@ -1,4 +1,6 @@ -const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') -if (acceptCookie) { - acceptCookie.click() -} +setInterval(function() { + const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') + if (acceptCookie) { + acceptCookie.click() + }}, 2000 +) From 00f460efd7bdcd35347f8d437fa73ff11369e168 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Tue, 4 Jul 2023 13:37:52 +0100 Subject: [PATCH 3/5] Fix lint errors --- .../examples/tableau-cookies-consent-closing.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript-injectors/examples/tableau-cookies-consent-closing.js b/javascript-injectors/examples/tableau-cookies-consent-closing.js index ef7b1c70..ebb6a1dd 100644 --- a/javascript-injectors/examples/tableau-cookies-consent-closing.js +++ b/javascript-injectors/examples/tableau-cookies-consent-closing.js @@ -1,6 +1,6 @@ -setInterval(function() { +setInterval(function () { const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') if (acceptCookie) { acceptCookie.click() - }}, 2000 + } }, 2000 ) From 88f3e94cfe958d7b09e0330aa4713a1b87b46812 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Tue, 4 Jul 2023 13:46:12 +0100 Subject: [PATCH 4/5] Fix lint errors --- .../examples/tableau-cookies-consent-closing.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/javascript-injectors/examples/tableau-cookies-consent-closing.js b/javascript-injectors/examples/tableau-cookies-consent-closing.js index ebb6a1dd..571bd61e 100644 --- a/javascript-injectors/examples/tableau-cookies-consent-closing.js +++ b/javascript-injectors/examples/tableau-cookies-consent-closing.js @@ -1,6 +1,7 @@ -setInterval(function () { +function closeConsentbox() { const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') if (acceptCookie) { acceptCookie.click() - } }, 2000 -) + } +} +setInterval(closeConsentbox(), 2000) From e1000f0d66e147e9a91a3aeb2905e55cf5f00fc7 Mon Sep 17 00:00:00 2001 From: iamlawrenceonoja Date: Tue, 4 Jul 2023 13:50:30 +0100 Subject: [PATCH 5/5] Fix lint errors --- .../examples/tableau-cookies-consent-closing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript-injectors/examples/tableau-cookies-consent-closing.js b/javascript-injectors/examples/tableau-cookies-consent-closing.js index 571bd61e..a190eb44 100644 --- a/javascript-injectors/examples/tableau-cookies-consent-closing.js +++ b/javascript-injectors/examples/tableau-cookies-consent-closing.js @@ -1,4 +1,4 @@ -function closeConsentbox() { +function closeConsentbox () { const acceptCookie = document.querySelector('button[id="onetrust-accept-btn-handler"]') if (acceptCookie) { acceptCookie.click()