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

Line 13: Line 13:
  
 
if(['Project', 'Model', 'human_practices', 'Achievements', 'Team'].indexOf(sessionStorage.getItem('KEY')) > -1 ){
 
if(['Project', 'Model', 'human_practices', 'Achievements', 'Team'].indexOf(sessionStorage.getItem('KEY')) > -1 ){
 +
console.log('If statement with indexof was executed');
 
if(ref !== loc || ref !== loc + '#'){ sessionStorage.setItem('KEY', ref.substr( ref.indexOf('Greece/')+7, ref.length )); }  
 
if(ref !== loc || ref !== loc + '#'){ sessionStorage.setItem('KEY', ref.substr( ref.indexOf('Greece/')+7, ref.length )); }  
 
}
 
}

Revision as of 19:20, 27 September 2017

console.log('master script');

                (function($) {
                    $.fn.goTo = function() {
                      $('html, body').animate({
                         scrollTop: $(this).offset().top + 'px'}, 1000);
                      return this; // for chaining...
                    }
                 })(jQuery);

var ref = document.location.href; var loc = 'https://2017.igem.org/Team:Greece/'+ sessionStorage.getItem('KEY');

if(['Project', 'Model', 'human_practices', 'Achievements', 'Team'].indexOf(sessionStorage.getItem('KEY')) > -1 ){ console.log('If statement with indexof was executed'); if(ref !== loc || ref !== loc + '#'){ sessionStorage.setItem('KEY', ref.substr( ref.indexOf('Greece/')+7, ref.length )); } }

var master = sessionStorage.getItem('KEY'); var link = sessionStorage.getItem('LINK'); if(link != null){ history.replaceState(null, null, link); document.title = link.toUpperCase();

if(ref !== loc || ref !== loc + '#'){

  if(sessionStorage.getItem('LINK') !== master){
      sessionStorage.setItem('LINK', master);
  }

} }