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

Line 1: Line 1:
 
console.log('master script');
 
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 ref = document.location.href;

Revision as of 13:21, 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 ){ 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);
  }

} }

       if(link !== master){ if(link !== null){
         $('#display_box').css('display', 'block');
         $('.display_frame').removeClass('reveal');
         $('#' + link).addClass('reveal');
         $('#footer').addClass('reveal');
         $('#ct1').goTo();
         void(document.title = link.toUpperCase());
       }}