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