diff --git a/javascript-injectors/README.md b/javascript-injectors/README.md index e4180206e..aef1ea68f 100644 --- a/javascript-injectors/README.md +++ b/javascript-injectors/README.md @@ -213,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 new file mode 100644 index 000000000..686853004 --- /dev/null +++ b/javascript-injectors/examples/googlemaps-cookies-consent-closing.js @@ -0,0 +1,7 @@ +function closeConsentbox () { + const acceptCookie = document.querySelector('button[aria-label="Accept all"]') + if (acceptCookie) { + acceptCookie.click() + } +} +setInterval(closeConsentbox(), 2000)