new WOW().init(); jQuery(document).ready(function($) { $(window).bind('load', function() { $('#loader').fadeOut(700); }); /*============================================ Welcome Cookies ==============================================*/ $(function dw_set_cookie() { var COOKIE = 'windhamdavid-cookie'; var dwcookie = $.cookie(COOKIE); if (dwcookie == null) { $.cookie(COOKIE, 'yum-cookies', { expires: 7, path: '/'}); $('.terminal-welcome').modal('show'); $('.welcome').typed({ strings: ['Hey,', 'Hello,\n^10Welcome to ^10my domain ^10...^10', 'Hello, \nWelcome to my little corner of the internet. \n^10It is nice to ', 'Hello, \nWelcome to my little corner of the internet. \nWhat is your name?^200\n'], typeSpeed: 30, backSpeed: 50, startDelay: 0, backDelay: 0, loop: false, loopCount: false, attr: null, callback: function(){ dw_terminal(); } }); $('.first-slide').css('visibility','hidden'); } else { $('.terminal').modal('show'); if (localStorage.getItem('person') === null) { var person = 'anonymous person'; } else { var person = localStorage.getItem('person'); } $('.welcome-back-text').typed({ strings: ['...', 'Welcome back ' +person], typeSpeed: 30, backSpeed: 50, startDelay: 0, backDelay: 0, loop: false, loopCount: false, attr: null, callback: function(){ dw_terminal(); } }); $('.first-slide').css('visibility','hidden'); $('.terminal').on('hidden.bs.modal', function () { dw_caro(); $('.first-slide').css('visibility','visible'); }); } }); function dw_shift() { $('.terminal-welcome').modal('hide'); $('.terminal-welcome').on('hidden.bs.modal', function () { dw_caro(); $('.first-slide').css('visibility','visible'); }); } /*============================================ Terminal ==============================================*/ (function ($){ $.fn.cli = function(handler, prompt, effect){ if (!prompt) prompt = 'you@david > '; if (!effect) effect = $.fn.text; return this.each(function(){ var self = $(this); function newline(){ self. append('
'+prompt+'
'); try { $('[contenteditable]', self)[0].focus(); }catch(e){ } } newline(); self.on('keydown', '[contenteditable]', function(evt){ if (evt.keyCode === 13){ $(this).removeAttr('contenteditable'); effect.call($('').appendTo(self),handler(this.textContent || this.innerText)); newline(); return false; } }); }); }; })(jQuery); function dw_terminal(){ function type(text){ var span = $('').appendTo(this).after(' '); var style = $('').appendTo('head'); $('p.input').addClass('old'); var progress = 0; var timer = setInterval (function(){ span.text(text.substr(0, progress++)); if (progress > text.length){ $('#blinker').remove(); style.remove(); $('[contenteditable]')[0].focus(); clearInterval(timer); } },100); } $('.thermo-intro').cli(function(text){ if (text.length > 1) { localStorage.setItem('person', text), dw_shift(); }; return ''; }, null, type); $('.thermo').cli(function(text){ if (/exit/i.test(text)) { $('.terminal').modal('hide'); } if (/help/i.test(text)) return "I need somebody. Type 'exit' to close"; if (/hello/i.test(text)) return "Hello to you!"; if (/what/i.test(text)) return "This is a website silly human"; if (/and/i.test(text)) return "and what?"; if (/who/i.test(text)) return "David A. Windham"; if (/when/i.test(text)) return "Yesterday"; if (/how/i.test(text)) return "JavaScript is a dynamic computer programming language"; if (/why/i.test(text)) return "For fun"; if (/you/i.test(text)) return "your mama"; if (/cd ../i.test(text)) return "Oh, I see"; if (/thermonuclear/i.test(text)) return "Wouldn't you prefer a nice game of chess?"; if (text.length < 3) return "type 'exit' to close"; return 'command not found: '+text; }, null, type); $('p.input').on('touchstart click', function(e) { e.preventDefault(); $('[contenteditable]')[0].focus(); }); } /*============================================ Navigation ==============================================*/ $('.nav-toggle').on('touchstart click', function(e) { e.preventDefault(); $( this ).toggleClass( 'active' ); }); $('#nav').affix({ //offset: {top: $('.intro').height()-$('.navbar').height()} }); $(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; } ); }); /*============================================ Carousel ==============================================*/ $('.caro-grad').appear(); $('.caro-grad').one('appear', dw_appear); function dw_appear() { $('#caro').carousel({ interval: 5555, wrap: false, pause: false }); var anima = new DrawFillSVG({elementId: 'sv'}); anima.replay(); }; $(document).bind('keyup', function(e) { if(e.which === 39){ //$('#caro-lead').carousel('next'); $('#caro').carousel('next'); } else if(e.which === 37){ //$('#caro-lead').carousel('prev'); $('#caro').carousel('prev'); } }); /*============================================ SVG Animate ==============================================*/ $('#caro').on('slid.bs.carousel', function() { $('.active .animac').removeClass('hide-svg fade-svg'); var animac = new DrawFillSVG({elementId: 'svg-mac'}); var animac1 = new DrawFillSVG({elementId: 'svg-imac'}); var animac2 = new DrawFillSVG({elementId: 'svg'}); animac.replay(); animac1.replay(); animac2.replay(); }); $('#caro').on('slide.bs.carousel', function() { $('.active #svg-imac.bg').attr('class', 'svg screen'); $('.active .animac').addClass('fade-svg').delay(1000).queue(function(hideit){ $(this).addClass('hide-svg'); hideit(); }); }); $('#caro').on('slid.bs.carousel', function() { $('.active #svg-imac.screen').delay(2500).queue(function(screenit){ $(this).attr('class', 'bg'); screenit(); }); }); /*============================================ Calendar ==============================================*/ $('.calendar').fullCalendar ({ firstDay : 1, height: 345, events: [ { title: 'Project', start: '2014-09-27', end: '2014-10-02' }, { title: 'Conf', start: '2014-10-11', end: '2014-10-13', borderColor: 'red' }, { title: 'off', start: '2014-10-13', end: '2014-10-16' }, { title: 'Contract', start: '2014-10-16', end: '2014-10-31' }, { title: 'Contract', start: '2014-11-03', end: '2014-11-22' }, { title: 'Project', start: '2014-12-01', end: '2014-12-06' }, { title: 'Project', start: '2014-12-08', end: '2014-12-13' }, { title: 'Holiday', start: '2014-12-22', end: '2015-01-05', borderColor: 'red' }, { title: 'Project', start: '2015-01-06', end: '2015-01-25' }, { title: 'Project', start: '2015-02-02', end: '2015-02-14' }, { title: 'Holiday', start: '2015-02-14', end: '2015-02-19', borderColor: 'red' }, { title: 'Project', start: '2015-02-19', end: '2015-03-07' } ] }); });