1var curSlide = 0; 2var animSpeed = 750; 3var sliding = false; 4var cat_active = false; 5var changingProject = false; 6var arrowOffset = false; 7var swiper = false; 8if (typeof window.orientation !== 'undefined') var inMobile = true; 9else var inMobile = false; 10// centers elements with fixed positioning 11jQuery.fn.center = function(onlyHoriz, maxTop) { 12 if (!this.hasClass("no-center")) { 13 onlyHoriz = typeof onlyHoriz !== 'undefined' ? onlyHoriz : false; 14 maxTop = typeof maxTop !== 'undefined' ? maxTop : 0; 15 this.css("position", "fixed"); 16 if (!onlyHoriz) this.css("top", Math.max(maxTop, (($(window).height() - 17 $(this).outerHeight()) / 2) + $(window).scrollTop()) + 18 "px"); 19 this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 20 2) + $(window).scrollLeft()) + "px"); 21 } 22 return this; 23} 24 25function setGrid() { 26 $.get("/setting/grid"); 27} 28 29function setList() { 30 $.get("/setting/list"); 31} 32 33function setPresentationOn() { 34 $.get("/setting/presentation_on"); 35} 36 37function setPresentationOff() { 38 $.get("/setting/presentation_off"); 39} 40 41function nextProject() { 42 if (!changingProject && next_url) { 43 changingProject = true; 44 $("#proj-images").animate({ 45 'top': '-' + $(window).height() + 'px' 46 }, animSpeed, function() { 47 $.get(next_url, function(data) { 48 history.replaceState(false, "", next_url); 49 $("#proj-content").empty().css('visibility', 50 'invisible').html(data); 51 document.title = full_title; 52 if (presentation) initProject(true); 53 else initProject(false); 54 $("#proj-content").fadeIn(250, function() { 55 changingProject = false; 56 }); 57 }); 58 }); 59 } 60} 61 62function prevProject() { 63 if (!changingProject && prev_url) { 64 changingProject = true; 65 $("#proj-images").animate({ 66 'top': $(window).height() + 'px' 67 }, animSpeed, function() { 68 $.get(prev_url, function(data) { 69 history.replaceState(false, "", prev_url); 70 $("#proj-content").empty().css('visibility', 71 'invisible').html(data); 72 document.title = full_title; 73 if (presentation) initProject(true); 74 else initProject(false); 75 $("#proj-content").fadeIn(250, function() { 76 changingProject = false; 77 }); 78 }); 79 }); 80 } 81} 82 83 //$(function() { 84 // $('#vticker').vTicker(); 85 //}); 86 87function initProject(in_presentation) { 88 curSlide = 0; 89 sizeSlides(); 90 // if we have videos on the page, size them after their metadata is loaded so sizing works properly 91 $(".proj-image video").each(function() { 92 $(this).bind('loadedmetadata', function() { 93 fullscreenImage($(this)); 94 }); 95 $(this).bind('canplay', function() { 96 $(this).parent().find(".buffering-indicator").hide(); 97 }); 98 $(this).bind('waiting', function() { 99 $(this).parent().find(".buffering-indicator").show(); 100 }); 101 }); 102 // stop images from dragging 103 $(".proj-image").on('dragstart', function(e) { 104 e.preventDefault(); 105 }); 106 /// 107 /// more problematic things down here 108 /// i.e. deal with mobile browsers 109 /// 110 // if we are on a mobile device, init the touch swipe functionality 111 if (inMobile) { // show arrows only if necessary 112 if ($(".proj-image").length < 2) { 113 $("#move-left").hide(); 114 $("#move-right").hide(); 115 } else { 116 $("#move-left").show(); 117 $("#move-right").show(); 118 } 119 $("#proj-content").touchwipe({ 120 wipeLeft: nextSlide, 121 wipeRight: prevSlide, 122 preventDefaultEvents: false, 123 wipeUp: scrollUp,
124 wipeDown: scrollDown 125 }); 126 } 127 // we are on desktop; check if in presentation 128 else { 129 // if we aren't in presentation mode 130 if (!in_presentation) { 131 // show arrows only if necessary 132 if ($(".proj-image").length < 2) { 133 $("#move-left").hide(); 134 $("#move-right").hide(); 135 } else { 136 $("#move-left").show(); 137 $("#move-right").show(); 138 } 139 } 140 // we're in presentation mode, hide arrows and X 141 else { 142 $(".nopres").hide(); 143 } 144 } 145 } 146 // scrollUp and scrollDown are for moving up/down description text on mobile 147 148function scrollUp() { 149 if (parseInt($(".mobile-descrip").css("margin-top").split("px")[0]) != 150 0 && curSlide == 0) $(".mobile-descrip").stop().animate({ 151 'margin-top': '+=60px' 152 }, 200); 153} 154 155function scrollDown() { 156 if (curSlide == 0) $(".mobile-descrip").stop().animate({ 157 'margin-top': '-=60px' 158 }, 200); 159 } 160 // does trick to figure out bold hover sizing for all menu items... 161 162function fontFix() { 163 console.log("fixing fonts"); 164 $('.menu-listing a').each(function() { 165 $(this).parent().css({ 166 "width": "auto" 167 }).css({ 168 "width": $(this).width() + 6 169 }); 170 //$(this).parent().; 171 }); 172 } 173 // we have to put this in a callback given to typekit 174 // else the sizing will be based on sans-serif rather than our font 175 176function typekitActive() { 177 // putting this code in a document ready because sometimes on slow mobile loads it is never called 178 // so the menu never fades in 179 $(document).ready(function() { 180 fontFix(); 181 }); 182} 183 184function togglePresentation() { 185 if (!presentation) { 186 setPresentationOn(); 187 $(".nopres").stop().fadeOut(500); 188 presentation = true; 189 } else { 190 setPresentationOff(); 191 $(".nopres").stop().css("visibility", "visible").fadeIn(500); 192 presentation = false; 193 } 194} 195 196function goToSlide(slideNum) { 197 var numSlides = $(".proj-image").length; 198 var w = $(window).width(); 199 $("#proj-images-slider").css("left", '-' + (slideNum * w) + 'px'); 200 curSlide = slideNum; 201} 202 203function slidingOff() { 204 sliding = false; 205} 206 207function resetVideoSlide() { 208 // if current slide is a video, stop playing and reset its position 209 var vidEle = $(".proj-image").eq(curSlide).find('video').get(0); 210 if (vidEle && !inMobile) { 211 vidEle.pause(); 212 //vidEle.currentTime = 0; 213 } 214} 215 216function playVideoSlide() { 217 // if upcoming slide is a video, play it 218 var vidEle = $(".proj-image").eq(curSlide).find('video').get(0); 219 if (vidEle && !inMobile) { 220 vidEle.play(); 221 } 222} 223 224function pauseVimeo() { 225 var iframe = $('#vimeo-player')[0]; 226 if( !iframe) { 227 return; 228 } 229 230 var player = new Vimeo.Player(iframe); 231 player.pause(); 232} 233 234function nextSlide() { 235 var numSlides = $(".proj-image").length; 236 var w = $(window).width(); 237 resetVideoSlide(); 238 pauseVimeo(); 239 240 // if not on last slide 241 if (curSlide != numSlides - 1 && !sliding) { 242 sliding = true; 243 $("#proj-images-slider").stop().animate({ 244 'left': '-=' + w + 'px' 245 }, animSpeed, slidingOff); 246 //$("#proj-images-slider").stop().transition({x:'-='+w+'px'},animSpeed, slidingOff); 247 curSlide++; 248 } 249 // on last slide 250 else if (!sliding) { 251 sliding = true; 252 $("#proj-images-slider").stop().animate({ 253 'left': '0' 254 }, animSpeed, slidingOff); 255 //$("#proj-images-slider").stop().transition({x:'0'},animSpeed, slidingOff); 256 curSlide = 0; 257 } 258 playVideoSlide(); 259} 260 261function prevSlide() { 262 var numSlides = $(".proj-image").length; 263 var w = $(window).width(); 264 resetVideoSlide(); 265 // if not on first slide 266 if (curSlide != 0 && !sliding) { 267 sliding = true; 268 $("#proj-images-slider").stop().animate({ 269 'left': '+=' + w + 'px' 270 }, animSpeed, slidingOff); 271 //$("#proj-images-slider").stop().transition({x:'+='+w+'px'},animSpeed,slidingOff); 272 curSlide--; 273 } 274 // on first slide 275 else if (!sliding) { 276 sliding = true; 277 $("#proj-images-slider").stop().animate({ 278 'left': -1 * w * (numSlides - 1) + 'px' 279 }, animSpeed, slidingOff); 280 //$("#proj-images-slider").stop().transition({x:-1*w*(numSlides-1) + 'px'},animSpeed,slidingOff); 281 curSlide = numSlides - 1; 282 } 283 playVideoSlide(); 284 } 285 286// given a jquery object, resize it to fit properly to window size 287function fullscreenImage(obj) { 288 if (obj.length == 0) return; 289 norel = false;
290 domObj = obj.get(0); 291 // if a video, query its built-in videoWidth and videoHeight properties 292 if (domObj.tagName == "VIDEO") { 293 if (inMobile) return; 294 var imgW = domObj.videoWidth; 295 var imgH = domObj.videoHeight; 296 } else { 297 var imgW = obj.width(); 298 var imgH = obj.height(); 299 } 300 var imgRatio = imgW / imgH; 301 // mobile browser fix for proper window height 302 var pageH = window.innerHeight ? window.innerHeight : $(window).height(); 303 var pageW = window.innerWidth ? window.innerWidth : $(window).width(); 304 var pageRatio = pageW / pageH; 305 // if page ratio greater than or equal to background image, size bg image to width of browser 306 // and then make it center vertically 307 if (pageRatio >= imgRatio) { 308 obj.width(pageW); 309 obj.height(imgH * (pageW / imgW)); 310 obj.css('top', -1 * ((imgH * (pageW / imgW)) - pageH) / 2 + "px"); 311 obj.css('left', '0'); 312 } 313 // else, the page is tall so just size the bgImage to the height of browser 314 // and then make it center horizontally 315 else { 316 obj.height(pageH); 317 obj.width(imgW * (pageH / imgH)); 318 obj.css('top', '0'); 319 obj.css('left', -1 * ((imgW * (pageH / imgH)) - pageW) / 2 + "px"); 320 } 321} 322 323function sizeProjectThumbs() { 324 var thumb_ratio = 500 / 281.0; 325 var thumb_height = $(".index-thumb").width() / thumb_ratio; 326 /* 327 var _w_th = ($("#projects").width()-8)*0.3333; 328 $(".index-thumb").each(function(){ 329 $(this).width(_w_th).height(_w_th/thumb_ratio); 330 }); 331 */ 332 $(".index-thumb").each(function() { 333 //$(this).width($(this).width()-4); 334 $(this).height(thumb_height); 335 }); 336} 337 338function sizeSlides() { 339 var winw = $(window).width(); 340 var winh = $(window).height(); 341 //var winh = window.outerHeight+50; 342 $("#proj-images").width(winw); 343 $("#proj-images").height(winh); 344 $(".proj-image").width(winw); 345 $(".proj-image").height(winh); 346 $("#proj-images-slider").width($('.proj-image').length * winw); 347 // set mobile descrip to be height auto for long descirptions 348 $(".proj-image.mobile-descrip").height("auto"); 349 // this effectively re-offsets the slide so the series isn't off-center 350 goToSlide(curSlide); 351 // set every image to be browser sized 352 $(".proj-image").each(function() { 353 fullscreenImage($(this).find("img").not(".noresize").not( 354 "p img")); 355 fullscreenImage($(this).find("video")); 356 }); 357} 358 359function resetIndexVideos() { 360 $("video").each(function() { 361 $(this).get(0).pause(); 362 }); 363 $(".index-thumb video, .index-thumb .buffering-indicator").hide(); 364 $('.index-thumb .thumbnail-play,.index-thumb .index-thumb-text').show(); 365} 366$(document).ready(function() { 367 jQuery.easing.def = "easeInOutQuart"; // see http://easings.net/ 368 var page = window.location.pathname; 369 // if on homepage, set timeout for bg video to fade in and play 370 if (page == "/") { 371 $("#bgvideo").each(function() { 372 $(this).bind('loadedmetadata', function() { 373 fullscreenImage($(this)); 374 }); 375 $(this).bind('canplay', function() { 376 $(this).parent().find( 377 ".buffering-indicator").hide(); 378 }); 379 $(this).bind('waiting', function() { 380 $(this).parent().find( 381 ".buffering-indicator").show(); 382 }); 383 }); 384 setTimeout(function() { 385 $("#bgvideo").get(0).play(); 386 $("#bgvideo").fadeIn(1000); 387 }, 1000); 388 } 389 // only do this stuff on a work page 390 if (typeof work !== 'undefined') { 391 // arrows to control slide show and some other things 392 $(document).keydown(function(e) { 393 //console.log(e.keyCode); 394 if (e.keyCode == 38) { // up arrow pressed 395 prevProject(); 396 } else if (e.keyCode == 37) { // left arrow pressed 397 prevSlide(); 398 } else if (e.keyCode == 40) { // down arrow pressed 399 nextProject(); 400 } else if (e.keyCode == 39) { // right arrow pressed 401 nextSlide(); 402 } else if (e.keyCode == 27) { // ESC key pressed 403 history.back(); 404 return false;
405 } else if (e.keyCode == 80) { // P pressed (presentation mode) 406 togglePresentation(); 407 } 408 }); 409 410 // mouse wheel controls slideshow 411 // $("body").bind("mousewheel", function(e, delta, deltax, deltay){ 412 // if(delta < 0) 413 // nextSlide(); 414 // else 415 // prevSlide(); 416 // }); 417 418 initProject(presentation); 419 // clicking left or right on the screne moves the images 420 $("#move-left").click(prevSlide); 421 $("#move-right").click(nextSlide); 422 // hovering over left/right arrow zones bumps them a little 423 arrowOffset = parseInt($("#arrow-left").css('left').split("px")[ 424 0]); 425 $("#move-left").hover(function() { 426 $("#arrow-left").stop().animate({ 427 'left': (arrowOffset - 4) + "px" 428 }, 200); 429 }, function() { 430 $("#arrow-left").stop().animate({ 431 'left': (arrowOffset) + "px" 432 }, 200); 433 }); 434 $("#move-right").hover(function() { 435 $("#arrow-right").stop().animate({ 436 'right': (arrowOffset - 4) + "px" 437 }, 200); 438 }, function() { 439 $("#arrow-right").stop().animate({ 440 'right': (arrowOffset) + "px" 441 }, 200); 442 }); 443 444 } 445 446 // clicking on thumbnail for mobile video 447 $(".playvideothumb").click(function() { 448 var vid = $(this).siblings('video').get(0); 449 vid.play(); 450 vid.webkitEnterFullscreen(); 451 }); 452 453 // stuff that needs to be called when the page is resized 454 $(window).resize(function() { 455 if (page == "/") { 456 fullscreenImage($("#bgvideo"), false); 457 sizeSlides(); 458 } else if (typeof work !== 'undefined') { 459 sizeSlides(); 460 } 461 // resize thumbnails on For/At 462 sizeProjectThumbs(); 463 }); 464 // check press page, add text underneath 465 $(document).ready(function() { 466 if (window.location.href == 467 "http://www.studiodror.com/at/press/") { 468 $(".index-thumb").addClass("press-thumb"); 469 $(".index-thumb-text").addClass("press-thumb-text"); 470 } else {} 471 }); 472 // clicking on a project category removes others 473 $(".project-cat").click(function(e) { 474 cat_active = true; 475 var cat_id = $(this).attr("data-cat"); 476 // stuff for thumbs 477 $(".index-thumb").addClass("hidden-thumb"); 478 $(".index-thumb[data-cat='" + cat_id + "']").removeClass( 479 "hidden-thumb"); 480 $(".blank-thumb").removeClass("hidden-thumb"); // don't gray out the menu thumb 481 $(".menu-listing .menu-listing-text").removeClass( 482 'current-cat'); 483 $(".menu-listing[data-cat='" + cat_id + 484 "'] .menu-listing-text").addClass('current-cat'); 485 }); 486 // clicking on quadror category removes others 487 $("#M2_QuaDror").click(function(e) { 488 cat_active = true; 489 var cat_id = $(this).attr("data-cat"); 490 // stuff for thumbs 491 $(".index-thumb").addClass("hidden-thumb"); 492 $(".index-thumb[qd-cat='1']").removeClass( 493 "hidden-thumb"); 494 $(".blank-thumb").removeClass("hidden-thumb"); // don't gray out the menu thumb 495 $(".menu-listing .menu-listing-text").removeClass( 496 'current-cat'); 497 $(".menu-listing[data-cat='" + cat_id + 498 "'] .menu-listing-text").addClass('current-cat'); 499 }); 500 // prevent default event for clicking #M2_Press 501 $("#M2_Press").click(function(e) { 502 e.preventDefault(); 503 $(".index-thumb").addClass("hidden-thumb"); 504 window.location = "/at/press"; 505 }); 506 // hovering into a project category highlights corresponding projects (and thumbs) 507 $(".project-cat").mouseover(function(e) { 508 cat_active = true; 509 var cat_id = $(this).attr("data-cat"); 510 // reset all styles 511 $(".project-cat a").removeClass("highlight-bold"); 512 $(".project-link a").removeClass("highlight"); 513 $(this).find("a").addClass("highlight-bold"); // highlight hovered category 514 //$(".project-link a").addClass("light"); 515 $(".project-link[data-cat='" + cat_id + "'] a").addClass( 516 "highlight"); 517 // stuff for thumbs 518 $(".index-thumb").addClass("inactive-thumb"); 519 $(".index-thumb[data-cat='" + cat_id + "']").removeClass( 520 "inactive-thumb"); 521 $(".menu-thumb").removeClass("inactive-thumb"); // don't gray out the menu thumb 522 }); 523 // hovering into a menu item brings up corresponding sub-menu 524 // $(document).ready(function() { 525 // $('.menu1-listing-text').hover( 526 // function(){ $("#menu-2").removeClass('submenu-show') } 527 // ); 528 // $('#M1_5').hover( 529 // //function(){ $("#menu-2").addClass('M1_5hover') } 530 // function(){ $("#menu-2").addClass('submenu-show') } 531 // ); 532 // }); 533 // check small,medium,large 534 $(document).ready(function() { 535 var MyHash = window.location.hash.substring(1); 536 if (window.location.hash.substring(1) == "") { 537 $(".index-thumb").removeClass("hidden-thumb"); 538 } 539 //else if (window.location.hash.substring(1) == "projects"){ 540 //$("#sml").load("sml.php"); 541 //document.getElementById("sml").innerHTML='<object type="text/html" data="http://studiodror.com/sml.php" ></object>'; 542 //$(".menu-listing[data-cat='"+MyHash+"'] .menu-listing-text").addClass('current-cat'); 543 //$(".index-thumb").addClass("hidden-thumb"); 544 //$(".index-thumb[data-cat='"+MyHash+"']").removeClass("hidden-thumb"); 545 //$(".blank-thumb").removeClass("hidden-thumb"); 546 //} 547 else if (window.location.hash.substring(1) == "quadror") { 548 $( 549 ".menu-listing[data-cat='quadror'] .menu-listing-text" 550 ).addClass('current-cat'); 551 $(".index-thumb").addClass("hidden-thumb"); 552 $(".index-thumb[qd-cat='1']").removeClass( 553 "hidden-thumb"); 554 $(".blank-thumb").removeClass("hidden-thumb"); 555 } else if (window.location.hash.substring(1) == MyHash) { 556 $(".menu-listing[data-cat='" + MyHash + 557 "'] .menu-listing-text").addClass( 558 'current-cat'); 559 $(".index-thumb").addClass("hidden-thumb"); 560 $(".index-thumb[data-cat='" + MyHash + "']").removeClass( 561 "hidden-thumb"); 562 $(".blank-thumb").removeClass("hidden-thumb"); 563 } 564 }); 565 // prevent default event for clicking #M1_5 566 //$("#M1_5").click(function(e){ e.preventDefault(); }); 567 //$("#M1_2").click(function(e) { 568 // e.preventDefault(); 569 // window.location = "/smlxl"; 570 //}); 571 // prevent default event for clicking Coming Soon
572 //$(".index-thumb[titl='Coming soon']").click(function(e) { 573 // e.preventDefault(); 574 //}); 575 //$(".index-thumb[titl='Coming soon']").mouseover(function(e) { 576 // $(".index-thumb[titl='Coming soon']").addClass("noclick"); 577 //}); 578 // prevent default event for clicking NoClick item 579 $(".index-thumb[noclick='1']").click(function(e) { 580 e.preventDefault(); 581 }); 582 $(".index-thumb[noclick='1']").mouseover(function(e) { 583 $(".index-thumb[noclick='1']").addClass("noclick"); 584 }); 585 // if on a work index, we hovered over a category, disable the highlights if our mouse goes out of main-container 586 $(".project-cat").mouseleave(function() { 587 if (cat_active) { 588 cat_active = false; 589 //$(".project-cat").removeClass("highlight"); 590 $(".project-link a").removeClass("light"); 591 //$(".project-link .slash").removeClass('light-slash').addClass('normal-slash'); 592 $(".index-thumb").removeClass("inactive-thumb"); 593 } 594 }); 595 // if on a work index, we hovered over a category, disable the highlights if our mouse goes out of main-container 596 $(".project-cat").mouseleave(function(e) { 597 $(".project-cat a").removeClass("highlight-bold"); 598 $(".project-link a").removeClass("highlight"); 599 }); 600 /* 601 // if on a work index, if we hover over a project title and we don't have any active category hovers, bold the corresponding category 602 $(".project-link, .index-thumb").hover(function(){ 603 if(!cat_active){ 604 var cat_id = $(this).attr("data-cat"); 605 $(".project-cat[data-cat='"+cat_id+"'] a").addClass("highlight-bold"); 606 } 607 }, function(){ 608 if(!cat_active){ 609 // reset all styles 610 $(".project-cat a").removeClass("highlight-bold"); 611 } 612 }); 613 */ 614 // style active page links 615 $('a').each(function() { 616 if ($(this).attr('href') === window.location.pathname) { 617 $(this).addClass('current'); 618 } 619 }); 620 // bind all the video elements in thumbnails to get rid of buffering indicators automagically 621 $(".index-thumb video").each(function() { 622 $(this).bind('loadedmetadata', function() {}); 623 $(this).bind('canplay', function() { 624 $(this).parent().find( 625 ".buffering-indicator").hide(); 626 }); 627 $(this).bind('waiting', function() { 628 $(this).parent().find( 629 ".buffering-indicator").show(); 630 }); 631 }); 632 // clicking play buttons over work index thumbnails 633 $(".thumbnail-play").click(function(e) { 634 e.preventDefault(); // prevent <a> on thumbnail div from linking to project page 635 // reset all existing play videos (if any) 636 resetIndexVideos(); 637 // make video + buffering indicator appear, everything else disappear 638 var par = $(this).parent(); 639 par.find('.thumbnail-play,.index-thumb-text').hide(); 640 par.find('video').show(); 641 par.find('video').css('display', 'block').get(0).play(); 642 }); 643 $(".index-thumb video").click(function(e) { 644 e.preventDefault(); 645 resetIndexVideos(); 646 }); 647 // callback on query change (for fixing font bold-hover issues) 648 enquire.register( 649 'only screen and (min-width:321px) and (max-width:640px), (min-device-width:321px) and (max-device-width:640px)', { 650 match: fontFix, 651 unmatch: fontFix 652 }) 653 //enquire.register('only screen and (min-width: 641px)', fontFix); 654 sizeProjectThumbs(); 655}); 656$(window).load(function() { 657 sizeSlides(); 658 fullscreenImage($("#bgvideo"), false); 659});
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.