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
admin:online-platform-cms:3rd-party-scripts:content-hidder-script [2022/11/10 11:19] edvinas-bazeviciusadmin:online-platform-cms:3rd-party-scripts:content-hidder-script [2023/04/12 12:14] (current) 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>
 +**REDIRECT_TO_MAIN_PAGE_AFTER_LOGIN**
 +<code>
 +Set this to "true" if you want that after login 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 34:
     - 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 62:
   '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 82: Line 103:
 } }
  
-function startHider() {+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;
  
Line 92: Line 123:
   document.addEventListener('routeChange', hidePageContent);   document.addEventListener('routeChange', hidePageContent);
   document.addEventListener('cmsPageLoaded', 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.1668079195.txt.gz
  • Last modified: 2022/11/10 11:19
  • by edvinas-bazevicius