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

 
(15 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
     "Design": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Design.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" },
 
     "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": "" },
+
     "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": "" },
+
     "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": "" },
 
     "Demo": { "url": "" },
     "Modeling-Overview": { "url": "" },
+
    "Contribution": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Contribution.html&action=raw&ctype=text/html"},
     "Searching-Engine": { "url": "" },
+
    "Improve": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Improve.html&action=raw&ctype=text/html"},
     "Simulation-Circuits": { "url": "" },
+
    "Demostrate": {"url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Demostration.html&action=raw&ctype=text/html"},
     "Evolution-Algorithm": { "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" },
     "Reference": { "url": "" },
+
     "Recommendation": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Recommendation.html&action=raw&ctype=text/html" },
     "HP-Overview": { "url": "" },
+
     "Simulation-Circuits": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/SimulationCircuit.html&action=raw&ctype=text/html" },
     "HP-Siliver": { "url": "" },
+
     "Evolution-Algorithm": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/EvolutionAlgorithm.html&action=raw&ctype=text/html" },
     "HP-Gold": { "url": "" },
+
     "Reference": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Reference.html&action=raw&ctype=text/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": "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": "" },
 
     "Human-Practice": { "url": "" },
     "Public-Engagement": { "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": "" },
+
     "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": "" },
+
     "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": "" },
+
     "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": "" },
+
     "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" },
 
     "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/Results.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" },
 
     "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" },
 
     "Results": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Interlab/Results.html&action=raw&ctype=text/html" },
     "Medal-Overview": { "url": "" },
+
     "Wet-Lab": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Safety/WetLabSafety.html&action=raw&ctype=text/html"},
     "Medal-Bronze": { "url": "" },
+
    "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-Sliver": { "url": "" },
+
     "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-Gold": { "url": "" },
+
     "Medal-Bronze": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Bronze.html&action=raw&ctype=text/html" },
     "T-Overview": { "url": "" },
+
     "Medal-Sliver": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Silver.html&action=raw&ctype=text/html" },
     "Members": { "url": "" },
+
     "Medal-Gold": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Medal/Gold.html&action=raw&ctype=text/html" },
     "Advisors": { "url": "" },
+
     "T-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Overview.html&action=raw&ctype=text/html" },
     "Instructors": { "url": "" },
+
     "Members": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/TeamMember.html&action=raw&ctype=text/html" },
     "Notebook": { "url": "" },
+
     "Advisors": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Advisor.html&action=raw&ctype=text/html" },
     "Notebook": { "url": "" },
+
     "Instructors": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Instructor.html&action=raw&ctype=text/html" },
     "A-Overview": { "url": "" },
+
     "Notebook": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Team/Notebook.html&action=raw&ctype=text/html" },
     "Group": { "url": "" },
+
     "A-Overview": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/Overview.html&action=raw&ctype=text/html" },
     "Attribution": { "url": "" },
+
     "Group": { "url": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Attribution/GroupStructure.html&action=raw&ctype=text/html" },
     "Acknowlegement": { "url": "" }
+
     "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 nowLoadingID = 0;
 
var onNextPageShow = false;
 
var onNextPageShow = false;
 
var isAllowNextPage = false;
 
var isAllowNextPage = false;
 +
var scrollLock = false;
 +
var nextPage = 0
 +
 +
function initTopBar(page) {
 +
    // main menu
 +
    requestAnimationFrame(function () {
 +
        $('.following.bar')
 +
            .removeClass('light fixed')
 +
            .find('.menu')
 +
            // .addClass('inverted')
 +
            .find('.additional.item')
 +
            .transition('hide')
 +
            ;
 +
    });
 +
    $(".sticky-navigator").addClass('showtext');
 +
    setTimeout(() => {
 +
        $(".sticky-navigator").removeClass('showtext');
 +
    }, 2000);
 +
    if (page === 'Home') {
 +
        $('.text').removeClass('default').addClass('light');
 +
    } else {
 +
        $('.text').removeClass('light').addClass('default');
 +
    }
 +
    if ($("#"+page+">.page-container>.next-page-identify").length > 0) {
 +
        $(".nextpage").show();
 +
        $(".nextpage").attr("data-value", $("#" + page + ">.page-container>.next-page-identify").attr("data-value"));
 +
    } else {
 +
        $(".nextpage").hide();
 +
    }
 +
    if ($("#" + page + ">.page-container>.last-page-identify").length > 0) {
 +
        $(".lastpage").show();
 +
        $(".lastpage").attr("data-value", $("#" + page + ">.page-container>.last-page-identify").attr("data-value"));
 +
    } else {
 +
        $(".lastpage").hide();
 +
    }
 +
    $(".top").attr("data-value", page);
 +
 +
    $('#' + 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')
 +
                        ;
 +
                });
 +
            }
 +
        });
 +
    nextPage = $('#' + page + '>.page-container>.next-page-identify').attr("data-value");
 +
}
 +
 +
 +
 +
  
 
function loadPages() {
 
function loadPages() {
 +
    $('#page-process').progress({
 +
        percent: 50
 +
    });
 
     for (let page in pages) {
 
     for (let page in pages) {
         if (pages[page].url === "") continue;
+
        pageList.push(page);
 +
    }
 +
    for (let page in pages) {
 +
         if (pages[page].url === "") {
 +
            nowLoadingID += 1;
 +
            continue;
 +
        }
 
         $.get(pages[page].url, function (data) {
 
         $.get(pages[page].url, function (data) {
 
             $('#' + page).html(data);
 
             $('#' + page).html(data);
 
             nowLoadingID += 1;
 
             nowLoadingID += 1;
             // main menu
+
             //initTopBar(page);
console.log($('#' + page + '>.page-container'));
+
            // console.log(nowLoadingID);
             $('#' + page + '>.page-container')
+
            // console.log(pageList.length);
                .visibility({
+
             $('#page-process').progress({
                    offset: -5,
+
                percent: parseInt((nowLoadingID + 1) / pageList.length * 50) + 50
                    observeChanges: true,
+
            });
                    once: false,
+
            if (nowLoadingID + 1 === pageList.length) {
                    context: $('#' + page),
+
                // console.log('now mount');
                    continuous: true,
+
                $('a').on('click', function() {
                    onTopPassed: function () {
+
                    // console.log('click');
                        requestAnimationFrame(function () {
+
                    let target = $(this).attr('goto');
                            $('.following.bar')
+
                    // console.log(target);
                                .addClass('light fixed')
+
                     let dstPage = pageList.findIndex((value, index, arr) => {
                                .find('.menu')
+
                        return value === target;
                                .removeClass('inverted')
+
                    });
                                ;
+
                    // console.log(dstPage);
                            $('.following .additional.item')
+
                     if (target) {
                                .transition('scale in', 750)
+
                         jumpToPage(dstPage + 1);
                                ;
+
                        });
+
                    },
+
                    onTopPassedReverse: function () {
+
                        requestAnimationFrame(function () {
+
                            $('.following.bar')
+
                                .removeClass('light fixed')
+
                                .find('.menu')
+
                                .addClass('inverted')
+
                                .find('.additional.item')
+
                                .transition('hide')
+
                                ;
+
                        });
+
                     },
+
                    onBottomVisible: function () {
+
                        if (onNextPageShow) return;
+
                        onNextPageShow = true;
+
                        setTimeout(() => {
+
                            isAllowNextPage = true;
+
                            $(".next-page").animate({
+
                                'opacity': '0.8'
+
                            }, 500);
+
                        }, 500);
+
                     },
+
                    onBottomVisibleReverse: function () {
+
                         $(".next-page").animate({
+
                            'opacity': '0'
+
                        }, 200);
+
                        onNextPageShow = false;
+
                        isAllowNextPage = false;
+
 
                     }
 
                     }
 
                 });
 
                 });
 +
                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);
 +
                });
 +
                let dstPage = 0;
 +
                urlSplit = window.location.href.split('?');
 +
                if (urlSplit.length > 1) {
 +
                    dstPage = 0 + pageList.findIndex((value, index, arr) => {
 +
                        return value === urlSplit[1];
 +
                    });
 +
                }
 +
                if (dstPage == 0) {
 +
                    $(".side-bar").hide();
 +
                } else {
 +
                    $(".side-bar").show();
 +
                }
 +
                fkpage.goToNextSlide();
 +
                console.log(pageList[dstPage]);
 +
                initTopBar(pageList[dstPage]);
 +
                backToTop(pageList[dstPage]);
 +
                setTimeout(() => {
 +
                    $('.page.dimmer').dimmer('hide');
 +
                    $('#home-video')[0].play();
 +
                }, 1000);
 +
               
 +
            }
 
         });
 
         });
 
          
 
          
Line 107: Line 243:
 
}
 
}
  
window.onload = function () {
+
// loadPages();
    loadPages();
+
$('page-process').hide();
};
+
$('.page.dimmer').dimmer('show');
  
$('.ui.sticky')
+
$('#loading').load(function () {
     .sticky()
+
    $('page-process').show();
     ;
+
     if($('#page-process').attr('data-precent') < 50) {
 +
        $('#page-process').progress({
 +
            percent: 50
 +
        });
 +
     }
 +
   
 +
});

Latest revision as of 17:21, 17 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": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Projects/Demostration.html&action=raw&ctype=text/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" },
   "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": "https://2018.igem.org/wiki/index.php?title=Template:SYSU-Software/statics/html/Modeling/Reference.html&action=raw&ctype=text/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": "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
   requestAnimationFrame(function () {
       $('.following.bar')
           .removeClass('light fixed')
           .find('.menu')
           // .addClass('inverted')
           .find('.additional.item')
           .transition('hide')
           ;
   });
   $(".sticky-navigator").addClass('showtext');
   setTimeout(() => {
       $(".sticky-navigator").removeClass('showtext');
   }, 2000);
   if (page === 'Home') {
       $('.text').removeClass('default').addClass('light');
   } else {
       $('.text').removeClass('light').addClass('default');
   }
   if ($("#"+page+">.page-container>.next-page-identify").length > 0) {
       $(".nextpage").show();
       $(".nextpage").attr("data-value", $("#" + page + ">.page-container>.next-page-identify").attr("data-value"));
   } else {
       $(".nextpage").hide();
   }
   if ($("#" + page + ">.page-container>.last-page-identify").length > 0) {
       $(".lastpage").show();
       $(".lastpage").attr("data-value", $("#" + page + ">.page-container>.last-page-identify").attr("data-value"));
   } else {
       $(".lastpage").hide();
   }
   $(".top").attr("data-value", page);
   $('#' + 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')
                       ;
               });
           }
       });
   nextPage = $('#' + page + '>.page-container>.next-page-identify').attr("data-value");

}



function loadPages() {

   $('#page-process').progress({
       percent: 50
   });
   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);
           $('#page-process').progress({
               percent: parseInt((nowLoadingID + 1) / pageList.length * 50) + 50
           });
           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);
                   if (target) {
                       jumpToPage(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);
               });
               let dstPage = 0;
               urlSplit = window.location.href.split('?');
               if (urlSplit.length > 1) {
                   dstPage = 0 + pageList.findIndex((value, index, arr) => {
                       return value === urlSplit[1];
                   });
               }
               if (dstPage == 0) {
                   $(".side-bar").hide();
               } else {
                   $(".side-bar").show();
               }
               fkpage.goToNextSlide();
               console.log(pageList[dstPage]);
               initTopBar(pageList[dstPage]);
               backToTop(pageList[dstPage]);
               setTimeout(() => {
                   $('.page.dimmer').dimmer('hide');
                   $('#home-video')[0].play();
               }, 1000);
               
           }
       });
       
   }

}

// loadPages(); $('page-process').hide(); $('.page.dimmer').dimmer('show');

$('#loading').load(function () {

   $('page-process').show();
   if($('#page-process').attr('data-precent') < 50) {
       $('#page-process').progress({
           percent: 50
       });
   }
   

});