CharisKomos (Talk | contribs) |
CharisKomos (Talk | contribs) |
||
Line 57: | Line 57: | ||
'Notebook' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', | 'Notebook' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', | ||
'Description' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)', | 'Description' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)', | ||
− | 'Engagement' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)' | + | 'Engagement' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)', |
+ | 'InterLab' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)' | ||
}, | }, | ||
/* Back_to_top right */ | /* Back_to_top right */ | ||
Line 68: | Line 69: | ||
'Notebook' : '-205px 0px 0px 5%', | 'Notebook' : '-205px 0px 0px 5%', | ||
'Engagement' : '-150px 0px 0px 15.5%', | 'Engagement' : '-150px 0px 0px 15.5%', | ||
− | 'Collaborations' : '-150px 0px 0px 5%' | + | 'Collaborations' : '-150px 0px 0px 5%', |
+ | 'InterLab' : '-225px 0px 0px 15.5%' | ||
}, | }, | ||
Line 77: | Line 79: | ||
'Basic_Part' : '0.8', | 'Basic_Part' : '0.8', | ||
'Composite_Part' : '0.8', | 'Composite_Part' : '0.8', | ||
− | 'Part_Collection' : '0.8' | + | 'Part_Collection' : '0.8', |
+ | 'InterLab' : '0.8' | ||
}, | }, | ||
Revision as of 13:01, 19 October 2017
console.log('master script'); console.log('Location: ' + window.location.href); console.log('Referrer: ' + document.referrer); console.log('KEY: ' + sessionStorage.getItem('KEY')); console.log('LINK: ' + sessionStorage.getItem('LINK'));
(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('LINK')) > -1 ){ console.log('If statement with indexof was executed'); console.log(sessionStorage.getItem('LINK')); sessionStorage.removeItem('LINK'); //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'); console.log('This is LINK before if statement of != :' + 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); }
}
}
/* Styling Object */
var styleObj = { /* Background Images of display_box*/
'Notebook' : 'url(https://static.igem.org/mediawiki/2017/e/e8/Greekom_notebook_background_image.png)',
/* Back_to_top properties*/
/* Back_to_top background-image*/
'back_to_top' : { 'OSIRIS_Protocol' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Results' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Part_Collection' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Basic_Part' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Composite_Part' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Notebook' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)', 'Description' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)', 'Engagement' : 'url(https://static.igem.org/mediawiki/2017/3/3e/GreeKom_backtotop_black.png)', 'InterLab' : 'url(https://static.igem.org/mediawiki/2017/e/e0/GreeKom_backtotop_white.png)' },
/* Back_to_top right */
'back_to_top_position_right' : { 'Description' : '180px' },
/* Back_to_top margin*/
'back_to_top_position_margin' : { 'Notebook' : '-205px 0px 0px 5%', 'Engagement' : '-150px 0px 0px 15.5%', 'Collaborations' : '-150px 0px 0px 5%', 'InterLab' : '-225px 0px 0px 15.5%' },
/* Back_to_top opacity*/
'back_to_top_opacity' : { 'OSIRIS_Protocol' : '0.8', 'Engagement' : '0.8', 'Basic_Part' : '0.8', 'Composite_Part' : '0.8', 'Part_Collection' : '0.8', 'InterLab' : '0.8' },
/* Transitions */
'names_of_transisted_images' : { 'OSIRIS_Protocol' : '.content_image', 'Engagement' : '.content_image_public_engagement', 'Results' : '.content_image_results', 'Basic_Part' : '.content_image_basic_part', 'Composite_Part' : '.content_image_composite_part', 'Part_Collection' : '.content_image_collection_part', 'InterLab' : '.content_image_interlab' }
}
function controllingGeneralStyle(){
/* Change background image of display_box on specific pages */ ['Notebook'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#display_box').css('background-image', styleObj[ $('.reveal').attr('id') ] ) : $('#display_box').css('background-image', 'none');
/* Change back-to-top image of display_box on specific pages */ ['OSIRIS_Protocol','Results','Part_Collection','Basic_Part','Composite_Part','Engagement', 'Notebook', 'Description'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#back_to_top').css('background-image', styleObj.back_to_top[ $('.reveal').attr('id') ]) : $('#back_to_top').css('background-image', 'url(https://static.igem.org/mediawiki/2017/8/8d/GreeKom_backtotop_grey.png)');
/* Adjust back_to_top position with right */ ['Description'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#back_to_top').css('right', styleObj.back_to_top_position_right[ $('.reveal').attr('id') ] ) : $('#back_to_top').css('right', 'initial');
/* Adjust back_to_top position with margin */ ['Notebook', 'Engagement', 'Collaborations'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#back_to_top').css('margin', styleObj.back_to_top_position_margin[ $('.reveal').attr('id') ] ) : $('#back_to_top').css('margin', '-205px 0px 0px 15.5%');
/* Style back_to_top position with opacity */ ['OSIRIS_Protocol', 'Engagement', 'Basic_Part', 'Composite_Part', 'Part_Collection'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#back_to_top').css('opacity', styleObj.back_to_top_opacity[ $('.reveal').attr('id') ] ) : $('#back_to_top').css('opacity', '1');
/* Adding transitions to images */
['OSIRIS_Protocol', 'Engagement', 'Results', 'Basic_Part', 'Composite_Part', 'Part_Collection', 'InterLab'].indexOf( $('.reveal').attr('id') ) > -1 ? $( styleObj.names_of_transisted_images[ $('.reveal').attr('id') ] ).addClass('slide_in') : $( styleObj.names_of_transisted_images[ $('.reveal').attr('id') ] ).removeClass('slide_in'); }