1(function ($) { 2 "use strict"; 3 /*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */ 4 /*jshint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false, validthis: true */ 5 /*global jQuery,setTimeout,clearTimeout,projekktor,location,setInterval,YT,clearInterval,pixelentity,prettyPrint */ 6 7 var jwin = $(window),sc; 8 var jhtml = $("html"); 9 var body; 10 var container; 11 var containerH = 0,h = 0; 12 var scroller; 13 var filterable = false,isotope = false; 14 var layoutSwitcher = false; 15 var cells; 16 var overs; 17 var containerHeightTimer = 0; 18 var header,arrows,mobile,background; 19 var fullpage; 20 var headerY = 0,stickyH = 0; 21 var isSticky = false; 22 var headlines; 23 var sections; 24 var sliderBG; 25 var stickyMode = "sticky"; 26 var scrolling = false; 27 var changedActive = false; 28 var staff; 29 var footer,sitebody; 30 var openProject = false; 31 var stickyFooter = false; 32 var overlay; 33 var ie8 = ($.browser.msie && $.browser.version < 9); 34 var cssA = $.support.cssanimation; 35 var topt; 36 37 window.peGmapStyle = [ 38 { 39 stylers: [ 40 { saturation: -100 } 41 ] 42 },{ 43 featureType: "road", 44 elementType: "geometry", 45 stylers: [ 46 { lightness: 100 }, 47 { visibility: "simplified" } 48 ] 49 },{ 50 featureType: "road", 51 elementType: "labels", 52 stylers: [ 53 { visibility: "off" } 54 ] 55 } 56 ]; 57 58 function imgfilter() { 59 return this.href.match(/\.(jpg|jpeg|png|gif)$/i); 60 } 61 62 pixelentity.classes.Controller = function() { 63 64 var w,h,nw,nh; 65 var active; 66 var nav; 67 var useAnimations = false; 68 69 function fullPageResize() { 70 fullpage.find(".peNeedResize").triggerHandler("resize"); 71 } 72 73 function resize() { 74 nw = jwin.width(); 75 nh = window.innerHeight ? window.innerHeight: jwin.height(); 76 77 if (nw === w && nh === h) { 78 return; 79 } 80 81 w = nw; 82 h = nh; 83 84 // test this 85 if (mobile && jwin.scrollTop() > 0) { 86 return; 87 } 88 89 if (fullpage.length > 0) { 90 var fh = Math.max(300,h-body.find("section.pe-main-section:first").offset().top); 91 var mh = parseInt(fullpage.attr("data-maxheight"),10); 92 if (mh > 0) { 93 fh = Math.min(fh,mh); 94 } 95 96 mh = parseInt(fullpage.attr("data-minheight"),10); 97 98 if (mh > 0) { 99 fh = Math.max(fh,mh); 100 } 101 102 fullpage.height(fh); 103 fullPageResize(); 104 setTimeout(fullPageResize,500); 105 if ($.browser.msie && $.browser.version < 10) { 106 setTimeout(fullPageResize,1500); 107 setTimeout(fullPageResize,2000); 108 setTimeout(fullPageResize,2000); 109 } 110 } 111 112 } 113 114 function makeAnimated(e) { 115 cells.filter(e.currentTarget).find("div.scalable img").addClass("animated"); 116 } 117 118 function sticky(e) { 119 var wsp = jwin.scrollTop(); 120 if (sliderBG && !mobile && $.support.csstransforms) { 121 sliderBG.transform(1,0,-wsp >> 1); 122 } 123 body[wsp > 30 ? "addClass" : "removeClass"]("pe-header-scrolled"); 124 if (stickyFooter && wsp > Math.max(h,1000)) { 125 if (!body.hasClass("pe-sticky")) { 126 sitebody.css("margin-bottom",footer.outerHeight()); 127 body.addClass("pe-sticky"); 128 } 129 } else { 130 if (body.hasClass('pe-sticky')) { 131 //if (wsp < h-footer.outerHeight()) { 132 sitebody.css("margin-bottom",0); 133 body.removeClass("pe-sticky"); 134 //} 135 } 136 } 137 } 138 139 function widgets(el,controller) { 140 el = el || body; 141 142 if (el.hasClass("pe-controller-widgets")) { 143 return; 144 } 145 146 el.addClass("pe-controller-widgets"); 147 148 el.find('.peSlider.peVolo').attr({ 149 "data-controls-arrows": "edges-buttons", 150 "data-controls-bullets": "enabled", 151 "data-icon-font": "enabled" 152 }); 153 154 el.find('.carouselBox').attr({ 155 "data-height": "0,0" 156 }); 157 158 el.find('a.peVideo').attr({ 159 "data-autoplay": "disabled" 160 }); 161 162 el.find('.peBackground').attr({ 163 "data-mobile": mobile ? "true" : "" 164 }); 165 166 el.find('.peSlider[data-height]').not('.peGallerySlider').find('> div').addClass("scale"); 167 168 if (useAnimations) { 169 el.find('.pe-animation-maybe').removeClass('pe-animation-maybe').addClass('pe-animation-wants'); 170 } 171 172 if (el === body) { 173 resize(); 174 } 175 176 var parallax = $('.pe-main-section.pe-parallax'); 177 178 if (ie8) { 179 el.find('div:last-child').addClass('pe-last-child'); 180 } 181 182 parallax.each(function (idx) { 183 var ps = parallax.eq(idx); 184 var xpos = "50%"; 185 if (ps.hasClass("pe-bg-left")) { 186 xpos = '0%'; 187 } else if (ps.hasClass("pe-bg-right")) { 188 xpos = '100%'; 189 } 190 if (!mobile && !ie8) { 191 ps.parallax(xpos,0.5); 192 } 193 }); 194 195 el.find(".post-pagination.pe-load-more").peLoadMore(); 196 197 $.pixelentity.widgets.build(el,controller); 198 199 if (el !== body) { 200 var sec = el.closest("section.pe-main-section"); 201 if (sec.length > 0) { 202 sec.data("processed",false); 203 animate(sec); 204 } 205 } 206 207 } 208 209 function fixHeaderHeight() { 210 var logo = header.find("img:first"); 211 var lh = logo.height() || parseInt(logo.attr("height"),10); 212 header.find("header").height(lh).find("> div").height(lh);
213 header.find(".pe-menu-main").css("padding-top",lh-37); 214 if (!body.hasClass("pe-header-transparent")) { 215 body.css("padding-top",header.css("position") === "relative" ? 0 : lh); 216 } 217 stickyH = header.height(); 218 jhtml.data('header-height',stickyH); 219 setTimeout(function () { 220 stickyH = header.height(); 221 jhtml.data('header-height',stickyH); 222 },100); 223 } 224 225 function noop(e) { 226 e.preventDefault(); 227 return false; 228 } 229 230 231 function makeActive(hash) { 232 var url = window.location.href.replace(/#.*/,'') + (hash ? '#'+hash : ''); 233 var active = header.find("a[href='%0']".format(url)); 234 235 if (active.length > 0) { 236 changedActive = true; 237 } 238 239 if (changedActive > 0) { 240 header.find("li.active").removeClass("active"); 241 active.parent().addClass("active"); 242 } 243 } 244 245 function sectionHandler(direction) { 246 247 if (scrolling) { 248 return; 249 } 250 251 var hash = this.id === 'section-0' ? '' : this.id.replace(/section\-/,''); 252 253 /* 254 if (!$.browser.msie) { 255 window.location.hash = hash; 256 } 257 */ 258 259 makeActive(hash); 260 } 261 262 function cleanAnimation() { 263 var jthis = $(this); 264 var cl = jthis.data("removeclass") || ""; 265 cl += " pe-animation-has pe-animation-wants pe-animation-maybe"; 266 jthis.removeClass(cl); 267 //jthis.removeClass(cl).addClass('pe-animation-maybe pe-animation-wants'); 268 } 269 270 271 function animate(sec) { 272 /* 273 if (sec.data("processed")) { 274 return; 275 } 276 */ 277 var items = sec.find('.pe-animation-wants').not('.pe-animation-has'); 278 var delay = 0; 279 var incr = 0.3; 280 if (items.length > 0) { 281 var i,item,cl; 282 incr = items.length <= 4 ? 0.3 : 0.1; 283 sec.css("overflow","hidden"); 284 //items.addClass('animated pe-animation-has'); 285 var clean = []; 286 for (i=0;i<items.length;i++) { 287 item = items.eq(i); 288 if (item.hasClass('pe-animation-has')) { 289 continue; 290 } 291 cl = "animated pe-animation-has "+item.attr('data-animation') || 'fadeIn'; 292 item.data("removeclass",cl); 293 item.one($.support.cssanimationEnd,cleanAnimation); 294 item[0].style[cssA+"Delay"] = delay +"s"; 295 item.addClass(cl); 296 delay += incr; 297 } 298 299 //items.removeClass('pe-animation-wants'); 300 } 301 sec.data("processed",true); 302 } 303 304 305 function animationHandler(direction) { 306 var sec = sections.filter(this); 307 animate(sec); 308 } 309 310 function scrollEnd() { 311 scrolling = false; 312 } 313 314 function hashHandler(e) { 315 316 var url = (e && e.currentTarget) ? e.currentTarget.href : window.location.href; 317 var hash = url.split(/#/)[1]; 318 319 if (hash) { 320 var section = sections.filter('[id="section-%0"]'.format(hash)); 321 if (section.length > 0) { 322 makeActive(hash); 323 scrolling = true; 324 sticky(); 325 var fixed = header.css("position") == 'fixed'; 326 scroller.animate({scrollTop: section.offset().top-(fixed ? stickyH : 0)+4},500,scrollEnd); 327 } 328 } 329 } 330 331 function staffHandler(e) { 332 var member = staff.filter(e.currentTarget); 333 334 if (member.data("locked")) { 335 return; 336 } 337 338 var info = member.find(".info-wrap"); 339 var details = member.find(".details"); 340 341 342 if (e.type === "mouseenter") { 343 member.data("over",true); 344 member.css("overflow","hidden").height("auto"); 345 member.height(member.height()); 346 info.show(); 347 details.css("margin-top",-details.height()+41); 348 //console.log(-details.height()+24); 349 } else { 350 if (!member.data("over")) { 351 return; 352 } 353 member.data("locked",true); 354 member.data("over",false); 355 details.css("margin-top",-20); 356 setTimeout(function () { 357 info.hide(); 358 member.height("auto"); 359 member.data("locked",false); 360 },300); 361 } 362 } 363 364 function portfolioLoaded() { 365 var project = window.location.hash.match(/\/(.+)/); 366 if (project && project[1]) { 367 //setTimeout(function () { 368 jQuery("a[data-slug='"+project[1]+"']:first").trigger("click"); 369 //},10); 370 } 371 } 372 373 function carouselNavigation(e) { 374 var carousel = $(e.currentTarget); 375 var navigation = carousel.attr("data-show-navigation") != "no"; 376 try { 377 carousel.next()[navigation ? "removeClass" : "addClass"]("pe-block-hidden"); 378 } catch (x) { 379 } 380 } 381 382 function wrefresh() { 383 $.waypoints('refresh'); 384 } 385 386 387 function start() { 388 389 body = $("body"); 390 scroller = $("html,body"); 391 mobile = $.pixelentity.browser.mobile; 392 393 topt = window.peThemeOptions || {}; 394 useAnimations = (!mobile && $.support.cssanimation); 395 useAnimations = useAnimations && topt.animations == "yes"; 396 useAnimations = useAnimations && window.peAnimations !== false; 397 398 if (!mobile && !($.browser.msie && $.browser.version < 9) && body.is(".pe-sticky-footer.page-template-page_builder-php.pe-page-fullwidth")) { 399 footer = body.find("> .site-wrapper > div.footer"); 400 sitebody = body.find("> div > div.site-body"); 401 stickyFooter = true; 402 } 403 404 if (mobile) { 405 jhtml.addClass("mobile").removeClass("desktop"); 406 if ($.pixelentity.browser.android) { 407 jhtml.addClass("android"); 408 } else if ($.pixelentity.browser.iDev) { 409 jhtml.addClass("ios"); 410 } 411 } else { 412 jhtml.addClass("desktop").removeClass("mobile"); 413 } 414
415 header = $(".site-wrapper .pe-menu-sticky"); 416 417 fixHeaderHeight(); 418 419 fullpage = $(".site-wrapper > .site-body > .pe-full-page"); 420 421 if (!mobile) { 422 header.on('click','a[href=#]',noop); 423 } 424 425 $(".pe-menu-main").each(function () { 426 $(this).peMenu(); 427 }); 428 429 // pe menu 430 /* 431 jQuery(function() { 432 $(".pe-menu-main").each(function () { 433 $(this).peMenu(); 434 }); 435 setTimeout(function () { 436 $(".project-filter").peMenu(); 437 },1000); 438 }); 439 */ 440 441 $(".pe-full-page .peSlider[data-height]").attr("data-height","300,container,1440"); 442 $('.header header .sm-icon-wrap a[data-position]').attr("data-position","bottom"); 443 444 var escapelist = $(".pe-container .pe-escape-container"); 445 446 escapelist.each(function(idx) { 447 var el = escapelist.eq(idx); 448 el.closest(".pe-container").before(el); 449 }); 450 451 var splash = $("section.pe-splash-section"); 452 453 if (splash.length > 0) { 454 sliderBG = splash.find(".peWrap"); 455 //sliderBG.parent().one("ready.pixelentity",function () { 456 var caption = splash.find(" > div.peCaption"); 457 458 if (caption.length > 0) { 459 460 headlines = caption.find(".pe-headlines > div"); 461 if (headlines.length > 0) { 462 var mh = 0,mw = 0; 463 headlines.each(function (idx) { 464 mw = Math.max(headlines.eq(idx).width(),mw); 465 mh = Math.max(headlines.eq(idx).height(),mh); 466 }); 467 caption.find(".pe-headlines").width(mw).height(mh); 468 } 469 470 var slider = splash.find(".peVolo"); 471 if (mobile && slider.attr("data-transition") === 'pz' && !window.peForcePanZoom) { 472 slider.attr("data-transition","fade"); 473 } 474 slider.find(".peCaption").remove(); 475 slider.find(".peWrap > div:first").prepend(caption); 476 477 var ah = 0; 478 setInterval(function () { 479 ah = (ah + 1) % headlines.length; 480 headlines.removeClass("pe-active").eq(ah).addClass("pe-active"); 481 482 },4000); 483 } 484 //}); 485 } 486 487 if (!mobile) { 488 staff = $(".pe-view-layout-class-staff .staff-item"); 489 staff.on("mouseenter mouseleave",staffHandler); 490 491 } 492 493 var bgyt = $("#pe-bg-video"); 494 495 if (bgyt.length > 0) { 496 if (!$.fn.mb_YTPlayer || mobile || ie8 || window.peBgVideo === false) { 497 if (bgyt.attr("data-fallback")) { 498 bgyt.css({ 499 "background-image" : 'url(%0)'.format(bgyt.attr("data-fallback")) 500 }).addClass("pe-active"); 501 } 502 } else { 503 var def; 504 try { 505 def = eval('({%0})'.format(bgyt.attr("data-settings"))); 506 } catch (x) { 507 console.log("error parsing video data-settings"); 508 def = {containment:'body',autoPlay:true, mute:true, startAt:0, opacity:1, showControls:0}; 509 } 510 var videos = []; 511 var i = 0,video; 512 while ((video = bgyt.attr('data-video%0'.format(i++)))) { 513 videos.push(jQuery.extend({videoURL:video},def)); 514 } 515 bgyt.YTPlaylist(videos, false); 516 517 if ( def.autoPlay ) { 518 519 jwin.on( 'load', function() { 520 setTimeout( function() { bgyt.YTPPlay(); }, 1000 ); 521 setTimeout( function() { bgyt.YTPPlay(); }, 3000 ); 522 setTimeout( function() { bgyt.YTPPlay(); }, 5000 ); 523 setTimeout( function() { bgyt.YTPPlay(); }, 10000 ); 524 }); 525 526 } 527 } 528 $("#pe-bg-video-overlay").addClass("pe-active"); 529 } 530 531 $(".pe-ajax-portfolio:last").one("ajaxloaded.pixelentity",portfolioLoaded); 532 $(body).on("pe-carousel-navigation",".carouselBox",carouselNavigation); 533 534 widgets(body,{}); 535 536 $("img[data-original]:not(img.pe-lazyload-inited)").peLazyLoading(); 537 538 if (mobile) { 539 setTimeout(function () { 540 //alert("ok"); 541 jwin.triggerHandler("pe-lazyloading-refresh"); 542 },100); 543 } else { 544 cells = $(".peIsotopeGrid .peIsotopeItem"); 545 cells.one("mouseenter",makeAnimated); 546 } 547 548 jwin.resize(resize); 549 jwin.on("load",resize); 550 jwin.on("scroll",sticky); 551 552 sections = $('section.pe-main-section'); 553 var refresh = false; 554 555 if (sections.length > 1) { 556 refresh = true; 557 sections.filter(".pe-splash-section").waypoint({handler: sectionHandler,offset: -100}); 558 sections.not(".pe-splash-section").waypoint({handler: sectionHandler,offset: 100}); 559 } 560 561 if (useAnimations && sections.length > 0) { 562 refresh = true; 563 var wh = window.innerHeight ? window.innerHeight: jwin.height(); 564 sections.not(".pe-splash-section").waypoint({handler: animationHandler,offset: wh-(window.peAnimationOffset ? window.peAnimationOffset : 200 )}); 565 } 566 567 if (refresh) { 568 setTimeout(wrefresh,500); 569 setInterval(wrefresh,1000); 570 } 571 572 //jwin.on("hashchange",hashHandler); 573 574 body.on("click","a[href]",hashHandler); 575 hashHandler(); 576 //makeActive(); 577 resize();
578 overlay = body.find("> .site-loader"); 579 if (overlay.length > 0) { 580 //jwin.one("load",function () { 581 setTimeout(function() { 582 overlay.addClass("pe-disabled"); 583 setTimeout(function () { 584 overlay.css("visibility","hidden"); 585 },500); 586 jwin.on("beforeunload",function (e) { 587 overlay.css("visibility","visible").removeClass("pe-disabled"); 588 }); 589 },500); 590 //}); 591 } 592 593 594 595 } 596 597 $.extend(this, { 598 // public API 599 widgets: widgets, 600 start: start 601 }); 602 603 }; 604 605}(jQuery));
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.