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/11/21 10:41] ringaudas-vainiusadmin: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 38: Line 41:
 <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 60: Line 65:
   'evolution',   'evolution',
   'betgames-rng-wheel'   'betgames-rng-wheel'
-   +];
-]+
  
 const getElement = async selector => { const getElement = async selector => {
Line 95: Line 99:
 } }
  
-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 105: Line 119:
   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.txt
  • Last modified: 2023/04/12 12:14
  • by ignas-bogusis