admin:online-platform-cms:3rd-party-scripts:content-hidder-script

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
admin:online-platform-cms:3rd-party-scripts:content-hidder-script [2022/10/31 11:55] ignas-bogusisadmin:online-platform-cms:3rd-party-scripts:content-hidder-script [2023/04/12 12:13] ignas-bogusis
Line 9: Line 9:
 <code> <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.  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>
 +**REDIRECT_TO_MAIN_PAGE_AFTER_REGISTRATION**
 +<code>
 +Set this to "true" if you want that after complete registration user will be redirected to your main page and hider script disabled. There is one downside with it - after redirect user will have to re-login to his account.
 </code> </code>
 **HIDDEN_GAMES** **HIDDEN_GAMES**
 <code> <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. 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> </code>
  
Line 27: Line 30:
     - roulette     - roulette
     - greyhounds     - greyhounds
 +    - pragmatic
 +    - agtslots
 +    - roulette-live
 +    - dogs
 +    - betgames-rng-wheel
     - undefined (hides every expandable header menu)     - undefined (hides every expandable header menu)
 +
  
 === HIDDER SCRIPT === === HIDDER SCRIPT ===
 <code> <code>
 const SUB_DOMAIN = ''; const SUB_DOMAIN = '';
 +const REDIRECT_TO_MAIN_PAGE_AFTER_REGISTRATION = true;
 +const REDIRECT_TO_MAIN_PAGE_AFTER_LOGIN = true;
 const HIDDEN_CONTENT = [ const HIDDEN_CONTENT = [
   '.banner-row.center',   '.banner-row.center',
Line 47: Line 58:
   'betgames-iframe',   'betgames-iframe',
   'greyhounds',   'greyhounds',
-  'undefined' +  'undefined', 
-]+  'pragmatic', 
 +  'agtslots', 
 +  'roulette-live', 
 +  'dogs', 
 +  'evolution', 
 +  'betgames-rng-wheel
 +];
  
 const getElement = async selector => { const getElement = async selector => {
Line 62: Line 79:
     getElement(element).then((selector) => {     getElement(element).then((selector) => {
       selector.forEach((elem) => {       selector.forEach((elem) => {
-        elem.style.display = 'none'+        elem.remove();
       })       })
     })     })
Line 69: Line 86:
     getElement('.website-game-' + game).then((selector) => {     getElement('.website-game-' + game).then((selector) => {
       selector.forEach((elem) => {       selector.forEach((elem) => {
-        elem.style.display = 'none'+        elem.remove();
       })       })
     })     })
Line 75: Line 92:
 } }
  
-function startHider() {+function addMeta() { 
 +  const meta = document.createElement("meta"); 
 +  meta.name = "robots"; 
 +  meta.content = "noindex"; 
 +  document.head.appendChild(meta); 
 +
 + 
 +function getParsedSubDomain() {
   const host = window.location.host;   const host = window.location.host;
-  const parsedSubDomain = host.split('.')[1] ? host.split('.')[0] : ' ';+  return host.split('.')[1] ? host.split('.')[0] : ' '
 +
 + 
 +function redirectToMainPage() { 
 +  const host = window.location.origin; 
 +  const newURL = host.replace(SUB_DOMAIN + '.', ''); 
 +  window.location.assign(newURL); 
 +
 + 
 +function startHider() { 
 +  const parsedSubDomain = getParsedSubDomain();
   if (parsedSubDomain !== SUB_DOMAIN) return;   if (parsedSubDomain !== SUB_DOMAIN) return;
  
-  console.log('Hidder enabled');+  addMeta();
   hidePageContent();   hidePageContent();
   window.addEventListener('resize', hidePageContent);   window.addEventListener('resize', hidePageContent);
   document.addEventListener('routeChange', hidePageContent);   document.addEventListener('routeChange', hidePageContent);
 +  document.addEventListener('cmsPageLoaded', hidePageContent);
 +  if (REDIRECT_TO_MAIN_PAGE_AFTER_REGISTRATION) {
 +    document.body.addEventListener('userRegisterComplete', redirectToMainPage);
 +  }
 +  if (REDIRECT_TO_MAIN_PAGE_AFTER_LOGIN) {
 +    document.body.addEventListener('userLogIn', redirectToMainPage);
 +  }
 } }
  
 startHider(); startHider();
 </code> </code>
  • admin/online-platform-cms/3rd-party-scripts/content-hidder-script.txt
  • Last modified: 2023/04/12 12:14
  • by ignas-bogusis