studio.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. new WOW().init();
  2. jQuery(document).ready(function($) {
  3. $(window).bind('load', function() {
  4. $('#loader').fadeOut(700);
  5. });
  6. /*============================================
  7. Welcome Cookies
  8. ==============================================*/
  9. $(function dw_set_cookie() {
  10. var COOKIE = 'windhamdavid-cookie';
  11. var dwcookie = $.cookie(COOKIE);
  12. if (dwcookie == null) {
  13. $.cookie(COOKIE, 'yum-cookies', { expires: 7, path: '/'});
  14. $('.terminal-welcome').modal('show');
  15. $('.welcome').typed({
  16. 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'],
  17. typeSpeed: 30,
  18. backSpeed: 50,
  19. startDelay: 0,
  20. backDelay: 0,
  21. loop: false,
  22. loopCount: false,
  23. attr: null,
  24. callback: function(){
  25. dw_terminal();
  26. }
  27. });
  28. $('.first-slide').css('visibility','hidden');
  29. }
  30. else {
  31. $('.terminal').modal('show');
  32. if (localStorage.getItem('person') === null) {
  33. var person = 'anonymous person';
  34. }
  35. else {
  36. var person = localStorage.getItem('person');
  37. }
  38. $('.welcome-back-text').typed({
  39. strings: ['...', 'Welcome back ' +person],
  40. typeSpeed: 30,
  41. backSpeed: 50,
  42. startDelay: 0,
  43. backDelay: 0,
  44. loop: false,
  45. loopCount: false,
  46. attr: null,
  47. callback: function(){
  48. dw_terminal();
  49. }
  50. });
  51. $('.first-slide').css('visibility','hidden');
  52. $('.terminal').on('hidden.bs.modal', function () {
  53. dw_caro();
  54. $('.first-slide').css('visibility','visible');
  55. });
  56. }
  57. });
  58. function dw_shift() {
  59. $('.terminal-welcome').modal('hide');
  60. $('.terminal-welcome').on('hidden.bs.modal', function () {
  61. dw_caro();
  62. $('.first-slide').css('visibility','visible');
  63. });
  64. }
  65. /*============================================
  66. Terminal
  67. ==============================================*/
  68. (function ($){
  69. $.fn.cli = function(handler, prompt, effect){
  70. if (!prompt) prompt = '<span class="u">you</span><span class="at">@</span><span class="mee">david</span>&nbsp;&gt;&nbsp;';
  71. if (!effect) effect = $.fn.text;
  72. return this.each(function(){
  73. var self = $(this);
  74. function newline(){
  75. self.
  76. append('<p class=input><span class=prompt>'+prompt+'</span><span style=outline:none contenteditable></span></p>');
  77. try {
  78. $('[contenteditable]', self)[0].focus();
  79. }catch(e){
  80. }
  81. }
  82. newline();
  83. self.on('keydown', '[contenteditable]', function(evt){
  84. if (evt.keyCode === 13){
  85. $(this).removeAttr('contenteditable');
  86. effect.call($('<p class=response>').appendTo(self),handler(this.textContent || this.innerText));
  87. newline();
  88. return false;
  89. }
  90. });
  91. });
  92. };
  93. })(jQuery);
  94. function dw_terminal(){
  95. function type(text){
  96. var span = $('<span>').appendTo(this).after('<span id="blinker" style="background:green">&nbsp;&nbsp;</span>');
  97. var style = $('<style>p.input {visibility: hidden} p.input.old {visibility: visible}</style>').appendTo('head');
  98. $('p.input').addClass('old');
  99. var progress = 0;
  100. var timer = setInterval (function(){
  101. span.text(text.substr(0, progress++));
  102. if (progress > text.length){
  103. $('#blinker').remove();
  104. style.remove();
  105. $('[contenteditable]')[0].focus();
  106. clearInterval(timer);
  107. }
  108. },100);
  109. }
  110. $('.thermo-intro').cli(function(text){
  111. if (text.length > 1) {
  112. localStorage.setItem('person', text),
  113. dw_shift();
  114. };
  115. return '';
  116. }, null, type);
  117. $('.thermo').cli(function(text){
  118. if (/exit/i.test(text)) {
  119. $('.terminal').modal('hide');
  120. }
  121. if (/help/i.test(text)) return "I need somebody. Type 'exit' to close";
  122. if (/hello/i.test(text)) return "Hello to you!";
  123. if (/what/i.test(text)) return "This is a website silly human";
  124. if (/and/i.test(text)) return "and what?";
  125. if (/who/i.test(text)) return "David A. Windham";
  126. if (/when/i.test(text)) return "Yesterday";
  127. if (/how/i.test(text)) return "JavaScript is a dynamic computer programming language";
  128. if (/why/i.test(text)) return "For fun";
  129. if (/you/i.test(text)) return "your mama";
  130. if (/cd ../i.test(text)) return "Oh, I see";
  131. if (/thermonuclear/i.test(text)) return "Wouldn't you prefer a nice game of chess?";
  132. if (text.length < 3) return "type 'exit' to close";
  133. return 'command not found: '+text;
  134. }, null, type);
  135. $('p.input').on('touchstart click', function(e) {
  136. e.preventDefault();
  137. $('[contenteditable]')[0].focus();
  138. });
  139. }
  140. /*============================================
  141. Navigation
  142. ==============================================*/
  143. $('.nav-toggle').on('touchstart click', function(e) {
  144. e.preventDefault();
  145. $( this ).toggleClass( 'active' );
  146. });
  147. $('#nav').affix({
  148. //offset: {top: $('.intro').height()-$('.navbar').height()}
  149. });
  150. $(function dw_hidenav() {
  151. var headerHeight = $('.navbar').height();
  152. $(window).on('scroll', { previousTop: 0 },
  153. function() {
  154. var currentTop = $(window).scrollTop();
  155. if (currentTop < this.previousTop) {
  156. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  157. $('.navbar').addClass('visible');
  158. $('.site-title a').removeClass('light');
  159. } else {
  160. $('.navbar').removeClass('visible fixed');
  161. $('.site-title a').addClass('light');
  162. }
  163. }
  164. else {
  165. $('.navbar').removeClass('visible');
  166. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  167. }
  168. this.previousTop = currentTop;
  169. }
  170. );
  171. });
  172. /*============================================
  173. Carousel
  174. ==============================================*/
  175. $('.caro-grad').appear();
  176. $('.caro-grad').one('appear', dw_appear);
  177. function dw_appear() {
  178. $('#caro').carousel({
  179. interval: 5555,
  180. wrap: false,
  181. pause: false
  182. });
  183. var anima = new DrawFillSVG({elementId: 'sv'});
  184. anima.replay();
  185. };
  186. $(document).bind('keyup', function(e) {
  187. if(e.which === 39){
  188. //$('#caro-lead').carousel('next');
  189. $('#caro').carousel('next');
  190. }
  191. else if(e.which === 37){
  192. //$('#caro-lead').carousel('prev');
  193. $('#caro').carousel('prev');
  194. }
  195. });
  196. /*============================================
  197. SVG Animate
  198. ==============================================*/
  199. $('#caro').on('slid.bs.carousel', function() {
  200. $('.active .animac').removeClass('hide-svg fade-svg');
  201. var animac = new DrawFillSVG({elementId: 'svg-mac'});
  202. var animac1 = new DrawFillSVG({elementId: 'svg-imac'});
  203. var animac2 = new DrawFillSVG({elementId: 'svg'});
  204. animac.replay();
  205. animac1.replay();
  206. animac2.replay();
  207. });
  208. $('#caro').on('slide.bs.carousel', function() {
  209. $('.active #svg-imac.bg').attr('class', 'svg screen');
  210. $('.active .animac').addClass('fade-svg').delay(1000).queue(function(hideit){
  211. $(this).addClass('hide-svg');
  212. hideit();
  213. });
  214. });
  215. $('#caro').on('slid.bs.carousel', function() {
  216. $('.active #svg-imac.screen').delay(2500).queue(function(screenit){
  217. $(this).attr('class', 'bg');
  218. screenit();
  219. });
  220. });
  221. /*============================================
  222. Calendar
  223. ==============================================*/
  224. $('.calendar').fullCalendar ({
  225. firstDay : 1,
  226. height: 345,
  227. events: [
  228. {
  229. title: 'Project',
  230. start: '2014-09-27',
  231. end: '2014-10-02'
  232. },
  233. {
  234. title: 'Conf',
  235. start: '2014-10-11',
  236. end: '2014-10-13',
  237. borderColor: 'red'
  238. },
  239. {
  240. title: 'off',
  241. start: '2014-10-13',
  242. end: '2014-10-16'
  243. },
  244. {
  245. title: 'Contract',
  246. start: '2014-10-16',
  247. end: '2014-10-31'
  248. },
  249. {
  250. title: 'Contract',
  251. start: '2014-11-03',
  252. end: '2014-11-22'
  253. },
  254. {
  255. title: 'Project',
  256. start: '2014-12-01',
  257. end: '2014-12-06'
  258. },
  259. {
  260. title: 'Project',
  261. start: '2014-12-08',
  262. end: '2014-12-13'
  263. },
  264. {
  265. title: 'Holiday',
  266. start: '2014-12-22',
  267. end: '2015-01-05',
  268. borderColor: 'red'
  269. },
  270. {
  271. title: 'Project',
  272. start: '2015-01-06',
  273. end: '2015-01-25'
  274. },
  275. {
  276. title: 'Project',
  277. start: '2015-02-02',
  278. end: '2015-02-14'
  279. },
  280. {
  281. title: 'Holiday',
  282. start: '2015-02-14',
  283. end: '2015-02-19',
  284. borderColor: 'red'
  285. },
  286. {
  287. title: 'Project',
  288. start: '2015-02-19',
  289. end: '2015-03-07'
  290. }
  291. ]
  292. });
  293. });