(Created page with "(function () { $(function ($) { //navbar $(".dropdown-button").dropdown({ hover: false, constrainWidth: false, belowOri...") |
|||
Line 14: | Line 14: | ||
}) | }) | ||
$('#notebook-buttons>a').each(function (index) { | $('#notebook-buttons>a').each(function (index) { | ||
− | + | ||
var $this = $(this); | var $this = $(this); | ||
$this.on('click', function () { | $this.on('click', function () { | ||
console.log("I clicked this"); | console.log("I clicked this"); | ||
$this.toggleClass('active'); | $this.toggleClass('active'); | ||
− | + | ||
}); | }); | ||
}) | }) | ||
− | var nonActiveNoDisplay(res) { | + | // var nonActiveNoDisplay(res) { |
− | + | // $.each | |
− | } | + | // } |
− | + | ||
− | var module_classes = ['cas13a', 'TDS', 'detection', 'sampleprep' ,'vesicles']; | + | var module_classes = ['cas13a', 'TDS', 'detection', 'sampleprep', 'vesicles']; |
var whosActive = function () { | var whosActive = function () { | ||
var res = new Array(module_classes.length); | var res = new Array(module_classes.length); | ||
Line 35: | Line 35: | ||
return res; | return res; | ||
} | } | ||
− | + | ||
− | var hasClass = function($el, className) { | + | var hasClass = function ($el, className) { |
return $el.attr('class').split(' ').some( | return $el.attr('class').split(' ').some( | ||
− | + | el => el === className) | |
} | } | ||
//toc | //toc | ||
− | // $(".scrollspy").scrollSpy(); | + | // $(".scrollspy").scrollSpy(); |
− | // setTimeout(function () { | + | // setTimeout(function () { |
− | // $("#toc").pushpin({ | + | // $("#toc").pushpin({ |
− | // offset: 150, | + | // offset: 150, |
− | // top: 0, | + | // top: 0, |
− | // bottom: $('footer').offset().top - $('#toc').outerHeight(true) | + | // bottom: $('footer').offset().top - $('#toc').outerHeight(true) |
− | // }) | + | // }) |
− | // }, 100); | + | // }, 100); |
//timeline | //timeline | ||
− | // $(".scrollspy").scrollSpy( | + | // $(".scrollspy").scrollSpy( |
− | // { | + | // { |
− | // getActiveElement: function (id) { | + | // getActiveElement: function (id) { |
− | // return "round" + (parseInt(id.replace(/\D/g, '')) - 20); | + | // return "round" + (parseInt(id.replace(/\D/g, '')) - 20); |
− | // } | + | // } |
− | // } | + | // } |
− | // ); | + | // ); |
$(".scrollspy").scrollSpy(); | $(".scrollspy").scrollSpy(); | ||
Line 97: | Line 97: | ||
}]; | }]; | ||
Materialize.scrollFire(options); | Materialize.scrollFire(options); | ||
− | + | ||
var white = " ", | var white = " ", | ||
first = "\u00A0\u00A0tudelft", | first = "\u00A0\u00A0tudelft", | ||
Line 108: | Line 108: | ||
ma = "ma" + "il", | ma = "ma" + "il", | ||
mm = ma + "to" + ":"; | mm = ma + "to" + ":"; | ||
− | |||
− | |||
− | |||
− | |||
− | + | // 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(); | ||
+ | |||
+ | |||
− | |||
− | |||
}); | }); | ||
}($)); | }($)); |
Revision as of 12:36, 13 October 2017
(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" + ":";
// 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 + ".");
}