CharisKomos (Talk | contribs) |
CharisKomos (Talk | contribs) |
||
Line 114: | Line 114: | ||
'Colon_Cancer_Fluid_Dynamics':'1200px', | 'Colon_Cancer_Fluid_Dynamics':'1200px', | ||
'RNAi_Classifier_Design' : '13850px', | 'RNAi_Classifier_Design' : '13850px', | ||
− | 'Results' : ' | + | 'Results' : '8800px' |
} | } | ||
} | } |
Revision as of 04:43, 16 December 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%', 'TeamRoster' : '-215px 0px 0px 46.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_osiris', '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', 'HP_Silver' : '.content_image_silver', 'TeamIntro' : '.content_image_teamintro' },
/* Resize display_box */
'resizal' : { 'Supervisors' : '1300px', 'Description' : '4150px', 'Medals' : '1200px', 'TeamRoster' : '1050px', 'Quorum_Sensing' : '1800px', 'Colon_Cancer_Fluid_Dynamics': '9350px', 'HP_Gold_Integrated' : '9200px', 'Protein_Structure_Prediction' : '1200px', 'Attributions' : '1000px', 'ProjectDesign' : '10350px', 'Colon_Cancer_Fluid_Dynamics':'1200px', 'RNAi_Classifier_Design' : '13850px', 'Results' : '8800px' }
}
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','InterLab'].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', 'InterLab', 'TeamRoster'].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', 'InterLab'].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', 'TeamIntro', 'HP_Silver'].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');
/* Resize display_box */ ['Supervisors', 'TeamRoster', 'Description', 'Medals', 'Quorum_Sensing','RNAi_Classifier_Design', 'Colon_Cancer_Fluid_Dynamics','HP_Gold_Integrated', 'Protein_Structure_Prediction', 'Attributions', 'ProjectDesign', 'RNAi_Classifier_Design', 'Results'].indexOf( $('.reveal').attr('id') ) > -1 ? $('#display_box').css('height', styleObj.resizal[ $('.reveal').attr('id') ] ) : $('#display_box').css('height', '800px');
}