Difference between revisions of "Template:Virginia/js/wiki"

Line 25: Line 25:
 
             if ((previous != id_name)) { //if you click a diff image
 
             if ((previous != id_name)) { //if you click a diff image
 
                 var id_previous = document.getElementById(previous);
 
                 var id_previous = document.getElementById(previous);
                 $(id_previous).hide();
+
                 $(id_previous).removeClass('unhidden');
 +
                $(id_previous).addClass('hidden');
 +
                //$(id_previous).toggleClass('hidden');
 
                 //console.log(id_previous);
 
                 //console.log(id_previous);
 
             }  
 
             }  
 
             else if (previous == id_name) { //clicking on the same image
 
             else if (previous == id_name) { //clicking on the same image
                 $(id_toggle).show();
+
                 $(id_previous).removeClass('hidden');               
 +
                $(id_previous).addClass('unhidden');
 +
                //$(id_toggle).toggleClass('unhidden');
 
             }
 
             }
             $(id_toggle).show(); //show bio
+
             $(id_toggle).removeClass('hidden');
 +
            $(id_toggle).addClass('unhidden');
 +
            //$(id_toggle).toggleClass('unhidden'); //show bio
 
             previous = id_name; //checks to see if you clicked different images
 
             previous = id_name; //checks to see if you clicked different images
 
         }  
 
         }  
 
         else {
 
         else {
             $(previous).show();
+
             $(previous).toggleClass('unhidden');
 
         }
 
         }
 
     });
 
     });
Line 165: Line 171:
 
$(function(){$(".scroll").click(function(){$("html,body").animate({scrollTop:$("#top").offset().top},"1000");return false})});
 
$(function(){$(".scroll").click(function(){$("html,body").animate({scrollTop:$("#top").offset().top},"1000");return false})});
  
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFqYXhsb2Fkcy5qcyIsImZvb3Rlci1oZWFkZXItdGVtcGxhdGUuanMiLCJpbWFnZS1nYWxsZXJ5LmpzIiwibmF2bGluZS5qcyIsInNjcm9sbHNlbnNpdGl2ZS5qcyIsInNtb290aHNjcm9sbGJhci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQ0hBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNB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FzcygnY3VycmVudCcpO1xyXG4gICAgICAgIH1cclxuICAgIH0pO1xyXG4gICAgLy9jb25zb2xlLmxvZygkKGRvY3VtZW50KS5zY3JvbGxUb3AoKSk7XHJcbn07XHJcblxyXG4kKGRvY3VtZW50KS5hamF4U3RvcChmdW5jdGlvbihldmVudCwgeGhyLCBvcHRpb25zKSB7XHJcbiAgICAvL2NvbnNvbGUubG9nKGV2ZW50KTtcclxuXHJcbiAgICB2YXIgdG9jID0gXCJcIjtcclxuICAgIHZhciBsZXZlbCA9IDA7XHJcblxyXG4gICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoXCJtYWluLWNvbnRlbnRcIikuaW5uZXJIVE1MID1cclxuICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChcIm1haW4tY29udGVudFwiKS5pbm5lckhUTUwucmVwbGFjZShcclxuICAgICAgICAgICAgLzxoKFtcXGRdKSBpZD1cIiguKylcIj4oW148XSspPFxcL2goW1xcZF0pPi9naSxcclxuICAgICAgICAgICAgZnVuY3Rpb24gKHN0ciwgb3BlbkxldmVsLCBpZCwgdGl0bGVUZXh0LCBjbG9zZUxldmVsKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgaWYgKG9wZW5MZXZlbCA+IGxldmVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9jICs9IChuZXcgQXJyYXkob3BlbkxldmVsIC0gbGV2ZWwgKyAxKSkuam9pbihcIjx1bD5cIik7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBlbHNlIGlmIChvcGVuTGV2ZWwgPCBsZXZlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRvYyArPSAobmV3IEFycmF5KGxldmVsIC0gb3BlbkxldmVsICsgMSkpLmpvaW4oXCI8L3VsPlwiKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICB0b2MgKz0gXCI8L2xpPlwiO1xyXG5cclxuICAgICAgICAgICAgICAgIGxldmVsID0gcGFyc2VJbnQob3BlbkxldmVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICB0b2MgKz0gXCI8bGk+PGEgaHJlZj1cXFwiI1wiICsgaWQgKyBcIlxcXCI+XCIgKyB0aXRsZVRleHRcclxuICAgICAgICAgICAgICAgICAgICArIFwiPC9hPlwiO1xyXG5cclxuICAgICAgICAgICAgICAgIHJldHVybiBzdHI7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICApO1xyXG5cclxuICAgICAgICBpZiAobGV2ZWwpIHtcclxuICAgICAgICAgICAgdG9jICs9IChuZXcgQXJyYXkobGV2ZWwgKzEpKS5qb2luKFwiPC91bD5cIik7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChcInZhLXRvY1wiKS5pbm5lckhUTUwgKz0gdG9jO1xyXG5cclxuICAgICAgICB1cGRhdGV0b2MoKTtcclxufSk7XHJcblxyXG4kKGRvY3VtZW50KS5vbignc2Nyb2xsJywgdXBkYXRldG9jKTtcclxuIiwiXHJcblxyXG4vLyBDb2RlIGNvdXJ0ZXN5IG9mIE1vaGFtZWQgSGFzYW5cclxuLy8gaHR0cHM6Ly9jb2RlcGVuLmlvL01obWRoYXNhbi9wZW4vbUFkYVFFXHJcblxyXG4kKGRvY3VtZW50KS5yZWFkeShmdW5jdGlvbiAoKSB7XHJcbiAgXHJcbiAgJ3VzZSBzdHJpY3QnO1xyXG4gIFxyXG4gICB2YXIgYywgY3VycmVudFNjcm9sbFRvcCA9IDAsXHJcbiAgICAgICBuYXZiYXIgPSAkKCdoZWFkZXInKTtcclxuXHJcbiAgICB2YXIgaG92ZXJlZCA9IGZhbHNlO1xyXG5cclxuICAgIG5hdmJhci5ob3ZlcihmdW5jdGlvbigpIHtcclxuICAgICAgICBob3ZlcmVkID0gdHJ1ZTtcclxuICAgIH0sXHJcbiAgICBmdW5jdGlvbigpIHtcclxuICAgICAgICBob3ZlcmVkID0gZ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9keVwiKS5hbmltYXRlKHtzY3JvbGxUb3A6JChcIiN0b3BcIikub2Zmc2V0KCkudG9wfSxcIjEwMDBcIik7cmV0dXJuIGZhbHNlfSl9KTtcclxuIl19

Revision as of 15:26, 31 August 2018

/**

* This page and wiki was built with the help of igem-wikibrick, a tool created by Virginia iGEM 2018
* @version v0.6.9
* @version v0.6.9
* @link https://github.com/Virginia-iGEM/igem-wikibrick
* @license MIT
*/



$(document).ajaxStop(function () {

   'use strict';
   
   var previous = 'Ngozi';
   $(document).on('click', '#image_gallery', function(event) {
       var id_name = event.target.id;
       console.log(id_name);
       id_name = id_name.replace(/[0-9]/g, ); //regex for alphabets, no numbers
       var id_toggle = document.getElementById(id_name); //get ID of names under class 'team-bio'
       if (document.getElementById(id_name) && id_name != "image_gallery") { //if ID exists and accounting for white space
           if ((previous != id_name)) { //if you click a diff image
               var id_previous = document.getElementById(previous);
               $(id_previous).removeClass('unhidden');
               $(id_previous).addClass('hidden');
               //$(id_previous).toggleClass('hidden');
               //console.log(id_previous);
           } 
           else if (previous == id_name) { //clicking on the same image
               $(id_previous).removeClass('hidden');                
               $(id_previous).addClass('unhidden');
               //$(id_toggle).toggleClass('unhidden');
           }
           $(id_toggle).removeClass('hidden');
           $(id_toggle).addClass('unhidden');
           //$(id_toggle).toggleClass('unhidden'); //show bio
           previous = id_name; //checks to see if you clicked different images
       } 
       else {
           $(previous).toggleClass('unhidden');
       }
   });

});

// Code courtesy of Ates Goral // https://stackoverflow.com/a/187946

var updatetoc = function() {

   var smallestoffset = -$(document).height();
   var smallestheader;
   $('article h1').each(function(i) { 
       var offset = $(this).position().top - $(document).scrollTop() - Math.max(document.documentElement.clientHeight, window.innerHeight || 0)/4; // Negative offset values indicate the header's top has passed 1/4 of the way down the viewport
       //console.log($(this).text() + ' ' + offset);
       if (offset > smallestoffset && offset <= 0) {
           smallestoffset = offset;
           smallestheader = $(this);
       }
   });
   if (smallestheader === undefined) {
       smallestheader = $('article h1:first');
   }
   //console.log(smallestheader.text());
   $('#va-toc>ul>li').each(function(i) {
       //console.log($(this).children('a').attr('href'));
       //console.log('#' + smallestheader.attr('id'));
       if ($(this).children('a').attr('href') === '#' + smallestheader.attr('id')) {
           $(this).children('ul').addClass('current');
       }
       else {
           $(this).children('ul').removeClass('current');
       }
   });
   //console.log($(document).scrollTop());

};

$(document).ajaxStop(function(event, xhr, options) {

   //console.log(event);
   var toc = "";
   var level = 0;
   document.getElementById("main-content").innerHTML =
       document.getElementById("main-content").innerHTML.replace(
           /<h([\d]) id="(.+)">([^<]+)<\/h([\d])>/gi,
           function (str, openLevel, id, titleText, closeLevel) {
               if (openLevel > level) {
toc += (new Array(openLevel - level + 1)).join("
    "); } else if (openLevel < level) { toc += (new Array(level - openLevel + 1)).join("
");
               }
               toc += "</li>";
               level = parseInt(openLevel);
toc += "
  • <a href=\"#" + id + "\">" + titleText + "</a>"; return str; } ); if (level) { toc += (new Array(level +1)).join("</ul>"); } document.getElementById("va-toc").innerHTML += toc; updatetoc(); }); $(document).on('scroll', updatetoc); // Code courtesy of Mohamed Hasan // https://codepen.io/Mhmdhasan/pen/mAdaQE $(document).ready(function () { 'use strict'; var c, currentScrollTop = 0, navbar = $('header'); var hovered = false; navbar.hover(function() { hovered = true; }, function() { hovered = false; }); $(window).scroll(function () { var a = $(window).scrollTop(); var b = navbar.height(); currentScrollTop = a; if (c < currentScrollTop && a > b + b && navbar && !hovered) { navbar.addClass("scrollUp"); } else if (c > currentScrollTop && !(a <= b)) { navbar.removeClass("scrollUp"); } c = currentScrollTop; }); }); //Code courtesy of https://codepen.io/kruxor/pen/CwpFq $(window).scroll(function() { if ($(this).scrollTop() > 50 ) { $('.scrolltop:hidden').stop(true, true).fadeIn(); } else { $('.scrolltop').stop(true, true).fadeOut(); } }); $(function(){$(".scroll").click(function(){$("html,body").animate({scrollTop:$("#top").offset().top},"1000");return false})}); //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFqY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gLy9pZiBJRCBleGlzdHMgYW5kIGFjY291bnRpbmcgZm9yIHdoaXRlIHNwYWNlXHJcbiAgICAgICAgICAgIGlmICgocHJldmlvdXMgIT0gaWRfbmFtZSkpIHsgLy9pZiB5b3UgY2xpY2sgYSBkaWZmIGltYWdlXHJcbiAgICAgICAgICAgICAgICB2YXIgaWRfcHJldmlvdXMgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChwcmV2aW91cyk7XHJcbiAgICAgICAgICAgICAgICAkKGlkX3ByZXZpb3VzKS5yZW1vdmVDbGFzcygndW5oaWRkZW4nKTtcclxuICAgICAgICAgICAgICAgICQoaWRfcHJldmlvdXMpLmFkZENsYXNzKCdoaWRkZW4nKTtcclxuICAgICAgICAgICAgICAgIC8vJChpZF9wcmV2aW91cykudG9nZ2xlQ2xhc3MoJ2hpZGRlbicpO1xyXG4gICAgICAgICAgICAgICAgLy9jb25zb2xlLmxvZyhpZF9wcmV2aW91cyk7XHJcbiAgICAgICAgICAgIH0gXHJcbiAgICAgICAgICAgIGVsc2UgaWYgKHByZXZpb3VzID09IGlkX25hbWUpIHsgLy9jbGlja2luZyBvbiB0aGUgc2FtZSBpbWFnZVxyXG4gICAgICAgICAgICAgICAgJChpZF9wcmV2aW91cykucmVtb3ZlQ2xhc3MoJ2hpZGRlbicpOyAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgICQoaWRfcHJldmlvdXMpLmFkZENsYXNzKCd1bmhpZGRlbicpO1xyXG4gICAgICAgICAgICAgICAgLy8kKGlkX3RvZ2dsZSkudG9nZ2xlQ2xhc3MoJ3VuaGlkZGVuJyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgJChpZF90b2dnbGUpLnJlbW92ZUNsYXNzKCdoaWRkZW4nKTtcclxuICAgICAgICAgICAgJChpZF90b2dnbGUpLmFkZENsYXNzKCd1bmhpZGRlbicpO1xyXG4gICAgICAgICAgICAvLyQoaWRfdG9nZ2xlKS50b2dnbGVDbGFzc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W50KTtcclxuXHJcbiAgICB2YXIgdG9jID0gXCJcIjtcclxuICAgIHZhciBsZXZlbCA9IDA7XHJcblxyXG4gICAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoXCJtYWluLWNvbnRlbnRcIikuaW5uZXJIVE1MID1cclxuICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChcIm1haW4tY29udGVudFwiKS5pbm5lckhUTUwucmVwbGFjZShcclxuICAgICAgICAgICAgLzxoKFtcXGRdKSBpZD1cIiguKylcIj4oW148XSspPFxcL2goW1xcZF0pPi9naSxcclxuICAgICAgICAgICAgZnVuY3Rpb24gKHN0ciwgb3BlbkxldmVsLCBpZCwgdGl0bGVUZXh0LCBjbG9zZUxldmVsKSB7XHJcblxyXG4gICAgICAgICAgICAgICAgaWYgKG9wZW5MZXZlbCA+IGxldmVsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdG9jICs9IChuZXcgQXJyYXkob3BlbkxldmVsIC0gbGV2ZWwgKyAxKSkuam9pbihcIjx1bD5cIik7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBlbHNlIGlmIChvcGVuTGV2ZWwgPCBsZXZlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHRvYyArPSAobmV3IEFycmF5KGxldmVsIC0gb3BlbkxldmVsICsgMSkpLmpvaW4oXCI8L3VsPlwiKTtcclxuICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICB0b2MgKz0gXCI8L2xpPlwiO1xyXG5cclxuICAgICAgICAgICAgICAgIGxldmVsID0gcGFyc2VJbnQob3BlbkxldmVsKTtcclxuXHJcbiAgICAgICAgICAgICAgICB0b2MgKz0gXCI8bGk+PGEgaHJlZj1cXFwiI1wiICsgaWQgKyBcIlxcXCI+XCIgKyB0aXRsZVRleHRcclxuICAgICAgICAgICAgICAgICAgICArIFwiPC9hPlwiO1xyXG5cclxuICAgICAgICAgICAgICAgIHJldHVybiBzdH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