admin:online-platform-cms:new-script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
admin:online-platform-cms:new-script [2022/10/28 08:49] – created edvinas-bazeviciusadmin:online-platform-cms:new-script [2022/10/31 11:49] (current) ignas-bogusis
Line 1: Line 1:
-test script page+==== USAGE ==== 
 + 
 +**SUB_DOMAIN** 
 +<code> 
 +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. 
 +</code> 
 +**HIDDEN_CONTENT** 
 +<code> 
 +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.  
 +</code> 
 +**HIDDEN_GAMES** 
 +<code> 
 +Here you can add games that you want to be hidden in header. If you pass `'undefined'` to hidden games array it will hide all expandable menus. It is important to know that if you want the best experience with the script you should add `'.left-menu.side-menu-toggle-wrapper'` to HIDDEN_CONTENT array, to hide mobile side menu, since this script can't handle it. 
 + 
 +</code> 
 + 
 +=== Available games === 
 +    - dogs 
 +    - prematch 
 +    - betgames-iframe 
 +    - betgames-rng-wheel 
 +    - live 
 +    - lottery 
 +    - horses 
 +    - keno 
 +    - roulette 
 +    - greyhounds 
 +    - undefined (hides every expandable header menu) 
 + 
 +==== HIDDER SCRIPT ==== 
 +<code> 
 +const SUB_DOMAIN = ''; 
 +const HIDDEN_CONTENT = [ 
 +  '.banner-row.center', 
 +  '.banner-row.right', 
 +  '.header-cms-links-row', 
 +  '#cms-footer-content-holder', 
 +  '.left-menu.side-menu-toggle-wrapper' 
 +]; 
 +const HIDDEN_GAMES = [ 
 +  'horses', 
 +  'lottery', 
 +  'roulette', 
 +  'horses', 
 +  'keno', 
 +  'betgames-iframe', 
 +  'greyhounds', 
 +  'undefined' 
 +
 + 
 +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'); 
 +  hidePageContent(); 
 +  window.addEventListener('resize', hidePageContent); 
 +  document.addEventListener('routeChange', hidePageContent); 
 +
 + 
 +startHider(); 
 +</code>
  • admin/online-platform-cms/new-script.1666946993.txt.gz
  • Last modified: 2022/10/28 08:49
  • by edvinas-bazevicius