Template:SYSU-Software/statics/js/loader.js

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": "" },
   "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": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Collaboration/XMU.html&action=raw&ctype=text/html" },
   "SCUT": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Collaboration/SCUT.html&action=raw&ctype=text/html" },
   "WHU": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Collaboration/WHU.html&action=raw&ctype=text/html" },
   "SYSU": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Collaboration/SYSU.html&action=raw&ctype=text/html" },
   "I-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Interlab/Overview.html&action=raw&ctype=text/html" },
   "Experiment": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Interlab/ExperimentDesign.html&action=raw&ctype=text/html" },
   "Material-Methods": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Interlab/MaterialMethods.html&action=raw&ctype=text/html" },
   "Results": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Interlab/Results.html&action=raw&ctype=text/html" },
   "Wet-Lab": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Safety/WetLabSafety.html&action=raw&ctype=text/html"},
   "Dry-Lab": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Safety/DryLabSafety.html&action=raw&ctype=text/html"},
   "Medal-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Overview.html&action=raw&ctype=text/html" },
   "Medal-Bronze": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Bronze.html&action=raw&ctype=text/html" },
   "Medal-Sliver": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Silver.html&action=raw&ctype=text/html" },
   "Medal-Gold": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Gold.html&action=raw&ctype=text/html" },
   "T-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Overview.html&action=raw&ctype=text/html" },
   "Members": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/TeamMember.html&action=raw&ctype=text/html" },
   "Advisors": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Advisor.html&action=raw&ctype=text/html" },
   "Instructors": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Instructor.html&action=raw&ctype=text/html" },
   "Notebook": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Notebook.html&action=raw&ctype=text/html" },
   "A-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/Overview.html&action=raw&ctype=text/html" },
   "Group": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/GroupStructure.html&action=raw&ctype=text/html" },
   "Attribution": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/Attribution.html&action=raw&ctype=text/html" },
   "Acknowlegement": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/Acknowledge.html&action=raw&ctype=text/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() {

   $('.page.dimmer').dimmer('show');
   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);
               });
               let index_map = {
                   1: 0,
                   2: 1,
                   3: 1,
                   4: 1,
                   5: 1,
                   6: 1,
                   7: 1,
                   8: 1,
                   9: 1,
                   10: 1,
                   11: 2,
                   12: 2,
                   13: 2,
                   14: 2,
                   15: 2,
                   16: 3,
                   17: 3,
                   18: 3,
                   19: 3,
                   20: 3,
                   21: 4,
                   22: 4,
                   23: 4,
                   24: 4,
                   25: 5,
                   26: 5,
                   27: 5,
                   28: 5,
                   29: 8,  /* Wet-lab */
                   30: 8,  /* Dry-lab */
                   31: 6,
                   32: 6,
                   33: 6,
                   34: 6,
                   35: 7,
                   36: 7,
                   37: 7,
                   38: 7,
                   39: 7,
                   40: 8,
                   41: 8,
                   42: 8,
                   43: 8
               };
               $('.myfkpage').children('li').each(function (index, ele) {
                   let temp = index_map[index];
                   // if (temp === 0) {
                   //     $(this).addClass('noscroll');
                   // } else {
                   //     $(this).addClass('scroll');
                   // }
                   $(this).children('.page-container').addClass('test' + temp);
               });
               $('.page.dimmer').dimmer('hide');
               // $('#home-video')[0].play();
           }
       });
       
   }

}

loadPages();

$('.ui.sticky')

   .sticky()
   ;