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

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 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 () {
+
 
     if ($(this).attr('data-value') != undefined) {
+
function jumpToPage(pageId) {
         $(".next-page").hide();
+
     if (pageId != undefined) {
         fkpage.goToSlide($(this).attr('data-value'));
+
         if (pageId == 1) {
         initTopBar(pageList[$(this).attr('data-value') - 1]);
+
            $(".side-bar").hide();
         backToTop(pageList[$(this).attr('data-value') - 1]);
+
         } else {
 +
            $(".side-bar").show();
 +
        }
 +
        fkpage.goToSlide(pageId);
 +
         initTopBar(pageList[pageId - 1]);
 +
         backToTop(pageList[pageId - 1]);
 
     }
 
     }
 +
}
 +
 +
$('.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');
 
});
 
});

Revision as of 14:45, 17 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',
       'SYSU-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',
       '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