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

 
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
         'Demo',
 
         'Demo',
 
         "Contribution",
 
         "Contribution",
         'Improve',
+
         'Improvement',
 
         'Demostrate'],
 
         'Demostrate'],
 
     'Modeling': [
 
     'Modeling': [
 
         'Overview',
 
         'Overview',
         'Recommendation System',
+
         'Search & Recommendation System',
 
         'Simulation for Circuits',
 
         'Simulation for Circuits',
 
         'Directed Evolution Algorithm',
 
         'Directed Evolution Algorithm',
Line 26: Line 26:
 
         'SCUT-ChinaA',
 
         'SCUT-ChinaA',
 
         'WHU-China',
 
         'WHU-China',
         'SYSU-China'],
+
         'XJTU-China'],
 
     'Interlab': [
 
     'Interlab': [
 
         'Overview',
 
         'Overview',
Line 45: Line 45:
 
         'Team Members',
 
         'Team Members',
 
         'Advisors',
 
         'Advisors',
         'Instructors',
+
         'Instructors & Individuals',
 
         'Notebook'],
 
         'Notebook'],
 
     'Attributions': [
 
     'Attributions': [
Line 58: 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 66: 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 77: Line 83:
 
}
 
}
  
$('.menu .item').on('click', function () {
+
function jumpToPage(pageId) {
     if ($(this).attr('data-value') != undefined) {
+
     if (pageId != undefined) {
         $(".next-page").hide();
+
         if (pageId == 1) {
         fkpage.goToSlide($(this).attr('data-value'));
+
            $(".side-bar").hide();
         initTopBar(pageList[$(this).attr('data-value') - 1]);
+
         } else {
         backToTop(pageList[$(this).attr('data-value') - 1]);
+
            $(".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