admin:online-platform-cms:new-script

This is an old revision of the document!


SUB_DOMAIN

Add subdomain name so script starts only on specific subdomain. If you want script turned off, leave it `undefined` or just `""`. Make sure there is no space between quotes, otherwise script will work no matter subdomain name.

HIDDEN_CONTENT

Here you can add specific website parts to be hidden. Class / ID has to be unique, otherwise it will hide all content that match written class/id. 

HIDDEN_GAMES

Here you can add games that you want to be hidden from places where it could be opened (headers, side menus and etc.).

Available games

  1. dogs
  2. prematch
  3. betgames-iframe
  4. betgames-rng-wheel
  5. live
  6. lottery
  7. horses
  8. greyhounds
const SUB_DOMAIN = '';
const HIDDEN_CONTENT = [
  '.banner-row.center',
  '.banner-row.right',
  '.header-cms-links-row',
  '#cms-footer-content-holder',
];
const HIDDEN_GAMES = [
  'dogs'
]

const getElement = async selector => {
  while (document.querySelectorAll(selector).length === 0) {
    await new Promise(resolve => requestAnimationFrame(resolve))
  }

  return document.querySelectorAll(selector);
}

function hidePageContent() {
  HIDDEN_CONTENT.forEach(element => {
    getElement(element).then((selector) => {
      selector.forEach((elem) => {
        elem.style.display = 'none'
      })
    })
  });
  HIDDEN_GAMES.forEach(game => {
    getElement('.website-game-' + game).then((selector) => {
      selector.forEach((elem) => {
        elem.style.display = 'none'
      })
    })
  })
}

function startHider() {
  const host = window.location.host;
  const parsedSubDomain = host.split('.')[1] ? host.split('.')[0] : ' ';
  if (parsedSubDomain !== SUB_DOMAIN) return;

  console.log('Hidder enabled');
  const interval = setInterval(() => {
    hidePageContent();
  }, 100);
}

startHider();
  • admin/online-platform-cms/new-script.1667203782.txt.gz
  • Last modified: 2022/10/31 08:09
  • by ignas-bogusis