Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- const config = {
- referenceButtonClass: 'brlbs-btn-accept-all', // Possible values: brlbs-btn-accept-all, brlbs-btn-save, brlbs-btn-accept-only-essential, brlbs-cmpnt-btn-preferences
- buttonPosition: 'before', // Possible values: after, before
- buttonText: 'Gib Geld',
- buttonUrl: 'https://URL-ZUR-SEITE-BZGL-ABO',
- maxAttempts: 20 // Attempts to find the dialog
- };
- function createCustomButton(container, config) {
- const newButton = document.createElement('button');
- newButton.className = 'brlbs-cmpnt-btn brlbs-cmpnt-font-semibold brlbs-cmpnt-w-full';
- Object.assign(newButton.style, {
- '--tw-ring-color': 'var(--dialog-button-accept-all-color-hover)',
- background: 'var(--dialog-button-accept-all-color)',
- color: 'var(--dialog-button-accept-all-text-color)'
- });
- newButton.textContent = config.buttonText;
- newButton.onclick = function() { window.location.href = config.buttonUrl; };
- const newDiv = document.createElement('div');
- newDiv.appendChild(newButton);
- if (config.buttonPosition === 'after') {
- container.parentNode.insertBefore(newDiv, container.nextSibling);
- } else {
- container.parentNode.insertBefore(newDiv, container);
- }
- }
- function initCustomButton(config, attempts = 0) {
- const dialogReferenceButton = document.querySelector(`.brlbs-cmpnt-dialog-iab-tcf-entrance button.${config.referenceButtonClass}`)?.parentElement;
- if (dialogReferenceButton) {
- createCustomButton(dialogReferenceButton, config);
- } else if (attempts < config.maxAttempts) {
- setTimeout(() => initCustomButton(config, attempts + 1), 50);
- }
- }
- document.addEventListener('DOMContentLoaded', () => initCustomButton(config));
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement