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

 
(7 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
         'Techniques',
 
         'Techniques',
 
         'Validation',
 
         'Validation',
         'Demo'],
+
         'Demo',
 +
        "Contribution",
 +
        'Improvement',
 +
        'Demostrate'],
 
     'Modeling': [
 
     'Modeling': [
 
         'Overview',
 
         'Overview',
         'Searching  Engine',
+
         'Search & Recommendation System',
 
         'Simulation for Circuits',
 
         'Simulation for Circuits',
 
         'Directed Evolution Algorithm',
 
         'Directed Evolution Algorithm',
Line 21: Line 24:
 
     'Collaboration': [
 
     'Collaboration': [
 
         'XMU-China',
 
         'XMU-China',
         'SCUT-China',
+
         'SCUT-ChinaA',
 
         'WHU-China',
 
         'WHU-China',
         'SYSU-China'],
+
         'XJTU-China'],
 
     'Interlab': [
 
     'Interlab': [
 
         'Overview',
 
         'Overview',
Line 29: Line 32:
 
         'Material and Methods',
 
         'Material and Methods',
 
         'Results'],
 
         'Results'],
 +
    "Safety": [
 +
        "Wet Lab Safety",
 +
        "Dry Lab Safety"
 +
    ],
 
     'Medal': [
 
     'Medal': [
 
         'Overview',
 
         'Overview',
Line 38: Line 45:
 
         'Team Members',
 
         'Team Members',
 
         'Advisors',
 
         'Advisors',
         'Instructors',
+
         'Instructors & Individuals',
 
         'Notebook'],
 
         'Notebook'],
 
     'Attributions': [
 
     'Attributions': [
Line 51: Line 58:
 
let index = 2;
 
let index = 2;
 
for (ele in data) {
 
for (ele in data) {
 +
    block_list = ['Demo', 'Integrated Human Practice'];
 
     let html;
 
     let html;
 
     if (ele == 'HumanPractice') {
 
     if (ele == 'HumanPractice') {
Line 59: Line 67:
 
     }
 
     }
 
     for (x in data[ele]) {
 
     for (x in data[ele]) {
         html += `<div class="item" style="color: white !important;" data-value="${index}">${data[ele][x]}</div>`
+
         if (block_list.indexOf(data[ele][x]) !== -1) {
 +
            // console.log('hit!!')
 +
            html += `<div class="item" style="display: none;" data-value="${index}">${data[ele][x]}</div>`
 +
        } else {
 +
            html += `<div class="item" style="color: white !important;" data-value="${index}">${data[ele][x]}</div>`
 +
        }
 
         index += 1;
 
         index += 1;
 
     }
 
     }
Line 66: Line 79:
 
}
 
}
  
$('.item').on('click', function () {
+
function backToTop(page) {
     if ($(this).attr('data-value') != undefined) {
+
    $("#" + page).scrollTop(0);
         $(".next-page").animate({
+
}
             'opacity': '0'
+
 
         }, 0);
+
function jumpToPage(pageId) {
         onNextPageShow = false;
+
     if (pageId != undefined) {
         isAllowNextPage = false;
+
         if (pageId == 1) {
         fkpage.goToSlide($(this).attr('data-value'));
+
            $(".side-bar").hide();
         console.log(pageList[$(this).attr('data-value')]);
+
        } else {
 +
             $(".side-bar").show();
 +
         }
 +
        fkpage.goToSlide(pageId);
 +
         let name = pageList[pageId - 1];
 +
         initTopBar(name);
 +
         backToTop(name);
 +
        if (history.pushState) {
 +
            history.pushState(null, null, `https://2018.igem.org/Team:SYSU-Software?${name}`);
 +
         } else {
 +
            history.hash(`https://2018.igem.org/Team:SYSU-Software?${name}`);
 +
        }
 
     }
 
     }
 +
}
 +
 +
$('.menu .item').on('click', function () {
 +
    jumpToPage($(this).attr('data-value'));
 +
});
 +
 +
$('.nextpage').on('click', function () {
 +
    jumpToPage($(this).attr('data-value'));
 +
});
 +
 +
$('.top').on('click', function () {
 +
    backToTop($(this).attr('data-value'));
 +
});
 +
 +
$('.lastpage').on('click', function () {
 +
    jumpToPage($(this).attr('data-value'));
 +
});
 +
$('#home-video').on('click', function() {
 +
    jumpToPage('2');
 
});
 
});

Latest revision as of 01:09, 18 October 2018

let data = {

   'Project': [
       'Description',
       'Design',
       'Feature',
       'Techniques',
       'Validation',
       'Demo',
       "Contribution",
       'Improvement',
       'Demostrate'],
   'Modeling': [
       'Overview',
       'Search & Recommendation System',
       'Simulation for Circuits',
       'Directed Evolution Algorithm',
       'Reference'],
   'HumanPractice': [
       'Overview',
       'Silver',
       'Gold',
       'Integrated Human Practice',
       'Public Engagement'],
   'Collaboration': [
       'XMU-China',
       'SCUT-ChinaA',
       'WHU-China',
       'XJTU-China'],
   'Interlab': [
       'Overview',
       'Experiment Design',
       'Material and Methods',
       'Results'],
   "Safety": [
       "Wet Lab Safety",
       "Dry Lab Safety"
   ],
   'Medal': [
       'Overview',
       'Bronze',
       'Silver',
       'Gold'],
   'Team': [
       'Overview',
       'Team Members',
       'Advisors',
       'Instructors & Individuals',
       'Notebook'],
   'Attributions': [
       'Overview',
       'Group Structure',
       'Attribution in Project',
       'Acknowledgement'],

}


// main menu navigator let index = 2; for (ele in data) {

   block_list = ['Demo', 'Integrated Human Practice'];
   let html;
   if (ele == 'HumanPractice') {
html = `
Human Practice