1"use strict"; var $ = jQuery; 2$(function() { new (function(){ 3 var Customize = require('./customize/customize.js'); 4 var TopNav = require('./widgets/top-nav.js'); 5 var MenuToggle = require('./widgets/menu-toggle.js'); 6 var Players = require('./animation/players.js'); 7 var Scrolling = require('./animation/scrolling.js'); 8 var tools = require('./tools/tools.js'); 9 var ShowList = require('./widgets/show-list.js'); 10 var Gallery = require('./widgets/gallery.js'); 11 var fluid = require('./widgets/fluid.js'); 12 var Counter = require('./widgets/counter.js'); 13 var ChangeColors = require('./widgets/change-colors.js'); 14 var Sliders = require('./widgets/sliders.js'); 15 var loading = require('./widgets/loading.js'); 16 var CssAnimation = require('./animation/css-animation.js'); 17 var dotScroll = require('./widgets/dot-scroll.js'); 18 var Map = require('./widgets/map.js'); 19 var Skillbar = require('./widgets/skillbar.js'); 20 var AjaxForm = require('./widgets/ajax-form.js'); 21 var YoutubeBG = require('./widgets/youtube-bg.js'); 22 var VimeoBG = require('./widgets/vimeo-bg.js'); 23 var VideoBG = require('./widgets/video-bg.js'); 24 var app = require('./app/app.js'); 25 var OverlayWindow = require('./widgets/overlay-window.js'); 26 var isPoorBrowser = $('html').hasClass('poor-browser'); 27 var isAndroid43minus = $('html').hasClass('android-browser-4_3minus'); 28 var $pageTransition = $('.page-transition'); 29 var me = this; 30 var $window = $(window); 31 var $sections = $('section'); 32 var sectionTriggers = []; 33 var lastActiveSectionHash; 34 var location = document.location.hash ? document.location.href.replace(new RegExp(document.location.hash+'$'),'') : document.location.href.replace('#',''); 35 var $navLinks = (function(){ 36 var $res = jQuery(); 37 $('#top-nav .navbar-nav a').each(function(){ 38 var $this = $(this); 39 if( 40 (!this.hash) || 41 ( 42 (this.href === location+this.hash) && 43 ($('section'+this.hash).length > 0) 44 ) 45 ){ 46 $res = $res.add($this); 47 } 48 }); 49 return $res; 50 })(); 51 var isMobile = $('html').hasClass('mobile'); 52 var scrolling; 53 var maxScrollPosition; 54 var ticker = new (function(){ 55 var me = this; 56 window.requestAnimFrame = (function(){ 57 return window.requestAnimationFrame || 58 window.webkitRequestAnimationFrame || 59 window.mozRequestAnimationFrame || 60 window.oRequestAnimationFrame || 61 window.msRequestAnimationFrame || 62 function(/* function */ callback, /* DOMElement */ element){ 63 window.setTimeout(callback, 1000 / 60); 64 }; 65 })(); 66 var lastPosition = -1; 67 this.pageIsReady = false; 68 (function animate(time){ 69 if(me.pageIsReady){ 70 var windowTopPos = tools.windowYOffset(); 71 if (lastPosition !== windowTopPos) { 72 scrolling.scroll(windowTopPos); 73 trigNavigationLinks(windowTopPos); 74 } 75 lastPosition = windowTopPos; 76 TWEEN.update(); 77 app.tick(); 78 } 79 if(loading.queue.length > 0) { 80 (loading.queue.pop())(); 81 } 82 requestAnimFrame(animate); 83 })(); 84 })(); 85 86 this.topNav = undefined; 87 this.players = Players; 88 this.afterConfigure = function(){ 89 var hash = window.location.hash; 90 if (history && history.replaceState) { 91 history.replaceState("", document.title, window.location.pathname + window.location.search); 92 } 93 new YoutubeBG(); 94 new VimeoBG(); 95 new VideoBG(); 96 app.prepare(function(){ 97 loading.load(function (){ 98 $navLinks = $navLinks.add(dotScroll.links()).click(function(){ 99 $navLinks.removeClass('target'); 100 $(this).addClass('target'); 101 }); 102 me.topNav = new TopNav(); 103 new MenuToggle(); 104 scrolling = new Scrolling(me); 105 widgets($('body')); 106 new Gallery(onBodyHeightResize, widgets, unwidgets); 107 var windowW = $window.width(); 108 var windowH = $window.height(); 109 $window.resize(function(){ 110 var newWindowW = $window.width(); 111 var newWindowH = $window.height(); 112 if(newWindowW!==windowW || newWindowH!==windowH){ //IE 8 fix 113 windowW = newWindowW; 114 windowH = newWindowH; 115 fluid.setup($('body')); 116 onBodyHeightResize(); 117 } 118 }); 119 app.setup(function(){ 120 var finish = function(){ 121 buildSizes(); 122 calcNavigationLinkTriggers(); 123 ticker.pageIsReady = true; 124 $navLinks.each(function(){ 125 if(this.href==location){ 126 $(this).addClass('active'); 127 } 128 });
129 $('.bigtext').each(function(){ 130 $(this).bigtext(); 131 }); 132 app.ungated(); 133 setTimeout(function(){ 134 loading.ungate(); 135 navigate(window.location.href, hash); 136 }); 137 }; 138 var test = function(){ 139 var $excl = $('.non-preloading, .non-preloading img'); 140 var $imgs = $('img').not($excl); 141 for(var i=0; i<$imgs.length; i++){ 142 if( (!$imgs[i].width || !$imgs[i].height) && (!$imgs[i].naturalWidth || !$imgs[i].naturalHeight) ){ 143 setTimeout(test, 100); 144 return; 145 } 146 } 147 finish(); 148 } 149 test(); 150 }); 151 }); 152 }); 153 } 154 function onBodyHeightResize() { 155 buildSizes(); 156 scrolling.scroll(tools.windowYOffset()); 157 calcNavigationLinkTriggers(); 158 } 159 function widgets($context){ 160 new ShowList($context, me); 161 new Sliders($context); 162 if(!isMobile) $context.find('.hover-dir').each( function() { $(this).hoverdir({speed: 300}); } ); 163 $context.find("a").click(function(e){ 164 var $this = $(this); 165 if($this.data('toggle')) return; 166 navigate(this.href, this.hash, e, $this) 167 }); 168 fluid.setup($context); 169 new Map($context); 170 new Counter($context, me); 171 new ChangeColors($context); 172 new Skillbar($context, me); 173 $context.find("input,select,textarea").not("[type=submit]").jqBootstrapValidation(); 174 new AjaxForm($context); 175 new CssAnimation($context, me); 176 $('.widget-tabs a').click(function (e) { 177 e.preventDefault() 178 $(this).tab('show') 179 }); 180 $('.widget-tooltip').tooltip(); 181 $('.widget-popover').popover(); 182 $context.find('video').each(function(){ // IE 9 Fix 183 if($(this).attr('muted')!==undefined){ 184 this.muted=true; 185 } 186 }); 187 $context.find('.open-overlay-window').each(function(){ 188 var $this = $(this);
189 var $overlay = $($this.data('overlay-window')); 190 var overlayWindow = new OverlayWindow($overlay); 191 $this.click(function(e){ 192 e.preventDefault(); 193 overlayWindow.show(); 194 }) 195 }); 196 if(isPoorBrowser){ 197 $context.find('.tlt-loop').remove(); 198 }else{ 199 $context.find('.textillate').each(function(){ 200 var $tlt = $(this); 201 $tlt.textillate(eval('('+$tlt.data('textillate-options')+')')); 202 }); 203 } 204 } 205 function unwidgets($context){ 206 new Sliders($context, true); 207 $context.find('.player').each(function(){ 208 var ind = $(this).data('player-ind'); 209 me.players[ind].pause(); 210 me.players.splice(ind, 1); 211 }) 212 } 213 function navigate(href, hash, e, $elem) { 214 var hrefBH = hash ? href.replace(new RegExp(hash+'$'), '') : href; 215 if(location === hrefBH && hash && hash.indexOf("!") === -1){ 216 var $content = $(hash); 217 if (e) { 218 e.preventDefault(); 219 } 220 if($content.length > 0){ 221 var offset = $content.offset().top - me.topNav.state2H; 222 var tn = $content.get(0).tagName.toLowerCase(); 223 if(tn === 'h1' || tn === 'h2' || tn === 'h3' || tn === 'h4' || tn === 'h5' || tn === 'h6'){ 224 offset -= 20; 225 } 226 if (offset < 0) offset = 0; 227 tools.scrollTo(offset); 228 }else{ 229 tools.scrollTo(0); 230 } 231 }else if(e && (href !== location+'#')){ 232 if(!$elem.attr('target')){ 233 var pageTransition = function(){ 234 e.preventDefault(); 235 me.topNav.state1(); 236 loading.gate(function(){ 237 window.location = href; 238 }); 239 } 240 if($elem.hasClass('page-transition')){ 241 pageTransition(); 242 }else{ 243 $pageTransition.each(function(){ 244 var container = $(this).get(0); 245 if($.contains(container, $elem[0])){ 246 pageTransition(); 247 } 248 }); 249 } 250 } 251 } 252 } 253 function calcNavigationLinkTriggers(){ 254 var wh = $window.height(); 255 var triggerDelta = wh/3; 256 sectionTriggers = []; 257 $sections.each(function(i){ 258 var $s = $(this); 259 var id = $s.attr('id'); 260 if(id){ 261 sectionTriggers.push({hash: '#'+id, triggerOffset: $s.data('position')-triggerDelta}); 262 } 263 }); 264 trigNavigationLinks(tools.windowYOffset()); 265 } 266 function trigNavigationLinks(windowTopPos){ 267 var activeSectionHash; 268 for(var i=0; i<sectionTriggers.length; i++){ 269 if(sectionTriggers[i].triggerOffset<windowTopPos){ 270 activeSectionHash = sectionTriggers[i].hash; 271 } 272 } 273 if(activeSectionHash!=lastActiveSectionHash){ 274 var sectionLink = location + activeSectionHash; 275 lastActiveSectionHash = activeSectionHash; 276 $navLinks.each(function(){ 277 var $a = $(this); 278 if(this.href === sectionLink){ 279 $a.addClass('active'); 280 $a.removeClass('target'); 281 }else{ 282 $a.removeClass('active'); 283 } 284 }); 285 app.changeSection(me, activeSectionHash); 286 } 287 } 288 function buildSizes(){ 289 app.buildSizes(me); 290 maxScrollPosition = $('body').height() - $window.height(); 291 for(var i=0; i<me.players.length; i++){ 292 var $v = me.players[i].$view; 293 $v.data('position', $v.offset().top); 294 } 295 } 296 var animEnd = function(elems, end, modern, callback, time){ 297 var additionTime = 100; 298 var defaultTime = 1000; 299 return elems.each(function() { 300 var elem = this; 301 if (modern && !isAndroid43minus) { 302 var done = false; 303 $(elem).bind(end, function() { 304 done = true; 305 $(elem).unbind(end); 306 return callback.call(elem); 307 }); 308 if(time >= 0 || time === undefined){ 309 var wTime = time === undefined ? 1000 : defaultTime + additionTime; 310 setTimeout(function(){ 311 if(!done){ 312 $(elem).unbind(end); 313 callback.call(elem); 314 } 315 }, wTime) 316 } 317 }else{ 318 callback.call(elem); 319 } 320 }); 321 } 322 $.fn.animationEnd = function(callback, time) { 323 return animEnd(this, tools.animationEnd, Modernizr.cssanimations, callback, time); 324 }; 325 $.fn.transitionEnd = function(callback, time) { 326 return animEnd(this, tools.transitionEnd, Modernizr.csstransitions, callback, time); 327 }; 328 $.fn.stopTransition = function(){ 329 return this.css({ 330 '-webkit-transition': 'none', 331 '-moz-transition': 'none', 332 '-ms-transition': 'none', 333 '-o-transition': 'none', 334 'transition': 'none' 335 }); 336 } 337 $.fn.cleanTransition = function(){ 338 return this.css({ 339 '-webkit-transition': '', 340 '-moz-transition': '', 341 '-ms-transition': '', 342 '-o-transition': '', 343 'transition': '' 344 }); 345 } 346 $.fn.nonTransition = function(css) { 347 return this.stopTransition().css(css).cleanTransition(); 348 }; 349 $.fn.transform = function(str, origin) { 350 return this.css(tools.transformCss(str, origin)); 351 }; 352 $('video').each(function(){ // IE 9 Fix 353 if($(this).attr('muted')!==undefined){ 354 this.muted=true; 355 } 356 }); 357 new Customize(me); 358})();});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.