Warning: filemtime(): stat failed for /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/../../../../../../wp-includes/js/jquery/ui.core.js in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 90

Warning: filemtime(): stat failed for /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/../../../../../../wp-includes/js/jquery/ui.widget.js in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 90

Warning: filemtime(): stat failed for /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/../../../../../../wp-includes/js/jquery/ui.tabs.js in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 90

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 75

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 76

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 77

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 78

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php:90) in /home/sdonator/public_html/wp-content/themes/progressio/wpv_common/assets/js/combine.php on line 80
;/** * @summary Handles the addition of the comment form. * * @since 2.7.0 * * @type {Object} */ var addComment = { /** * @summary Retrieves the elements corresponding to the given IDs. * * @since 2.7.0 * * @param {string} commId The comment ID. * @param {string} parentId The parent ID. * @param {string} respondId The respond ID. * @param {string} postId The post ID. * @returns {boolean} Always returns false. */ moveForm: function( commId, parentId, respondId, postId ) { var div, element, style, cssHidden, t = this, comm = t.I( commId ), respond = t.I( respondId ), cancel = t.I( 'cancel-comment-reply-link' ), parent = t.I( 'comment_parent' ), post = t.I( 'comment_post_ID' ), commentForm = respond.getElementsByTagName( 'form' )[0]; if ( ! comm || ! respond || ! cancel || ! parent || ! commentForm ) { return; } t.respondId = respondId; postId = postId || false; if ( ! t.I( 'wp-temp-form-div' ) ) { div = document.createElement( 'div' ); div.id = 'wp-temp-form-div'; div.style.display = 'none'; respond.parentNode.insertBefore( div, respond ); } comm.parentNode.insertBefore( respond, comm.nextSibling ); if ( post && postId ) { post.value = postId; } parent.value = parentId; cancel.style.display = ''; /** * @summary Puts back the comment, hides the cancel button and removes the onclick event. * * @returns {boolean} Always returns false. */ cancel.onclick = function() { var t = addComment, temp = t.I( 'wp-temp-form-div' ), respond = t.I( t.respondId ); if ( ! temp || ! respond ) { return; } t.I( 'comment_parent' ).value = '0'; temp.parentNode.insertBefore( respond, temp ); temp.parentNode.removeChild( temp ); this.style.display = 'none'; this.onclick = null; return false; }; /* * Sets initial focus to the first form focusable element. * Uses try/catch just to avoid errors in IE 7- which return visibility * 'inherit' when the visibility value is inherited from an ancestor. */ try { for ( var i = 0; i < commentForm.elements.length; i++ ) { element = commentForm.elements[i]; cssHidden = false; // Modern browsers. if ( 'getComputedStyle' in window ) { style = window.getComputedStyle( element ); // IE 8. } else if ( document.documentElement.currentStyle ) { style = element.currentStyle; } /* * For display none, do the same thing jQuery does. For visibility, * check the element computed style since browsers are already doing * the job for us. In fact, the visibility computed style is the actual * computed value and already takes into account the element ancestors. */ if ( ( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) || style.visibility === 'hidden' ) { cssHidden = true; } // Skip form elements that are hidden or disabled. if ( 'hidden' === element.type || element.disabled || cssHidden ) { continue; } element.focus(); // Stop after the first focusable element. break; } } catch( er ) {} return false; }, /** * @summary Returns the object corresponding to the given ID. * * @since 2.7.0 * * @param {string} id The ID. * @returns {Element} The element belonging to the ID. */ I: function( id ) { return document.getElementById( id ); } }; ;/* * jQuery UI Effects 1.8.15 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Effects/ */ jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], 16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", "borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, 0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, 211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, [{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.15",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", "pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* ((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h *
*
*
*
*
*
*
*
* *
*
*
*/ (function ($) { // Force the hardware acceleration on Safari (this is cousing problems on Chrome) // Please consider this EXPERIMENTAL and remove it if needed //if ($.browser.webkit && !window.chrome) { // $("body").css({ // "WebkitTransform": "translateZ(0)" // }); //} var _defaults = { // inner width of the slider (content width) width: "auto", // height of the slider (content height) height: 300, // No height (let it resize to fit to the slide's height). // NOTE: If this is true the "height" option is ignored autoHeight: false, // boolean that indicates whether the slider expands horizontally to the // viewport or sticks to the content width (option allowing a) boxed layout // where the slider?s width equals to the content width, or b) slider that // is laid to the whole width of the screen resolution) expand: false, // ms in which each slide is shown pause_time: 4000, // in ms animation_time: 800, // effect slug. If this is a function, it is expected to // return the fx name effect: "fade", // A placeholder for custom fx settings effect_settings: { easing: "easeInOutExpo" }, // initial slide index start_slide: 0, // ?left?, ?right? or ?none? auto_direction: "right", // boolean; whether to show left/right arrows show_arrows: true, // boolean; whether to show slide bullets as navigation show_bullets: true, // boolean; whether to show captions show_caption: true, // boolean; whether to clear the pending timeout for next animation pause_on_hover: true, // string; text for ?Previous? button prev_text: "Previous", // string; for ?Next? button next_text: "Next", // boolean; whether to show slide number in each bullet, used when // show_bullets is true //show_bullet_numbers : false, // boolean, looks for the data-thumb attribute in the current slide and // uses this link as a thumbnail for the current bullet. We will provide // a single slider with consistent sized thumbnails, but each slider // should accommodate for different sized thumbnail. If it is a problem // to auto detect their sizes, we may add options for that. //thumbnail_bullets : false, // number from 0 to 1, you should convert it to a MS filter rule for IE. caption_opacity: 0.6, // Others maybe? ----------------------------------------------------------- loop: 0, // not implemented // The following are selectors that should match existing elements to be // used as custom containers for captions and navigation elements. If these // are not found, the generig elements will be appended to the gallery's // outer-most wrapper. These can also be dom elements. captionContainer: null, navPrevContainer: null, // not implemented navNextContainer: null, // not implemented pagerContainer: null // not implemented }; /** ========================================================================== * The Slide class. Each slider has a "slides" property that is an array * collection of Slide instancies */ function Slide(element, type, slider) { var slideInstance = this; this.element = element; this.wrapper = element.parentNode; this.type = type; this.slider = slider; /** * This should be private and is only used to cache the object! * Use the "getCaption" getter instead. */ this._caption = null; var $element = $(element); $.data(this.element, "Slide", this); $.data(this.wrapper, "Slide", this); // Store it's natural Width and Height if ("naturalWidth" in element) { this.width = element.naturalWidth; this.height = element.naturalHeight; } else { this.width = $element.width(); this.height = $element.height(); } // Apply the custom style (if any) $element.parent().attr("style", this.getStyle()); // Center the content and crop it if needed $element.css({ top : "50%", left: "50%", marginLeft: -this.width/2, marginTop: -this.height/2 }); // The slides are initially hidden (BUT AFTER the above measurenments and if // NOT already marked as active) if (!$element.parent().is(".active")) { $element.parent().hide(); } // Attach the onclick behavior if needed var _href = this.getHref(); if (_href) { $(this.wrapper).css({ cursor: "hand", // Old IE cursor: "pointer" }).click(function(e) { // Attaching link behavior to the slides makes sence for image // slides only. However, it is not disabled for the HTML slides // here are some cases that should be filtered: // 1. Click on link - let it go // 2. Click anything within form - leave it as is. Too many // things could be broken otherwise... if ($(e.target).is("a, form")) { return true; } // Respect those if (e.isDefaultPrevented()) { return false; } if (!$(this).is(".active")) { return false; } var target = slideInstance.getHrefTarget().replace(/^_/, ""); if (target == "blank" || target == "new") { window.open(_href); } else { try { // top, parent, self, frame name... window[target].location = _href; } catch (ex) { // perhaps cross-domain restriction } } }); } var wrapper; this.getCaptionWrapper = function () { if ( !wrapper ) { if ( !! this.slider.options.captionContainer) { wrapper = $(this.slider.options.captionContainer); if (!wrapper.length) { wrapper = $(this.element).closest(".wpv-wrapper"); } else { // Attach the pause_on_hover listeners if ( !!this.slider.options.pause_on_hover ) { var _inst = this.slider; wrapper.hover(function () { _inst.pause(); }, function () { _inst.resume(); }); } wrapper = wrapper.eq(0); } } else { wrapper = $(this.element).closest(".wpv-wrapper"); } } return wrapper; } } Slide.prototype = { /** * Returns the caption element (jQuery) for this slide or null */ getCaption: function () { if (!this._caption) { // check for cached object var src = unescape($(this.element).attr("data-caption") || $(this.element).attr("alt") || ""); if (!src) { return null; } var wrapper = this.getCaptionWrapper(); // If a slide?s caption starts with a hash sign, then this is an id // pointing to the html element containing a html caption var isId = src.indexOf("#") === 0, elem = null; if (isId) { elem = $(src); if (!elem.length) { elem = null; } else { // clone the element and append it to container (but only if its not // allready a child of the container) if (!elem.closest(wrapper).length) { elem = elem.clone().removeAttr("id").addClass("wpv-caption").appendTo(wrapper); } } } // create one if needed if (!elem && !isId) { elem = $('
').html(src).appendTo(wrapper); } if (elem) { elem.addClass("wpv-caption"); var style = this.getCaptionStyle(); if (style) { elem.attr("style", style); } this._caption = elem; } } return this._caption; }, /** * Returns the custom style for this slide as string (can be empty string) */ getStyle: function () { return unescape($(this.element).attr("data-style") || ""); }, /** * Returns the custom style for this slide's caption as string * (can be empty string) */ getCaptionStyle: function () { return unescape($(this.element).attr("data-caption-style") || ""); }, /** * Returns the "link URL" for that slide as string * (can be empty string) */ getHref: function () { return unescape($(this.element).attr("data-href") || ""); }, /** * Returns the "link URL - target" for that slide as string */ getHrefTarget: function () { return unescape($(this.element).attr("data-target") || "_self"); } }; /** ========================================================================== * The WPVSlider class */ function WPVSlider(elem, options) { var _inst = this; this.view = elem; var _cfg = $.extend(true, {}, _defaults, options); this.options = _cfg; /** * The id (unique name) of the FX that is currently in use */ var _fxId = "fade"; this.slides = []; this.showLoadingMask = function () { var mask = $(".wpv-loading-mask", this.view); if (!mask.length) { mask = $('
').appendTo(this.view); } mask.css({ top: 0, left: 0, right: 0, bottom: 0, opacity: 1, display: "block" }); }; this.hideLoadingMask = function (callback) { var mask = $(".wpv-loading-mask", this.view); if (mask.length) { mask.animate({ opacity: 0 }, 1000, "easeInQuad", function () { $(this).hide(); (callback || $.noop)(); }); } }; this.showLoadingMask(); // Slideshow and Navigation Controll Methods ------------------------------- var _slideShowTimer, _paused = 0, _isAnimating, _isAnimatingCaptions; // Be CAREFUL with timers! $(window).bind("unload beforeunload", function () { _inst.stop(); }); /** * Starts the slideshow if it's not already running */ this.start = function (delay) { if (_isAnimating || _isAnimatingCaptions || _paused) { _slideShowTimer = window.setTimeout(function () { _inst.start(_cfg.pause_time); }, 200); return; } _slideShowTimer = window.setTimeout(function () { if (_paused) { _inst.start(_cfg.pause_time); } else { _inst[_inst.getDirection() == "right" ? "next" : "prev"](function () { if ( !! _slideShowTimer) { // false if stopped while animating _inst.start(_cfg.pause_time); } }); } }, delay || 0); }; /** * Stops the slideshow (if it is currently running) */ this.stop = function () { if (_slideShowTimer) { window.clearTimeout(_slideShowTimer); _slideShowTimer = null; } _paused = 0; }; /** * Pauses the running slideshow */ this.pause = function () { _paused = +new Date(); }; /** * Resumes the running slideshow */ this.resume = function () { _paused = 0; }; /** * Returns a boolean to indicate if the slideshow is currently running */ this.isRunning = function () { return !!_slideShowTimer; }; /** * Returns the zero-based index of the currently active slide. If there is * no active slide (initially, and if none is specified in start_slide * option) this method just returns -1. * @return {int} */ this.getIindex = function () { return $(".wpv-slide-wrapper", elem).filter(".active").index(); }; this.getSlideElements = function () { return $(".wpv-slide-wrapper", elem); }; /** * Returns the currently active Slide object. * NOTE: This can be undefined if there is no active item! * @return {Slide} */ this.getCurrentSlide = function () { return $(".wpv-slide-wrapper.active", elem).eq(0); }; /** * Returns next slide (the one after the currently active). If the last * slide is active this will return the first one. * NOTE: This can be undefined if there are no slides! * NOTE: This can be the active slide if there is only one slide! * @return {jQuery} */ this.getNextSlide = function () { var cur = this.getCurrentSlide(); var next = cur.next(".wpv-slide-wrapper", elem); if (!next.length) { next = $(".wpv-slide-wrapper:first", elem); } return next.eq(0); }; /** * Returns previous slide (the one before the currently active). If the * first slide is active this will return the last one. * NOTE: This can be an empty jQuery object if there are no slides! * NOTE: This can be the active slide if there is only one slide! * @return {jQuery} */ this.getPreviousSlide = function () { var cur = this.getCurrentSlide(); var prev = cur.prev(".wpv-slide-wrapper", elem); if (!prev.length) { prev = $(".wpv-slide-wrapper:last", elem); } return prev.eq(0); }; /** * Returns "left" or "right" depending on the CURRENT value of the * "auto_direction" config. property. * @return {string} */ this.getDirection = function () { return _cfg.auto_direction == "left" ? "left" : "right"; }; /** * Runs a transition to the next slide */ this.next = function (callback) { this.goTo("next", callback); }; /** * Runs a transition to the previous slide */ this.prev = function (callback) { this.goTo("prev", callback); }; this.goTo = function (index, callback) { if (_isAnimating || _isAnimatingCaptions) { return false; // Do we need queue here? } if (index == this.getIindex()) { return; } var toHide = this.getCurrentSlide(); var toShow; if (index == "prev") { toShow = this.getPreviousSlide(); } else { if (index == "next") { toShow = this.getNextSlide(); } else { toShow = $(".wpv-slide-wrapper", elem).eq(index); } } var evt = new $.Event("beforeChange"); $(elem).trigger(evt, [this, toShow, toHide]); if (evt.isDefaultPrevented()) { return; } toHide.removeClass("active").addClass("animated"); toShow.addClass("active animated"); function _mainAnimationCallback() { toShow.removeClass("animated"); toHide.removeClass("animated"); $(_inst.view.parentNode).removeClass("animated"); _isAnimating = false; if ($.isFunction(callback)) { callback.apply(_inst, arguments); } var evt = new $.Event("afterChange"); $(elem).trigger(evt, [_inst, toShow, toHide]); if (evt.isDefaultPrevented()) { _inst.stop(); } if (toShow[0] == $(".wpv-slide-wrapper", elem).filter(":last")[0]) { evt = new $.Event("lastSlide"); $(elem).trigger(evt, [_inst, toShow, toHide]); if (evt.isDefaultPrevented()) { _inst.stop(); } } else { if (toShow[0] == $(".wpv-slide-wrapper", elem).filter(":first")[0]) { evt = new $.Event("firstSlide"); $(elem).trigger(evt, [_inst, toShow, toHide]); if (evt.isDefaultPrevented()) { _inst.stop(); } } } } function _runMainAnimation() { $(_inst.view.parentNode).addClass("animated"); _inst.setFX(_inst.options.effect); _isAnimating = true; if (!WPVSlider.fx[_fxId]) { _mainAnimationCallback(); } else { var dir = $.WPVSlider.Util.getDirection(toHide, toShow, $(".wpv-slide-wrapper", elem)); if (!dir) { $(_inst.view.parentNode).removeClass("animated"); _isAnimating = false; return; } toShow.stop(1, 1).trigger("fxStop"); toHide.stop(1, 1).trigger("fxStop"); WPVSlider.fx[_fxId].run({ slider: _inst, toShow: toShow, toHide: toHide, dir: dir, callback: _mainAnimationCallback, duration: _cfg.animation_time, easing: _cfg.effect_settings.easing }); } } _runMainAnimation(); }; this.getFX = function () { return _fxId; }; this.setFX = function (fxId) { var _oldId = _fxId; var id = $.isFunction(fxId) ? fxId() : fxId; if (id in WPVSlider.fx) { if (id != _fxId) { var oldFx = WPVSlider.fx[id]; if ($.isFunction(oldFx.uninit)) { oldFx.uninit(this); } oldFx = null; var newFx = WPVSlider.fx[id]; if ($.isFunction(newFx.init)) { newFx.init(this); } newFx = null; _fxId = id; } } }; this.getOption = function (name) { return _cfg[name]; }; this.setOption = function (name, value) { _cfg[name] = value; return this; }; // Layout Controll Methods ------------------------------------------------- this.setWidth = function (w) { $elem.width(w); }; this.setHeight = function (h) { $elem.height(h); }; this.setExpanded = function (bExpanded) { var _outerWrapper = $elem.parent(); _outerWrapper.height(_outerWrapper.height()); _outerWrapper[ !! bExpanded ? "addClass" : "removeClass"]("wpv-full-width"); function repositionSlides() { var view = $elem.closest(".wpv-view"); //var maxWidth = view.width(); //var maxHeight = view.height(); $(".wpv-slide", view).each(function (i, o) { var $el = $(o); // keep proportions of images //if ($el.is("img")) { var slide = $el.data("Slide"); // The image is not yet load if (!slide) { return true; } //console.log(view.parent().width (), slide.width) //var maxWidth = Math.min(view.parent().width (), slide.width ); //var maxHeight = Math.min(view.parent().height(), slide.height); //$el.css({ // width : maxWidth, // height: maxHeight //}); $el.css({ top : "50%", left: "50%", marginLeft: -slide.width/2, marginTop : -slide.height/2 }); //$el.css({ // left: maxWidth / 2, // top: maxHeight / 2 //}); //$el.css({ // marginLeft: -$el.width() / 2, // marginTop: -$el.height() / 2 //}); //} else { // $(o).css({ // width: "100%", // height: "100%" // }); //} }); } function syncExpandedView() { if (bExpanded) { var w = $("body").width(); _outerWrapper.width(w); var bp = (window.width - window.innerWidth) / 2; var l = _outerWrapper.offset().left; if (l > bp) { _outerWrapper.css("left", bp - l); } } else { $(elem).add(_outerWrapper).width(calcWidth()); } //repositionSlides(); } if ( !! bExpanded) { $(window).unbind("resize.syncWPV", syncExpandedView).bind("resize.syncWPV", syncExpandedView); syncExpandedView(); } else { syncExpandedView(); $(window).unbind("resize.syncWPV"); } }; this.isExpanded = function () { return $(elem).parent().hasClass("wpv-full-width"); }; this.setShowArrows = function (bShow) { var _outerWrapper = $(elem).parent(); var leftArrow = $(".wpv-nav-prev", _outerWrapper); var rightArrow = $(".wpv-nav-next", _outerWrapper); // create them if needed if ( !! bShow) { if (!leftArrow.length) { leftArrow = $('
').html(_cfg.prev_text).bind({ click: function () { _inst.prev(); }, mouseenter: function () { _inst.pause(); }, mouseleave: function () { _inst.resume(); }, "mousedown selectstart": false // unselectable }).appendTo(_outerWrapper); } if (!rightArrow.length) { rightArrow = $('
').html(_cfg.next_text).bind({ click: function () { _inst.next(); }, mouseenter: function () { _inst.pause(); }, mouseleave: function () { _inst.resume(); }, "mousedown selectstart": false // unselectable }).appendTo(_outerWrapper); } } // hide them if needed else { leftArrow.hide(); rightArrow.hide(); } }; this.setShowBullets = function (bShow) { var _outerWrapper = $(elem).parent(); var pager = $(".wpv-nav-pager", _outerWrapper); // create it if needed if ( !! bShow) { if (!pager.length) { pager = $('
    ').appendTo(_outerWrapper); var curIndex = _inst.getIindex(); $(".wpv-slide-wrapper", elem).each(function (i, slide) { var li = $('
  • ').click(function () { _inst.goTo(i); }).bind("mousedown selectstart", false).hover(function () { _inst.pause(); $(this).addClass("hover"); }, function () { _inst.resume(); $(this).removeClass("hover"); }).appendTo(pager); if (curIndex === i) { li.addClass("active"); } }); $elem.bind({ "beforeChange": function (e, slider, toShow, toHide) { pager.find("li.active").removeClass("active"); pager.find("li").eq(toShow.index()).addClass("active"); } }); } } // hide it if needed else { pager.hide(); } }; this.setShowCaption = function (bShow) { if ( !! bShow) { $elem.unbind("beforeChange.changeCaption").bind({ "beforeChange.changeCaption": function (e, slider, newSlide, oldSlide) { if (_isAnimatingCaptions || !newSlide || !slider.options.show_caption) { return; } var newCaption = $(newSlide ? newSlide.data("Slide").getCaption() : "
    "); var oldCaption = $(oldSlide ? oldSlide.data("Slide").getCaption() : "
    "); var worker = WPVSlider.fx[_fxId] && WPVSlider.fx[_fxId].changeCaptions ? WPVSlider.fx[_fxId].changeCaptions : WPVSlider.captionFx.fadeToggle; var speed = slider.options.effect_settings.caption_animation_time; if (!speed && speed !== 0) { speed = slider.options.animation_time; } var delay = slider.options.effect_settings.caption_delay || 0; _isAnimatingCaptions = true; $(slider.view.parentNode).addClass("animated"); worker({ oldCaption: oldCaption, newCaption: newCaption, slider: slider, slideToShow: newSlide, slideToHide: oldSlide, speed: speed, delay: delay }, function () { $(slider.view.parentNode).removeClass("animated"); _isAnimatingCaptions = false; }); } }); } else { $elem.unbind("beforeChange.changeCaption"); } }; function calcWidth() { var _width = _cfg.width; if (_width != "auto") { var _width2 = parseFloat(_width); if (!isNaN(_width2)) { if (_width2 === 0) { _width = "auto"; } else if (_width2 < 0) { var prt = $(elem).closest(".wpv-wrapper").parent(); if (prt.length) { var max = prt.width(); var min = 100; _width = Math.max(max + _width2, min); } else { _width = "auto"; } } } else { _width = "auto"; } } return _width; } //////////////////////////////////////////////////////////////////////////// // // // INITIALIZE // // // //////////////////////////////////////////////////////////////////////////// var $elem = $(elem); // Mark it as our's $elem.addClass("wpv-view"); // Wrap it with a fixed-size wrapper $elem.wrap('
    '); var _outerWrapper = $elem.parent(); $elem.wrapInner('
    '); var _innerWrapper = $elem.find("> .wpv-htmlslide-wrap"); // Resize it and make it invisible while initializing $elem.css({ visibility: "hidden", width : calcWidth(), height: _cfg.height }); // Attach the pause_on_hover listeners if ( !! _cfg.pause_on_hover) { _outerWrapper.hover(function () { _inst.pause(); }, function () { _inst.resume(); }); } // Collect all slides now ================================================== var slides = $elem.find(".wpv-slide").wrap('
    '), len = slides.length, initialSlide, loadCallback = function (el, type, initial) { var slide = new Slide(el, type, _inst); _inst.slides.push(slide); if (initial) { initialSlide = slide; } // When ALL the slides are ready fire the load event if (_inst.slides.length === len) { $elem.css("visibility", "visible"); _inst.setExpanded(_cfg.expand); _outerWrapper.addClass("wpv-loaded"); _inst.hideLoadingMask(function () { $elem.trigger("sliderload", [_inst]); initialSlide.getCaption(); // Do I need these ? $elem.trigger("beforeChange", [_inst, $(initialSlide.wrapper)]); //elem.trigger("afterChange", [_inst, $(initialSlide.wrapper)]); if (len > 1 && (_cfg.auto_direction == "left" || _cfg.auto_direction == "right")) { _inst.start(_cfg.pause_time); } initialSlide = null; }); } slide = null; }; // Add some classNames to the outer wrapper to help the CSS styling if ( !! _cfg.show_arrows && len > 1) { _outerWrapper.addClass("wpv-show-arrows"); } if ( !! _cfg.show_bullets && len > 1) { _outerWrapper.addClass("wpv-show-bullets"); } if ( !! _cfg.show_caption) { _outerWrapper.addClass("wpv-show-caption"); } slides.each(function (i, o) { var $o = $(o), type = "html"; switch (o.nodeName.toLowerCase()) { case "img": type = "image"; break; case "iframe": type = "frame"; break; case "object": type = "object"; break; case "embed": type = "embed"; $o.attr("wmode", "transparent").removeAttr("bgcolor"); o.wmode = "transparent"; break; } if (type == "image" || type == "frame") { if ( !! o.complete || o.readyState == "complete" || o.readyState == "loaded") { loadCallback(o, type, i === (_cfg.start_slide || 0)); } else { $o.bind("load readystatechange", function (e) { if (e.type == "load") { $o.unbind("load").unbind("readystatechange"); loadCallback(o, type, i === (_cfg.start_slide || 0)); } else { if (o.readyState == "complete" || o.readyState == "loaded") { $o.unbind("load").unbind("readystatechange"); loadCallback(o, type, i === (_cfg.start_slide || 0)); } } }); } } else { loadCallback(o, type, i === (_cfg.start_slide || 0)); } }); // Find and show the initial slide var startSlide = $(".wpv-slide-wrapper.active", elem); if (!startSlide.length) { startSlide = $(".wpv-slide-wrapper", elem).eq(_cfg.start_slide || 0); } startSlide.addClass("active").show(); //.closest(".wpv-view").css("visibility", "visible"); _inst.setExpanded(_cfg.expand); _inst.setFX(_cfg.effect); // Show the arrows if needed _inst.setShowArrows(_cfg.show_arrows && len > 1); // Show the pager if needed _inst.setShowBullets(_cfg.show_bullets && len > 1); // Show the captions? _inst.setShowCaption(_cfg.show_caption); // Autorun the slideshow if needed //if (_cfg.auto_direction == "left" || _cfg.auto_direction == "right") { // _inst.start(_cfg.pause_time); //} // startSlide.closest(".wpv-view").css("visibility", "visible"); _outerWrapper.addClass("wpv-ready"); // Trigger the "sliderready" event $elem.trigger("sliderready", [_inst]); } WPVSlider.getInstance = function (elem, options) { var inst = $.data(elem, "WPVSlider"); if (!inst) { inst = new WPVSlider(elem, options); $.data(elem, "WPVSlider", inst); } return inst; }; // Expose the constructor $.WPVSlider = WPVSlider; $.WPVSlider.Util = { getDirection: function (from, to, all) { var fromIndex = all.index(from); var toIndex = all.index(to); if (fromIndex === 0 && toIndex == all.length - 1) { return "prev"; } if (fromIndex == all.length - 1 && toIndex === 0) { return "next"; } if (fromIndex < toIndex) { return "next"; } if (fromIndex > toIndex) { return "prev"; } } }; /** * Public container for transition effects (available as jQuery.WPVSlider.fx) */ WPVSlider.fx = {}; // Built-in Effects ---------------------------------------------------------- WPVSlider.fx.fade = { run: function (cfg) { cfg = $.extend({ duration: 1000, easing: "linear" }, cfg); cfg.toShow.css({ opacity: 0, zIndex: 3 }).show(); //var w1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).width() : 0; //var h1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).height() : 0; //var w2 = $("> .wpv-slide", cfg.toShow).width(); //var h2 = $("> .wpv-slide", cfg.toShow).height(); //if (cfg.toHide && (w1 > w2 || h1 > h2)) { cfg.toHide.fadeTo(cfg.duration, 0, "linear", function () { cfg.toHide.css({ display: "none", opacity: 1 }); }); //} cfg.toShow.animate({ opacity: 1 }, cfg.duration, cfg.easing, function () { cfg.toHide.hide(); cfg.callback(); }); cfg.toHide.css({ zIndex: 2 }); } }; WPVSlider.fx.slide = { run: function (cfg) { cfg = $.extend({ duration: 800, easing: "easeOutExpo" }, cfg); //console.log(cfg.toShow.data("Slide").width) cfg.toShow.css({ //left: cfg.toShow.width() * (cfg.dir == "next" ? 1 : -1), left: cfg.toShow.data("Slide").width * (cfg.dir == "next" ? 1 : -1), zIndex: 3 }).show(); //var w1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).width() : 0; //var h1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).height() : 0; //var w2 = $("> .wpv-slide", cfg.toShow).width(); //var h2 = $("> .wpv-slide", cfg.toShow).height(); //if (cfg.toHide && (w1 > w2 || h1 > h2)) { cfg.toHide.fadeTo(cfg.duration, 0, "linear", function () { cfg.toHide.css({ display: "none", opacity: 1 }); }); //} cfg.toShow.animate({ left: 0 }, cfg.duration, cfg.easing, function () { cfg.toHide.stop(1, 0).hide(); cfg.callback(); }); if (cfg.toHide) { cfg.toHide.css({ zIndex: 2 }); } } }; WPVSlider.fx.random = { run: function () { var fx = []; for (var name in WPVSlider.fx) { if (name != "random") { fx.push(name); } } return WPVSlider.fx[fx[Math.floor(Math.random() * fx.length)]].run.apply(this, arguments); } }; // --------------------------------------------------------------------------- /** * And some public static caption effects that the effects may refer to */ WPVSlider.captionFx = {}; /** * Caption effects factory */ WPVSlider.createCaptionFx = function (cfg, hideFn, showFn, onComplete) { var queue = (function () { var q = []; function next() { if (q.length) { q.shift()(next); } else { onComplete(); } } function add(fn) { q.push(fn); } return { next: next, add: add }; })(); if (!$.isArray(hideFn)) { hideFn = hideFn ? [hideFn] : []; } if (!$.isArray(showFn)) { showFn = showFn ? [showFn] : []; } return function () { $.each(hideFn, function (i, fn) { queue.add(function (next) { setTimeout(function () { fn(next); }, cfg.delay || 0); }); }); $.each(showFn, function (i, fn) { queue.add(function (next) { setTimeout(function () { fn(next); }, cfg.delay || 0); }); }); queue.next(); }; }; /** * Just show/hide captions without animation (but thay still can have delays) */ WPVSlider.captionFx.toggle = function (cfg, callback) { if (cfg.newCaption.length) { $(cfg.newCaption).hide(); } WPVSlider.createCaptionFx( cfg, function (next) { // hideFn if (cfg.oldCaption.length) { $(cfg.oldCaption).hide(); } next(); }, function (next) { // showFn if (cfg.newCaption.length) { $(cfg.newCaption).show(); } next(); }, callback || $.noop)(); }; /** * Fade-in/out both captions at the same time */ WPVSlider.captionFx.fadeToggle = function (cfg, callback) { //console.log(arguments) if (cfg.newCaption.length) { $(cfg.newCaption).fadeOut(0); } WPVSlider.createCaptionFx( cfg, function (next) { // hideFn if (cfg.oldCaption.length) { $(cfg.oldCaption).fadeIn(0).fadeOut(cfg.speed, "linear"); } next(); }, function (next) { // showFn if (cfg.newCaption.length) { $(cfg.newCaption || []).fadeTo(cfg.speed, cfg.slider.options.caption_opacity, "linear", next); } else { next(); } }, callback || $.noop)(); }; // The jQuery Plugin --------------------------------------------------------- $.fn.wpvSlider = function (opt) { var _args = arguments, result; var isMethodCall = typeof opt == "string"; this.each(function (i, o) { // Method call if (isMethodCall) { if (opt.charAt(0) != "_") { var _inst = WPVSlider.getInstance(o); if (_inst && $.isFunction(_inst[opt])) { result = _inst[opt].apply(_inst, Array.prototype.slice.call(_args, 1)); if (result !== undefined) { return false; // break each } } _inst = null; // free object refs } } // Create instance else { WPVSlider.getInstance(o, opt); } }); _args = null; // free object refs return isMethodCall ? result : this; }; })(jQuery);;//////////////////////////////////////////////////////////////////////////////// // // // Grid-based Effects // // // //////////////////////////////////////////////////////////////////////////////// (function ($, undefined) { function getGrid(cfg) { var root = cfg.slider.view; var gridLayer = $(".wpv-fx-grid", root); if (!gridLayer.length) { gridLayer = $('
    ').css({ width: "100%", height: "100%", position: "absolute", zIndex: 30 }) .bind("click", function(e) { cfg.slider.getCurrentSlide().trigger(e); }) .appendTo(root); } else { gridLayer.unbind().empty(); } var facetWidth = Math.ceil($(root).width() / cfg.cols); var facetHeight = Math.ceil($(root).height() / cfg.rows); var i = 0; for (var row = 0; row < cfg.rows; row++) { for (var col = 0; col < cfg.cols; col++) { var facet = $('
    ').css({ width: facetWidth, height: facetHeight, left: col * facetWidth, top: row * facetHeight, position: "absolute", overflow: "hidden", zIndex: 30 }).appendTo(gridLayer); facet[0].row = row; facet[0].col = col; facet[0].facetWidth = facetWidth; facet[0].facetHeight = facetHeight; facet[0].rows = cfg.rows; facet[0].cols = cfg.cols; facet[0].index = i++; } } if (cfg.toShow) { cfg.toShow.unbind("fxStop").bind("fxStop", function () { gridLayer.find("wpv-fx-grid-facet").andSelf().stop(1, 1); }); } if (cfg.visibleGrid) { var gridMask = $(".wpv-fx-grid-mask", root); if (!gridMask.length) { gridMask = gridLayer.clone().attr("class", "wpv-fx-grid-mask").css({ position: "absolute", overflow: "hidden", width: "100%", height: "100%", zIndex: 31 }) .bind("click", function(e) { cfg.slider.getCurrentSlide().trigger(e); }) .appendTo(root); } else { $(".wpv-fx-grid-mask", root).fadeIn(600); } } return gridLayer; } function toNum(x, defaultValue) { x = parseFloat(x); if (isNaN(x)) { return defaultValue || 0; } return x; } function parseCssPrefs(css, slice) { var newCss = {}; function parse(x) { return eval(x.replace(/@(.+?)\b/g, function (a, b) { return slice[b]; })); } for (var x in css) { if ($.isArray(css[x]) && typeof css[x][0] == "string") { newCss[x] = [parse(css[x][0]), css[x][1]]; } else if (String(css[x]).indexOf("@") != -1) { newCss[x] = parse(css[x]); } else { newCss[x] = css[x]; } } return newCss; } function wave(grid, cfg, callback) { var cnt = cfg.cols * cfg.rows; var waveDuration = Math.max(cfg.waveDuration, cnt); var subDelay = Math.floor(waveDuration / cnt); var done = 0; var img = cfg.toShow.show().find("> img"); cfg.toShow.show(); //var top = (toNum(img.css("top")) + toNum(img.css("marginTop"))) - toNum(img.css("marginBottom")); //var left = (toNum(img.css("left")) + toNum(img.css("marginLeft"))) - toNum(img.css("marginRight")); var top = Math[$.browser.webkit ? "floor" : "round"]((cfg.toShow.parent().height() - $(img).height())/2); var left = Math[$.browser.webkit ? "floor" : "round"]((cfg.toShow.parent().width () - $(img).width ())/2); cfg.toShow.hide(); var facetImage = $('').css({ width: img[0].style.width, height: img[0].style.height }); var _grid = sortGrid(grid, cfg.waveType); $.each(_grid, function (i, o) { var cssFrom = parseCssPrefs(cfg.cssFrom, o); var cssTo = parseCssPrefs(cfg.cssTo, o); var facet = $(o); facetImage.clone().css({ marginLeft: left + (o.facetWidth * o.col * -1), marginTop: top + (o.facetHeight * o.row * -1) }).appendTo(o); facet.stop(1, 0).delay(Math.ceil(subDelay * i)).css(cssFrom).animate(cssTo, cfg.subslideDuration, cfg.easing, function () { facet.css("filter", "none"); cssFrom = cssTo = facet = null; if (++done >= cnt) { callback(); } }); }); img = facetImage = null; } function initGridFx(slider) { getGrid($.extend({ rows: 3, cols: 6, slider: slider, visibleGrid: true }, slider.options.effect_settings)); } function runGridFx(cfg) { if (cfg.toShow.data("Slide").type == "image") { var _cfg = $.extend(true, { rows: 3, cols: 6, subslideDuration: 300, subslideTransition: "fade", waveDuration: 900, waveType: "natural", easing: "easeOutQuint", cssFrom: {}, cssTo: {}, visibleGrid: false }, cfg); var grid = getGrid(_cfg); var w1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).width() : 0; var h1 = cfg.toHide ? $("> .wpv-slide", cfg.toHide).height() : 0; var w2 = $("> .wpv-slide", cfg.toShow).width(); var h2 = $("> .wpv-slide", cfg.toShow).height(); wave(grid, _cfg, function () { _cfg.toHide.hide(); _cfg.toShow.show(); grid.remove(); _cfg.callback(); _cfg = grid = null; }); } /* * Grid-based effects does not support content other than images thus we * need to create a pseudo-fx for this cases * (img to html and html to html transitions) */ else { $(".wpv-fx-grid-mask", cfg.slider.view).fadeOut(); $.WPVSlider.fx.fade.run(cfg); } } function sortGrid(grid, sorter) { var slices = $(".wpv-fx-grid-facet", grid).get(); if (sorter && sorter != "natural") { slices.sort(_sorters[sorter]); } return slices; } // Grid sorting functions ---------------------------------------------------- var _sorters = { R2L: function (a, b) { // right to left return a.col === b.col ? _sorters.T2B(a, b) : a.col < b.col ? 1 : -1; }, R2L_SNAKE: function (a, b) { // right to left - snake return a.col === b.col ? _sorters[a.col % 2 == 0 ? "B2T" : "T2B"](a, b) : a.col < b.col ? 1 : -1; }, L2R: function (a, b) { // left to right return a.col === b.col ? _sorters.T2B(a, b) : a.col < b.col ? -1 : 1; }, L2R_SNAKE: function (a, b) { // left to right - snake return a.col === b.col ? _sorters[a.col % 2 == 0 ? "T2B" : "B2T"](a, b) : a.col < b.col ? -1 : 1; }, B2T: function (a, b) { // bottom to top return a.row === b.row ? _sorters.L2R(a, b) : a.row < b.row ? 1 : -1; }, B2T_SNAKE: function (a, b) { // bottom to top - snake return a.row === b.row ? _sorters[a.row % 2 == 0 ? "L2R" : "R2L"](a, b) : a.row < b.row ? 1 : -1; }, T2B: function (a, b) { // top to bottom return a.row === b.row ? _sorters.L2R(a, b) : a.row < b.row ? -1 : 1; }, T2B_SNAKE: function (a, b) { // top to bottom - snake return a.row === b.row ? _sorters[a.row % 2 == 0 ? "L2R" : "R2L"](a, b) : a.row < b.row ? -1 : 1; }, BR2TL: function (a, b) { // bottom/right to top/left var x = a.col + a.row; var y = b.col + b.row; return x === y ? _sorters.B2T(a, b) : x < y ? 1 : -1; }, TL2BR: function (a, b) { // top/left to bottom/right var x = a.col + a.row; var y = b.col + b.row; return x === y ? _sorters.T2B(a, b) : x < y ? -1 : 1; }, TR2BL: function (a, b) { // top/right to bottom/left var x = a.col - a.row; var y = b.col - b.row; return x === y ? _sorters.T2B(a, b) : x < y ? 1 : -1; }, BL2TR: function (a, b) { // bottom/left to top/right var x = a.col - a.row; var y = b.col - b.row; return x === y ? _sorters.B2T(a, b) : x < y ? -1 : 1; }, RAND: function (a, b) { // random var x = Math.random(); return x == 0.5 ? 0 : x < 0.5 ? -1 : 1; //return _sorters[["R2L", "L2R", "B2T", "T2B", "BR2TL", "TL2BR", "TR2BL", "BL2TR"][Math.floor(Math.random() * 8)]].call(null, a, b); } } $.WPVSlider.fx.gridFadeQueue = { init: initGridFx, changeCaptions: $.WPVSlider.captionFx.toggle, /* Here cfg contains: slider toShow toHide dir callback duration easing */ run: function (cfg) { runGridFx( $.extend({ easing: "linear", waveDuration: 600, subslideDuration: 600, cssFrom: { opacity: 0 }, cssTo: { opacity: 1 }, visibleGrid: true }, cfg, cfg.slider.options.effect_settings)); } }; $.WPVSlider.fx.gridWaveBL2TR = { init: initGridFx, changeCaptions: $.WPVSlider.captionFx.toggle, run: function (cfg) { runGridFx( $.extend({ easing: "linear", waveType: "BL2TR", waveDuration: 200, subslideDuration: 300, visibleGrid: true, rows: 3, cols: 6, cssFrom: { opacity: 0, marginTop: "@facetHeight", marginLeft: "-@facetWidth" }, cssTo: { opacity: [1, "easeInSine"], marginTop: 0, marginLeft: 0 } }, cfg, cfg.slider.options.effect_settings)); } }; $.WPVSlider.fx.gridRandomSlideDown = { init: initGridFx, changeCaptions: $.WPVSlider.captionFx.toggle, run: function (cfg) { runGridFx( $.extend({ waveType: "RAND", rows: 3, cols: 6, waveDuration: 600, subslideDuration: 600, visibleGrid: true, easing: "easeOutExpo", cssFrom: { height: 0, marginTop: "-@facetHeight", opacity: 0 }, cssTo: { opacity: 1, height: "@facetHeight", marginTop: 0 } }, cfg, cfg.slider.options.effect_settings)); } }; // effects with subcaptions function getSubcaptionSpeed(subcaption, cfg) { var x = parseInt($(subcaption).attr("data-animation-duration"), 10); if (isNaN(x) || x < 0) { x = cfg.speed; } return x; } // NOTE that the per-subcaption delay is added to the global one! function getSubcaptionDelay(subcaption, cfg) { var x = parseInt($(subcaption).attr("data-animation-delay"), 10); if (isNaN(x) || x < 0) { x = 0; } return x; } function getSubcaptionEasing(subcaption, cfg) { return $(subcaption).attr("data-animation-easing") || cfg.slider.options.effect_settings.easing || "easeInOutCirc"; } $.WPVSlider.fx.slideMultipleCaptions = { // Use the built-in slide transition for main animations run: function () { return $.WPVSlider.fx.slide.run.apply(this, arguments); }, /** * cfg contains: * - oldCaption {jQuery} * - newCaption {jQuery} * - slider (The instance) * - slideToShow {Slide} * - slideToHide {Slide} */ changeCaptions: function (cfg, callback) { // Go deeper in the captions to look for subcaptions to animate var oldSubCaptions = cfg.oldCaption.find(".sub-caption"); var newSubCaptions = cfg.newCaption.find(".sub-caption"); if (!oldSubCaptions.length) { oldSubCaptions = cfg.oldCaption; } if (!newSubCaptions.length) { newSubCaptions = cfg.newCaption; } $(newSubCaptions).removeClass("visible"); var hideFunctions = []; oldSubCaptions.each(function (i, o) { var speed = getSubcaptionSpeed(o, cfg); var easing = getSubcaptionEasing(o, cfg); var delay = getSubcaptionDelay(o, cfg); if (!cfg.slider.options.effect_settings.caption_queue) { hideFunctions.push(function (next) { $(o).delay(delay).removeClass("visible", speed, easing); next(); }); } else { hideFunctions.push(function (next) { $(o).delay(delay).removeClass("visible", speed, easing, next); }); } }); hideFunctions.push(function (next) { if (cfg.newCaption.length) { cfg.newCaption.animate({ opacity: "show" }, 500, "linear"); } next(); }); var showFunctions = []; newSubCaptions.each(function (i, o) { var speed = getSubcaptionSpeed(o, cfg); var easing = getSubcaptionEasing(o, cfg); var delay = getSubcaptionDelay(o, cfg); if (!cfg.slider.options.effect_settings.caption_queue) { showFunctions.push(function (next) { $(o).delay(delay).addClass("visible", speed, easing); next(); }); } else { showFunctions.push(function (next) { $(o).delay(delay).addClass("visible", speed, easing, next); }); } }); showFunctions.push(function (next) { if (cfg.oldCaption.length) { cfg.oldCaption.animate({ opacity: "hide" }, 300, "linear", next); } else { next(); } }); $.WPVSlider.createCaptionFx( cfg, hideFunctions, showFunctions, callback || $.noop)(); } }; // zoom effects $.WPVSlider.fx.zoomIn = { init : function(slider) { if (slider.options.captionContainer) { var captionContainer = $(slider.options.captionContainer); $(slider.view).bind({ "afterChange" : function() { if ($(".wpv-caption:visible", captionContainer).length === 0) { captionContainer.hide(); } }, "beforeChange" : function() { captionContainer.show(); } }); } }, run: function (cfg) { cfg = $.extend({ duration: 1000, easing: "easeOutSine" }, cfg); var content = $(cfg.toShow[0].firstChild); var targetHeight = cfg.toShow.height(); var targetWidth = cfg.toShow.width(); var halfX = targetWidth / 2; var halfY = targetHeight / 2; var contentHeight = content.height(); var contentWidth = content.width(); cfg.toHide.css({ zIndex: 2 }); if (content.is("img")) { var diffY = Math.abs(parseFloat(content.css("marginTop" ))); var diffX = Math.abs(parseFloat(content.css("marginLeft"))); content.css({ opacity: 0, position: "absolute", clip: "rect(" + (diffY + halfY) + "px " + (diffX + halfX) + "px " + halfY + "px " + halfX + "px)" }).show().animate({ opacity: 1 }, { duration: cfg.duration, easing: cfg.easing, step: function (cur, fx) { content[0].style.clip = "rect( " + (diffY - halfY * fx.pos) + "px " + (diffX + halfX * fx.pos) + "px " + (diffY + halfY * fx.pos) + "px " + (diffX - halfX * fx.pos) + "px)"; }, complete: function () { cfg.toHide.hide(); content.css({ clip: "auto" }); cfg.callback(); } }); cfg.toShow.css({ display: "block", zIndex: 3 }); } else { var cssBackup = { // top : content.css("top"), //left : content.css("left"), //marginRight : content.css("marginRight"), //marginBottom : content.css("marginBottom") }; content.css({ //top : "50%", //left : "50%", width: "100%", height: "100%" }); cfg.toShow.css({ opacity: 0, zIndex: 3, display: "block", position: "absolute", width: 0, height: 0, top: "50%", left: "50%" }).animate({ opacity: 1, top: 0, left: 0, width: "100%", height: "100%" }, { duration: cfg.duration, easing: cfg.easing, //step : function(cur, fx) { // if (fx.prop == "opacity") { // content[0].style.top = halfY - (halfX * fx.pos) + "px"; // content[0].style.left = halfX - (halfX * fx.pos) + "px"; // content[0].style.height = (targetHeight * fx.pos) + "px"; // content[0].style.width = (targetWidth * fx.pos) + "px"; // } //}, complete: function () { cfg.toHide.hide(); //content.css(cssBackup); cfg.callback(); } }); } }, /** * cfg contains: * - oldCaption {jQuery} * - newCaption {jQuery} * - slider (The instance) * - slideToShow {Slide} * - slideToHide {Slide} */ changeCaptions: function (cfg, callback) { var Z = 200, delay = Math.round(cfg.slider.options.animation_time * 0.3), time = Math.round(cfg.slider.options.animation_time * 0.4); if (cfg.newCaption.length) { cfg.newCaption.css({ opacity: 0, zIndex: Z + 1 }).show().delay(delay).fadeTo(time, 1, "linear", callback); } else { callback(); } // This is FALSE on the first showing of the first slide! if (cfg.oldCaption) { cfg.oldCaption.css({ zIndex: Z }).delay(delay).fadeTo(time, 0, "linear", function () { cfg.oldCaption.hide(); }); } } }; // shrink $.WPVSlider.fx.shrink = { init: function(slider) { if ($.browser.webkit) { $("#container").css("WebkitTransform", "none"); } //console.log(this, arguments); }, // Use the built-in slide transition for main animations run: function (cfg) { var captionToHide, captionToShow = cfg.toShow.data("Slide").getCaption(), wI = cfg.toShow.closest(".wpv-wrapper").width(), wO = cfg.toShow.closest(".wpv-wrapper").innerWidth(); if (cfg.toHide) { captionToHide = cfg.toHide.data("Slide").getCaption(); cfg.toHide.css({ zIndex: 2 }).animate({ left: cfg.dir == "prev" ? wO : -wO / 2, opacity: 0 }, cfg.duration, cfg.easing); } //w = cfg.toShow.width(); cfg.toShow.css({ left: wO * (cfg.dir == "next" ? 1 : -1), zIndex: 4, opacity: 1 }).show().animate({ left: 0 }, { duration: cfg.duration, easing: cfg.easing, step: function (cur, fx) { if (captionToShow && captionToShow.length) { captionToShow.css({ left: cur + wI, opacity: fx.pos }); } if (captionToHide && captionToHide.length) { captionToHide.css({ left: wI - wO * fx.pos * (cfg.dir == "prev" ? -1 : 1), opacity: 1 - fx.pos }); } }, complete: function () { cfg.toHide.hide(); cfg.callback(); } }); }, /** * Just define an empty function here to get rid of the default one. In this * case the caption animations are easier to handle in the main function above */ changeCaptions: function (cfg, callback) { callback(); } }; $.WPVSlider.fx.peek = { run: function (cfg) { var padd = 20; var slide = cfg.toHide; var slides = slide.parent().find(".wpv-slide-wrapper").hide(); var indexToHide = slides.index(cfg.toHide); var indexToShow = slides.index(cfg.toShow); cfg.toHide.show().css({ left: 0 }); if (cfg.dir == "next") { cfg.toShow.show().css({ left: slide.width() + padd }); if (indexToShow == slides.length - 1) { slides.eq(0).show().css({ left: slide.width() + cfg.toShow.width() + padd * 2 }); } else { cfg.toShow.next().show().css({ left: slide.width() + cfg.toShow.width() + padd * 2 }); } } else { cfg.toShow.show().css({ left: -cfg.toShow.width() - padd }); if (indexToHide == slides.length - 1) { slides.eq(0).show().css({ left: cfg.toHide.width() + padd }); } else { cfg.toHide.next().show().css({ left: cfg.toHide.width() + padd }); } } slide.parent().css({ left: 0 }).animate({ left: (slide.width() + padd) * (cfg.dir == "next" ? -1 : 1) }, cfg.duration, cfg.easing, cfg.callback); }, changeCaptions: function (cfg, callback) { if (cfg.newCaption.parent().length) { var startTop = cfg.newCaption.parent()[0].scrollTop; var top = cfg.newCaption[0].offsetTop - cfg.newCaption.scrollTop(); if (cfg.newCaption.parent().css('opacity') != 0) { cfg.newCaption.parent().css({ dummy: 0 }).animate({ dummy: 1 }, { duration: cfg.slider.options.animation_time, easing: "easeInOutCubic", step: function (cur) { this.scrollTop = startTop + (cur * (top - startTop)); }, complete: callback }); } else { cfg.newCaption.parent().scrollTop = top; cfg.newCaption.parent().animate({ opacity: 1 }, { duration: cfg.slider.options.animation_time, easing: "easeInOutCubic", complete: callback }); } } else { if (cfg.oldCaption.length > 0) { cfg.oldCaption.parent().animate({ opacity: 0 }, { duration: cfg.slider.options.animation_time, easing: "easeInOutCubic", complete: callback }); } else { callback(); } } } }; })(jQuery);;/* * jPlayer Plugin for jQuery JavaScript Library * http://www.happyworm.com/jquery/jplayer * * Copyright (c) 2009 - 2010 Happyworm Ltd * Dual licensed under the MIT and GPL licenses. * - http://www.opensource.org/licenses/mit-license.php * - http://www.gnu.org/copyleft/gpl.html * * Author: Mark J Panaghiston * Version: 2.0.0 * Date: 20th December 2010 */ (function(c,h){c.fn.jPlayer=function(a){var b=typeof a==="string",d=Array.prototype.slice.call(arguments,1),f=this;a=!b&&d.length?c.extend.apply(null,[true,a].concat(d)):a;if(b&&a.charAt(0)==="_")return f;b?this.each(function(){var e=c.data(this,"jPlayer"),g=e&&c.isFunction(e[a])?e[a].apply(e,d):e;if(g!==e&&g!==h){f=g;return false}}):this.each(function(){var e=c.data(this,"jPlayer");if(e){e.option(a||{})._init();e.option(a||{})}else c.data(this,"jPlayer",new c.jPlayer(a,this))});return f};c.jPlayer= function(a,b){if(arguments.length){this.element=c(b);this.options=c.extend(true,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};c.jPlayer.event={ready:"jPlayer_ready",resize:"jPlayer_resize",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata", loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};c.jPlayer.htmlEvent=["loadstart","abort","emptied","stalled","loadedmetadata","loadeddata","canplaythrough","ratechange"];c.jPlayer.pause= function(){c.each(c.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};c.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};c.jPlayer.convertTime=function(a){a=new Date(a*1E3);var b=a.getUTCHours(),d=a.getUTCMinutes();a=a.getUTCSeconds();b=c.jPlayer.timeFormat.padHour&&b<10?"0"+b:b;d=c.jPlayer.timeFormat.padMin&&d<10?"0"+d:d;a=c.jPlayer.timeFormat.padSec&&a<10?"0"+a:a;return(c.jPlayer.timeFormat.showHour? b+c.jPlayer.timeFormat.sepHour:"")+(c.jPlayer.timeFormat.showMin?d+c.jPlayer.timeFormat.sepMin:"")+(c.jPlayer.timeFormat.showSec?a+c.jPlayer.timeFormat.sepSec:"")};c.jPlayer.uaMatch=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,f=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&f.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};c.jPlayer.browser={};var m=c.jPlayer.uaMatch(navigator.userAgent); if(m.browser){c.jPlayer.browser[m.browser]=true;c.jPlayer.browser.version=m.version}c.jPlayer.prototype={count:0,version:{script:"2.0.0",needFlash:"2.0.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:false,backgroundColor:"#000000",cssSelectorAncestor:"#jp_interface_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute", volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",currentTime:".jp-current-time",duration:".jp-duration"},idPrefix:"jp",errorAlerts:false,warningAlerts:false},instances:{},status:{src:"",media:{},paused:true,format:{},formatType:"",waitForPlay:true,waitForLoad:true,srcSet:false,video:false,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0},_status:{volume:h,muted:false,width:0,height:0},internal:{ready:false,instance:h,htmlDlyCmdId:h},solution:{html:true, flash:true},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:true,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:true,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:false,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:false,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:false,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:true,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"', flashCanPlay:false,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:false,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=c.extend({},this.status,this._status);this.internal=c.extend({},this.internal);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.status.volume=this._limitValue(this.options.volume,0,1);this.status.muted= this.options.muted;this.status.width=this.element.css("width");this.status.height=this.element.css("height");this.element.css({"background-color":this.options.backgroundColor});c.each(this.options.supplied.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.format[i]){var j=false;c.each(a.formats,function(n,k){if(i===k){j=true;return false}});j||a.formats.push(i)}});c.each(this.options.solution.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.solution[i]){var j= false;c.each(a.solutions,function(n,k){if(i===k){j=true;return false}});j||a.solutions.push(i)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")===""&&this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=c.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=c.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:h});this.internal.video=c.extend({},{id:this.options.idPrefix+ "_video_"+this.count,jq:h});this.internal.flash=c.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:h,swf:this.options.swfPath+(this.options.swfPath!==""&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf"});this.internal.poster=c.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:h});c.each(c.jPlayer.event,function(e,g){if(a.options[e]!==h){a.element.bind(g+".jPlayer",a.options[e]);a.options[e]=h}});this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id= this.internal.poster.id;this.htmlElement.poster.onload=function(){if(!a.status.video||a.status.waitForPlay)a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=c("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.require.audio=false;this.require.video=false;c.each(this.formats,function(e,g){a.require[a.format[g].media]=true});this.html.audio.available=false;if(this.require.audio){this.htmlElement.audio= document.createElement("audio");this.htmlElement.audio.id=this.internal.audio.id;this.html.audio.available=!!this.htmlElement.audio.canPlayType}this.html.video.available=false;if(this.require.video){this.htmlElement.video=document.createElement("video");this.htmlElement.video.id=this.internal.video.id;this.html.video.available=!!this.htmlElement.video.canPlayType}this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};c.each(this.formats,function(e,g){a.html.canPlay[g]= a.html[a.format[g].media].available&&""!==a.htmlElement[a.format[g].media].canPlayType(a.format[g].codec);a.flash.canPlay[g]=a.format[g].flashCanPlay&&a.flash.available});this.html.desired=false;this.flash.desired=false;c.each(this.solutions,function(e,g){if(e===0)a[g].desired=true;else{var i=false,j=false;c.each(a.formats,function(n,k){if(a[a.solutions[0]].canPlay[k])if(a.format[k].media==="video")j=true;else i=true});a[g].desired=a.require.audio&&!i||a.require.video&&!j}});this.html.support={}; this.flash.support={};c.each(this.formats,function(e,g){a.html.support[g]=a.html.canPlay[g]&&a.html.desired;a.flash.support[g]=a.flash.canPlay[g]&&a.flash.desired});this.html.used=false;this.flash.used=false;c.each(this.solutions,function(e,g){c.each(a.formats,function(i,j){if(a[g].support[j]){a[g].used=true;return false}})});this.html.used||this.flash.used||this._error({type:c.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SOLUTION, hint:c.jPlayer.errorHint.NO_SOLUTION});this.html.active=false;this.html.audio.gate=false;this.html.video.gate=false;this.flash.active=false;this.flash.gate=false;if(this.flash.used){var b="id="+escape(this.internal.self.id)+"&vol="+this.status.volume+"&muted="+this.status.muted;if(c.browser.msie&&Number(c.browser.version)<=8){var d='';f[1]='';f[2]='';f[3]='';f[4]='';b=document.createElement(d);for(d=0;d0?100*d/this.status.duration:0;if(typeof a.seekable==="object"&&a.seekable.length>0){e=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100;g=100*a.currentTime/a.seekable.end(a.seekable.length-1)}else{e=100;g=f}if(b)f=g=d=0;this.status.seekPercent=e;this.status.currentPercentRelative=g;this.status.currentPercentAbsolute=f;this.status.currentTime=d},_resetStatus:function(){this.status=c.extend({},this.status,c.jPlayer.prototype.status)}, _trigger:function(a,b,d){a=c.Event(a);a.jPlayer={};a.jPlayer.version=c.extend({},this.version);a.jPlayer.status=c.extend(true,{},this.status);a.jPlayer.html=c.extend(true,{},this.html);a.jPlayer.flash=c.extend(true,{},this.flash);if(b)a.jPlayer.error=c.extend({},b);if(d)a.jPlayer.warning=c.extend({},d);this.element.trigger(a)},jPlayerFlashEvent:function(a,b){if(a===c.jPlayer.event.ready&&!this.internal.ready){this.internal.ready=true;this.version.flash=b.version;this.version.needFlash!==this.version.flash&& this._error({type:c.jPlayer.error.VERSION,context:this.version.flash,message:c.jPlayer.errorMsg.VERSION+this.version.flash,hint:c.jPlayer.errorHint.VERSION});this._trigger(a)}if(this.flash.gate)switch(a){case c.jPlayer.event.progress:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.timeupdate:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.play:this._seeked();this._updateButtons(true);this._trigger(a);break;case c.jPlayer.event.pause:this._updateButtons(false); this._trigger(a);break;case c.jPlayer.event.ended:this._updateButtons(false);this._trigger(a);break;case c.jPlayer.event.error:this.status.waitForLoad=true;this.status.waitForPlay=true;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._error({type:c.jPlayer.error.URL, context:b.src,message:c.jPlayer.errorMsg.URL,hint:c.jPlayer.errorHint.URL});break;case c.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case c.jPlayer.event.seeked:this._seeked();this._trigger(a);break;default:this._trigger(a)}return false},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration}, _updateButtons:function(a){this.status.paused=!a;if(this.css.jq.play.length&&this.css.jq.pause.length)if(a){this.css.jq.play.hide();this.css.jq.pause.show()}else{this.css.jq.play.show();this.css.jq.pause.hide()}},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(c.jPlayer.convertTime(this.status.currentTime)); this.css.jq.duration.length&&this.css.jq.duration.text(c.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},setMedia:function(a){var b=this;this._seeked();clearTimeout(this.internal.htmlDlyCmdId);var d=this.html.audio.gate,f=this.html.video.gate,e=false;c.each(this.formats,function(g,i){var j=b.format[i].media==="video"; c.each(b.solutions,function(n,k){if(b[k].support[i]&&b._validString(a[i])){var l=k==="html";if(j)if(l){b.html.audio.gate=false;b.html.video.gate=true;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}else if(l){b.html.audio.gate=true;b.html.video.gate=false;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}if(b.flash.active||b.html.active&&b.flash.gate||d===b.html.audio.gate&&f===b.html.video.gate)b.clearMedia();else if(d!== b.html.audio.gate&&f!==b.html.video.gate){b._html_pause();b.status.video&&b.internal.video.jq.css({width:"0px",height:"0px"});b._resetStatus()}if(j){if(l){b._html_setVideo(a);b.html.active=true;b.flash.active=false}else{b._flash_setVideo(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&&b.css.jq.videoPlay.show();b.status.video=true}else{if(l){b._html_setAudio(a);b.html.active=true;b.flash.active=false}else{b._flash_setAudio(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&& b.css.jq.videoPlay.hide();b.status.video=false}e=true;return false}});if(e)return false});if(e){if(this._validString(a.poster))if(this.htmlElement.poster.src!==a.poster)this.htmlElement.poster.src=a.poster;else this.internal.poster.jq.show();else this.internal.poster.jq.hide();this.status.srcSet=true;this.status.media=c.extend({},a);this._updateButtons(false);this._updateInterface()}else{this.status.srcSet&&!this.status.waitForPlay&&this.pause();this.html.audio.gate=false;this.html.video.gate=false; this.flash.gate=false;this.html.active=false;this.flash.active=false;this._resetStatus();this._updateInterface();this._updateButtons(false);this.internal.poster.jq.hide();this.html.used&&this.require.video&&this.internal.video.jq.css({width:"0px",height:"0px"});this.flash.used&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._error({type:c.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SUPPORT,hint:c.jPlayer.errorHint.NO_SUPPORT})}}, clearMedia:function(){this._resetStatus();this._updateButtons(false);this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);if(this.html.active)this._html_clearMedia();else this.flash.active&&this._flash_clearMedia()},load:function(){if(this.status.srcSet)if(this.html.active)this._html_load();else this.flash.active&&this._flash_load();else this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_play(a);else this.flash.active&& this._flash_play(a);else this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_pause(a);else this.flash.active&&this._flash_pause(a);else this._urlNotSetError("pause")},pauseOthers:function(){var a=this;c.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){if(this.status.srcSet)if(this.html.active)this._html_pause(0);else this.flash.active&& this._flash_pause(0);else this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);if(this.status.srcSet)if(this.html.active)this._html_playHead(a);else this.flash.active&&this._flash_playHead(a);else this._urlNotSetError("playHead")},mute:function(){this.status.muted=true;this.html.used&&this._html_mute(true);this.flash.used&&this._flash_mute(true);this._updateMute(true);this._updateVolume(0);this._trigger(c.jPlayer.event.volumechange)},unmute:function(){this.status.muted=false; this.html.used&&this._html_mute(false);this.flash.used&&this._flash_mute(false);this._updateMute(false);this._updateVolume(this.status.volume);this._trigger(c.jPlayer.event.volumechange)},_updateMute:function(a){if(this.css.jq.mute.length&&this.css.jq.unmute.length)if(a){this.css.jq.mute.hide();this.css.jq.unmute.show()}else{this.css.jq.mute.show();this.css.jq.unmute.hide()}},volume:function(a){a=this._limitValue(a,0,1);this.status.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a); this.status.muted||this._updateVolume(a);this._trigger(c.jPlayer.event.volumechange)},volumeBar:function(a){if(!this.status.muted&&this.css.jq.volumeBar){var b=this.css.jq.volumeBar.offset();a=a.pageX-b.left;b=this.css.jq.volumeBar.width();this.volume(a/b)}},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.width(a*100+"%")},_volumeFix:function(a){var b=0.0010*Math.random();return a+(a<0.5?b:-b)},_cssSelectorAncestor:function(a, b){this.options.cssSelectorAncestor=a;b&&c.each(this.options.cssSelector,function(d,f){self._cssSelector(d,f)})},_cssSelector:function(a,b){var d=this;if(typeof b==="string")if(c.jPlayer.prototype.options.cssSelector[a]){this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer");this.options.cssSelector[a]=b;this.css.cs[a]=this.options.cssSelectorAncestor+" "+b;this.css.jq[a]=b?c(this.css.cs[a]):[];this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(f){d[a](f);c(this).blur(); return false});b&&this.css.jq[a].length!==1&&this._warning({type:c.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:c.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:c.jPlayer.warningHint.CSS_SELECTOR_COUNT})}else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:c.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:c.jPlayer.warningHint.CSS_SELECTOR_METHOD});else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_STRING, context:b,message:c.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:c.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset();a=a.pageX-b.left;b=this.css.jq.seekBar.width();this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},currentTime:function(){},duration:function(){},option:function(a,b){var d=a;if(arguments.length===0)return c.extend(true,{},this.options);if(typeof a==="string"){var f=a.split(".");if(b===h){for(var e=c.extend(true, {},this.options),g=0;g=9||this.htmlElement.media.load()}},_html_load:function(){if(this.status.waitForLoad){this.status.waitForLoad=false;this.htmlElement.media.src=this.status.src; try{this.htmlElement.media.load()}catch(a){}}clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load();this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime= a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime= a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}}},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume= a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4a":b._getMovie().fl_setAudio_m4a(a[e]);break;case "mp3":b._getMovie().fl_setAudio_mp3(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}}); if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4v":b._getMovie().fl_setVideo_m4v(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}});if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_clearMedia:function(){this.internal.flash.jq.css({width:"0px", height:"0px"});try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=false},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=false;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0){this.status.waitForLoad=false;this._flash_checkWaitForPlay()}}, _flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}}},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}}, _flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=false,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a);b=true}catch(f){}else if(navigator.plugins&&navigator.mimeTypes.length>0)if(d=navigator.plugins["Shockwave Flash"])if(navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a)b=true;return c.browser.msie&& Number(c.browser.version)>=9?false:b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return ad?d:a},_urlNotSetError:function(a){this._error({type:c.jPlayer.error.URL_NOT_SET,context:a,message:c.jPlayer.errorMsg.URL_NOT_SET,hint:c.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){this._error({type:c.jPlayer.error.FLASH,context:this.internal.flash.swf,message:c.jPlayer.errorMsg.FLASH+a.message,hint:c.jPlayer.errorHint.FLASH})},_error:function(a){this._trigger(c.jPlayer.event.error, a);if(this.options.errorAlerts)this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(c.jPlayer.event.warning,h,a);if(this.options.errorAlerts)this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)}};c.jPlayer.error={FLASH:"e_flash",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support", URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};c.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.", VERSION:"jPlayer "+c.jPlayer.prototype.version.script+" needs Jplayer.swf version "+c.jPlayer.prototype.version.needFlash+" but found "};c.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};c.jPlayer.warning= {CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};c.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of methodCssSelectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."}; c.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery);;/* VideoJS - HTML5 Video Player v2.0.2 This file is part of VideoJS. Copyright 2010 Zencoder, Inc. VideoJS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. VideoJS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with VideoJS. If not, see . */ // Self-executing function to prevent global vars and help with minification (function(window, undefined){ var document = window.document; // Using jresig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/ (function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})(); // Video JS Player Class var VideoJS = JRClass.extend({ // Initialize the player for the supplied video tag element // element: video tag init: function(element, setOptions){ // Allow an ID string or an element if (typeof element == 'string') { this.video = document.getElementById(element); } else { this.video = element; } // Store reference to player on the video element. // So you can acess the player later: document.getElementById("video_id").player.play(); this.video.player = this; this.values = {}; // Cache video values. this.elements = {}; // Store refs to controls elements. // Default Options this.options = { autoplay: false, preload: true, useBuiltInControls: false, // Use the browser's controls (iPhone) controlsBelow: false, // Display control bar below video vs. in front of controlsAtStart: false, // Make controls visible when page loads controlsHiding: true, // Hide controls when not over the video defaultVolume: 0.85, // Will be overridden by localStorage volume if available playerFallbackOrder: ["html5", "flash", "links"], // Players and order to use them flashPlayer: "htmlObject", flashPlayerVersion: false // Required flash version for fallback }; // Override default options with global options if (typeof VideoJS.options == "object") { _V_.merge(this.options, VideoJS.options); } // Override default & global options with options specific to this player if (typeof setOptions == "object") { _V_.merge(this.options, setOptions); } // Override preload & autoplay with video attributes if (this.getPreloadAttribute() !== undefined) { this.options.preload = this.getPreloadAttribute(); } if (this.getAutoplayAttribute() !== undefined) { this.options.autoplay = this.getAutoplayAttribute(); } // Store reference to embed code pieces this.box = this.video.parentNode; this.linksFallback = this.getLinksFallback(); this.hideLinksFallback(); // Will be shown again if "links" player is used // Loop through the player names list in options, "html5" etc. // For each player name, initialize the player with that name under VideoJS.players // If the player successfully initializes, we're done // If not, try the next player in the list this.each(this.options.playerFallbackOrder, function(playerType){ if (this[playerType+"Supported"]()) { // Check if player type is supported this[playerType+"Init"](); // Initialize player type return true; // Stop looping though players } }); // Start Global Listeners - API doesn't exist before now this.activateElement(this, "player"); this.activateElement(this.box, "box"); }, /* Behaviors ================================================================================ */ behaviors: {}, newBehavior: function(name, activate, functions){ this.behaviors[name] = activate; this.extend(functions); }, activateElement: function(element, behavior){ // Allow passing and ID string if (typeof element == "string") { element = document.getElementById(element); } this.behaviors[behavior].call(this, element); }, /* Errors/Warnings ================================================================================ */ errors: [], // Array to track errors warnings: [], warning: function(warning){ this.warnings.push(warning); this.log(warning); }, /* History of errors/events (not quite there yet) ================================================================================ */ history: [], log: function(event){ if (!event) { return; } if (typeof event == "string") { event = { type: event }; } if (event.type) { this.history.push(event.type); } if (this.history.length >= 50) { this.history.shift(); } try { console.log(event.type); } catch(e) { try { opera.postError(event.type); } catch(e){} } }, /* Local Storage ================================================================================ */ setLocalStorage: function(key, value){ if (!localStorage) { return; } try { localStorage[key] = value; } catch(e) { if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014 this.warning(VideoJS.warnings.localStorageFull); } } }, /* Helpers ================================================================================ */ getPreloadAttribute: function(){ if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload")) { var preload = this.video.getAttribute("preload"); // Only included the attribute, thinking it was boolean if (preload === "" || preload === "true") { return "auto"; } if (preload === "false") { return "none"; } return preload; } }, getAutoplayAttribute: function(){ if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("autoplay")) { var autoplay = this.video.getAttribute("autoplay"); if (autoplay === "false") { return false; } return true; } }, // Calculates amoutn of buffer is full bufferedPercent: function(){ return (this.duration()) ? this.buffered()[1] / this.duration() : 0; }, // Each that maintains player as context // Break if true is returned each: function(arr, fn){ if (!arr || arr.length === 0) { return; } for (var i=0,j=arr.length; i= playerVersion; } }); VideoJS.flashPlayers = {}; VideoJS.flashPlayers.htmlObject = { flashPlayerVersion: 9, init: function() { return true; }, api: { // No video API available with HTML Object embed method width: function(width){ if (width !== undefined) { this.element.width = width; this.box.style.width = width+"px"; this.triggerResizeListeners(); return this; } return this.element.width; }, height: function(height){ if (height !== undefined) { this.element.height = height; this.box.style.height = height+"px"; this.triggerResizeListeners(); return this; } return this.element.height; } } }; /* Download Links Fallback (Player Type) ================================================================================ */ VideoJS.player.extend({ linksSupported: function(){ return true; }, linksInit: function(){ this.showLinksFallback(); this.element = this.video; }, // Get the download links block element getLinksFallback: function(){ return this.box.getElementsByTagName("P")[0]; }, // Hide no-video download paragraph hideLinksFallback: function(){ if (this.linksFallback) { this.linksFallback.style.display = "none"; } }, // Hide no-video download paragraph showLinksFallback: function(){ if (this.linksFallback) { this.linksFallback.style.display = "block"; } } }); //////////////////////////////////////////////////////////////////////////////// // Class Methods // Functions that don't apply to individual videos. //////////////////////////////////////////////////////////////////////////////// // Combine Objects - Use "safe" to protect from overwriting existing items VideoJS.merge = function(obj1, obj2, safe){ for (var attrname in obj2){ if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; } } return obj1; }; VideoJS.extend = function(obj){ this.merge(this, obj, true); }; VideoJS.extend({ // Add VideoJS to all video tags with the video-js class when the DOM is ready setupAllWhenReady: function(options){ // Options is stored globally, and added ot any new player on init VideoJS.options = options; VideoJS.DOMReady(VideoJS.setup); }, // Run the supplied function when the DOM is ready DOMReady: function(fn){ VideoJS.addToDOMReady(fn); }, // Set up a specific video or array of video elements // "video" can be: // false, undefined, or "All": set up all videos with the video-js class // A video tag ID or video tag element: set up one video and return one player // An array of video tag elements/IDs: set up each and return an array of players setup: function(videos, options){ var returnSingular = false, playerList = [], videoElement; // If videos is undefined or "All", set up all videos with the video-js class if (!videos || videos == "All") { videos = VideoJS.getVideoJSTags(); // If videos is not an array, add to an array } else if (typeof videos != 'object' || videos.nodeType == 1) { videos = [videos]; returnSingular = true; } // Loop through videos and create players for them for (var i=0; i 0) { var newBufferEnd = (event.loaded / event.total) * this.duration(); if (newBufferEnd > this.values.bufferEnd) { this.values.bufferEnd = newBufferEnd; } } }, iOSInterface: function(){ if(VideoJS.iOSVersion() < 4) { this.forceTheSource(); } // Fix loading issues if(VideoJS.isIPad()) { // iPad could work with controlsBelow this.buildAndActivateSpinner(); // Spinner still works well on iPad, since iPad doesn't have one } }, // Fix android specific quirks // Use built-in controls, but add the big play button, since android doesn't have one. androidInterface: function(){ this.forceTheSource(); // Fix loading issues _V_.addListener(this.video, "click", function(){ this.play(); }); // Required to play this.buildBigPlayButton(); // But don't activate the normal way. Pause doesn't work right on android. _V_.addListener(this.bigPlayButton, "click", function(){ this.play(); }.context(this)); this.positionBox(); this.showBigPlayButtons(); }, /* Wait for styles (TODO: move to _V_) ================================================================================ */ loadInterface: function(){ if(!this.stylesHaveLoaded()) { // Don't want to create an endless loop either. if (!this.positionRetries) { this.positionRetries = 1; } if (this.positionRetries++ < 100) { setTimeout(this.loadInterface.context(this),10); return; } } this.hideStylesCheckDiv(); this.showPoster(); if (this.video.paused !== false) { this.showBigPlayButtons(); } if (this.options.controlsAtStart) { this.showControlBars(); } this.positionAll(); }, /* Control Bar ================================================================================ */ buildAndActivateControlBar: function(){ /* Creating this HTML
    00:00 / 00:00
    */ // Create a div to hold the different controls this.controls = _V_.createElement("div", { className: "vjs-controls" }); // Add the controls to the video's container this.box.appendChild(this.controls); this.activateElement(this.controls, "controlBar"); this.activateElement(this.controls, "mouseOverVideoReporter"); // Build the play control this.playControl = _V_.createElement("div", { className: "vjs-play-control", innerHTML: "" }); this.controls.appendChild(this.playControl); this.activateElement(this.playControl, "playToggle"); // Build the progress control this.progressControl = _V_.createElement("div", { className: "vjs-progress-control" }); this.controls.appendChild(this.progressControl); // Create a holder for the progress bars this.progressHolder = _V_.createElement("div", { className: "vjs-progress-holder" }); this.progressControl.appendChild(this.progressHolder); this.activateElement(this.progressHolder, "currentTimeScrubber"); // Create the loading progress display this.loadProgressBar = _V_.createElement("div", { className: "vjs-load-progress" }); this.progressHolder.appendChild(this.loadProgressBar); this.activateElement(this.loadProgressBar, "loadProgressBar"); // Create the playing progress display this.playProgressBar = _V_.createElement("div", { className: "vjs-play-progress" }); this.progressHolder.appendChild(this.playProgressBar); this.activateElement(this.playProgressBar, "playProgressBar"); // Create the progress time display (00:00 / 00:00) this.timeControl = _V_.createElement("div", { className: "vjs-time-control" }); this.controls.appendChild(this.timeControl); // Create the current play time display this.currentTimeDisplay = _V_.createElement("span", { className: "vjs-current-time-display", innerHTML: "00:00" }); this.timeControl.appendChild(this.currentTimeDisplay); this.activateElement(this.currentTimeDisplay, "currentTimeDisplay"); // Add time separator this.timeSeparator = _V_.createElement("span", { innerHTML: " / " }); this.timeControl.appendChild(this.timeSeparator); // Create the total duration display this.durationDisplay = _V_.createElement("span", { className: "vjs-duration-display", innerHTML: "00:00" }); this.timeControl.appendChild(this.durationDisplay); this.activateElement(this.durationDisplay, "durationDisplay"); // Create the volumne control this.volumeControl = _V_.createElement("div", { className: "vjs-volume-control", innerHTML: "
    " }); this.controls.appendChild(this.volumeControl); this.activateElement(this.volumeControl, "volumeScrubber"); this.volumeDisplay = this.volumeControl.children[0]; this.activateElement(this.volumeDisplay, "volumeDisplay"); // Crete the fullscreen control this.fullscreenControl = _V_.createElement("div", { className: "vjs-fullscreen-control", innerHTML: "
    " }); this.controls.appendChild(this.fullscreenControl); this.activateElement(this.fullscreenControl, "fullscreenToggle"); }, /* Poster Image ================================================================================ */ buildAndActivatePoster: function(){ this.updatePosterSource(); if (this.video.poster) { this.poster = document.createElement("img"); // Add poster to video box this.box.appendChild(this.poster); // Add poster image data this.poster.src = this.video.poster; // Add poster styles this.poster.className = "vjs-poster"; this.activateElement(this.poster, "poster"); } else { this.poster = false; } }, /* Big Play Button ================================================================================ */ buildBigPlayButton: function(){ /* Creating this HTML
    */ this.bigPlayButton = _V_.createElement("div", { className: "vjs-big-play-button", innerHTML: "" }); this.box.appendChild(this.bigPlayButton); this.activateElement(this.bigPlayButton, "bigPlayButton"); }, /* Spinner (Loading) ================================================================================ */ buildAndActivateSpinner: function(){ this.spinner = _V_.createElement("div", { className: "vjs-spinner", innerHTML: "
    " }); this.box.appendChild(this.spinner); this.activateElement(this.spinner, "spinner"); }, /* Styles Check - Check if styles are loaded (move ot _V_) ================================================================================ */ // Sometimes the CSS styles haven't been applied to the controls yet // when we're trying to calculate the height and position them correctly. // This causes a flicker where the controls are out of place. buildStylesCheckDiv: function(){ this.stylesCheckDiv = _V_.createElement("div", { className: "vjs-styles-check" }); this.stylesCheckDiv.style.position = "absolute"; this.box.appendChild(this.stylesCheckDiv); }, hideStylesCheckDiv: function(){ this.stylesCheckDiv.style.display = "none"; }, stylesHaveLoaded: function(){ if (this.stylesCheckDiv.offsetHeight != 5) { return false; } else { return true; } }, /* VideoJS Box - Holds all elements ================================================================================ */ positionAll: function(){ this.positionBox(); this.positionControlBars(); this.positionPoster(); }, positionBox: function(){ // Set width based on fullscreen or not. if (this.videoIsFullScreen) { this.box.style.width = ""; this.element.style.height=""; if (this.options.controlsBelow) { this.box.style.height = ""; this.element.style.height = (this.box.offsetHeight - this.controls.offsetHeight) + "px"; } } else { this.box.style.width = this.width() + "px"; this.element.style.height=this.height()+"px"; if (this.options.controlsBelow) { this.element.style.height = ""; // this.box.style.height = this.video.offsetHeight + this.controls.offsetHeight + "px"; } } }, /* Subtitles ================================================================================ */ getSubtitles: function(){ var tracks = this.video.getElementsByTagName("TRACK"); for (var i=0,j=tracks.length; i "); subtitle.start = this.parseSubtitleTime(time[0]); subtitle.end = this.parseSubtitleTime(time[1]); // Additional lines - Subtitle Text text = []; for (var j=i; j'); // Add this subtitle this.subtitles.push(subtitle); } } }, parseSubtitleTime: function(timeText) { var parts = timeText.split(':'), time = 0; // hours => seconds time += parseFloat(parts[0])*60*60; // minutes => seconds time += parseFloat(parts[1])*60; // get seconds var seconds = parts[2].split(/\.|,/); // Either . or , time += parseFloat(seconds[0]); // add miliseconds ms = parseFloat(seconds[1]); if (ms) { time += ms/1000; } return time; }, buildSubtitles: function(){ /* Creating this HTML
    */ this.subtitlesDisplay = _V_.createElement("div", { className: 'vjs-subtitles' }); this.box.appendChild(this.subtitlesDisplay); this.activateElement(this.subtitlesDisplay, "subtitlesDisplay"); }, /* Player API - Translate functionality from player to video ================================================================================ */ addVideoListener: function(type, fn){ _V_.addListener(this.video, type, fn.rEvtContext(this)); }, play: function(){ this.video.play(); return this; }, onPlay: function(fn){ this.addVideoListener("play", fn); return this; }, pause: function(){ this.video.pause(); return this; }, onPause: function(fn){ this.addVideoListener("pause", fn); return this; }, paused: function() { return this.video.paused; }, currentTime: function(seconds){ if (seconds !== undefined) { try { this.video.currentTime = seconds; } catch(e) { this.warning(VideoJS.warnings.videoNotReady); } this.values.currentTime = seconds; return this; } return this.video.currentTime; }, onCurrentTimeUpdate: function(fn){ this.currentTimeListeners.push(fn); }, duration: function(){ return this.video.duration; }, buffered: function(){ // Storing values allows them be overridden by setBufferedFromProgress if (this.values.bufferStart === undefined) { this.values.bufferStart = 0; this.values.bufferEnd = 0; } if (this.video.buffered && this.video.buffered.length > 0) { var newEnd = this.video.buffered.end(0); if (newEnd > this.values.bufferEnd) { this.values.bufferEnd = newEnd; } } return [this.values.bufferStart, this.values.bufferEnd]; }, volume: function(percentAsDecimal){ if (percentAsDecimal !== undefined) { // Force value to between 0 and 1 this.values.volume = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); this.video.volume = this.values.volume; this.setLocalStorage("volume", this.values.volume); return this; } if (this.values.volume) { return this.values.volume; } return this.video.volume; }, onVolumeChange: function(fn){ _V_.addListener(this.video, 'volumechange', fn.rEvtContext(this)); }, width: function(width){ if (width !== undefined) { this.video.width = width; // Not using style so it can be overridden on fullscreen. this.box.style.width = width+"px"; this.triggerResizeListeners(); return this; } return this.video.offsetWidth; }, height: function(height){ if (height !== undefined) { this.video.height = height; this.box.style.height = height+"px"; this.triggerResizeListeners(); return this; } return this.video.offsetHeight; }, supportsFullScreen: function(){ if(typeof this.video.webkitEnterFullScreen == 'function') { // Seems to be broken in Chromium/Chrome if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) { return true; } } return false; }, html5EnterNativeFullScreen: function(){ try { this.video.webkitEnterFullScreen(); } catch (e) { if (e.code == 11) { this.warning(VideoJS.warnings.videoNotReady); } } return this; }, // Turn on fullscreen (window) mode // Real fullscreen isn't available in browsers quite yet. enterFullScreen: function(){ if (this.supportsFullScreen()) { this.html5EnterNativeFullScreen(); } else { this.enterFullWindow(); } }, exitFullScreen: function(){ if (this.supportsFullScreen()) { // Shouldn't be called } else { this.exitFullWindow(); } }, enterFullWindow: function(){ this.videoIsFullScreen = true; // Storing original doc overflow value to return to when fullscreen is off this.docOrigOverflow = document.documentElement.style.overflow; // Add listener for esc key to exit fullscreen _V_.addListener(document, "keydown", this.fullscreenOnEscKey.rEvtContext(this)); // Add listener for a window resize _V_.addListener(window, "resize", this.fullscreenOnWindowResize.rEvtContext(this)); // Hide any scroll bars document.documentElement.style.overflow = 'hidden'; // Apply fullscreen styles _V_.addClass(this.box, "vjs-fullscreen"); // Resize the box, controller, and poster this.positionAll(); }, // Turn off fullscreen (window) mode exitFullWindow: function(){ this.videoIsFullScreen = false; document.removeEventListener("keydown", this.fullscreenOnEscKey, false); window.removeEventListener("resize", this.fullscreenOnWindowResize, false); // Unhide scroll bars. document.documentElement.style.overflow = this.docOrigOverflow; // Remove fullscreen styles _V_.removeClass(this.box, "vjs-fullscreen"); // Resize the box, controller, and poster to original sizes this.positionAll(); }, onError: function(fn){ this.addVideoListener("error", fn); return this; }, onEnded: function(fn){ this.addVideoListener("ended", fn); return this; } }); //////////////////////////////////////////////////////////////////////////////// // Element Behaviors // Tell elements how to act or react //////////////////////////////////////////////////////////////////////////////// /* Player Behaviors - How VideoJS reacts to what the video is doing. ================================================================================ */ VideoJS.player.newBehavior("player", function(player){ this.onError(this.playerOnVideoError); // Listen for when the video is played this.onPlay(this.playerOnVideoPlay); this.onPlay(this.trackCurrentTime); // Listen for when the video is paused this.onPause(this.playerOnVideoPause); this.onPause(this.stopTrackingCurrentTime); // Listen for when the video ends this.onEnded(this.playerOnVideoEnded); // Set interval for load progress using buffer watching method // this.trackCurrentTime(); this.trackBuffered(); // Buffer Full this.onBufferedUpdate(this.isBufferFull); },{ playerOnVideoError: function(event){ this.log(event); this.log(this.video.error); }, playerOnVideoPlay: function(event){ this.hasPlayed = true; }, playerOnVideoPause: function(event){}, playerOnVideoEnded: function(event){ this.currentTime(0); this.pause(); }, /* Load Tracking -------------------------------------------------------------- */ // Buffer watching method for load progress. // Used for browsers that don't support the progress event trackBuffered: function(){ this.bufferedInterval = setInterval(this.triggerBufferedListeners.context(this), 500); }, stopTrackingBuffered: function(){ clearInterval(this.bufferedInterval); }, bufferedListeners: [], onBufferedUpdate: function(fn){ this.bufferedListeners.push(fn); }, triggerBufferedListeners: function(){ this.isBufferFull(); this.each(this.bufferedListeners, function(listener){ (listener.context(this))(); }); }, isBufferFull: function(){ if (this.bufferedPercent() == 1) { this.stopTrackingBuffered(); } }, /* Time Tracking -------------------------------------------------------------- */ trackCurrentTime: function(){ if (this.currentTimeInterval) { clearInterval(this.currentTimeInterval); } this.currentTimeInterval = setInterval(this.triggerCurrentTimeListeners.context(this), 100); // 42 = 24 fps this.trackingCurrentTime = true; }, // Turn off play progress tracking (when paused or dragging) stopTrackingCurrentTime: function(){ clearInterval(this.currentTimeInterval); this.trackingCurrentTime = false; }, currentTimeListeners: [], // onCurrentTimeUpdate is in API section now triggerCurrentTimeListeners: function(late, newTime){ // FF passes milliseconds late as the first argument this.each(this.currentTimeListeners, function(listener){ (listener.context(this))(newTime || this.currentTime()); }); }, /* Resize Tracking -------------------------------------------------------------- */ resizeListeners: [], onResize: function(fn){ this.resizeListeners.push(fn); }, // Trigger anywhere the video/box size is changed. triggerResizeListeners: function(){ this.each(this.resizeListeners, function(listener){ (listener.context(this))(); }); } } ); /* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location ================================================================================ */ VideoJS.player.newBehavior("mouseOverVideoReporter", function(element){ // Listen for the mouse move the video. Used to reveal the controller. _V_.addListener(element, "mousemove", this.mouseOverVideoReporterOnMouseMove.context(this)); // Listen for the mouse moving out of the video. Used to hide the controller. _V_.addListener(element, "mouseout", this.mouseOverVideoReporterOnMouseOut.context(this)); },{ mouseOverVideoReporterOnMouseMove: function(){ this.showControlBars(); clearInterval(this.mouseMoveTimeout); this.mouseMoveTimeout = setTimeout(this.hideControlBars.context(this), 4000); }, mouseOverVideoReporterOnMouseOut: function(event){ // Prevent flicker by making sure mouse hasn't left the video var parent = event.relatedTarget; while (parent && parent !== this.box) { parent = parent.parentNode; } if (parent !== this.box) { this.hideControlBars(); } } } ); /* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location ================================================================================ */ VideoJS.player.newBehavior("box", function(element){ this.positionBox(); _V_.addClass(element, "vjs-paused"); this.activateElement(element, "mouseOverVideoReporter"); this.onPlay(this.boxOnVideoPlay); this.onPause(this.boxOnVideoPause); },{ boxOnVideoPlay: function(){ _V_.removeClass(this.box, "vjs-paused"); _V_.addClass(this.box, "vjs-playing"); }, boxOnVideoPause: function(){ _V_.removeClass(this.box, "vjs-playing"); _V_.addClass(this.box, "vjs-paused"); } } ); /* Poster Image Overlay ================================================================================ */ VideoJS.player.newBehavior("poster", function(element){ this.activateElement(element, "mouseOverVideoReporter"); this.activateElement(element, "playButton"); this.onPlay(this.hidePoster); this.onEnded(this.showPoster); this.onResize(this.positionPoster); },{ showPoster: function(){ if (!this.poster) { return; } this.poster.style.display = "block"; this.positionPoster(); }, positionPoster: function(){ // Only if the poster is visible if (!this.poster || this.poster.style.display == 'none') { return; } this.poster.style.height = this.height() + "px"; // Need incase controlsBelow this.poster.style.width = this.width() + "px"; // Could probably do 100% of box }, hidePoster: function(){ if (!this.poster) { return; } this.poster.style.display = "none"; }, // Update poster source from attribute or fallback image // iPad breaks if you include a poster attribute, so this fixes that updatePosterSource: function(){ if (!this.video.poster) { var images = this.video.getElementsByTagName("img"); if (images.length > 0) { this.video.poster = images[0].src; } } } } ); /* Control Bar Behaviors ================================================================================ */ VideoJS.player.newBehavior("controlBar", function(element){ if (!this.controlBars) { this.controlBars = []; this.onResize(this.positionControlBars); } this.controlBars.push(element); _V_.addListener(element, "mousemove", this.onControlBarsMouseMove.context(this)); _V_.addListener(element, "mouseout", this.onControlBarsMouseOut.context(this)); },{ showControlBars: function(){ if (!this.options.controlsAtStart && !this.hasPlayed) { return; } this.each(this.controlBars, function(bar){ bar.style.display = "block"; }); }, // Place controller relative to the video's position (now just resizing bars) positionControlBars: function(){ this.updatePlayProgressBars(); this.updateLoadProgressBars(); }, hideControlBars: function(){ if (this.options.controlsHiding && !this.mouseIsOverControls) { this.each(this.controlBars, function(bar){ bar.style.display = "none"; }); } }, // Block controls from hiding when mouse is over them. onControlBarsMouseMove: function(){ this.mouseIsOverControls = true; }, onControlBarsMouseOut: function(event){ this.mouseIsOverControls = false; } } ); /* PlayToggle, PlayButton, PauseButton Behaviors ================================================================================ */ // Play Toggle VideoJS.player.newBehavior("playToggle", function(element){ if (!this.elements.playToggles) { this.elements.playToggles = []; this.onPlay(this.playTogglesOnPlay); this.onPause(this.playTogglesOnPause); } this.elements.playToggles.push(element); _V_.addListener(element, "click", this.onPlayToggleClick.context(this)); },{ onPlayToggleClick: function(event){ if (this.paused()) { this.play(); } else { this.pause(); } }, playTogglesOnPlay: function(event){ this.each(this.elements.playToggles, function(toggle){ _V_.removeClass(toggle, "vjs-paused"); _V_.addClass(toggle, "vjs-playing"); }); }, playTogglesOnPause: function(event){ this.each(this.elements.playToggles, function(toggle){ _V_.removeClass(toggle, "vjs-playing"); _V_.addClass(toggle, "vjs-paused"); }); } } ); // Play VideoJS.player.newBehavior("playButton", function(element){ _V_.addListener(element, "click", this.onPlayButtonClick.context(this)); },{ onPlayButtonClick: function(event){ this.play(); } } ); // Pause VideoJS.player.newBehavior("pauseButton", function(element){ _V_.addListener(element, "click", this.onPauseButtonClick.context(this)); },{ onPauseButtonClick: function(event){ this.pause(); } } ); /* Play Progress Bar Behaviors ================================================================================ */ VideoJS.player.newBehavior("playProgressBar", function(element){ if (!this.playProgressBars) { this.playProgressBars = []; this.onCurrentTimeUpdate(this.updatePlayProgressBars); } this.playProgressBars.push(element); },{ // Ajust the play progress bar's width based on the current play time updatePlayProgressBars: function(newTime){ var progress = (newTime !== undefined) ? newTime / this.duration() : this.currentTime() / this.duration(); if (isNaN(progress)) { progress = 0; } this.each(this.playProgressBars, function(bar){ if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; } }); } } ); /* Load Progress Bar Behaviors ================================================================================ */ VideoJS.player.newBehavior("loadProgressBar", function(element){ if (!this.loadProgressBars) { this.loadProgressBars = []; } this.loadProgressBars.push(element); this.onBufferedUpdate(this.updateLoadProgressBars); },{ updateLoadProgressBars: function(){ this.each(this.loadProgressBars, function(bar){ if (bar.style) { bar.style.width = _V_.round(this.bufferedPercent() * 100, 2) + "%"; } }); } } ); /* Current Time Display Behaviors ================================================================================ */ VideoJS.player.newBehavior("currentTimeDisplay", function(element){ if (!this.currentTimeDisplays) { this.currentTimeDisplays = []; this.onCurrentTimeUpdate(this.updateCurrentTimeDisplays); } this.currentTimeDisplays.push(element); },{ // Update the displayed time (00:00) updateCurrentTimeDisplays: function(newTime){ if (!this.currentTimeDisplays) { return; } // Allows for smooth scrubbing, when player can't keep up. var time = (newTime) ? newTime : this.currentTime(); this.each(this.currentTimeDisplays, function(dis){ dis.innerHTML = _V_.formatTime(time); }); } } ); /* Duration Display Behaviors ================================================================================ */ VideoJS.player.newBehavior("durationDisplay", function(element){ if (!this.durationDisplays) { this.durationDisplays = []; this.onCurrentTimeUpdate(this.updateDurationDisplays); } this.durationDisplays.push(element); },{ updateDurationDisplays: function(){ if (!this.durationDisplays) { return; } this.each(this.durationDisplays, function(dis){ if (this.duration()) { dis.innerHTML = _V_.formatTime(this.duration()); } }); } } ); /* Current Time Scrubber Behaviors ================================================================================ */ VideoJS.player.newBehavior("currentTimeScrubber", function(element){ _V_.addListener(element, "mousedown", this.onCurrentTimeScrubberMouseDown.rEvtContext(this)); },{ // Adjust the play position when the user drags on the progress bar onCurrentTimeScrubberMouseDown: function(event, scrubber){ event.preventDefault(); this.currentScrubber = scrubber; this.stopTrackingCurrentTime(); // Allows for smooth scrubbing this.videoWasPlaying = !this.paused(); this.pause(); _V_.blockTextSelection(); this.setCurrentTimeWithScrubber(event); _V_.addListener(document, "mousemove", this.onCurrentTimeScrubberMouseMove.rEvtContext(this)); _V_.addListener(document, "mouseup", this.onCurrentTimeScrubberMouseUp.rEvtContext(this)); }, onCurrentTimeScrubberMouseMove: function(event){ // Removeable this.setCurrentTimeWithScrubber(event); }, onCurrentTimeScrubberMouseUp: function(event){ // Removeable _V_.unblockTextSelection(); document.removeEventListener("mousemove", this.onCurrentTimeScrubberMouseMove, false); document.removeEventListener("mouseup", this.onCurrentTimeScrubberMouseUp, false); if (this.videoWasPlaying) { this.play(); this.trackCurrentTime(); } }, setCurrentTimeWithScrubber: function(event){ var newProgress = _V_.getRelativePosition(event.pageX, this.currentScrubber); var newTime = newProgress * this.duration(); this.triggerCurrentTimeListeners(0, newTime); // Allows for smooth scrubbing // Don't let video end while scrubbing. if (newTime == this.duration()) { newTime = newTime - 0.1; } this.currentTime(newTime); } } ); /* Volume Display Behaviors ================================================================================ */ VideoJS.player.newBehavior("volumeDisplay", function(element){ if (!this.volumeDisplays) { this.volumeDisplays = []; this.onVolumeChange(this.updateVolumeDisplays); } this.volumeDisplays.push(element); this.updateVolumeDisplay(element); // Set the display to the initial volume },{ // Update the volume control display // Unique to these default controls. Uses borders to create the look of bars. updateVolumeDisplays: function(){ if (!this.volumeDisplays) { return; } this.each(this.volumeDisplays, function(dis){ this.updateVolumeDisplay(dis); }); }, updateVolumeDisplay: function(display){ var volNum = Math.ceil(this.volume() * 6); this.each(display.children, function(child, num){ if (num < volNum) { _V_.addClass(child, "vjs-volume-level-on"); } else { _V_.removeClass(child, "vjs-volume-level-on"); } }); } } ); /* Volume Scrubber Behaviors ================================================================================ */ VideoJS.player.newBehavior("volumeScrubber", function(element){ _V_.addListener(element, "mousedown", this.onVolumeScrubberMouseDown.rEvtContext(this)); },{ // Adjust the volume when the user drags on the volume control onVolumeScrubberMouseDown: function(event, scrubber){ // event.preventDefault(); _V_.blockTextSelection(); this.currentScrubber = scrubber; this.setVolumeWithScrubber(event); _V_.addListener(document, "mousemove", this.onVolumeScrubberMouseMove.rEvtContext(this)); _V_.addListener(document, "mouseup", this.onVolumeScrubberMouseUp.rEvtContext(this)); }, onVolumeScrubberMouseMove: function(event){ this.setVolumeWithScrubber(event); }, onVolumeScrubberMouseUp: function(event){ this.setVolumeWithScrubber(event); _V_.unblockTextSelection(); document.removeEventListener("mousemove", this.onVolumeScrubberMouseMove, false); document.removeEventListener("mouseup", this.onVolumeScrubberMouseUp, false); }, setVolumeWithScrubber: function(event){ var newVol = _V_.getRelativePosition(event.pageX, this.currentScrubber); this.volume(newVol); } } ); /* Fullscreen Toggle Behaviors ================================================================================ */ VideoJS.player.newBehavior("fullscreenToggle", function(element){ _V_.addListener(element, "click", this.onFullscreenToggleClick.context(this)); },{ // When the user clicks on the fullscreen button, update fullscreen setting onFullscreenToggleClick: function(event){ if (!this.videoIsFullScreen) { this.enterFullScreen(); } else { this.exitFullScreen(); } }, fullscreenOnWindowResize: function(event){ // Removeable this.positionControlBars(); }, // Create listener for esc key while in full screen mode fullscreenOnEscKey: function(event){ // Removeable if (event.keyCode == 27) { this.exitFullScreen(); } } } ); /* Big Play Button Behaviors ================================================================================ */ VideoJS.player.newBehavior("bigPlayButton", function(element){ if (!this.elements.bigPlayButtons) { this.elements.bigPlayButtons = []; this.onPlay(this.bigPlayButtonsOnPlay); this.onEnded(this.bigPlayButtonsOnEnded); } this.elements.bigPlayButtons.push(element); this.activateElement(element, "playButton"); },{ bigPlayButtonsOnPlay: function(event){ this.hideBigPlayButtons(); }, bigPlayButtonsOnEnded: function(event){ this.showBigPlayButtons(); }, showBigPlayButtons: function(){ this.each(this.elements.bigPlayButtons, function(element){ element.style.display = "block"; }); }, hideBigPlayButtons: function(){ this.each(this.elements.bigPlayButtons, function(element){ element.style.display = "none"; }); } } ); /* Spinner ================================================================================ */ VideoJS.player.newBehavior("spinner", function(element){ if (!this.spinners) { this.spinners = []; _V_.addListener(this.video, "loadeddata", this.spinnersOnVideoLoadedData.context(this)); _V_.addListener(this.video, "loadstart", this.spinnersOnVideoLoadStart.context(this)); _V_.addListener(this.video, "seeking", this.spinnersOnVideoSeeking.context(this)); _V_.addListener(this.video, "seeked", this.spinnersOnVideoSeeked.context(this)); _V_.addListener(this.video, "canplay", this.spinnersOnVideoCanPlay.context(this)); _V_.addListener(this.video, "canplaythrough", this.spinnersOnVideoCanPlayThrough.context(this)); _V_.addListener(this.video, "waiting", this.spinnersOnVideoWaiting.context(this)); _V_.addListener(this.video, "stalled", this.spinnersOnVideoStalled.context(this)); _V_.addListener(this.video, "suspend", this.spinnersOnVideoSuspend.context(this)); _V_.addListener(this.video, "playing", this.spinnersOnVideoPlaying.context(this)); _V_.addListener(this.video, "timeupdate", this.spinnersOnVideoTimeUpdate.context(this)); } this.spinners.push(element); },{ showSpinners: function(){ this.each(this.spinners, function(spinner){ spinner.style.display = "block"; }); clearInterval(this.spinnerInterval); this.spinnerInterval = setInterval(this.rotateSpinners.context(this), 100); }, hideSpinners: function(){ this.each(this.spinners, function(spinner){ spinner.style.display = "none"; }); clearInterval(this.spinnerInterval); }, spinnersRotated: 0, rotateSpinners: function(){ this.each(this.spinners, function(spinner){ // spinner.style.transform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)'; spinner.style.WebkitTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)'; spinner.style.MozTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)'; }); if (this.spinnersRotated == 360) { this.spinnersRotated = 0; } this.spinnersRotated += 45; }, spinnersOnVideoLoadedData: function(event){ this.hideSpinners(); }, spinnersOnVideoLoadStart: function(event){ this.showSpinners(); }, spinnersOnVideoSeeking: function(event){ /* this.showSpinners(); */ }, spinnersOnVideoSeeked: function(event){ /* this.hideSpinners(); */ }, spinnersOnVideoCanPlay: function(event){ /* this.hideSpinners(); */ }, spinnersOnVideoCanPlayThrough: function(event){ this.hideSpinners(); }, spinnersOnVideoWaiting: function(event){ // Safari sometimes triggers waiting inappropriately // Like after video has played, any you play again. this.showSpinners(); }, spinnersOnVideoStalled: function(event){}, spinnersOnVideoSuspend: function(event){}, spinnersOnVideoPlaying: function(event){ this.hideSpinners(); }, spinnersOnVideoTimeUpdate: function(event){ // Safari sometimes calls waiting and doesn't recover if(this.spinner.style.display == "block") { this.hideSpinners(); } } } ); /* Subtitles ================================================================================ */ VideoJS.player.newBehavior("subtitlesDisplay", function(element){ if (!this.subtitleDisplays) { this.subtitleDisplays = []; this.onCurrentTimeUpdate(this.subtitleDisplaysOnVideoTimeUpdate); this.onEnded(function() { this.lastSubtitleIndex = 0; }.context(this)); } this.subtitleDisplays.push(element); },{ subtitleDisplaysOnVideoTimeUpdate: function(time){ // Assuming all subtitles are in order by time, and do not overlap if (this.subtitles) { // If current subtitle should stay showing, don't do anything. Otherwise, find new subtitle. if (!this.currentSubtitle || this.currentSubtitle.start >= time || this.currentSubtitle.end < time) { var newSubIndex = false, // Loop in reverse if lastSubtitle is after current time (optimization) // Meaning the user is scrubbing in reverse or rewinding reverse = (this.subtitles[this.lastSubtitleIndex].start > time), // If reverse, step back 1 becase we know it's not the lastSubtitle i = this.lastSubtitleIndex - (reverse) ? 1 : 0; while (true) { // Loop until broken if (reverse) { // Looping in reverse // Stop if no more, or this subtitle ends before the current time (no earlier subtitles should apply) if (i < 0 || this.subtitles[i].end < time) { break; } // End is greater than time, so if start is less, show this subtitle if (this.subtitles[i].start < time) { newSubIndex = i; break; } i--; } else { // Looping forward // Stop if no more, or this subtitle starts after time (no later subtitles should apply) if (i >= this.subtitles.length || this.subtitles[i].start > time) { break; } // Start is less than time, so if end is later, show this subtitle if (this.subtitles[i].end > time) { newSubIndex = i; break; } i++; } } // Set or clear current subtitle if (newSubIndex !== false) { this.currentSubtitle = this.subtitles[newSubIndex]; this.lastSubtitleIndex = newSubIndex; this.updateSubtitleDisplays(this.currentSubtitle.text); } else if (this.currentSubtitle) { this.currentSubtitle = false; this.updateSubtitleDisplays(""); } } } }, updateSubtitleDisplays: function(val){ this.each(this.subtitleDisplays, function(disp){ disp.innerHTML = val; }); } } ); //////////////////////////////////////////////////////////////////////////////// // Convenience Functions (mini library) // Functions not specific to video or VideoJS and could probably be replaced with a library like jQuery //////////////////////////////////////////////////////////////////////////////// VideoJS.extend({ addClass: function(element, classToAdd){ if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) { element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd; } }, removeClass: function(element, classToRemove){ if (element.className.indexOf(classToRemove) == -1) { return; } var classNames = element.className.split(/\s+/); classNames.splice(classNames.lastIndexOf(classToRemove),1); element.className = classNames.join(" "); }, createElement: function(tagName, attributes){ return this.merge(document.createElement(tagName), attributes); }, // Attempt to block the ability to select text while dragging controls blockTextSelection: function(){ document.body.focus(); document.onselectstart = function () { return false; }; }, // Turn off text selection blocking unblockTextSelection: function(){ document.onselectstart = function () { return true; }; }, // Return seconds as MM:SS formatTime: function(secs) { var seconds = Math.round(secs); var minutes = Math.floor(seconds / 60); minutes = (minutes >= 10) ? minutes : "0" + minutes; seconds = Math.floor(seconds % 60); seconds = (seconds >= 10) ? seconds : "0" + seconds; return minutes + ":" + seconds; }, // Return the relative horizonal position of an event as a value from 0-1 getRelativePosition: function(x, relativeElement){ return Math.max(0, Math.min(1, (x - this.findPosX(relativeElement)) / relativeElement.offsetWidth)); }, // Get an objects position on the page findPosX: function(obj) { var curleft = obj.offsetLeft; while(obj = obj.offsetParent) { curleft += obj.offsetLeft; } return curleft; }, getComputedStyleValue: function(element, style){ return window.getComputedStyle(element, null).getPropertyValue(style); }, round: function(num, dec) { if (!dec) { dec = 0; } return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); }, addListener: function(element, type, handler){ if (element.addEventListener) { element.addEventListener(type, handler, false); } else if (element.attachEvent) { element.attachEvent("on"+type, handler); } }, removeListener: function(element, type, handler){ if (element.removeEventListener) { element.removeEventListener(type, handler, false); } else if (element.attachEvent) { element.detachEvent("on"+type, handler); } }, get: function(url, onSuccess){ if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function () { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {} //Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant throw new Error("This browser does not support XMLHttpRequest."); }; } var request = new XMLHttpRequest(); request.open("GET",url); request.onreadystatechange = function() { if (request.readyState == 4 && request.status == 200) { onSuccess(request.responseText); } }.context(this); request.send(); }, trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); }, // DOM Ready functionality adapted from jQuery. http://jquery.com/ bindDOMReady: function(){ if (document.readyState === "complete") { return VideoJS.onDOMReady(); } if (document.addEventListener) { document.addEventListener("DOMContentLoaded", VideoJS.DOMContentLoaded, false); window.addEventListener("load", VideoJS.onDOMReady, false); } else if (document.attachEvent) { document.attachEvent("onreadystatechange", VideoJS.DOMContentLoaded); window.attachEvent("onload", VideoJS.onDOMReady); } }, DOMContentLoaded: function(){ if (document.addEventListener) { document.removeEventListener( "DOMContentLoaded", VideoJS.DOMContentLoaded, false); VideoJS.onDOMReady(); } else if ( document.attachEvent ) { if ( document.readyState === "complete" ) { document.detachEvent("onreadystatechange", VideoJS.DOMContentLoaded); VideoJS.onDOMReady(); } } }, // Functions to be run once the DOM is loaded DOMReadyList: [], addToDOMReady: function(fn){ if (VideoJS.DOMIsReady) { fn.call(document); } else { VideoJS.DOMReadyList.push(fn); } }, DOMIsReady: false, onDOMReady: function(){ if (VideoJS.DOMIsReady) { return; } if (!document.body) { return setTimeout(VideoJS.onDOMReady, 13); } VideoJS.DOMIsReady = true; if (VideoJS.DOMReadyList) { for (var i=0; i0||!b&&a.length>0&&k(a.slice(1),c.slice(1))}function l(a){if(typeof a!=g)return a;var c=[],b="";for(var d in a){b=typeof a[d]==g?l(a[d]):[d,m?encodeURI(a[d]):a[d]].join("=");c.push(b)}return c.join("&")}function n(a){var c=[];for(var b in a)a[b]&&c.push([b,'="',a[b],'"'].join(""));return c.join(" ")}function o(a){var c=[];for(var b in a)c.push([''].join(""));return c.join("")}var g="object",m=true;try{var j=i.description||function(){return(new i("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}()}catch(p){j="Unavailable"}var e=j.match(/\d+/g)||[0];f[h]={available:e[0]>0,activeX:i&&!i.name,version:{original:j,array:e,string:e.join("."),major:parseInt(e[0],10)||0,minor:parseInt(e[1],10)||0,release:parseInt(e[2],10)||0},hasVersion:function(a){a=/string|number/.test(typeof a)?a.toString().split("."):/object/.test(typeof a)?[a.major,a.minor]:a||[0,0];return k(e,a)},encodeParams:true,expressInstall:"expressInstall.swf",expressInstallIsActive:false,create:function(a){if(!a.swf||this.expressInstallIsActive||!this.available&&!a.hasVersionFail)return false;if(!this.hasVersion(a.hasVersion||1)){this.expressInstallIsActive=true;if(typeof a.hasVersionFail=="function")if(!a.hasVersionFail.apply(a))return false;a={swf:a.expressInstall||this.expressInstall,height:137,width:214,flashvars:{MMredirectURL:location.href,MMplayerType:this.activeX?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}attrs={data:a.swf,type:"application/x-shockwave-flash",id:a.id||"flash_"+Math.floor(Math.random()*999999999),width:a.width||320,height:a.height||180,style:a.style||""};m=typeof a.useEncode!=="undefined"?a.useEncode:this.encodeParams;a.movie=a.swf;a.wmode=a.wmode||"opaque";delete a.fallback;delete a.hasVersion;delete a.hasVersionFail;delete a.height;delete a.id;delete a.swf;delete a.useEncode;delete a.width;var c=document.createElement("div");c.innerHTML=["",o(a),""].join("");return c.firstChild}};f.fn[h]=function(a){var c=this.find(g).andSelf().filter(g);/string|object/.test(typeof a)&&this.each(function(){var b=f(this),d;a=typeof a==g?a:{swf:a};a.fallback=this;if(d=f[h].create(a)){b.children().remove();b.html(d)}});typeof a=="function"&&c.each(function(){var b=this;b.jsInteractionTimeoutMs=b.jsInteractionTimeoutMs||0;if(b.jsInteractionTimeoutMs<660)b.clientWidth||b.clientHeight?a.call(b):setTimeout(function(){f(b)[h](a)},b.jsInteractionTimeoutMs+66)});return c}})(jQuery,"flash",navigator.plugins["Shockwave Flash"]||window.ActiveXObject);;/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */;// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ // Copyright (c) 2010 Jack Moore - jack@colorpowered.com // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php (function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g")[0].src=c;if(U(f))b("")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw")[0];c.name=i+ +new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g'); } label = label.stop(1, 1).css({ left: 0, opacity: 0 }).text(msg).appendTo($fld.closest(".form-field-wrapper")); label.animate({ left: ["100%", "easeOutExpo"], opacity: [1, "linear"] }, 500); if (!noFocus) { $fld.trigger("focus"); } } // Plugin $.fn.validator = function () { return this.filter("form").each(function (i, f) { // turn off the native validation if any f.noValidate = true; $(f.elements).not(":button, :checkbox, :radio, :submit, :reset, fieldset, label, form").each(function () { $fld = $(this); var fld_width = $fld.outerWidth({margin: true}); $fld.wrap( $('
    ').css({ width: fld_width }) ).css({ width: $fld.width() }); $fld.unbind("change.validateForm keyup").bind("change.validateForm keyup", function (e) { if (e.type == "keyup" && e.keyCode == 9) { return true; } $fld.toggleClass("invalid", !validateField($(this), true)); }); }); f.validate = function (noFocus) { $(".error-message", this).css({ opacity: 0 }); for (var j = 0; j < this.elements.length; j++) { if (!validateField($(this.elements[j]), noFocus)) { return false; } } return true; }; $(f).unbind("submit.validateForm").bind("submit.validateForm", function () { return f.validate(); }).unbind("reset.validateForm").bind("reset.validateForm", function () { $(this.elements).removeClass("invalid"); }); }); }; })(jQuery);;// fdc93ff4 // jquery.tweet.js - See http://tweet.seaofclouds.com/ or https://github.com/seaofclouds/tweet for more info // Copyright (c) 2008-2011 Todd Matthews & Steve Purcell (function($) { $.fn.tweet = function(o){ var s = $.extend({ username: null, // [string or array] required unless using the 'query' option; one or more twitter screen names (use 'list' option for multiple names, where possible) list: null, // [string] optional name of list belonging to username favorites: false, // [boolean] display the user's favorites instead of his tweets query: null, // [string] optional search query (see also: http://search.twitter.com/operators) avatar_size: null, // [integer] height and width of avatar if displayed (48px max) count: 3, // [integer] how many tweets to display? fetch: null, // [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option) page: 1, // [integer] which page of results to fetch (if count != fetch, you'll get unexpected results) retweets: true, // [boolean] whether to fetch (official) retweets (not supported in all display modes) intro_text: null, // [string] do you want text BEFORE your your tweets? outro_text: null, // [string] do you want text AFTER your tweets? join_text: null, // [string] optional text in between date and tweet, try setting to "auto" auto_join_text_default: "i said,", // [string] auto text for non verb: "i said" bullocks auto_join_text_ed: "i", // [string] auto text for past tense: "i" surfed auto_join_text_ing: "i am", // [string] auto tense for present tense: "i was" surfing auto_join_text_reply: "i replied to", // [string] auto tense for replies: "i replied to" @someone "with" auto_join_text_url: "i was looking at", // [string] auto tense for urls: "i was looking at" http:... loading_text: null, // [string] optional loading text, displayed while tweets load refresh_interval: null , // [integer] optional number of seconds after which to reload tweets twitter_url: "twitter.com", // [string] custom twitter url, if any (apigee, etc.) twitter_api_url: "api.twitter.com", // [string] custom twitter api url, if any (apigee, etc.) twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.) template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet
  • - see code for available vars comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort) return tweet2["tweet_time"] - tweet1["tweet_time"]; }, filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch') return true; } }, o); // See http://daringfireball.net/2010/07/improved_regex_for_matching_urls var url_regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi; // Expand values inside simple string templates with {placeholders} function t(template, info) { if (typeof template === "string") { var result = template; for(var key in info) { var val = info[key]; result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val); } return result; } else return template(info); } // Export the t function for use when passing a function as the 'template' option $.extend({tweet: {t: t}}); function replacer (regex, replacement) { return function() { var returning = []; this.each(function() { returning.push(this.replace(regex, replacement)); }); return $(returning); }; } $.fn.extend({ linkUrl: replacer(url_regexp, function(match) { var url = (/^[a-z]+:/i).test(match) ? match : "http://"+match; return ""+match+""; }), linkUser: replacer(/@(\w+)/gi, "@$1"), // Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi, ' #$1'), capAwesome: replacer(/\b(awesome)\b/gi, '$1'), capEpic: replacer(/\b(epic)\b/gi, '$1'), makeHeart: replacer(/(<)+[3]/gi, "") }); function parse_date(date_str) { // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse // cannot handle in IE. We therefore perform the following transformation: // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000" return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3')); } function relative_time(date) { var relative_to = (arguments.length > 1) ? arguments[1] : new Date(); var delta = parseInt((relative_to.getTime() - date) / 1000, 10); var r = ''; if (delta < 60) { r = delta + ' seconds ago'; } else if(delta < 120) { r = 'a minute ago'; } else if(delta < (45*60)) { r = (parseInt(delta / 60, 10)).toString() + ' minutes ago'; } else if(delta < (2*60*60)) { r = 'an hour ago'; } else if(delta < (24*60*60)) { r = '' + (parseInt(delta / 3600, 10)).toString() + ' hours ago'; } else if(delta < (48*60*60)) { r = 'a day ago'; } else { r = (parseInt(delta / 86400, 10)).toString() + ' days ago'; } return 'about ' + r; } function build_auto_join_text(text) { if (text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) { return s.auto_join_text_reply; } else if (text.match(url_regexp)) { return s.auto_join_text_url; } else if (text.match(/^((\w+ed)|just) .*/im)) { return s.auto_join_text_ed; } else if (text.match(/^(\w*ing) .*/i)) { return s.auto_join_text_ing; } else { return s.auto_join_text_default; } } function build_api_url() { var proto = ('https:' == document.location.protocol ? 'https:' : 'http:'); var count = (s.fetch === null) ? s.count : s.fetch; if (s.list) { return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+"&callback=?"; } else if (s.favorites) { return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+count+"&callback=?"; } else if (s.query === null && s.username.length == 1) { return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+'&callback=?'; } else { var query = (s.query || 'from:'+s.username.join(' OR from:')); return proto+'//'+s.twitter_search_url+'/search.json?&q='+encodeURIComponent(query)+'&rpp='+count+'&page='+s.page+'&callback=?'; } } // Convert twitter API objects into data available for // constructing each tweet
  • using a template function extract_template_data(item){ var o = {}; o.item = item; o.source = item.source; o.screen_name = item.from_user || item.user.screen_name; o.avatar_size = s.avatar_size; o.avatar_url = item.profile_image_url || item.user.profile_image_url; o.retweet = typeof(item.retweeted_status) != 'undefined'; o.tweet_time = parse_date(item.created_at); o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text; o.tweet_id = item.id_str; o.twitter_base = "http://"+s.twitter_url+"/"; o.user_url = o.twitter_base+o.screen_name; o.tweet_url = o.user_url+"/status/"+o.tweet_id; o.reply_url = o.twitter_base+"intent/tweet?in_reply_to="+o.tweet_id; o.retweet_url = o.twitter_base+"intent/retweet?tweet_id="+o.tweet_id; o.favorite_url = o.twitter_base+"intent/favorite?tweet_id="+o.tweet_id; o.retweeted_screen_name = o.retweet && item.retweeted_status.user.screen_name; o.tweet_relative_time = relative_time(o.tweet_time); o.tweet_raw_text = o.retweet ? ('RT @'+o.retweeted_screen_name+' '+item.retweeted_status.text) : item.text; // avoid '...' in long retweets o.tweet_text = $([o.tweet_raw_text]).linkUrl().linkUser().linkHash()[0]; o.tweet_text_fancy = $([o.tweet_text]).makeHeart().capAwesome().capEpic()[0]; // Default spans, and pre-formatted blocks for common layouts o.user = t('{screen_name}', o); o.join = s.join_text ? t(' {join_text} ', o) : ' '; o.avatar = o.avatar_size ? t('{screen_name}\'s avatar', o) : ''; o.time = t('{tweet_relative_time}', o); o.text = t('{tweet_text_fancy}', o); o.reply_action = t('reply', o); o.retweet_action = t('retweet', o); o.favorite_action = t('favorite', o); return o; } return this.each(function(i, widget){ var list = $('
      ').appendTo(widget); var intro = '

      '+s.intro_text+'

      '; var outro = '

      '+s.outro_text+'

      '; var loading = $('

      '+s.loading_text+'

      '); if(s.username && typeof(s.username) == "string"){ s.username = [s.username]; } if (s.loading_text) $(widget).append(loading); $(widget).bind("tweet:load", function(){ $.getJSON(build_api_url(), function(data){ if (s.loading_text) loading.remove(); if (s.intro_text) list.before(intro); list.empty(); var tweets = $.map(data.results || data, extract_template_data); tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count); list.append($.map(tweets, function(o) { return "
    • " + t(s.template, o) + "
    • "; }).join('')). children('li:first').addClass('tweet_first').end(). children('li:odd').addClass('tweet_even').end(). children('li:even').addClass('tweet_odd'); if (s.outro_text) list.after(outro); $(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full")); if (s.refresh_interval) { window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval); } }); }).trigger("tweet:load"); }); }; })(jQuery); ;/* * jQuery UI Accordion 1.8.13 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Accordion * * Depends: * jquery.ui.core.js * jquery.ui.widget.js */ (function( $, undefined ) { $.widget( "ui.accordion", { options: { active: 0, animated: "slide", autoHeight: true, clearStyle: false, collapsible: false, event: "click", fillSpace: false, header: "> li > :first-child,> :not(li):even", icons: { header: "ui-icon-triangle-1-e", headerSelected: "ui-icon-triangle-1-s" }, navigation: false, navigationFilter: function() { return this.href.toLowerCase() === location.href.toLowerCase(); } }, _create: function() { var self = this, options = self.options; self.running = 0; self.element .addClass( "ui-accordion ui-widget ui-helper-reset" ) // in lack of child-selectors in CSS // we need to mark top-LIs in a UL-accordion for some IE-fix .children( "li" ) .addClass( "ui-accordion-li-fix" ); self.headers = self.element.find( options.header ) .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) .bind( "mouseenter.accordion", function() { if ( options.disabled ) { return; } $( this ).addClass( "ui-state-hover" ); }) .bind( "mouseleave.accordion", function() { if ( options.disabled ) { return; } $( this ).removeClass( "ui-state-hover" ); }) .bind( "focus.accordion", function() { if ( options.disabled ) { return; } $( this ).addClass( "ui-state-focus" ); }) .bind( "blur.accordion", function() { if ( options.disabled ) { return; } $( this ).removeClass( "ui-state-focus" ); }); self.headers.next() .addClass( "" ); if ( options.navigation ) { var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); if ( current.length ) { var header = current.closest( ".ui-accordion-header" ); if ( header.length ) { // anchor within header self.active = header; } else { // anchor within content self.active = current.closest( ".ui-accordion-content" ).prev(); } } } self.active = self._findActive( self.active || options.active ) .addClass( "ui-state-default ui-state-active" ) .toggleClass( "ui-corner-all" ) .toggleClass( "ui-corner-top" ); self.active.next().addClass( "ui-accordion-content-active" ); self._createIcons(); self.resize(); // ARIA self.element.attr( "role", "tablist" ); self.headers .attr( "role", "tab" ) .bind( "keydown.accordion", function( event ) { return self._keydown( event ); }) .next() .attr( "role", "tabpanel" ); self.headers .not( self.active || "" ) .attr({ "aria-expanded": "false", "aria-selected": "false", tabIndex: -1 }) .next() .hide(); // make sure at least one header is in the tab order if ( !self.active.length ) { self.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { self.active .attr({ "aria-expanded": "true", "aria-selected": "true", tabIndex: 0 }); } // only need links in tab order for Safari if ( !$.browser.safari ) { self.headers.find( "a" ).attr( "tabIndex", -1 ); } if ( options.event ) { self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { self._clickHandler.call( self, event, this ); event.preventDefault(); }); } }, _createIcons: function() { var options = this.options; if ( options.icons ) { $( "" ) .addClass( "ui-icon " + options.icons.header ) .prependTo( this.headers ); this.active.children( ".ui-icon" ) .toggleClass(options.icons.header) .toggleClass(options.icons.headerSelected); this.element.addClass( "ui-accordion-icons" ); } }, _destroyIcons: function() { this.headers.children( ".ui-icon" ).remove(); this.element.removeClass( "ui-accordion-icons" ); }, destroy: function() { var options = this.options; this.element .removeClass( "ui-accordion ui-widget ui-helper-reset" ) .removeAttr( "role" ); this.headers .unbind( ".accordion" ) .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) .removeAttr( "aria-expanded" ) .removeAttr( "aria-selected" ) .removeAttr( "tabIndex" ); this.headers.find( "a" ).removeAttr( "tabIndex" ); this._destroyIcons(); var contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); if ( options.autoHeight || options.fillHeight ) { contents.css( "height", "" ); } return $.Widget.prototype.destroy.call( this ); }, _setOption: function( key, value ) { $.Widget.prototype._setOption.apply( this, arguments ); if ( key == "active" ) { this.activate( value ); } if ( key == "icons" ) { this._destroyIcons(); if ( value ) { this._createIcons(); } } // #5332 - opacity doesn't cascade to positioned elements in IE // so we need to add the disabled class to the headers and panels if ( key == "disabled" ) { this.headers.add(this.headers.next()) [ value ? "addClass" : "removeClass" ]( "ui-accordion-disabled ui-state-disabled" ); } }, _keydown: function( event ) { if ( this.options.disabled || event.altKey || event.ctrlKey ) { return; } var keyCode = $.ui.keyCode, length = this.headers.length, currentIndex = this.headers.index( event.target ), toFocus = false; switch ( event.keyCode ) { case keyCode.RIGHT: case keyCode.DOWN: toFocus = this.headers[ ( currentIndex + 1 ) % length ]; break; case keyCode.LEFT: case keyCode.UP: toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; break; case keyCode.SPACE: case keyCode.ENTER: this._clickHandler( { target: event.target }, event.target ); event.preventDefault(); } if ( toFocus ) { $( event.target ).attr( "tabIndex", -1 ); $( toFocus ).attr( "tabIndex", 0 ); toFocus.focus(); return false; } return true; }, resize: function() { var options = this.options, maxHeight; if ( options.fillSpace ) { if ( $.browser.msie ) { var defOverflow = this.element.parent().css( "overflow" ); this.element.parent().css( "overflow", "hidden"); } maxHeight = this.element.parent().height(); if ($.browser.msie) { this.element.parent().css( "overflow", defOverflow ); } this.headers.each(function() { maxHeight -= $( this ).outerHeight( true ); }); this.headers.next() .each(function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); }) .css( "overflow", "auto" ); } else if ( options.autoHeight ) { maxHeight = 0; this.headers.next() .each(function() { maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); }) .height( maxHeight ); } return this; }, activate: function( index ) { // TODO this gets called on init, changing the option without an explicit call for that this.options.active = index; // call clickHandler with custom event var active = this._findActive( index )[ 0 ]; this._clickHandler( { target: active }, active ); return this; }, _findActive: function( selector ) { return selector ? typeof selector === "number" ? this.headers.filter( ":eq(" + selector + ")" ) : this.headers.not( this.headers.not( selector ) ) : selector === false ? $( [] ) : this.headers.filter( ":eq(0)" ); }, // TODO isn't event.target enough? why the separate target argument? _clickHandler: function( event, target ) { var options = this.options; if ( options.disabled ) { return; } // called only when using activate(false) to close all parts programmatically if ( !event.target ) { if ( !options.collapsible ) { return; } this.active .removeClass( "ui-state-active ui-corner-top" ) .addClass( "ui-state-default ui-corner-all" ) .children( ".ui-icon" ) .removeClass( options.icons.headerSelected ) .addClass( options.icons.header ); this.active.next().addClass( "ui-accordion-content-active" ); var toHide = this.active.next(), data = { options: options, newHeader: $( [] ), oldHeader: options.active, newContent: $( [] ), oldContent: toHide }, toShow = ( this.active = $( [] ) ); this._toggle( toShow, toHide, data ); return; } // get the click target var clicked = $( event.currentTarget || target ), clickedIsActive = clicked[0] === this.active[0]; // TODO the option is changed, is that correct? // TODO if it is correct, shouldn't that happen after determining that the click is valid? options.active = options.collapsible && clickedIsActive ? false : this.headers.index( clicked ); // if animations are still active, or the active header is the target, ignore click if ( this.running || ( !options.collapsible && clickedIsActive ) ) { return; } // find elements to show and hide var active = this.active, toShow = clicked.next(), toHide = this.active.next(), data = { options: options, newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, oldHeader: this.active, newContent: clickedIsActive && options.collapsible ? $([]) : toShow, oldContent: toHide }, down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); // when the call to ._toggle() comes after the class changes // it causes a very odd bug in IE 8 (see #6720) this.active = clickedIsActive ? $([]) : clicked; this._toggle( toShow, toHide, data, clickedIsActive, down ); // switch classes active .removeClass( "ui-state-active ui-corner-top" ) .addClass( "ui-state-default ui-corner-all" ) .children( ".ui-icon" ) .removeClass( options.icons.headerSelected ) .addClass( options.icons.header ); if ( !clickedIsActive ) { clicked .removeClass( "ui-state-default ui-corner-all" ) .addClass( "ui-state-active ui-corner-top" ) .children( ".ui-icon" ) .removeClass( options.icons.header ) .addClass( options.icons.headerSelected ); clicked .next() .addClass( "ui-accordion-content-active" ); } return; }, _toggle: function( toShow, toHide, data, clickedIsActive, down ) { var self = this, options = self.options; self.toShow = toShow; self.toHide = toHide; self.data = data; var complete = function() { if ( !self ) { return; } return self._completed.apply( self, arguments ); }; // trigger changestart event self._trigger( "changestart", null, self.data ); // count elements to animate self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); if ( options.animated ) { var animOptions = {}; if ( options.collapsible && clickedIsActive ) { animOptions = { toShow: $( [] ), toHide: toHide, complete: complete, down: down, autoHeight: options.autoHeight || options.fillSpace }; } else { animOptions = { toShow: toShow, toHide: toHide, complete: complete, down: down, autoHeight: options.autoHeight || options.fillSpace }; } if ( !options.proxied ) { options.proxied = options.animated; } if ( !options.proxiedDuration ) { options.proxiedDuration = options.duration; } options.animated = $.isFunction( options.proxied ) ? options.proxied( animOptions ) : options.proxied; options.duration = $.isFunction( options.proxiedDuration ) ? options.proxiedDuration( animOptions ) : options.proxiedDuration; var animations = $.ui.accordion.animations, duration = options.duration, easing = options.animated; if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { easing = "slide"; } if ( !animations[ easing ] ) { animations[ easing ] = function( options ) { this.slide( options, { easing: easing, duration: duration || 700 }); }; } animations[ easing ]( animOptions ); } else { if ( options.collapsible && clickedIsActive ) { toShow.toggle(); } else { toHide.hide(); toShow.show(); } complete( true ); } // TODO assert that the blur and focus triggers are really necessary, remove otherwise toHide.prev() .attr({ "aria-expanded": "false", "aria-selected": "false", tabIndex: -1 }) .blur(); toShow.prev() .attr({ "aria-expanded": "true", "aria-selected": "true", tabIndex: 0 }) .focus(); }, _completed: function( cancel ) { this.running = cancel ? 0 : --this.running; if ( this.running ) { return; } if ( this.options.clearStyle ) { this.toShow.add( this.toHide ).css({ height: "", overflow: "" }); } // other classes are removed before the animation; this one needs to stay until completed this.toHide.removeClass( "ui-accordion-content-active" ); // Work around for rendering bug in IE (#5421) if ( this.toHide.length ) { this.toHide.parent()[0].className = this.toHide.parent()[0].className; } this._trigger( "change", null, this.data ); } }); $.extend( $.ui.accordion, { version: "1.8.13", animations: { slide: function( options, additions ) { options = $.extend({ easing: "swing", duration: 300 }, options, additions ); if ( !options.toHide.size() ) { options.toShow.animate({ height: "show", paddingTop: "show", paddingBottom: "show" }, options ); return; } if ( !options.toShow.size() ) { options.toHide.animate({ height: "hide", paddingTop: "hide", paddingBottom: "hide" }, options ); return; } var overflow = options.toShow.css( "overflow" ), percentDone = 0, showProps = {}, hideProps = {}, fxAttrs = [ "height", "paddingTop", "paddingBottom" ], originalWidth; // fix width before calculating height of hidden element var s = options.toShow; originalWidth = s[0].style.width; s.width( parseInt( s.parent().width(), 10 ) - parseInt( s.css( "paddingLeft" ), 10 ) - parseInt( s.css( "paddingRight" ), 10 ) - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) ); $.each( fxAttrs, function( i, prop ) { hideProps[ prop ] = "hide"; var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); showProps[ prop ] = { value: parts[ 1 ], unit: parts[ 2 ] || "px" }; }); options.toShow.css({ height: 0, overflow: "hidden" }).show(); options.toHide .filter( ":hidden" ) .each( options.complete ) .end() .filter( ":visible" ) .animate( hideProps, { step: function( now, settings ) { // only calculate the percent when animating height // IE gets very inconsistent results when animating elements // with small values, which is common for padding if ( settings.prop == "height" ) { percentDone = ( settings.end - settings.start === 0 ) ? 0 : ( settings.now - settings.start ) / ( settings.end - settings.start ); } options.toShow[ 0 ].style[ settings.prop ] = ( percentDone * showProps[ settings.prop ].value ) + showProps[ settings.prop ].unit; }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoHeight ) { options.toShow.css( "height", "" ); } options.toShow.css({ width: originalWidth, overflow: overflow }); options.complete(); } }); }, bounceslide: function( options ) { this.slide( options, { easing: options.down ? "easeOutBounce" : "swing", duration: options.down ? 1000 : 200 }); } } }); })( jQuery ); ;/*! * JqueryAsynchImageLoader (JAIL) : plugin for jQuery * * Developed by * Sebastiano Armeli-Battana (@sebarmeli) - http://www.sebastianoarmelibattana.com * Dual licensed under the MIT or GPL Version 3 licenses. */ /* Copyright (c) 2011 Sebastiano Armeli-Battana (http://www.sebastianoarmelibattana.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* JAIL helps loading images asynchronously and it can be used to make your page load faster. * Selected images will be downloaded after the document is ready not blocking the page * to render other elements. Images can be loaded after an event is triggered (like clicking * on a link, mouseovering on some elements, scrolling up/down) or after some delay or simply the * visible images will be loaded. * * First of all, this plugin requires you to make some HTML changes. * E.g. * * * You can define a noscript block in order to respect the principles of progressive * enhancemnt * E.g. * * * You can call the function in this way * E.g. * $(function(){ * $('img.lazy').asynchImageLoader(); * }); * or * $(function(){ * $('img.lazy').jail(); * }); * You can also have different configurations: * * - timeout : number of msec after that the images will be loaded - Default: 10ms * - effect : any jQuery effect that makes the images display (e.g. "fadeIn"). If you are loading a large number of images, it is best to NOT use this setting. Effect calls are very expensive - Default: NULL * - speed : string or number determining how long the animation will run - Default: 400 * - selector : selector that you need to bind the trigger event - Default: NULL * - event : event that triggers the image to load. You can choose "load", "load+scroll", "click", "mouseover", or "scroll". Default: "load+scroll" * - offset : an offset of "500" would cause any images that are less than 500px below the bottom of the window or 500px above the top of the window to load. - Default: 0 * - callback : function that will be called after all the images are loaded - Default: "" * - callbackAfterEachImage : function that will be called after an image is loaded - Default: "" * - placeholder: location of an image (such a loader) you want to display while waiting for the images to be loaded - Default: "" * * * Tested with jQuery 1.3.2+ on FF 2/3, Opera 10+, Safari 4+, Chrome on Mac and IE 6/7/8 on Win. * * Contributor : Derek Lindahl - dlindahl * * @link http://github.com/sebarmeli/JAIL * @author Sebastiano Armeli-Battana * @date 03/08/2011 * @version 0.9.5 * */ /*globals window,jQuery,setTimeout,clearTimeout */ ;(function($){ var $window = $(window); $.fn.asynchImageLoader = $.fn.jail = function(options) { // Configuration options = $.extend({ timeout : 10, effect : false, speed : 400, selector: null, offset : 0, event : 'load+scroll', callback : jQuery.noop, callbackAfterEachImage : jQuery.noop, placeholder : false, container : window }, options); var images = this; $.jail.initialStack = this; var waitingStack = []; this.data('waitingStack', waitingStack); // Store the selector into 'triggerEl' data for the images selected this.data('triggerEl', (options.selector) ? $(options.selector) : $window); images.addClass("loading"); // Use a placeholder in case it is specified /*if (options.placeholder !== false) { images.each(function() { $(this).data("cssBackgroundBackup", { backgroundImage : $(this).css("backgroundImage"), backgroundPosition : $(this).css("backgroundPosition"), backgroundRepeat : $(this).css("backgroundRepeat") }).css({ backgroundImage : "url('" + options.placeholder + "')", backgroundPosition : "center center", backgroundRepeat : "no-repeat" }); //$(this).attr("src", options.placeholder); }); }*/ // When the event is not specified the images will be loaded with a delay if(/^load/.test(options.event)) { $.asynchImageLoader.later.call(this, options); } else { $.asynchImageLoader.onEvent.call(this, options, images); } return this; }; // Methods cointaing the logic $.asynchImageLoader = $.jail = { _purgeWaitingStack : function(stack, options) { var len = stack.length, loaded = 0, scope = this; if (!len) { return; } // TODO: ensure callback context function loadCallback(image) { $(image).removeClass("loading").addClass("loaded"); // Images loaded with some effect if existing if (options.speed) { $(image).animate({opacity : 1}, options.speed, "linear", function() { options.callbackAfterEachImage.call(scope, $(image), options); }); } else { $(image).css("opacity", 1); options.callbackAfterEachImage.call(scope, $(image), options); } if (++loaded == len) { if ($.isFunction(options.callback)) { options.callback.call(scope, options); } stack.splice(0, len); stack = null; } } function loadListener(e) { loadCallback(this); } $.each(stack, function(i, img) {//console.log(img) $(img).one("load", loadListener); var src = $(img).data("shouldLoad"); $(img).removeData("shouldLoad"); $(img).attr("src", src); }); }, // Remove any elements that have been loaded from the jQuery stack. // This should speed up subsequent calls by not having to iterate over the loaded elements. _purgeStack : function(stack, options) { // number of images not loaded var i = 0, waitingStack; while(i < stack.length) { if(stack[i].getAttribute('data-href')) { i++; } else { waitingStack = $.data(stack[i], 'waitingStack'); waitingStack.push(stack.splice(i, 1)); } } if (waitingStack && waitingStack.length) { this._purgeWaitingStack(waitingStack, options); } }, // Load the image - after the event is triggered on the image itself - no need // to check for visibility _loadOnEvent : function(e) { var $img = $(this), options = e.data.options, images = e.data.images; // Load images $.asynchImageLoader._loadImage(options, $img); // Image has been loaded so there is no need to listen anymore $img.unbind( options.event, $.asynchImageLoader._loadOnEvent ); $.asynchImageLoader._purgeStack( images, options ); if (!!options.callback) { $.asynchImageLoader._purgeStack( $.jail.initialStack, options ); //$.asynchImageLoader._launchCallback($.jail.initialStack, options); } }, // Load the image - after the event is triggered by a DOM element different // from the images (options.selector value) or the event is "scroll" - // visibility of the images is checked _bufferedEventListener : function(e) { var images = e.data.images, options = e.data.options, triggerEl = images.data('triggerEl'); clearTimeout(images.data('poller')); images.data('poller', setTimeout(function() { images.each(function _imageLoader(){ $.asynchImageLoader._loadImageIfVisible(options, this, triggerEl); }); $.asynchImageLoader._purgeStack( images, options ); if (!!options.callback) { $.asynchImageLoader._purgeStack( $.jail.initialStack, options ); //$.asynchImageLoader._launchCallback($.jail.initialStack, options); } }, options.timeout)); }, // Images loaded triggered by en event (event different from "load" or "load+scroll") onEvent : function(options, images) { images = images || this; if (options.event === 'scroll' || options.selector) { var triggerEl = images.data('triggerEl'); if(images.length > 0) { // Bind the event to the selector specified in the config obj triggerEl.bind( options.event, { images:images, options:options }, $.asynchImageLoader._bufferedEventListener ); if (options.event === 'scroll' || !options.selector) { $window.resize({ images:images, options:options }, $.asynchImageLoader._bufferedEventListener ); } return; } else { if (!!triggerEl) { triggerEl.unbind( options.event, $.asynchImageLoader._bufferedEventListener ); } } } else { // Bind the event to the images images.bind(options.event, { options:options, images:images }, $.asynchImageLoader._loadOnEvent); } }, // Method called when event : "load" or "load+scroll" (default) later : function(options) { var images = this; // If the 'load' event is specified, immediately load all the visible images and remove them from the stack if (options.event === 'load') { images.each(function(){ $.asynchImageLoader._loadImageIfVisible(options, this, images.data('triggerEl')); }); } $.asynchImageLoader._purgeStack(images, options); // After [timeout] has elapsed, load the remaining images if they are visible OR (if no event is specified) setTimeout(function() { if (options.event === 'load') { images.each(function(){ $.asynchImageLoader._loadImage(options, $(this)); }); } else { // Method : "load+scroll" images.each(function(){ $.asynchImageLoader._loadImageIfVisible(options, this, images.data('triggerEl')); }); } $.asynchImageLoader._purgeStack( images, options ); if (options.event === 'load+scroll') { options.event = 'scroll'; $.asynchImageLoader.onEvent( options, images ); } }, options.timeout); }, // Function that checks if the images have been loaded _loadImageIfVisible : function(options, image, triggerEl) { var $img = $(image), container = (/scroll/i.test(options.event)) ? triggerEl : $window; if ($.asynchImageLoader._isInTheScreen (container, $img, options.offset)) { $.asynchImageLoader._loadImage(options, $img); } }, // Function that returns true if the image is visible inside the "window" (or specified container element) _isInTheScreen : function($ct, $img, optionOffset) { var is_ct_window = $ct[0] === window, ct_offset = (is_ct_window ? { top:0, left:0 } : $ct.offset()), ct_top = ct_offset.top + ( is_ct_window ? $ct.scrollTop() : 0), ct_left = ct_offset.left + ( is_ct_window ? $ct.scrollLeft() : 0), ct_right = ct_left + $ct.width(), ct_bottom = ct_top + $ct.height(), img_offset = $img.offset(), img_width = $img.width(), img_height = $img.height(); return (ct_top - optionOffset) <= (img_offset.top + img_height) && (ct_bottom + optionOffset) >= img_offset.top && (ct_left - optionOffset)<= (img_offset.left + img_width) && (ct_right + optionOffset) >= img_offset.left; }, // Main function --> Load the images copying the "data-href" attribute into the "src" attribute _loadImage : function(options, $img) { //$img.hide(); $img.css("opacity", 0).data("shouldLoad", $img.attr("data-href")).removeAttr('data-href'); } }; }(jQuery));;jQuery(function($) { $('form.contact_form').validator().submit(function(e) { var form = $(this); if (!e.isDefaultPrevented()) { $.post(this.action,{ 'to': $('input[name="contact_to"]', form).val(), 'name': $('input[name="contact_name"]', form).val(), 'email': $('input[name="contact_email"]', form).val(), 'content': $('textarea[name="contact_content"]', form).val() },function(data){ form.fadeOut('fast', function() { form.siblings('p').show(); }); }); } e.preventDefault(); }); });;/*! * jQuery corner plugin: simple corner rounding * Examples and documentation at: http://jquery.malsup.com/corner/ * version 2.12 (23-MAY-2011) * Requires jQuery v1.3.2 or later * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * Authors: Dave Methvin and Mike Alsup */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners) * width: width of the effect; in the case of rounded corners this is the radius. * specify this value using the px suffix such as 10px (yes, it must be pixels). */ ;(function($) { var style = document.createElement('div').style, moz = style['MozBorderRadius'] !== undefined, webkit = style['WebkitBorderRadius'] !== undefined, radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined, mode = document.documentMode || 0, noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8), expr = $.browser.msie && (function() { var div = document.createElement('div'); try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); } catch(e) { return false; } return true; })(); $.support = $.support || {}; $.support.borderRadius = moz || webkit || radius; // so you can do: if (!$.support.borderRadius) $('#myDiv').corner(); function sz(el, p) { return parseInt($.css(el,p))||0; }; function hex2(s) { s = parseInt(s).toString(16); return ( s.length < 2 ) ? '0'+s : s; }; function gpc(node) { while(node) { var v = $.css(node,'backgroundColor'), rgb; if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') { if (v.indexOf('rgb') >= 0) { rgb = v.match(/\d+/g); return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]); } return v; } if (node.nodeName.toLowerCase() == 'html') break; node = node.parentNode; // keep walking if transparent } return '#ffffff'; }; function getWidth(fx, i, width) { switch(fx) { case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width)))); case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width)))); case 'sharp': return width-i; case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width)))); case 'slide': return Math.round(width*(Math.atan2(i,width/i))); case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1)))); case 'curl': return Math.round(width*(Math.atan(i))); case 'tear': return Math.round(width*(Math.cos(i))); case 'wicked': return Math.round(width*(Math.tan(i))); case 'long': return Math.round(width*(Math.sqrt(i))); case 'sculpt': return Math.round(width*(Math.log((width-i-1),width))); case 'dogfold': case 'dog': return (i&1) ? (i+1) : width; case 'dog2': return (i&2) ? (i+1) : width; case 'dog3': return (i&3) ? (i+1) : width; case 'fray': return (i%2)*width; case 'notch': return width; case 'bevelfold': case 'bevel': return i+1; case 'steep': return i/2 + 1; case 'invsteep':return (width-i)/2+1; } }; $.fn.corner = function(options) { // in 1.3+ we can fix mistakes with the ready state if (this.length == 0) { if (!$.isReady && this.selector) { var s = this.selector, c = this.context; $(function() { $(s,c).corner(options); }); } return this; } return this.each(function(index){ var $this = $(this), // meta values override options o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(), keep = /keep/.test(o), // keep borders? cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]), // corner color sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]), // strip color width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/, fx = ((o.match(re)||['round'])[0]), fold = /dogfold|bevelfold/.test(o), edges = { T:0, B:1 }, opts = { TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o), BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o) }, // vars used in func later strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz; if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR ) opts = { TL:1, TR:1, BL:1, BR:1 }; // support native rounding if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) { if (opts.TL) $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px'); if (opts.TR) $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px'); if (opts.BL) $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px'); if (opts.BR) $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px'); return; } strip = document.createElement('div'); $(strip).css({ overflow: 'hidden', height: '1px', minHeight: '1px', fontSize: '1px', backgroundColor: sc || 'transparent', borderStyle: 'solid' }); pad = { T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0, B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0 }; if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE if (!keep) this.style.border = 'none'; strip.style.borderColor = cc || gpc(this.parentNode); cssHeight = $(this).outerHeight(); for (j in edges) { bot = edges[j]; // only add stips if needed if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) { strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none'); d = document.createElement('div'); $(d).addClass('jquery-corner'); ds = d.style; bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild); if (bot && cssHeight != 'auto') { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.bottom = ds.left = ds.padding = ds.margin = '0'; if (expr) ds.setExpression('width', 'this.parentNode.offsetWidth'); else ds.width = '100%'; } else if (!bot && $.browser.msie) { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.top = ds.left = ds.right = ds.padding = ds.margin = '0'; // fix ie6 problem when blocked element has a border width if (expr) { bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth'); ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"'); } else ds.width = '100%'; } else { ds.position = 'relative'; ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px'; } for (i=0; i < width; i++) { w = Math.max(0,getWidth(fx,i, width)); e = strip.cloneNode(false); e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px'; bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild); } if (fold && $.support.boxModel) { if (bot && noBottomFold) continue; for (c in opts) { if (!opts[c]) continue; if (bot && (c == 'TL' || c == 'TR')) continue; if (!bot && (c == 'BL' || c == 'BR')) continue; common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor }; $horz = $('
      ').css(common).css({ width: width + 'px', height: '1px' }); switch(c) { case 'TL': $horz.css({ bottom: 0, left: 0 }); break; case 'TR': $horz.css({ bottom: 0, right: 0 }); break; case 'BL': $horz.css({ top: 0, left: 0 }); break; case 'BR': $horz.css({ top: 0, right: 0 }); break; } d.appendChild($horz[0]); var $vert = $('
      ').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' }); switch(c) { case 'TL': $vert.css({ left: width }); break; case 'TR': $vert.css({ right: width }); break; case 'BL': $vert.css({ left: width }); break; case 'BR': $vert.css({ right: width }); break; } d.appendChild($vert[0]); } } } } }); }; $.fn.uncorner = function() { if (radius || moz || webkit) this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0); $('div.jquery-corner', this).remove(); return this; }; // expose options $.fn.corner.defaults = { useNative: true, // true if plugin should attempt to use native browser support for border radius rounding metaAttr: 'data-corner' // name of meta attribute to use for options }; })(jQuery); ;/* Vamtam common javascript effects and scripts */ VideoJS.setupAllWhenReady(); (function ($, undefined) { $(function () { // lazy load images // The JAIL plugin is written in such a way that makes an error if it's // applied in empty collection! var commonImages = $('img.lazy').not(".portfolios.sortable img, :animated, .wpv-wrapper img"); if (commonImages.length) { commonImages.jail({ speed: 800 }); } var sliderImages = $('.wpv-wrapper img.lazy'); if(sliderImages.length) { sliderImages.jail({ speed: 1400, event: 'load' }); } var portfolioImages = $('.portfolios.sortable img.lazy'); if (portfolioImages.length) { portfolioImages.jail({ speed: 1400, event: "load", callback: function () { setTimeout(function () { $(".portfolios.sortable").each(function () { var list = $('ul', this); var items = $("li", list); var links = $('.sort_by_cat a', this); list.css({ width: list.width(), height: list.height(), position: "relative" }); var places = []; items.each(function (i, item) { var box = { top: item.offsetTop, left: item.offsetLeft }; $(this).css(box); box.height = $(item).height(); box.width = $(item).width(); places.push(box); }); var columns = { portfolio_two_columns: 2, portfolio_three_columns: 3, portfolio_four_columns: 4 }; items.css({ position: "absolute" }); fixRowHeights(items); function getNumColumns() { for (var c in columns) { if (list.hasClass(c)) { return columns[c]; } } return 1; } function fixRowHeights(items) { var cols = getNumColumns(); if (cols > 1) { var h = 0, bottomLine = 0, last = items[0]; items.each(function (j) { $(this).css({ height: "auto" }); h = Math.max(h, $(this).outerHeight()); $(this).css({ top: bottomLine }) if ((j + 1) % cols === 0 || j == items.length - 1) { $(this).prevUntil(last).andSelf().css({ height: h, marginTop: 0, marginBottom: 0 }); bottomLine += h + 20; h = 0; last = this; } }); } } links.each(function (i, link) { var cat = $(this).attr('data-value'); var toShow = cat == 'all' ? items : items.filter('[data-type*=' + cat + ']'); var toHide = cat == 'all' ? $() : items.not('[data-type*=' + cat + ']'); $(this).click(function (e) { links.removeClass('active'); $(this).addClass('active'); var cols = getNumColumns(); var H = 0, L = toShow.length, curH = 0, $img, bottomLine = 0, last = toShow[0]; toShow.each(function (j) { $img = $(this).stop(1, 0).css("zIndex", 2); if (!$img.is(":visible")) { $img.css({ opacity: 0, display: "block" }); } $img.css({ height: "auto" }).data("targetPositionTop", places[j].top); curH = Math.max(curH, $img.outerHeight()); if (cols > 1) { if ((j + 1) % cols === 0 || j == L - 1) { var coll = $img.prevUntil(last).andSelf(); if (toShow.index(last) === 0) { coll.add(last); } coll.data("targetPositionTop", bottomLine).css({ height: curH }); bottomLine += curH + 20; curH = 0; last = this; } } }).each(function (j) { $(this).delay(j * 100).animate({ opacity: [1, "linear"], top: $.data(this, "targetPositionTop"), left: places[j].left }, 800, "easeInOutExpo", function() { $(this).addClass("no-filter"); }); H = Math.max(H, places[j].top + $(this).height()); }); list.animate({ height: bottomLine || H }, 600, "easeInOutExpo"); toHide.filter(":visible").each(function (j) { $(this).stop(1, 0).delay(j * 100).queue(function() { $(this) .css({ zIndex: 1 }) .removeClass("no-filter") .animate({ opacity: "hide" }, 800, "linear"); }).dequeue(); }); return false; }); }); }); }, 0); } }); } // lightbox var load_lightbox = function () { $(".colorbox, .lightbox").each(function () { if ($(this).is('.no-lightbox') || ($(this).is('.size-thumbnail') && $(this).is(':not(.colorbox)') && $(this).is(':not(.lightbox)'))) { return true; } var iframe = $(this).attr('data-iframe'); if (iframe == undefined || iframe == 'false') iframe = false; else iframe = true; var href = false; var inline = $(this).attr('data-inline'); if (inline == undefined || inline == 'false') inline = false; else { inline = true; href = $(this).attr('data-href'); } var width = $(this).attr('data-width'); if (width == undefined) { if (iframe == true || inline == true) width = '80%'; else width = ''; } var height = $(this).attr('data-height'); if (height == undefined) { if (iframe == true || inline == true) height = '80%'; else height = ''; } var photo = $(this).attr('data-photo'); photo = !(photo == undefined || photo == 'false'); var close = $(this).attr('data-close'); close = !! (close == undefined || close == 'true'); $(this).colorbox({ opacity: 0.7, innerWidth: width, innerHeight: height, iframe: iframe, inline: inline, href: href, photo: photo, maxHeight: '90%', maxWidth: '90%', scalePhotos: true, title: function () { var share = ''; if ($('body').hasClass('cbox-share-facebook')) { share += ''; } if ($('body').hasClass('cbox-share-twitter')) { share += '\ '; } var title = $(this).attr('title'); title = title ? title : ''; return '
      ' + share + '
      ' + title + '
      '; }, onLoad: function () { if (!close) $("#cboxClose").css("visibility", "hidden"); else $("#cboxClose").css("visibility", "visible"); $("#colorbox").removeClass('withVideo'); } }); }); }; load_lightbox(); // tabs and accordions $('.tabs').tabs().each(function () { if (Number($(this).attr('data-delay'))) { $(this).tabs('rotate', $(this).attr('data-delay')); } }); $('.accordion').accordion({ autoHeight: false }); $(".toggle_title").click(function () { if ($(this).is('.toggle_active')) { $(this).removeClass('toggle_active').siblings('.toggle_content').slideUp("fast"); } else { $(this).addClass('toggle_active').siblings('.toggle_content').slideDown("fast"); } }).siblings('.toggle_content.load_hidden').hide(); // style images (those with hover icon) function style_images() { $('.image_styled').each(function () { $('a', this).append('
      '); }); } style_images(); // :before and :after fixes for ie7 if ($.browser.msie && $.browser.version == 7) { var ba = '.widget_pages li a'; $('*').each(function (i) { if ($(this)[0].currentStyle['before']) { var before = $(this).prepend('').find('span.before'); before.text($(this)[0].currentStyle['before'].replace(/'/g, '')); } if ($(this)[0].currentStyle['after']) { var after = $(this).append('').find('span.after'); after.text($(this)[0].currentStyle['after'].replace(/'/g, '')); } }); } }); })(jQuery); ;(function ($, undefined) { $(function () { // Fullwidth slider is without rounded corners if( ! $(".header-slider-wrapper").hasClass("fullwidth") ) { $(".wpv-wrapper").corner(); } $('#commentform, .searchform').validator(); $("nav > div > ul > li:last").css("paddingRight", 0); $("nav ul li").each(function (i, o) { $(this).find("ul").css({ visibility: "hidden", display: "none", opacity: 0 }); $(this).hover( function () { $('ul:first', this).stop(1, 1).delay(200).queue(function () { if ($(o).is(".hover")) { return; } var submenu = $('ul:first', o); var thisOffset = $(o).offset(); var vw = $(window).width(); var isFirst = submenu.is("nav > div > ul > li > ul"); submenu.css({ visibility: "hidden", display: "inline-block" }); $(o).addClass("hover"); if (thisOffset.left + $(o).outerWidth({margin: true}) + submenu.outerWidth({margin: true}) > vw) { submenu.css({ right: isFirst ? 0 : "100%", left: "auto" }); } else { submenu.css({ left: isFirst ? 0 : "100%", right: "auto" }); } $(this).css({ opacity: 0, visibility: "visible" }).animate({ opacity: 1 }, 200, "linear").dequeue(); }); }, function () { $('ul:first', this).stop(1, 0).delay(200).queue(function () { $(this).animate({ opacity: 0 }, 100, "linear", function () { $(this).css({ display: "none" }); $(o).removeClass("hover"); }).dequeue(); }); }); }); $("nav ul li ul li:has(ul)").find("a:first").append(" » "); $('.post-head a img').parent().addClass('a-reset'); $('.sitemap li:not(:has(.children))').addClass('single'); var tooltip_animation = 250; $('.shortcode-tooltip').hover(function () { $(this).find('.tooltip').fadeIn(tooltip_animation).animate({ bottom: 25 }, tooltip_animation); }, function () { $(this).find('.tooltip').animate({ bottom: 35 }, tooltip_animation).fadeOut(tooltip_animation); }); // hover effects ------------------------------------------------------------- $(".thumbnail").live({ mouseenter: function (e) { $(".info-pad", this).each(function () { if ($(this).css("position") == "absolute") { $(this).stop(1, 0).delay(100).queue(function () { $(this).css("zIndex", 2).animate({ opacity: 1 }, 400, "linear"); }).dequeue(); } }); }, mouseleave: function (e) { $(".info-pad", this).each(function () { if ($(this).css("position") == "absolute") { $(this).stop(1, 0).delay(100).animate({ opacity: 0 }, 400, "linear", function () { $(this).css("zIndex", -1); }); } }); } }); // adds the 'carved' button arrow $('a.button.carved, .button.carved a').append(function () { return $('
      ').css({ bottom: -5, left: 0, right: 0 }).append(function () { return $('
      ').css({ margin: 'auto', width: 0, height: 0, borderLeft: '10px solid transparent', borderRight: '10px solid transparent', borderBottom: '5px solid #fff' }); }); }); // scroll to top button $(window).bind('resize scroll', function () { if (window.pageYOffset > 0) $('#scroll-to-top').fadeIn('normal'); else $('#scroll-to-top').fadeOut('normal'); }); $('#scroll-to-top').click(function () { $('html,body').animate({ scrollTop: 0 }, 300); }); /* header slider */ function getThumbSrc(dir, slider) { var src = "about:blank"; var nextSlide = slider.wpvSlider(dir == "next" ? "getNextSlide" : "getPreviousSlide"); if (nextSlide.length) { src = nextSlide = nextSlide.find("> .wpv-slide").data("thumb") || ""; } return src; } function setThumb(dir, slider) { var btn = $(dir == "next" ? ".wpv-nav-next" : ".wpv-nav-prev", slider.parent()); var thumb = btn.find("> img.wpv-preview-thumb"); var thumbSrc = getThumbSrc(dir, slider); if (thumbSrc) { if (!thumb.length) { thumb = $('').appendTo(btn); } thumb.attr("src", thumbSrc).css({ visibility: "visible" }); } else { thumb.css({ visibility: "hidden" }); } } $("#header-slider, .slider-shortcode").bind("afterChange sliderload", function () { setThumb("next", $(this)); setThumb("prev", $(this)); }); // slide the nav buttons with the navigation-preview design $(".style-navigation-preview .wpv-nav-next, .style-gallery .wpv-nav-next").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginLeft: -$(this).outerWidth(), opacity: 1 }); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginLeft: -40, opacity: 0.3 }); }); $(".style-navigation-preview .wpv-nav-prev, .style-gallery .wpv-nav-prev").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginRight: -$(this).outerWidth(), opacity: 1 }); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginRight: -40, opacity: 0.3 }); }); // helpers for the peek slider design $(".style-peek .wpv-nav-next").live("mouseenter", function () { $(this).stop(1, 0).animate({ width: 50 }, 130); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ width: 40 }, 130); }); $(".style-peek .wpv-nav-prev").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginLeft: 0 }, 130); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginLeft: -10 }, 130); }); $(".style-peek #header-slider").one("sliderload", function (e, slider) { $(".wpv-slide-wrapper", slider.view).each(function (i, o) { $.data(o, "Slide").getCaption(); // Click to scroll $(o).click(function () { if (!$(o).is(".active")) { slider.goTo(i); return false; } }) }); $("#header-slider-caption-wrapper").show(); }); $(".style-peek #header-slider").one("beforeChange", function (e, slider, slideToShow, slideToHide) { var cur = slideToHide || slideToShow; var next = cur.next(".wpv-slide-wrapper"); if (!next.length) { next = cur.parent().find(".wpv-slide-wrapper:first"); } next.show().css({ left: cur.position().left + cur.width() + 20 }); }); }); // Internet Explorer fixes if ($.browser.msie && $.browser.version == 8) { /* if(WPV_THEME_URI) { // Shadows fix $('.shadow, .sep-3').hide(); $('.dark .shadow, .dark .sep-3').after(''); $('.light .shadow, .light .sep-3').after(''); $('body').bind('wpv-class-change', function() { $('.ie-shadow').show(); $('.classic .ie-shadow').hide(); }); } */ $('p:empty').hide(); // Last child elements $('p:last-child, ul li:last-child, ol li:last-child, .widget:last-child, .accordion:last-child, .toggle:last-child, .toggle_content:last-child').addClass('last'); } })(jQuery);