Team:TUDelft/js/script

(function () {

   $(function ($) {
       //navbar
       $(".dropdown-button").dropdown({
           hover: false,
           constrainWidth: false,
           belowOrigin: true
       });
       $('#menu-btn').click(function () {
           $('nav').addClass('show-nav');
       });
       $('#cross').click(function () {
           $('nav').removeClass('show-nav');
       })
       $('#notebook-buttons>a').each(function (index) {
           
           var $this = $(this);
           $this.on('click', function () {
               console.log("I clicked this");
               $this.toggleClass('active');
               
           });
       })
       var nonActiveNoDisplay(res) {
           $.each
       }
       
       var module_classes = ['cas13a', 'TDS', 'detection', 'sampleprep' ,'vesicles'];
       var whosActive = function () {
           var res = new Array(module_classes.length);
           $('#notebook-buttons>a').each(function (index) {
               var $this = $(this);
               res[index] = hasClass($this, 'active');
           })
           return res;
       }
       
       var hasClass = function($el, className) {
           return $el.attr('class').split(' ').some(
                   el => el === className)
       }
       //toc

// $(".scrollspy").scrollSpy(); // setTimeout(function () { // $("#toc").pushpin({ // offset: 150, // top: 0, // bottom: $('footer').offset().top - $('#toc').outerHeight(true) // }) // }, 100);

       //timeline

// $(".scrollspy").scrollSpy( // { // getActiveElement: function (id) { // return "round" + (parseInt(id.replace(/\D/g, )) - 20); // } // } // );

       $(".scrollspy").scrollSpy();


       //main
       //        function scaleIn() {
       //            $("scaleIn").each(function() {
       //                setTimeout(function () {
       //                    $(this).addClass('activated');
       //                }, 500)
       //            });
       //        }
       function scaleIn(el) {
           console.log("im called");
           $(".scaleIn").each(function (index) {
               var that = $(this);
               setTimeout(function () {
                   that.addClass('activated')
               }, 200 * index);
           })
       }
       $('select').material_select();


       var options = [{
           selector: '#thisList',
           offset: 500,
           callback: function (el) {
               Materialize.showStaggeredList($(el));
           }
           }, {
           selector: '#row1',
           offset: 0,
           callback: scaleIn
           }];
       Materialize.scrollFire(options);
       
       var white = " ",
           first = "\u00A0\u00A0tudelft",
           secon = "igem",
           third = "gmail",
           forth = "com",
           all = " " + " " + first + "." + secon + "@" + third + "." + forth,
           sall = " " + " " + all,
           ma = "ma" + "il",
           mm = ma + "to" + ":";
       $(function () {
           // Dynamically add e-mail to distract spam bots
           $("#mail-button").attr("href", mm + all.trim());
           $("#email").text(white + sall);
           // Removing empty p tages
           $("p").filter(function () {
               return $.trim($(this).text()) === ;
           }).remove();


       });
   });

}($));

function filter_notebook(select) {

   console.log(select);

} // function for copying text to clipboard (used for phone number) function copyToClipboard(element) {

   var $temp = $("<input>");
   $("body").append($temp);
   $temp.val(element).select();
   document.execCommand("copy");
   $temp.remove();
   alert("You copied: " + element + ".");

}