1/** 2 * Custom Javascript for BigFormat 3 * 4 * @package WordPress 5 * @subpackage Edition 6 * @since BigFormat 1.4 7 */ 8 9// Set jQuery to NoConflict Mode 10jQuery.noConflict(); 11 12(function ($) { 13 "use strict"; 14 15 /** 16 * Prevents right clicking to protect images 17 * @since v1.4 18 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 19 */ 20 $.fn.themewichThemeProtectImages = function(){ 21 var $this = $(this); 22 23 // If image protect is turned on 24 if ($('body').hasClass('imageprotect')) { 25 $this.bind("contextmenu", function(e) { 26 e.preventDefault(); 27 }); 28 } 29 } 30 31 /** 32 * Theme Tabs 33 * @since v1.4 34 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 35 */ 36 $.fn.themewichThemeTabs = function(){ 37 $( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" ); 38 $( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" ); 39 $( "#tabs" ).tabs({ fx: { opacity: 'toggle' } }); 40 } 41 42 /** 43 * Full Video Background 44 * @since v1.4 45 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 46 */ 47 $.fn.themewichThemeVideoBackground = function(allVideos){ 48 var $allVideos = $(allVideos), 49 $fluidEl = $(this); 50 51 $allVideos.each(function() { 52 $(this) 53 // jQuery .data does not work on object/embed elements 54 .attr('data-aspectRatio', this.height / this.width) 55 .removeAttr('height') 56 .removeAttr('width'); 57 }); 58 59 $(document).ready(function() { 60 var newWidth = $fluidEl.width(); 61 62 $allVideos.each(function() { 63 var $el = $(this); 64 $el 65 .width(newWidth) 66 .height(newWidth * $el.attr('data-aspectRatio')); 67 }); 68 }).resize(); 69 70 $(window).resize(function() { 71 var newWidth = $fluidEl.width(); 72 73 $allVideos.each(function() { 74 var $el = $(this); 75 76 $el 77 .width(newWidth) 78 .height(newWidth * $el.attr('data-aspectRatio')); 79 }); 80 }).resize(); 81 } 82 83 /** 84 * Remove Flash Controls/Elements for Flash Browsers 85 * @since v1.4 86 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 87 */ 88 $.fn.themewichThemeFlashControls = function(){ 89 if (swfobject.hasFlashPlayerVersion("8.0.0")) { 90 $('#videocaption .Center').css('z-index', '0'); 91 $('.videoslide').attr('style', 'display: none !important'); 92 $('.videowrapper').css('display', 'block'); 93 } 94 else { 95 $('#videocaption .Center').css('z-index', '1'); 96 $('#play-video').remove(); 97 $('.lines.vimeolines').remove(); 98 } 99 } 100 101 /** 102 * Theme Tooltips 103 * @since v1.4 104 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 105 */ 106 $.fn.themewichThemeTooltips = function(){ 107 $('.tooltip-top').tipsy({ 108 delayIn: 0, // delay before showing tooltip (ms) 109 delayOut: 0, // delay before hiding tooltip (ms) 110 fade: true, // fade tooltips in/out? 111 fallback: '', // fallback text to use when no tooltip text 112 gravity: 's', // gravity 113 html: false, // is tooltip content HTML? 114 live: false, // use live event support? 115 offset: 5, // pixel offset of tooltip from element 116 opacity: .8, // opacity of tooltip 117 title: 'title', // attribute/callback containing tooltip text 118 trigger: 'hover' // how tooltip is triggered - hover | focus | manual 119 }); 120 121 $('.tooltip-bottom').tipsy({ 122 delayIn: 0, // delay before showing tooltip (ms) 123 delayOut: 0, // delay before hiding tooltip (ms) 124 fade: true, // fade tooltips in/out? 125 fallback: '', // fallback text to use when no tooltip text 126 gravity: 'n', // gravity 127 html: false, // is tooltip content HTML? 128 live: false, // use live event support? 129 offset: 5, // pixel offset of tooltip from element 130 opacity: .8, // opacity of tooltip 131 title: 'title', // attribute/callback containing tooltip text 132 trigger: 'hover' // how tooltip is triggered - hover | focus | manual 133 }); 134 135 $('.tooltip-left').tipsy({ 136 delayIn: 0, // delay before showing tooltip (ms) 137 delayOut: 0, // delay before hiding tooltip (ms) 138 fade: true, // fade tooltips in/out? 139 fallback: '', // fallback text to use when no tooltip text 140 gravity: 'e', // gravity 141 html: false, // is tooltip content HTML? 142 live: false, // use live event support? 143 offset: 5, // pixel offset of tooltip from element 144 opacity: .8, // opacity of tooltip 145 title: 'title', // attribute/callback containing tooltip text 146 trigger: 'hover' // how tooltip is triggered - hover | focus | manual 147 }); 148 149 $('.tooltip-right').tipsy({ 150 delayIn: 0, // delay before showing tooltip (ms) 151 delayOut: 0, // delay before hiding tooltip (ms) 152 fade: true, // fade tooltips in/out? 153 fallback: '', // fallback text to use when no tooltip text 154 gravity: 'w', // gravity 155 html: false, // is tooltip content HTML? 156 live: false, // use live event support? 157 offset: 5, // pixel offset of tooltip from element 158 opacity: .8, // opacity of tooltip 159 title: 'title', // attribute/callback containing tooltip text 160 trigger: 'hover' // how tooltip is triggered - hover | focus | manual 161 }); 162 } 163 164 /** 165 * Theme Lightbox 166 * @since v1.4 167 * (c) Copyright 2014 Andre Gagnon - http://themewich.com
168 */ 169 $.fn.themewichThemeLightbox = function(){ 170 171 var lighboxSkin = $('body').attr('data-lightbox') ? $('body').attr('data-lightbox') : 'light_square'; 172 173 $(this).prettyPhoto({ 174 animation_speed: 'fast', /* fast/slow/normal */ 175 slideshow: 5000, /* false OR interval time in ms */ 176 autoplay_slideshow: false, /* true/false */ 177 opacity: 0.80, /* Value between 0 and 1 */ 178 show_title: false, /* true/false */ 179 allow_resize: true, /* Resize the photos bigger than viewport. true/false */ 180 default_width: 500, 181 default_height: 344, 182 counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ 183 theme: lighboxSkin, /* light_rounded / dark_rounded / light_square / dark_square / facebook */ 184 horizontal_padding: 20, /* The padding on each side of the picture */ 185 hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ 186 wmode: 'opaque', /* Set the flash wmode attribute */ 187 autoplay: true, /* Automatically start videos: True/False */ 188 modal: false, /* If set to true, only the close button will close the window */ 189 deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */ 190 overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ 191 keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ 192 changepicturecallback: function(){}, /* Called everytime an item is shown/changed */ 193 callback: function(){}, /* Called when prettyPhoto is closed */ 194 ie6_fallback: true 195 }); 196 } 197 198 /** 199 * Hover Overlays 200 * @since v1.4 201 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 202 */ 203 $.fn.themewichThemeHovers = function(){ 204 function hover_overlay() { 205 $('.portfolioitem a img').each(function() { 206 var $this = $(this); 207 208 $this.hover( function() { 209 $this.stop().animate({opacity : 0.1}, 500); 210 $this.parent().find('.thumbnailtitle').fadeIn('500'); 211 }, function() { 212 $this.stop().animate({opacity : 1}, 500); 213 $this.parent().find('.thumbnailtitle').css('display', 'none'); 214 }); 215 }); 216 } 217 hover_overlay(); 218 219 function hover_overlay_play() { 220 $('#play-button, #videoplaypause').hover( function() { 221 $(this).stop().animate({opacity : 1}, 100); 222 }, function() { 223 $(this).stop().animate({opacity : 0.5}, 100); 224 }); 225 } 226 hover_overlay_play(); 227 228 function hover_overlay_images() { 229 $('a img').not('.portfolioitem a img').hover( function() { 230 $(this).stop().animate({opacity : 0.7}, 500); 231 }, function() { 232 $(this).stop().animate({opacity : 1}, 500); 233 }); 234 } 235 hover_overlay_images(); 236 } 237 238 /** 239 * Portfolio Flexible Slider 240 * @since v1.4 241 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 242 */ 243 $.fn.themewichThemeSlideshow = function(){ 244 var $this = $(this), 245 autoplay = $this.attr('data-autoplay') ? $this.attr('data-autoplay') : 'true', 246 delay = $this.attr('data-autoplay-delay') ? $this.attr('data-autoplay-delay') : '7000'; 247 248 $(this).wmuSlider({ 249 animation: 'fade', 250 animationDuration: 600, 251 slideshow: autoplay, 252 slideshowSpeed: delay, 253 slideToStart: 0, 254 navigationControl: true, 255 paginationControl: true, 256 previousText: 'Previous', 257 nextText: 'Next', 258 touch: Modernizr.touch, 259 slide: 'span' 260 }); 261 } 262 263 /** 264 * Scroll To Top 265 * @since v1.4 266 * (c) Copyright 2014 Andre Gagnon - http://themewich.com
267 */ 268 $.fn.themewichThemeTop = function(){ 269 var top = $(this); 270 271 $(window).scroll(function () { 272 var y_scroll_pos = window.pageYOffset, 273 scroll_pos_test = 50; 274 275 if(y_scroll_pos > scroll_pos_test) { 276 top.fadeIn(1000); 277 jQuery('.iphone').children('.top').css('display', 'none !important'); 278 } else { 279 top.fadeOut(500); 280 } 281 }); 282 283 top.click(function(){ 284 $('html, body').animate({scrollTop:0}, 500, 'easeOutCubic'); 285 return false; 286 }); 287 } 288 289 /** 290 * Project Information on Project Pages 291 * @since v1.4 292 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 293 */ 294 $.fn.themewichThemeProjectDrawer = function() { 295 var $this = $(this), 296 tipsy = $('.tipsy.tipsy-on'); 297 298 $this.bind({ 299 toggleProject: function () { 300 $this = $(this); 301 302 $('.projectcontent').fadeToggle(500, 'easeOutCubic', function(){ 303 $this.toggleClass("minus"); 304 305 $('#prevslide').toggleClass('fullopen'); 306 307 var $thisclass = $this.hasClass('minus'), 308 $hidetext = $this.attr('data-hidetext'), 309 $showtext = $this.attr('data-showtext'); 310 311 if ($thisclass == true) { 312 $('.tipsy-inner').html($hidetext); 313 $this.attr('title', $hidetext); 314 } else { 315 $('.tipsy-inner').html($showtext); 316 $this.attr('title', $showtext); 317 } 318 }); 319 } 320 }); 321 322 $this.click(function (e) { 323 e.preventDefault(); 324 $(this).trigger("toggleProject"); 325 }); 326 327 $(window).load(function() { 328 tipsy 329 .animate({ 330 opacity: .8, 331 left: 69 332 }, 1000, "easeOutCubic") 333 .delay(3000) 334 .animate({ 335 opacity:0, 336 left:99 337 }, 1000, "easeOutCubic", function(){ 338 $('.tool-project').hover( 339 function(){ 340 tipsy.stop().animate({ opacity: .8, left: 69}, 1000, "easeOutCubic"); 341 }, function(){ 342 tipsy.stop().animate({ opacity: 0, left: 99}, 1000, "easeOutCubic"); 343 } 344 ); 345 }); 346 }); 347 348 if ($('body').hasClass('show-more')) { 349 $('.toggleproject').trigger("toggleProject"); 350 } 351 } 352 353 /** 354 * Navigation Drawer on Mobile 355 * @since v1.4 356 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 357 */ 358 $.fn.themewichThemeMobileNav = function() { 359 var button = $('#top_panel_button'), 360 height = $('#top_panel_content').height(), 361 $buttondisplay = button.css('display'); 362 363 if ($buttondisplay = 'none') { 364 $('#toggle_button').addClass('downarrow').removeClass('uparrow'); 365 } else { 366 $('#toggle_button').addClass('uparrow').removeClass('downarrow'); 367 } 368 369 button.click(function() { 370 var docHeight = $(document).height(), 371 windowHeight = $(window).height(), 372 scrollPos = docHeight - windowHeight + height; 373 374 $('#top_panel_content').animate({ height: "toggle"}, 500, 'easeOutCubic'); 375 376 $('#toggle_button').toggleClass("downarrow").toggleClass("uparrow"); 377 378 $('#top_panel').removeClass('active'); 379 380 $(this).addClass('active'); 381 }); 382 383 // Hide home nav drawer 384 $(window).load(function() { 385 $('.home #top_panel_content') 386 .delay(1500) 387 .animate({ height: "toggle"}, 500, 'easeOutCubic', function(){ 388 $('#toggle_button').toggleClass("downarrow").toggleClass("uparrow"); 389 $('#top_panel').removeClass('active'); 390 $(this).addClass('active'); 391 }); 392 }); 393 } 394 395 /** 396 * Desktop Nav Drawer 397 * @since v1.4 398 * (c) Copyright 2014 Andre Gagnon - http://themewich.com
399 */ 400 $.fn.themewichThemeFullNav = function() { 401 var navhandleinit = $('.navhandle').css('left'), 402 navwidth = $('.navcontainer').width() + 30, 403 mainmargin = $('.mainbody').css('margin-left'), 404 $navnow = $('.navhandle').css('left'), 405 navtray = $('#thumb-tray').css('left'); 406 407 $('.navhandle, #tray-button, .page-template-template-home-php .lines, .single-portfolio .lines').click(function() { 408 $('#supersized img').addClass('resize'); //add class for css3 transitions 409 410 var $thisid = $(this).attr("id"), 411 $thisclass = $(this).attr("class"), 412 $navnow = $('.navhandle').css('left'); 413 414 if ($navnow == navhandleinit) { 415 if (($thisid == 'tray-button')) { 416 $('#thumb-tray').stop().animate({bottom : 0}, 300); 417 } 418 419 $('#prevslide').stop().animate({left: 25 }, 500, 'easeOutCubic'); 420 $('.navcontainer').stop().animate({ left: -210 }, 500, 'easeOutCubic'); 421 $('.navhandle').stop().animate({ left: -10 }, 500, 'easeOutCubic'); 422 $('.mainbody').stop().animate({marginLeft: 10}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion 423 $('.videowrapper').animate({width: '120%', paddingLeft:0}, 500, 'easeOutCubic'); 424 $('.nav').fadeOut(500, 'easeOutCubic'); 425 $('.navhandle').toggleClass("rightarrow"); 426 } else { 427 $('#prevslide').stop().animate({left: 245}, 500, 'easeOutCubic'); 428 $('.navcontainer').stop().animate({ left: 0 }, 500, 'easeOutCubic'); 429 $('.navhandle').stop().animate({ left: navhandleinit}, 500, 'easeOutCubic'); 430 $('.mainbody').stop().animate({marginLeft: 220}, 500, 'easeOutCubic', function(){ $('#supersized img').removeClass('resize'); }); //remove css3 transition class after completion 431 $('#thumb-tray').stop().animate({bottom : -$('#thumb-tray').height()}, 300); 432 $('.videowrapper').animate({paddingLeft: 220, width: '100%'}, 500, 'easeOutCubic'); 433 $('.nav').fadeIn(500, 'easeOutCubic'); 434 $('.navhandle').toggleClass("rightarrow"); 435 436 $navnow = navhandleinit; 437 } 438 }); 439 } 440 441 /** 442 * Show Comments on Click 443 * @since v1.4 444 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 445 */ 446 $.fn.themewichShowComments = function() { 447 $(this).click(function(e) { 448 if ( $.browser.msie && $.browser.version == '7.0') { 449 $('html,body').parent().animate({scrollTop: $('.comments-section').offset().top}, 500, 'easeOutCubic'); 450 } else { 451 $('html,body').animate({scrollTop: $('.comments-section').offset().top}, 500, 'easeOutCubic'); 452 } 453 454 e.preventDefault(); 455 }); 456 } 457 458 /** 459 * Veritcally Center Homepage Captions 460 * @since v1.4 461 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 462 */ 463 $.fn.themewichThemeCenterCaption = function() { 464 this.css("position","absolute"); 465 this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px"); 466 return this; 467 } 468 469 $.fn.themewichThemeIsotope = function() { 470 471 var waitForFinalEvent = (function () { 472 var timers = {}; 473 return function (callback, ms, uniqueId) { 474 if (!uniqueId) { 475 uniqueId = "Don't call this twice without a uniqueId"; 476 } 477 if (timers[uniqueId]) { 478 clearTimeout (timers[uniqueId]); 479 } 480 timers[uniqueId] = setTimeout(callback, ms); 481 }; 482 })(); 483 484 485 /* Jquery Isotope */ 486 487 if($.fn.isotope) { 488 var $selector = '*'; 489 490 $(window).load(function(){ 491 var $container = $('#portfoliocontainer'); 492 493 $container.isotope({ 494 // options 495 itemSelector : '.portfoliothumb', 496 layoutMode : 'masonry' 497 }); 498 499 $(window).resize(function(){ 500 waitForFinalEvent(function(){ 501 $container.isotope('reLayout'); 502 }, 500, "re_Iso"); 503 }); 504 505 // filter items when filter link is clicked 506 $('#filters a, a.filtersort').click(function(){ 507 $('#filters a').removeClass("active"); 508 var $selector = $(this).attr('data-filter'); 509 510 $('#filters a').each(function() { 511 var $filterselect = jQuery(this).attr('data-filter'); 512 if ($filterselect == $selector){ 513 $(this).addClass("active"); 514 } 515 }); 516 517 $container.isotope({ filter: $selector }); 518 return false; 519 }); 520 }); 521 522 var scrollContainer = $('#portfoliocontainer'),
523 finishedText = scrollContainer.attr('data-finished'), 524 loadingText = scrollContainer.attr('data-loading'); 525 526 // Infininte Scroll 527 $('#portfoliocontainer').infinitescroll({ 528 navSelector : '#nextpost', // selector for the paged navigation 529 nextSelector : '#nextpost a', // selector for the NEXT link (to page 2) 530 itemSelector : '.portfoliothumb', // selector for all items you'll retrieve 531 loading: { 532 finishedMsg: finishedText, 533 img: agAjax.get_template_directory_uri + '/images/loading.gif', 534 msgText: loadingText 535 } 536 }, 537 // call Isotope as a callback 538 function( newElements ) { 539 $('#portfoliocontainer').isotope( 'insert', $( newElements ), function(){ 540 $('#portfoliocontainer').isotope('reLayout'); 541 $('body').themewichThemeHovers(); 542 $("a[rel^='prettyPhoto']").themewichThemeLightbox(); 543 }); 544 } 545 ); 546 547 548 $('#nextpost a').click(function(){ 549 $('#portfoliocontainer').infinitescroll('retrieve'); 550 return false; 551 }); 552 } // if isotope 553 } 554 555 $.fn.themewichThemeFixIOS = function() { 556 if ((navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 4_\d/i))) { 557 window.onscroll = function() { 558 $topscroll = window.pageYOffset; 559 $('.iphone #navscroll, .iphone #supersized li a, .iphone .lines').stop().animate({top : $topscroll}, 500); 560 }; 561 } 562 } 563 564 /** 565 * Run Javascript Functions on document ready 566 */ 567 $(document).ready(function(){ 568 569 $('html').themewichThemeProtectImages(); // Protect Images 570 $(".videowrapper").themewichThemeVideoBackground("#vimeofull, #myytplayer"); // Fullscreen video background 571 $('body').themewichThemeFlashControls(); // Remove flash controls 572 $('body').themewichThemeTooltips(); // Tooltips 573 $('body').themewichThemeHovers(); // Hovers 574 $('.top').themewichThemeTop(); // Scroll Top 575 $('.toggleproject').themewichThemeProjectDrawer(); // Project Drawer 576 $('#top_panel_button').themewichThemeMobileNav(); // Mobile Nav 577 $('body').themewichThemeFullNav(); // Full Nav Nav 578 $('.videos').fitVids(); // Fitvids 579 $('.comment.button').themewichShowComments(); // Show comments 580 $('body').themewichThemeIsotope(); // Theme Isotope 581 $('body').themewichThemeFixIOS(); // Fix iOS Woes 582 583 if($.fn.superfish) { 584 $('ul.sf-menu').superfish({ autoArrows: true }); // Menu 585 } 586 if($.fn.tabs) { 587 $('body').themewichThemeTabs(); // Tabs 588 } 589 if ($.fn.prettyPhoto) { 590 $("a[rel^='prettyPhoto']").themewichThemeLightbox(); // Lightbox 591 } 592 if ($.fn.wmuSlider) { 593 $('.projectslideshow').themewichThemeSlideshow(); // Slideshow 594 } 595 if ($.fn.validate) { 596 $("#contactform").validate(); // Contact form validation 597 $("#quickform").validate(); // Quick Contact form validation 598 $("#commentsubmit").validate(); // Comment form validation 599 } 600 601 $(window).resize(function(){ 602 $('.Center, .Left, .Right').not('.Right.Top, .Right.Bottom, .Left.Top, .Left.Bottom').themewichThemeCenterCaption(); 603 }); 604 605 }); 606 607 /** 608 * Run Javascript Functions on window load 609 */ 610 $(window).load(function(){ 611 $('#thumb-tray').css('display', 'block'); 612 }); 613 614})(jQuery); 615 616/** 617 * Custom Youtube Functions 618 * @since v1.0 619 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 620 */ 621function onYouTubePlayerReady(playerId) { 622 document.getElementById('myytplayer').style.width="100%"; 623 document.getElementById('myytplayer').style.height="100%"; 624 625 ytplayer = document.getElementById("myytplayer"); 626 ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); 627 628 $playerState = ytplayer.getPlayerState(); //get initial play state 629 630 if ($playerState == -1 || $playerState == 2 || $playerState == 0) { //if player is unstarted -1, or paused 2 or ended 631 jQuery('#play-video').addClass('play'); // Change play button 632 } else { 633 jQuery('#play-video').removeClass('play'); // Change play button 634 } 635 636 /* Play Button */ 637 jQuery('#play-video').click(function(e) { 638 var $playerState = ytplayer.getPlayerState(); //get play state 639 640 if ($playerState == -1 || $playerState == 2 || $playerState == 0) { //if player is unstarted -1, or paused 2 or ended 641 ytplayer.playVideo(); 642 } else { 643 ytplayer.pauseVideo(); 644 } 645 646 $playerState = ytplayer.getPlayerState(); //update player state 647 648 e.preventDefault(); 649 });
650} 651 652function onytplayerStateChange($playerState) { 653 if ($playerState == -1 || $playerState == 2 || $playerState == 0) { //if player is unstarted -1, or paused 2 or ended 654 jQuery('#play-video').addClass('play'); // Change play button 655 } else { 656 jQuery('#play-video').removeClass('play'); // Change play button 657 } 658} 659 660/** 661 * Custom Supersized Functions 662 * @since v1.0 663 * (c) Copyright 2014 Andre Gagnon - http://themewich.com 664 */ 665(function($){ 666 667 theme = { 668 669 /* Initial Placement 670 ----------------------------*/ 671 _init : function(){ 672 673 // Center Slide Links 674 if (api.options.slide_links) $(vars.slide_list).css('margin-left', -$(vars.slide_list).width()/2); 675 676 // Start progressbar if autoplay enabled 677 if (api.options.autoplay){ 678 if (api.options.progress_bar) theme.progressBar(); 679 }else{ 680 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play-button.png"); // If pause play button is image, swap src 681 if (api.options.progress_bar) $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); // Place progress bar 682 } 683 684 685 /* Thumbnail Tray 686 ----------------------------*/ 687 // Hide tray off screen 688 $(vars.thumb_tray).animate({bottom : -$(vars.thumb_tray).height()}, 0 ); 689 690 // Make thumb tray proper size 691 $(vars.thumb_list).width($('> li', vars.thumb_list).length * $('> li', vars.thumb_list).outerWidth(true)); //Adjust to true width of thumb markers 692 693 // Display total slides 694 if ($(vars.slide_total).length){ 695 $(vars.slide_total).html(api.options.slides.length); 696 } 697 698 699 /* Thumbnail Tray Navigation 700 ----------------------------*/ 701 if (api.options.thumb_links){ 702 //Hide thumb arrows if not needed 703 if ($(vars.thumb_list).width() <= $(vars.thumb_tray).width()){ 704 $(vars.thumb_back +','+vars.thumb_forward).fadeOut(0); 705 } 706 707 // Thumb Intervals 708 vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true); 709 vars.thumb_page = 0; 710 711 // Cycle thumbs forward 712 $(vars.thumb_forward).click(function(){ 713 if (vars.thumb_page - vars.thumb_interval <= -$(vars.thumb_list).width()){ 714 vars.thumb_page = 0; 715 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 716 }else{ 717 vars.thumb_page = vars.thumb_page - vars.thumb_interval; 718 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 719 } 720 }); 721 722 // Cycle thumbs backwards 723 $(vars.thumb_back).click(function(){ 724 if (vars.thumb_page + vars.thumb_interval > 0){ 725 vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval; 726 if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval; 727 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 728 }else{ 729 vars.thumb_page = vars.thumb_page + vars.thumb_interval; 730 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 731 } 732 }); 733 734 } 735 736 737 /* Navigation Items 738 ----------------------------*/ 739 $(vars.next_slide).click(function() { 740 api.nextSlide(); 741 }); 742 743 $(vars.prev_slide).click(function() { 744 api.prevSlide(); 745 }); 746 747 // Full Opacity on Hover 748 if(jQuery.support.opacity){
749 $(vars.prev_slide +','+vars.next_slide).mouseover(function() { 750 $(this).stop().animate({opacity:1},100); 751 }).mouseout(function(){ 752 $(this).stop().animate({opacity:.75},100); 753 }); 754 } 755 756 757 if (api.options.thumbnail_navigation){ 758 // Next thumbnail clicked 759 $(vars.next_thumb).click(function() { 760 api.nextSlide(); 761 }); 762 // Previous thumbnail clicked 763 $(vars.prev_thumb).click(function() { 764 api.prevSlide(); 765 }); 766 } 767 768 $(vars.play_button).click(function() { 769 api.playToggle(); 770 }); 771 772 773 /* Thumbnail Mouse Scrub 774 ----------------------------*/ 775 if (api.options.mouse_scrub){ 776 $(vars.thumb_tray).mousemove(function(e) { 777 var containerWidth = $(vars.thumb_tray).width(), 778 listWidth = $(vars.thumb_list).width(); 779 if (listWidth > containerWidth){ 780 var mousePos = 1, 781 diff = e.pageX - mousePos; 782 if (diff > 10 || diff < -10) { 783 mousePos = e.pageX; 784 newX = (containerWidth - listWidth) * (e.pageX/containerWidth); 785 diff = parseInt(Math.abs(parseInt($(vars.thumb_list).css('left'))-newX )).toFixed(0); 786 $(vars.thumb_list).stop().animate({'left':newX}, {duration:diff*3, easing:'easeOutExpo'}); 787 } 788 } 789 }); 790 } 791 792 793 /* Window Resize 794 ----------------------------*/ 795 $(window).resize(function(){ 796 797 // Delay progress bar on resize 798 if (api.options.progress_bar && !vars.in_animation){ 799 if (vars.slideshow_interval) clearInterval(vars.slideshow_interval); 800 if (api.options.slides.length - 1 > 0) clearInterval(vars.slideshow_interval); 801 802 $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); 803 804 if (!vars.progressDelay && api.options.slideshow){ 805 // Delay slideshow from resuming so Chrome can refocus images 806 vars.progressDelay = setTimeout(function() { 807 if (!vars.is_paused){ 808 theme.progressBar(); 809 vars.slideshow_interval = setInterval(api.nextSlide, api.options.slide_interval); 810 } 811 vars.progressDelay = false; 812 }, 1000); 813 } 814 } 815 816 // Thumb Links 817 if (api.options.thumb_links && vars.thumb_tray.length){ 818 // Update Thumb Interval & Page 819 vars.thumb_page = 0; 820 vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true); 821 822 // Adjust thumbnail markers 823 if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){ 824 $(vars.thumb_back +','+vars.thumb_forward).fadeIn('fast'); 825 $(vars.thumb_list).stop().animate({'left':0}, 200); 826 }else{ 827 $(vars.thumb_back +','+vars.thumb_forward).fadeOut('fast'); 828 } 829 830 } 831 }); 832 833 834 }, 835 836 837 /* Go To Slide 838 ----------------------------*/ 839 goTo : function(){ 840 if (api.options.progress_bar && !vars.is_paused){ 841 $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); 842 theme.progressBar(); 843 } 844 }, 845 846 /* Play & Pause Toggle 847 ----------------------------*/ 848 playToggle : function(state){ 849 850 if (state =='play'){ 851 // If image, swap to pause 852 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "pause-button.png"); 853 if (api.options.progress_bar && !vars.is_paused) theme.progressBar(); 854 }else if (state == 'pause'){ 855 // If image, swap to play 856 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play-button.png"); 857 if (api.options.progress_bar && vars.is_paused)$(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); 858 } 859 860 }, 861 862 863 /* Before Slide Transition 864 ----------------------------*/ 865 beforeAnimation : function(direction){ 866 if (api.options.progress_bar && !vars.is_paused) $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ); 867
868 /* Update Fields 869 ----------------------------*/ 870 // Update slide caption 871 if ($(vars.slide_caption).length){ 872 873 if (api.getField('title')) { 874 $(vars.slide_caption).html(api.getField('title')).css({ opacity: 0 }); 875 jQuery('.Center, .Left, .Right').not('.Right.Top, .Right.Bottom, .Left.Top, .Left.Bottom').themewichThemeCenterCaption(); 876 $(vars.slide_caption).animate({opacity: 1}, 1500, 'easeOutCubic'); 877 } else { 878 $(vars.slide_caption).html(''); 879 } 880 881 882 } 883 // Update slide number 884 if (vars.slide_current.length){ 885 $(vars.slide_current).html(vars.current_slide + 1); 886 } 887 888 889 // Highlight current thumbnail and adjust row position 890 if (api.options.thumb_links){ 891 892 $('.current-thumb').removeClass('current-thumb'); 893 $('li', vars.thumb_list).eq(vars.current_slide).addClass('current-thumb'); 894 895 // If thumb out of view 896 if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){ 897 // If next slide direction 898 if (direction == 'next'){ 899 if (vars.current_slide == 0){ 900 vars.thumb_page = 0; 901 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 902 } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left >= vars.thumb_interval){ 903 vars.thumb_page = vars.thumb_page - vars.thumb_interval; 904 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 905 } 906 // If previous slide direction 907 }else if(direction == 'prev'){ 908 if (vars.current_slide == api.options.slides.length - 1){ 909 vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval; 910 if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval; 911 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 912 } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left < 0){ 913 if (vars.thumb_page + vars.thumb_interval > 0) return false; 914 vars.thumb_page = vars.thumb_page + vars.thumb_interval; 915 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 916 } 917 } 918 } 919 920 921 } 922 923 }, 924 925 926 /* After Slide Transition 927 ----------------------------*/ 928 afterAnimation : function(){ 929 if (api.options.progress_bar && !vars.is_paused) theme.progressBar(); // Start progress bar 930 }, 931 932 933 /* Progress Bar 934 ----------------------------*/ 935 progressBar : function(){ 936 $(vars.progress_bar).stop().animate({left : -$(window).width()}, 0 ).animate({ left:0 }, api.options.slide_interval); 937 } 938 939 940 }; 941 942 943 /* Theme Specific Variables 944 ----------------------------*/ 945 $.supersized.themeVars = { 946 947 // Internal Variables 948 progress_delay : false, // Delay after resize before resuming slideshow 949 thumb_page : false, // Thumbnail page 950 thumb_interval : false, // Thumbnail interval 951 image_path : agAjax.get_template_directory_uri + '/images/', // Default image path 952 953 // General Elements 954 play_button : '.linesmobile, #pauseplay', // Play/Pause button 955 next_slide : '#nextslide', // Next slide button 956 prev_slide : '#prevslide', // Prev slide button 957 next_thumb : '#nextthumb', // Next slide thumb button 958 prev_thumb : '#prevthumb', // Prev slide thumb button 959 960 slide_caption : '#slidecaption', // Slide caption 961 slide_current : '.slidenumber', // Current slide number 962 slide_total : '.totalslides', // Total Slides 963 slide_list : '#slide-list', // Slide jump list 964
965 thumb_tray : '#thumb-tray', // Thumbnail tray 966 thumb_list : '#thumb-list', // Thumbnail list 967 thumb_forward : '#thumb-forward', // Cycles forward through thumbnail list 968 thumb_back : '#thumb-back', // Cycles backwards through thumbnail list 969 tray_arrow : '#tray-arrow', // Thumbnail tray button arrow 970 tray_button : '#tray-button', // Thumbnail tray button 971 972 progress_bar : '#progress-bar' // Progress bar 973 974 }; 975 976 /* Theme Specific Options 977 978 ----------------------------*/ 979 $.supersized.themeOptions = { 980 981 progress_bar : 1, // Timer for each slide 982 mouse_scrub : 0 // Thumbnails move with mouse 983 984 }; 985 986 987})(jQuery); 988 989/** 990Plugin Name: WP-Ajaxify-Comments 991Plugin URI: http://wordpress.org/extend/plugins/wp-ajaxify-comments/ 992Description: WP-Ajaxify-Comments hooks into your current theme and adds AJAX functionality to the comment form. 993Author: Jan Jonas 994Author URI: http://janjonas.net 995Version: 0.23.1 996License: GPLv2 997Text Domain: wpac 998*/ 999function wpac_extractBody(html) { 1000 var regex = new RegExp('<body[^>]*>((.|\n|\r)*)</body>', 'i'); 1001 return jQuery(regex.exec(html)[1]); 1002} 1003function wpac_showMessage(message, type) { 1004 var backgroundColor = "#000"; 1005 if (type == "error") backgroundColor = "#f00"; 1006 if (type == "success") backgroundColor = "#008000"; 1007 1008 jQuery.blockUI({ 1009 message: message, 1010 fadeIn: 400, 1011 fadeOut: 400, 1012 timeout: 1200, 1013 centerX: true, 1014 centerY: true, 1015 css: { 1016 width: '35px', 1017 top: '50%', 1018 left: '50%', 1019 border: 'none', 1020 padding: '15px', 1021 backgroundColor: '#000', 1022 '-webkit-border-radius': '10px', 1023 '-moz-border-radius': '10px', 1024 opacity: .75, 1025 color: '#fff', 1026 fontSize: '12px', 1027 lineHeight: '22px' 1028 }, 1029 overlayCSS: { 1030 backgroundColor: '#000', 1031 opacity: 0 1032 } 1033 }); 1034} 1035 1036function ac_resetForm(form) { 1037 jQuery(form).find('input:text, input:password, input:file, select, textarea').val(''); 1038 jQuery(form).find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected'); 1039} 1040 1041var wpac_debug_errorShown = false; 1042function wpac_debug(level, message) { 1043 1044 if (typeof window["console"] === 'undefined') { 1045 /* if (!wpac_debug_errorShown) alert("console object is undefined, debugging wp-ajaxify-comments is disabled!"); */ 1046 wpac_debug_errorShown = true; 1047 return; 1048 } 1049 1050 var args = jQuery.merge(["[WP-Ajaxify-Comments] " + message], jQuery.makeArray(arguments).slice(2)); 1051 //console[level].apply(console, args); 1052} 1053 1054jQuery(document).ready(function() { 1055 1056 var form = jQuery(jQuery(wpac_options.selectorCommentForm)[0]); 1057 var commentsContainer = jQuery(jQuery(wpac_options.selectorCommentsContainer)[0]); 1058 1059 // Debug infos 1060 1061 wpac_debug("info", "Enabled (Version: %s)", wpac_options.version); 1062 wpac_debug("info", "Search jQuery... Found: %s", jQuery.fn.jquery); 1063 if (form.length > 0) { 1064 wpac_debug("info", "Search comment form ('%s')... Found: %o", wpac_options.selectorCommentForm, form); 1065 } else { 1066 wpac_debug("error", "Search comment form ('%s')... Not found", wpac_options.selectorCommentForm); 1067 } 1068 if (commentsContainer.length > 0) { 1069 wpac_debug("info", "Search comments container ('%s')... Found: %o", wpac_options.selectorCommentsContainer, commentsContainer); 1070 } else { 1071 wpac_debug("error", "Search comment container ('%s')... Not found", wpac_options.selectorCommentsContainer); 1072 } 1073 1074 1075 // Abort initialization 1076 if (form.length == 0 || commentsContainer.length == 0) return; 1077 1078 // Intercept comment form submit 1079 jQuery(wpac_options["selectorCommentForm"]).live("submit", function (event) { 1080 1081 var form = jQuery(this); 1082 1083 event.preventDefault(); 1084 1085 wpac_showMessage(wpac_options["textLoading"], "loading"); 1086 1087 jQuery.ajax({ 1088 url: form.attr('action'), 1089 type: "POST", 1090 data: form.serialize(), 1091 success: function (data) { 1092 1093 var newComments = wpac_extractBody(data).find(wpac_options.selectorCommentsContainer); 1094 var oldComments = jQuery(wpac_options.selectorCommentsContainer); 1095 if (oldComments.length > 0 && newComments.length > 0) { 1096 // Update comments 1097 ac_resetForm(jQuery(form)); 1098 wpac_showMessage(wpac_options["textPosted"], "success"); 1099 oldComments.replaceWith(newComments); 1100 } else { 1101 // Fallback (page reload) if something went wrong 1102 location.reload(); 1103 } 1104 1105 }, 1106 error: function (jqXhr, textStatus, errorThrown) { 1107 var error = wpac_extractBody(jqXhr.responseText).html(); 1108 wpac_showMessage(error, "error"); 1109 } 1110 }); 1111 1112 });
1113 1114});
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.