Difference between revisions of "Template:Greece/master script"

Line 23: Line 23:
  
 
if(redirection){
 
if(redirection){
   if(!bool){  
+
   if(sessionStorage.getItem('Project') !== 'once'){
 +
 
 
   console.log('Just created: ' + newstr);
 
   console.log('Just created: ' + newstr);
  
Line 30: Line 31:
 
   history.replaceState(null, null, newstr);
 
   history.replaceState(null, null, newstr);
  
   var bool = true;
+
   sessionStorage.setItem('Project', 'once');
  }else{ history.replaceState(null, null, 'Project'); }
+
   }
    
+
 
}else{
 
}else{
 
   console.log('No action must be taken');
 
   console.log('No action must be taken');
 +
  sessionStorage.setItem('Project', 'none');
 
  }
 
  }
  

Revision as of 14:44, 23 September 2017

var str = document.referrer; var redirection = true;

if('https://2017.igem.org/Team:Greece/'.length < str.length){

var newstr = str.substr(str.indexOf('Greece/')+7, str.length);


if(performance.navigation.type == 0){

switch(newstr){

 case 'Model': redirection= false;
   break;
 case 'human_practices': redirection= false;
   break;
 case 'Achievements': redirection= false;
   break;
 case 'Team': redirection= false;
   break;
 case 'Project': redirection= false;
   break;

}

if(redirection){

 if(sessionStorage.getItem('Project') !== 'once'){
  console.log('Just created: ' + newstr);
  $('#' + newstr).css('display', 'block');
  history.replaceState(null, null, newstr);
  sessionStorage.setItem('Project', 'once');
 }

}else{

  console.log('No action must be taken');
  sessionStorage.setItem('Project', 'none');
}

}

}