Difference between revisions of "Template:SYSU-Software/statics/js/loader.js"

Line 10: Line 10:
 
     "Improve": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Improve.html&action=raw&ctype=text/html"},
 
     "Improve": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Improve.html&action=raw&ctype=text/html"},
 
     "Demostrate": {"url": ""},
 
     "Demostrate": {"url": ""},
     "Modeling-Overview": { "url": "../html/Modeling/ModelingOverview.html" },
+
     "Modeling-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/ModelingOverview.html&action=raw&ctype=text/html" },
 
     "Recommendation": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Recommendation.html&action=raw&ctype=text/html" },
 
     "Recommendation": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Recommendation.html&action=raw&ctype=text/html" },
     "Simulation-Circuits": { "url": "../html/Modeling/SimulationCircuit.html" },
+
     "Simulation-Circuits": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/SimulationCircuit.html&action=raw&ctype=text/html" },
     "Evolution-Algorithm": { "url": "../html/Modeling/EvolutionAlgorithm.html" },
+
     "Evolution-Algorithm": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/EvolutionAlgorithm.html&action=raw&ctype=text/html" },
 
     "Reference": { "url": "" },
 
     "Reference": { "url": "" },
     "HP-Overview": { "url": "../html/Human_Practice/Overview.html" },
+
     "HP-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Overview.html&action=raw&ctype=text/html" },
     "HP-Siliver": { "url": "../html/Human_Practice/Silver.html" },
+
     "HP-Siliver": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Silver.html&action=raw&ctype=text/html" },
     "HP-Gold": { "url": "../html/Human_Practice/Gold.html" },
+
     "HP-Gold": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Gold.html&action=raw&ctype=text/html" },
     "Human-Practice": { "url": "../html/Human_Practice/HumanPractice.html" },
+
     "Human-Practice": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/HumanPractice.html&action=raw&ctype=text/html" },
     "Public-Engagement": { "url": "../html/Human_Practice/PublicEngagement.html" },
+
     "Public-Engagement": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/PublicEngagement.html&action=raw&ctype=text/html" },
 
     "XMU": { "url": "../html/Collaboration/XMU.html" },
 
     "XMU": { "url": "../html/Collaboration/XMU.html" },
 
     "SCUT": { "url": "../html/Collaboration/SCUT.html" },
 
     "SCUT": { "url": "../html/Collaboration/SCUT.html" },

Revision as of 20:08, 14 October 2018

var pages = {

   "Home": { "url": "1" },
   "Description": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Description.html&action=raw&ctype=text/html" },
   "Design": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Design.html&action=raw&ctype=text/html" },
   "Feature": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Feature.html&action=raw&ctype=text/html" },
   "Techniques": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Techniques.html&action=raw&ctype=text/html" },
   "Validation": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Validation.html&action=raw&ctype=text/html" },
   "Demo": { "url": "" },
   "Contribution": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Contribution.html&action=raw&ctype=text/html"},
   "Improve": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Improve.html&action=raw&ctype=text/html"},
   "Demostrate": {"url": ""},
   "Modeling-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/ModelingOverview.html&action=raw&ctype=text/html" },
   "Recommendation": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Recommendation.html&action=raw&ctype=text/html" },
   "Simulation-Circuits": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/SimulationCircuit.html&action=raw&ctype=text/html" },
   "Evolution-Algorithm": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/EvolutionAlgorithm.html&action=raw&ctype=text/html" },
   "Reference": { "url": "" },
   "HP-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Overview.html&action=raw&ctype=text/html" },
   "HP-Siliver": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Silver.html&action=raw&ctype=text/html" },
   "HP-Gold": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/Gold.html&action=raw&ctype=text/html" },
   "Human-Practice": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/HumanPractice.html&action=raw&ctype=text/html" },
   "Public-Engagement": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Human_Practice/PublicEngagement.html&action=raw&ctype=text/html" },
   "XMU": { "url": "../html/Collaboration/XMU.html" },
   "SCUT": { "url": "../html/Collaboration/SCUT.html" },
   "WHU": { "url": "../html/Collaboration/WHU.html" },
   "SYSU": { "url": "../html/Collaboration/SYSU.html" },
   "I-Overview": { "url": "../html/Interlab/Overview.html" },
   "Experiment": { "url": "../html/Interlab/ExperimentDesign.html" },
   "Material-Methods": { "url": "../html/Interlab/MaterialMethods.html" },
   "Results": { "url": "../html/Interlab/Results.html" },
   "Wet-Lab": { "url": "../html/Safety/WetLabSafety.html"},
   "Dry-Lab": { "url": "../html/Safety/DryLabSafety.html"},
   "Medal-Overview": { "url": "../html/Medal/Overview.html" },
   "Medal-Bronze": { "url": "../html/Medal/Bronze.html" },
   "Medal-Sliver": { "url": "../html/Medal/Silver.html" },
   "Medal-Gold": { "url": "../html/Medal/Gold.html" },
   "T-Overview": { "url": "../html/Team/Overview.html" },
   "Members": { "url": "../html/Team/TeamMember.html" },
   "Advisors": { "url": "../html/Team/Advisor.html" },
   "Instructors": { "url": "../html/Team/Instructor.html" },
   "Notebook": { "url": "../html/Team/Notebook.html" },
   "A-Overview": { "url": "../html/Attribution/Overview.html" },
   "Group": { "url": "../html/Attribution/GroupStructure.html" },
   "Attribution": { "url": "../html/Attribution/Attribution.html" },
   "Acknowlegement": { "url": "../html/Attribution/Acknowledge.html" }

}

var pageList = [];

var nowLoadingID = 0; var onNextPageShow = false; var isAllowNextPage = false; var scrollLock = false; var nextPage = 0

function initTopBar(page) {

   // main menu
   if (page === 'Home') {
       $('.text').removeClass('default').addClass('light');
   } else {
       $('.text').removeClass('light').addClass('default');
   }
   $('#' + page + '>.page-container')
       .visibility({
           offset: -5,
           observeChanges: true,
           once: false,
           context: $('#' + page),
           continuous: true,
           onTopPassed: function () {
               requestAnimationFrame(function () {
                   $('.following.bar')
                       .addClass('light fixed')
                       .find('.menu')
                       // .removeClass('inverted')
                       ;
                   $('.following .additional.item')
                       .transition('scale in', 750)
                       ;
               });
           },
           onTopPassedReverse: function () {
               requestAnimationFrame(function () {
                   $('.following.bar')
                       .removeClass('light fixed')
                       .find('.menu')
                       // .addClass('inverted')
                       .find('.additional.item')
                       .transition('hide')
                       ;
               });
           }
       });
   $('#' + page + '>.page-container>.next-page-identify')
       .visibility({
           offset: -5,
           observeChanges: true,
           once: false,
           context: $('#' + page),
           continuous: true,
           onTopVisible: function () {
           },
           onTopVisibleReverse: function () {
           }
       });
   nextPage = $('#' + page + '>.page-container>.next-page-identify').attr("data-value");

}



function loadPages() {

   for (let page in pages) {
       pageList.push(page);
   }
   for (let page in pages) {
       if (pages[page].url === "") {
           nowLoadingID += 1;
           continue;
       }
       $.get(pages[page].url, function (data) {
           $('#' + page).html(data);
           nowLoadingID += 1;
           //initTopBar(page);
           // console.log(nowLoadingID);
           // console.log(pageList.length);
           if (nowLoadingID + 1 === pageList.length) {
               // console.log('now mount');
               $('a').on('click', function() {
                   // console.log('click');
                   let target = $(this).attr('goto');
                   // console.log(target);
                   let dstPage = pageList.findIndex((value, index, arr) => {
                       return value === target;
                   });
                   // console.log(dstPage);
                   fkpage.goToSlide(dstPage + 1);
               });
           }
       });
       
   }

}

loadPages();

$('.ui.sticky')

   .sticky()
   ;