|
|
@@ -1,145 +1,138 @@
|
|
|
-
|
|
|
-const aboutCarouselElement = document.querySelector('#caro-lead')
|
|
|
-const carousel = new bootstrap.Carousel(aboutCarouselElement, {
|
|
|
- interval: 5000,
|
|
|
- wrap: false
|
|
|
-});
|
|
|
-
|
|
|
-jQuery(document).ready(function($) {
|
|
|
-
|
|
|
- $(function () {
|
|
|
- $('[data-toggle="tooltip"]').tooltip()
|
|
|
- })
|
|
|
-
|
|
|
- var person = localStorage.getItem('person');
|
|
|
- console.log('person ' + person + ' from localstorage' )
|
|
|
-
|
|
|
- $('.nav-toggle').on('touchstart click', function(e) {
|
|
|
- e.preventDefault();
|
|
|
- $( this ).toggleClass( 'active' );
|
|
|
+// About page hero — vanilla fade-carousel (replaces Bootstrap Carousel).
|
|
|
+(function () {
|
|
|
+ const caro = document.getElementById('caro-lead');
|
|
|
+ const tv = document.getElementById('tv'); // full-bleed grayscale bg video
|
|
|
+ if (tv) { try { tv.play(); } catch (e) {} }
|
|
|
+ if (!caro) return;
|
|
|
+
|
|
|
+ const slides = Array.from(caro.querySelectorAll('.dw-fade-slide'));
|
|
|
+ const dots = Array.from(caro.querySelectorAll('.dw-fade-dot'));
|
|
|
+ const INTERVAL = 5000;
|
|
|
+ let index = 0;
|
|
|
+ let timer = null;
|
|
|
+
|
|
|
+ // The brain slide's #brain SVG ships with .hide-svg; reveal + line-draw it.
|
|
|
+ function drawBrain(slide) {
|
|
|
+ const brain = slide.querySelector('#brain');
|
|
|
+ if (!brain || !window.DrawFillSVG) return;
|
|
|
+ window.setTimeout(function () {
|
|
|
+ brain.classList.remove('hide-svg', 'fade-svg');
|
|
|
+ try { new window.DrawFillSVG({ elementId: 'brain' }).replay(); } catch (e) {}
|
|
|
+ }, 600);
|
|
|
+ }
|
|
|
+
|
|
|
+ function activate(i) {
|
|
|
+ i = Math.max(0, Math.min(slides.length - 1, i)); // wrap:false → clamp
|
|
|
+ index = i;
|
|
|
+ slides.forEach((s, n) => s.classList.toggle('active', n === i));
|
|
|
+ dots.forEach((d, n) => d.classList.toggle('active', n === i));
|
|
|
+ drawBrain(slides[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ function next() {
|
|
|
+ if (index >= slides.length - 1) { stop(); return; } // wrap:false — stop at end
|
|
|
+ activate(index + 1);
|
|
|
+ }
|
|
|
+ function start() { stop(); timer = window.setInterval(next, INTERVAL); }
|
|
|
+ function stop() { if (timer) { window.clearInterval(timer); timer = null; } }
|
|
|
+
|
|
|
+ dots.forEach(function (d) {
|
|
|
+ d.addEventListener('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ activate(parseInt(d.dataset.slide, 10) || 0);
|
|
|
+ start();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
- $(function dw_hidenav() {
|
|
|
- var headerHeight = $('.navbar').height();
|
|
|
- $(window).on('scroll', { previousTop: 0 },
|
|
|
- function() {
|
|
|
- var currentTop = $(window).scrollTop();
|
|
|
- if (currentTop < this.previousTop) {
|
|
|
- if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
|
|
|
- $('.navbar').addClass('visible');
|
|
|
- $('.site-title a').removeClass('light');
|
|
|
- } else {
|
|
|
- $('.navbar').removeClass('visible fixed');
|
|
|
- $('.site-title a').addClass('light');
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- $('.navbar').removeClass('visible');
|
|
|
- if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
|
|
|
- }
|
|
|
- this.previousTop = currentTop;
|
|
|
- }
|
|
|
- );
|
|
|
+ document.addEventListener('keyup', function (e) {
|
|
|
+ if (e.key === 'ArrowRight') activate(index + 1);
|
|
|
+ else if (e.key === 'ArrowLeft') activate(index - 1);
|
|
|
});
|
|
|
|
|
|
- var vidout = document.getElementById('tv');
|
|
|
- vidout.play();
|
|
|
-
|
|
|
-
|
|
|
- $(document).on('keyup', function(e) {
|
|
|
- if(e.which === 39){
|
|
|
- $('#caro-lead').carousel('next');
|
|
|
- }
|
|
|
- else if(e.which === 37){
|
|
|
- $('#caro-lead').carousel('prev');
|
|
|
+ caro.addEventListener('mouseenter', stop);
|
|
|
+ caro.addEventListener('mouseleave', start);
|
|
|
+
|
|
|
+ activate(0);
|
|
|
+ start();
|
|
|
+})();
|
|
|
+
|
|
|
+// navbar hide/show on scroll (ported from jQuery dw_hidenav)
|
|
|
+(function () {
|
|
|
+ const navbar = document.querySelector('.navbar');
|
|
|
+ if (!navbar) return;
|
|
|
+ const title = document.querySelector('.site-title a');
|
|
|
+ const headerHeight = navbar.offsetHeight;
|
|
|
+ let previousTop = 0;
|
|
|
+ window.addEventListener('scroll', function () {
|
|
|
+ const currentTop = window.scrollY;
|
|
|
+ if (currentTop < previousTop) {
|
|
|
+ if (currentTop > 0 && navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('visible');
|
|
|
+ if (title) title.classList.remove('light');
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible', 'fixed');
|
|
|
+ if (title) title.classList.add('light');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ navbar.classList.remove('visible');
|
|
|
+ if (currentTop > headerHeight && !navbar.classList.contains('fixed')) {
|
|
|
+ navbar.classList.add('fixed');
|
|
|
+ }
|
|
|
}
|
|
|
+ previousTop = currentTop;
|
|
|
+ }, { passive: true });
|
|
|
+})();
|
|
|
+
|
|
|
+document.querySelectorAll('.nav-toggle').forEach(function (el) {
|
|
|
+ el.addEventListener('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ el.classList.toggle('active');
|
|
|
});
|
|
|
-
|
|
|
- $('#caro-lead').on('slid.bs.carousel', function(event) {
|
|
|
- var consta = $('#caro-lead li.active');
|
|
|
- //console.log('target: ' + consta.data('target') + ' value: ' + ' slide-to: ' + consta.data('slideTo'));
|
|
|
- $('.carousel-caption').fadeIn(600);
|
|
|
- setTimeout(function() {
|
|
|
- if (consta.data('slideTo') === 0) {
|
|
|
-
|
|
|
- }
|
|
|
- if (consta.data('slideTo') === 1) {
|
|
|
-
|
|
|
- }
|
|
|
- if (consta.data('slideTo') === 2) {
|
|
|
-
|
|
|
- }
|
|
|
- }, 10);
|
|
|
- });
|
|
|
-
|
|
|
- $('#caro-lead').on('slid.bs.carousel', function() {
|
|
|
- $('.active #brain').delay(5000).removeClass('hide-svg fade-svg');
|
|
|
- var animac = new DrawFillSVG({elementId: 'brain'});
|
|
|
- animac.replay();
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/*============================================
|
|
|
- Form
|
|
|
-==============================================*/
|
|
|
-
|
|
|
-$('#commentform').validate({
|
|
|
- rules: {
|
|
|
- author: {
|
|
|
- required: true,
|
|
|
- minlength: 2
|
|
|
- },
|
|
|
- email: {
|
|
|
- required: true,
|
|
|
- email: true
|
|
|
- },
|
|
|
- comment: {
|
|
|
- required: true,
|
|
|
- minlength: 3
|
|
|
- }
|
|
|
- },
|
|
|
- messages: {
|
|
|
- author: 'Please enter in your name.',
|
|
|
- email: 'Please enter a valid email address.',
|
|
|
- comment: 'Nothing to Say?'
|
|
|
- },
|
|
|
- errorElement: 'div',
|
|
|
- errorPlacement: function(error, element) {
|
|
|
- element.before(error);
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
-/*============================================
|
|
|
- Calendar
|
|
|
-==============================================*/
|
|
|
+// Comment-form validation (jquery-validation) + FullCalendar still use jQuery.
|
|
|
+jQuery(document).ready(function ($) {
|
|
|
|
|
|
-var calendarEl = document.getElementById('calendar');
|
|
|
- var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
|
- headerToolbar: {
|
|
|
- start: 'title',
|
|
|
- center: '',
|
|
|
- end: 'prev,next'
|
|
|
- },
|
|
|
- firstDay : 1,
|
|
|
- height: 380,
|
|
|
- views: {
|
|
|
- dayGrid: { hiddenDays: [ 0,6,7 ] },
|
|
|
- timeGrid: {
|
|
|
- slotMinTime: '08:00:00',
|
|
|
- slotMaxTime: '17:00:00',
|
|
|
- dayHeaderFormat: { weekday: 'short' },
|
|
|
- hiddenDays: [ 0,6,7 ]
|
|
|
- },
|
|
|
+ $('#commentform').validate({
|
|
|
+ rules: {
|
|
|
+ author: { required: true, minlength: 2 },
|
|
|
+ email: { required: true, email: true },
|
|
|
+ comment: { required: true, minlength: 3 }
|
|
|
},
|
|
|
- googleCalendarApiKey: 'AIzaSyAGowGJYx6dOaQvG_vSUI73uT88VWOTcNQ',
|
|
|
- events: {
|
|
|
- googleCalendarId: 'davidawindham.com_bvrht1f8n2vgldgjenpgfdd4bk@group.calendar.google.com',
|
|
|
- className: 'gcal-event'
|
|
|
+ messages: {
|
|
|
+ author: 'Please enter in your name.',
|
|
|
+ email: 'Please enter a valid email address.',
|
|
|
+ comment: 'Nothing to Say?'
|
|
|
},
|
|
|
- eventDataTransform: function(event) { event.url = ""; return event; },
|
|
|
- eventClick: function(info) { info.jsEvent.preventDefault(); }
|
|
|
+ errorElement: 'div',
|
|
|
+ errorPlacement: function (error, element) {
|
|
|
+ element.before(error);
|
|
|
+ }
|
|
|
});
|
|
|
-calendar.render();
|
|
|
+
|
|
|
+ var calendarEl = document.getElementById('calendar');
|
|
|
+ if (calendarEl) {
|
|
|
+ var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
|
+ headerToolbar: { start: 'title', center: '', end: 'prev,next' },
|
|
|
+ firstDay: 1,
|
|
|
+ height: 380,
|
|
|
+ views: {
|
|
|
+ dayGrid: { hiddenDays: [0, 6, 7] },
|
|
|
+ timeGrid: {
|
|
|
+ slotMinTime: '08:00:00',
|
|
|
+ slotMaxTime: '17:00:00',
|
|
|
+ dayHeaderFormat: { weekday: 'short' },
|
|
|
+ hiddenDays: [0, 6, 7]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ googleCalendarApiKey: 'AIzaSyAGowGJYx6dOaQvG_vSUI73uT88VWOTcNQ',
|
|
|
+ events: {
|
|
|
+ googleCalendarId: 'davidawindham.com_bvrht1f8n2vgldgjenpgfdd4bk@group.calendar.google.com',
|
|
|
+ className: 'gcal-event'
|
|
|
+ },
|
|
|
+ eventDataTransform: function (event) { event.url = ''; return event; },
|
|
|
+ eventClick: function (info) { info.jsEvent.preventDefault(); }
|
|
|
+ });
|
|
|
+ calendar.render();
|
|
|
+ }
|
|
|
});
|