first commit

This commit is contained in:
alazhar
2020-01-02 23:15:16 +07:00
commit eda9661806
3433 changed files with 595883 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,79 @@
jQuery(document).ready(function(){
var port_carousel_wrapper = jQuery('.blog-carousel-wrapper');
function carousel_port_init(){
port_carousel_wrapper.each(function(){
var port_carousel = jQuery(this);
var port_holder = port_carousel.children('.blog-carousel-holder');
var port_item = port_carousel.find('.gdl-blog-widget');
port_item.css('float', 'left');
var parent_col = 12;
if( jQuery(this).parent().parent().hasClass('six') ){
parent_col = 6;
}else if( jQuery(this).parent().parent().hasClass('four') ){
parent_col = 4;
}else if( jQuery(this).parent().parent().hasClass('three') ){
parent_col = 3;
}
var child_col;
var child_size;
if( port_item.filter(':first').hasClass('three') ){
child_col = 3;
child_size = port_carousel.parents('.row').width() / 4;
}else if( port_item.filter(':first').hasClass('four') ){
child_col = 4;
child_size = port_carousel.parents('.row').width() / 3;
}else if( port_item.filter(':first').hasClass('six') ){
child_col = 6;
child_size = port_carousel.parents('.row').width() / 2;
}
port_holder.attr('data-num', parseInt(parent_col/child_col) );
if( jQuery('html').filter(':first').width() <= '767' ){
port_holder.attr('data-num', 1);
child_size = port_carousel.parents('.row').width();
}
port_item.css('width', child_size );
port_holder.attr('data-width', child_size);
port_holder.attr('data-max', port_item.length);
port_holder.width( port_item.length * child_size );
var cur_index = parseInt(port_holder.attr('data-index'));
port_holder.css({ 'margin-left': -(cur_index * child_size + 10) });
});
}
// bind the navigation
var port_nav = port_carousel_wrapper.children('.blog-nav-wrapper');
port_nav.children('.blog-nav.left').click(function(){
var port_holder = jQuery(this).parent('.blog-nav-wrapper').siblings('.blog-carousel-holder');
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index > 0 ){ cur_index--; }
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width')) + 10) });
});
port_nav.children('.blog-nav.right').click(function(){
var port_holder = jQuery(this).parent('.blog-nav-wrapper').siblings('.blog-carousel-holder');
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index + parseInt(port_holder.attr('data-num')) < parseInt(port_holder.attr('data-max')) ){
cur_index++;
}
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width')) + 10) });
});
carousel_port_init();
jQuery(window).resize(function(){
carousel_port_init();
});
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,73 @@
jQuery(document).ready(function(){
var port_carousel_wrapper = jQuery('#footer-gallery-container');
function carousel_port_init(){
port_carousel_wrapper.each(function(){
var port_carousel = jQuery(this);
var port_holder = port_carousel.children('#gallery-item-holder');
var port_item = port_carousel.find('.footer-gallery-item');
port_item.css('float', 'left');
var child_size;
if( port_item.filter(':first').hasClass('three') ){
port_holder.attr('data-num', 4);
child_size = port_carousel.width() / 4;
}else if( port_item.filter(':first').hasClass('four') ){
port_holder.attr('data-num', 3);
child_size = port_carousel.width() / 3;
}else if( port_item.filter(':first').hasClass('six') ){
port_holder.attr('data-num', 2);
child_size = port_carousel.width() / 2;
}else if( port_item.filter(':first').hasClass('one-fifth') ){
port_holder.attr('data-num', 5);
child_size = port_carousel.width() / 5;
}
if( jQuery('html').filter(':first').width() <= '767' ){
port_holder.attr('data-num', 1);
child_size = port_carousel.width();
}
port_item.css('width', child_size );
port_holder.attr('data-width', child_size);
port_holder.attr('data-max', port_item.length);
port_holder.width( port_item.length * child_size );
var cur_index = parseInt(port_holder.attr('data-index'));
port_holder.css({ 'margin-left': -(cur_index * child_size) });
});
}
// bind the navigation
var port_nav = port_carousel_wrapper.children('.footer-gallery-nav-wrapper');
port_nav.children('.footer-gallery-nav-left').click(function(){
var port_holder = jQuery(this).parent().siblings('.gallery-item-holder');
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index > 0 ){ cur_index--; }
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width'))) });
});
port_nav.children('.footer-gallery-nav-right').click(function(){
var port_holder = jQuery(this).parent().siblings('.gallery-item-holder');
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index + parseInt(port_holder.attr('data-num')) < parseInt(port_holder.attr('data-max')) ){
cur_index++;
}
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width'))) });
});
carousel_port_init();
jQuery(window).resize(function(){
carousel_port_init();
});
});

View File

@@ -0,0 +1,51 @@
jQuery(document).ready(function(){
jQuery("form.gdl-contact-form").submit(function(){
var the_form = jQuery(this);
var error = false;
jQuery(this).find('#sending-result').slideUp(200);
jQuery(this).find('.require-field').each(function(){
if(jQuery.trim(jQuery(this).val()) == '') {
error = true;
jQuery(this).siblings('.error').slideDown(200);
}else if(jQuery(this).hasClass('email')) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(!emailReg.test(jQuery.trim(jQuery(this).val()))) {
error = true;
jQuery(this).siblings('.error').slideDown(200);
}else{
jQuery(this).siblings('.error').slideUp(200);
}
}else{
jQuery(this).siblings('.error').slideUp(200);
}
});
if(error) return false;
jQuery(this).find('.contact-loading').fadeIn();
var send_data = jQuery(this).serialize();
jQuery.post(MyAjax.ajaxurl, 'action=submit_contact_form&' + send_data, function(data){
the_form.find('.contact-loading').fadeOut();
if( data.success == '1' ){
the_form.find('input[type="text"], textarea').val('');
the_form.find('#sending-result div').each(function(){
jQuery(this).html(data.value);
jQuery(this).removeClass('red').addClass('green');
jQuery(this).parent().slideDown(200);
});
}else{
the_form.find('#sending-result div').each(function(){
jQuery(this).html(data.value);
jQuery(this).removeClass('green').addClass('red');
jQuery(this).parent().slideDown(200);
});
}
}, 'json');
return false;
});
});

View File

@@ -0,0 +1,259 @@
jQuery(document).ready(function(){
// Search Default text
jQuery('.search-text input').live("blur", function(){
var default_value = jQuery(this).attr("data-default");
if (jQuery(this).val() == ""){
jQuery(this).val(default_value);
}
}).live("focus", function(){
var default_value = jQuery(this).attr("data-default");
if (jQuery(this).val() == default_value){
jQuery(this).val("");
}
});
// Top search
jQuery(".top-search-wrapper").find("#searchsubmit").click(function(){
if( parseInt(jQuery(this).siblings("#search-text").width()) == 1 ){
jQuery(this).siblings("#search-text").children("input[type='text']").val('');
jQuery(this).siblings("#search-text").children().css('display', 'block');
jQuery(this).siblings("#search-text").animate({ width: 174, 'margin-left': 15 });
jQuery(this).siblings("#search-text").children("input[type='text']").focus();
return false;
}
if( jQuery(this).siblings("#search-text").children("input[type='text']").val() == '' ){
return false;
}
});
jQuery("#searchform").click(function(){
if (event.stopPropagation){
event.stopPropagation();
}
else if(window.event){
window.event.cancelBubble=true;
}
//event.stopPropagation();
});
jQuery("html").click(function(){
jQuery(this).find(".top-search-wrapper").find("#search-text").animate({ width: 1, 'margin-left': 0 }, function(){
jQuery(this).children().css('display', 'none');
});
});
// Social Hover
jQuery("#gdl-social-icon .social-icon").hover(function(){
jQuery(this).animate({ opacity: 0.55 }, 150);
}, function(){
jQuery(this).animate({ opacity: 1 }, 150);
});
// Accordion
var gdl_accordion = jQuery('ul.gdl-accordion');
gdl_accordion.find('li').not('.active').each(function(){
jQuery(this).children('.accordion-content').css('display', 'none');
});
gdl_accordion.find('li').click(function(){
if( !jQuery(this).hasClass('active') ){
jQuery(this).addClass('active').children('.accordion-content').slideDown();
jQuery(this).siblings('li').removeClass('active').children('.accordion-content').slideUp();
}
});
// Toggle Box
var gdl_toggle_box = jQuery('ul.gdl-toggle-box');
gdl_toggle_box.find('li').not('.active').each(function(){
jQuery(this).children('.toggle-box-content').css('display', 'none');
});
gdl_toggle_box.find('li').click(function(){
if( jQuery(this).hasClass('active') ){
jQuery(this).removeClass('active').children('.toggle-box-content').slideUp();
}else{
jQuery(this).addClass('active').children('.toggle-box-content').slideDown();
}
});
// Tab
var gdl_tab = jQuery('div.gdl-tab');
gdl_tab.find('.gdl-tab-title li a').click(function(e){
if( jQuery(this).hasClass('active') ) return;
var data_tab = jQuery(this).attr('data-tab');
var tab_title = jQuery(this).parents('ul.gdl-tab-title');
var tab_content = tab_title.siblings('ul.gdl-tab-content');
// tab title
tab_title.find('a.active').removeClass('active');
jQuery(this).addClass('active');
// tab content
tab_content.children('li.active').removeClass('active').css('display', 'none');
tab_content.children('li[data-tab="' + data_tab + '"]').fadeIn().addClass('active');
e.preventDefault();
});
// Scroll Top
jQuery('div.scroll-top').click(function() {
jQuery('html, body').animate({ scrollTop:0 }, { duration: 600, easing: "easeOutExpo"});
return false;
});
// Blog Hover
jQuery(".blog-media-wrapper.gdl-image img, .port-media-wrapper.gdl-image img, .gdl-gallery-image img").hover(function(){
jQuery(this).animate({ opacity: 0.55 }, 150);
}, function(){
jQuery(this).animate({ opacity: 1 }, 150);
});
// Port Hover
jQuery(".portfolio-item").each(function(){
var port_hover = 0; var port_unhover = 0;
jQuery(this).hover(function(){
port_hover++;
var thumbnail_hover = jQuery(this).find('a.hover-wrapper');
var thumbnail_overlay_hover = thumbnail_hover.children('.portfolio-thumbnail-image-hover');
var thumbnail_overlay_hover_icon = thumbnail_hover.children('.hover-icon');
var tmp_height = thumbnail_hover.height();
var content_hover = jQuery(this).children('.portfolio-context');
var content_bar = content_hover.children('.port-bottom-border');
var cnt_height = content_hover.outerHeight();
content_bar.animate({ height: cnt_height }, {
duration: (cnt_height - 2) * 0.5,
complete: function(){
if( port_hover - 1 == port_unhover ){
thumbnail_overlay_hover.animate({ height: tmp_height }, tmp_height * 0.5);
thumbnail_overlay_hover_icon.fadeIn(200);
}
}
});
content_hover.animate({ 'padding-left': 20, 'padding-right': 20 }, 150);
}, function(){
port_unhover++;
var thumbnail_hover = jQuery(this).find('a.hover-wrapper');
var thumbnail_overlay_hover = thumbnail_hover.children('.portfolio-thumbnail-image-hover');
var thumbnail_overlay_hover_icon = thumbnail_hover.children('.hover-icon');
var tmp_height = thumbnail_hover.height();
var content_hover = jQuery(this).children('.portfolio-context');
var content_bar = content_hover.children('.port-bottom-border');
var cnt_height = content_hover.outerHeight();
if( thumbnail_hover.length == 0 ){
content_bar.animate({ height: 2 }, (cnt_height - 2) * 0.5 );
content_hover.animate({ 'padding-left': 0, 'padding-right': 40 }, 150);
}else{
thumbnail_overlay_hover.animate({ height: 0 }, {
duration: tmp_height * 0.5,
complete: function(){
content_bar.animate({ height: 2 }, (cnt_height - 2) * 0.5 );
content_hover.animate({ 'padding-left': 0, 'padding-right': 40 }, 150);
}
});
thumbnail_overlay_hover_icon.fadeOut(200);
}
});
});
// JW Player Responsive
responsive_jwplayer();
function responsive_jwplayer(){
jQuery('[id^="jwplayer"][id$="wrapper"]').each(function(){
var data_ratio = jQuery(this).attr('data-ratio');
if( !data_ratio || data_ratio.length == 0 ){
data_ratio = jQuery(this).height() / jQuery(this).width();
jQuery(this).css('max-width', '100%');
jQuery(this).attr('data-ratio', data_ratio);
}
jQuery(this).height(jQuery(this).width() * data_ratio);
});
}
jQuery(window).resize(function(){
responsive_jwplayer();
});
});
jQuery(window).load(function(){
// Menu Navigation
jQuery('#top-superfish-wrapper ul.top-menu').supersubs({
minWidth: 14.5, maxWidth: 25, extraWidth: 1
}).superfish({
delay: 400, speed: 'fast', animation: {opacity:'show',height:'show'}
});
jQuery('#main-superfish-wrapper ul.sf-menu').supersubs({
minWidth: 14.5, maxWidth: 17, extraWidth: 1
}).superfish({
delay: 400, speed: 'fast', animation: {opacity:'show',height:'show'}
});
// Personnal Item Height
function set_personnal_height(){
jQuery(".personnal-item-holder .row").each(function(){
var max_height = 0;
jQuery(this).find('.personnal-item').height('auto');
jQuery(this).find('.personnal-item-wrapper').each(function(){
if( max_height < jQuery(this).height()){
max_height = jQuery(this).height();
}
});
jQuery(this).find('.personnal-item').height(max_height);
});
}
set_personnal_height();
// Price Table Height
function set_price_table_height(){
jQuery(".price-table-wrapper .row").each(function(){
var max_height = 0;
jQuery(this).find('.best-price').removeClass('best-active');
jQuery(this).find('.price-item').height('auto');
jQuery(this).find('.price-item-wrapper').each(function(){
if( max_height < jQuery(this).height()){
max_height = jQuery(this).height();
}
});
jQuery(this).find('.price-item').height(max_height);
jQuery(this).find('.best-price').addClass('best-active');
});
}
set_price_table_height();
// Set Portfolio Max Height
function set_portfolio_height(){
jQuery('div.portfolio-item-holder').each(function(){
var context_height = 0;
jQuery(this).find('.portfolio-context').css({'height': 'auto'});
jQuery(this).find('.portfolio-context').each(function(){
if( context_height < jQuery(this).height()){
context_height = jQuery(this).height();
}
});
jQuery(this).find('.portfolio-context').css({'height': context_height});
var max_height = 0;
jQuery(this).children('.portfolio-item').height('auto');
jQuery(this).children('.portfolio-item').each(function(){
if( max_height < jQuery(this).height()){
max_height = jQuery(this).height();
}
});
jQuery(this).children('.portfolio-item').height(max_height);
});
}
setTimeout(function(){ set_portfolio_height(); }, 100);
// When window resize, set all function again
jQuery(window).resize(function(){
set_personnal_height();
set_price_table_height();
set_portfolio_height()
});
});

View File

@@ -0,0 +1,15 @@
jQuery(document).ready(function(){
jQuery('.gdl-tab-widget-wrapper').each(function(){
jQuery(this).find('.gdl-tab-widget-header-item a').click(function(){
jQuery(this).addClass('active');
jQuery(this).parent().siblings().children('a').removeClass('active');
var tab_id = jQuery(this).attr('data-id');
var widget_content = jQuery(this).parents('.gdl-tab-widget-header-wrapper').siblings('.gdl-tab-widget-content-wrapper');
widget_content.children('div[data-id="' + tab_id + '"]').each(function(){
jQuery(this).siblings().removeClass('active').css('display','none');
jQuery(this).fadeIn().addClass('active');
});
});
});
});

View File

@@ -0,0 +1,115 @@
/*!
* hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
*
* You may use hoverIntent under the terms of the MIT license. Basically that
* means you are free to use hoverIntent as long as this header is left intact.
* Copyright 2007, 2013 Brian Cherne
*/
/* hoverIntent is similar to jQuery's built-in "hover" method except that
* instead of firing the handlerIn function immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the event. The handlerOut function is only
* called after a matching handlerIn.
*
* // basic usage ... just like .hover()
* .hoverIntent( handlerIn, handlerOut )
* .hoverIntent( handlerInOut )
*
* // basic usage ... with event delegation!
* .hoverIntent( handlerIn, handlerOut, selector )
* .hoverIntent( handlerInOut, selector )
*
* // using a basic configuration object
* .hoverIntent( config )
*
* @param handlerIn function OR configuration object
* @param handlerOut function OR selector for delegation OR undefined
* @param selector selector OR undefined
* @author Brian Cherne <brian(at)cherne(dot)net>
*/
(function($) {
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
// default configuration values
var cfg = {
interval: 100,
sensitivity: 7,
timeout: 0
};
if ( typeof handlerIn === "object" ) {
cfg = $.extend(cfg, handlerIn );
} else if ($.isFunction(handlerOut)) {
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
} else {
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
}
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).off("mousemove.hoverIntent",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = jQuery.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// if e.type == "mouseenter"
if (e.type == "mouseenter") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).on("mousemove.hoverIntent",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "mouseleave"
} else {
// unbind expensive mousemove event
$(ob).off("mousemove.hoverIntent",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// listen for mouseenter and mouseleave
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
};
})(jQuery);

View File

@@ -0,0 +1,819 @@
/*
AnythingSlider v1.7.18
Original by Chris Coyier: http://css-tricks.com
Get the latest version: https://github.com/ProLoser/AnythingSlider
To use the navigationFormatter function, you must have a function that
accepts two paramaters, and returns a string of HTML text.
index = integer index (1 based);
panel = jQuery wrapped LI item this tab references
@return = Must return a string of HTML/Text
navigationFormatter: function(index, panel){
return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index
}
*/
(function($) {
$.anythingSlider = function(el, options) {
var base = this, o;
// Wraps the ul in the necessary divs and then gives Access to jQuery element
base.el = el;
base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');
// Add a reverse reference to the DOM object
base.$el.data("AnythingSlider", base);
base.init = function(){
// Added "o" to be used in the code instead of "base.options" which doesn't get modifed by the compiler - reduces size by ~1k
base.options = o = $.extend({}, $.anythingSlider.defaults, options);
base.initialized = false;
if ($.isFunction(o.onBeforeInitialize)) { base.$el.bind('before_initialize', o.onBeforeInitialize); }
base.$el.trigger('before_initialize', base);
// Cache existing DOM elements for later
// base.$el = original ul
// for wrap - get parent() then closest in case the ul has "anythingSlider" class
base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + o.theme);
base.$window = base.$el.closest('div.anythingWindow');
base.win = window;
base.$win = $(base.win);
base.$controls = $('<div class="anythingControls"></div>').appendTo( (o.appendControlsTo !== null && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper);
base.$startStop = $('<a href="#" class="start-stop"></a>');
if (o.buildStartStop) {
base.$startStop.appendTo( (o.appendStartStopTo !== null && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls );
}
base.$nav = $('<ul class="thumbNav" />').appendTo( (o.appendNavigationTo !== null && $(o.appendNavigationTo).length) ? $(o.appendNavigationTo) : base.$controls );
// Set up a few defaults & get details
base.flag = false; // event flag to prevent multiple calls (used in control click/focusin)
base.playing = o.autoPlay; // slideshow state; removed "startStopped" option
base.slideshow = false; // slideshow flag needed to correctly trigger slideshow events
base.hovered = false; // actively hovering over the slider
base.panelSize = []; // will contain dimensions and left position of each panel
base.currentPage = o.startPanel = parseInt(o.startPanel,10) || 1; // make sure this isn't a string
o.changeBy = parseInt(o.changeBy,10) || 1;
base.adj = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes
base.width = base.$el.width();
base.height = base.$el.height();
base.outerPad = [ base.$wrapper.innerWidth() - base.$wrapper.width(), base.$wrapper.innerHeight() - base.$wrapper.height() ];
if (o.playRtl) { base.$wrapper.addClass('rtl'); }
// Expand slider to fit parent
if (o.expand) {
base.$outer = base.$wrapper.parent();
base.$window.css({ width: '100%', height: '100%' }); // needed for Opera
base.checkResize();
}
// Build start/stop button
if (o.buildStartStop) { base.buildAutoPlay(); }
// Build forwards/backwards buttons
if (o.buildArrows) { base.buildNextBackButtons(); }
// can't lock autoplay it if it's not enabled
if (!o.autoPlay) { o.autoPlayLocked = false; }
base.updateSlider();
base.$lastPage = base.$currentPage;
// Get index (run time) of this slider on the page
base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;
base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex
if (base.runTimes === 1) { base.makeActive(); } // make the first slider on the page active
// Make sure easing function exists.
if (!$.isFunction($.easing[o.easing])) { o.easing = "swing"; }
// If pauseOnHover then add hover effects
if (o.pauseOnHover) {
base.$wrapper.hover(function() {
if (base.playing) {
base.$el.trigger('slideshow_paused', base);
base.clearTimer(true);
}
}, function() {
if (base.playing) {
base.$el.trigger('slideshow_unpaused', base);
base.startStop(base.playing, true);
}
});
}
// If a hash can not be used to trigger the plugin, then go to start panel
base.setCurrentPage(base.gotoHash() || o.startPage, false);
// Hide/Show navigation & play/stop controls
base.slideControls(false);
base.$wrapper.bind('mouseenter mouseleave', function(e){
base.hovered = (e.type === "mouseenter") ? true : false;
base.slideControls( base.hovered, false );
});
// Add keyboard navigation
$(document).keyup(function(e){
// Stop arrow keys from working when focused on form items
if (o.enableKeyboard && base.$wrapper.is('.activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
if (!o.vertical && (e.which === 38 || e.which === 40)) { return; }
switch (e.which) {
case 39: case 40: // right & down arrow
base.goForward();
break;
case 37: case 38: // left & up arrow
base.goBack();
break;
}
}
});
// Fix tabbing through the page, but don't change the view if the link is in view (showMultiple = true)
base.$items.delegate('a', 'focus.AnythingSlider', function(e){
var panel = $(this).closest('.panel'),
indx = base.$items.index(panel) + base.adj; // index can be -1 in nested sliders - issue #208
base.$items.find('.focusedLink').removeClass('focusedLink');
$(this).addClass('focusedLink');
base.$window.scrollLeft(0);
if ( ( indx !== -1 && (indx >= base.currentPage + o.showMultiple || indx < base.currentPage) ) ) {
base.gotoPage(indx);
e.preventDefault();
}
});
// Binds events
var triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");
$.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,f){
if ($.isFunction(o[f])){
base.$el.bind(triggers[i], o[f]);
}
});
if ($.isFunction(o.onSlideComplete)){
// Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157
base.$el.bind('slide_complete', function(){
setTimeout(function(){ o.onSlideComplete(base); }, 0);
});
}
base.initialized = true;
base.$el.trigger('initialized', base);
// trigger the slideshow
base.startStop(base.playing);
};
// called during initialization & to update the slider if a panel is added or deleted
base.updateSlider = function(){
// needed for updating the slider
base.$el.children('.cloned').remove();
base.$nav.empty();
// set currentPage to 1 in case it was zero - occurs when adding slides after removing them all
base.currentPage = base.currentPage || 1;
base.$items = base.$el.children();
base.pages = base.$items.length;
base.dir = (o.vertical) ? 'top' : 'left';
o.showMultiple = (o.vertical) ? 1 : parseInt(o.showMultiple,10) || 1; // only integers allowed
o.navigationSize = (o.navigationSize === false) ? 0 : parseInt(o.navigationSize,10) || 0;
if (o.showMultiple > 1) {
if (o.showMultiple > base.pages) { o.showMultiple = base.pages; }
base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1;
base.pages = base.$items.length - base.adjustMultiple;
}
// Hide navigation & player if there is only one page
base.$controls
.add(base.$nav)
.add(base.$startStop)
.add(base.$forward)
.add(base.$back)[(base.pages <= 1) ? 'hide' : 'show']();
if (base.pages > 1) {
// Build/update navigation tabs
base.buildNavigation();
}
// Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
// This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID
// Moved removeAttr before addClass otherwise IE7 ignores the addClass: http://bugs.jquery.com/ticket/9871
if (o.infiniteSlides && base.pages > 1) {
base.$el.prepend( base.$items.filter(':last').clone().removeAttr('id').addClass('cloned') );
// Add support for multiple sliders shown at the same time
if (o.showMultiple > 1) {
base.$el.append( base.$items.filter(':lt(' + o.showMultiple + ')').clone().removeAttr('id').addClass('cloned').addClass('multiple') );
} else {
base.$el.append( base.$items.filter(':first').clone().removeAttr('id').addClass('cloned') );
}
base.$el.find('.cloned').each(function(){
// disable all focusable elements in cloned panels to prevent shifting the panels by tabbing
$(this).find('a,input,textarea,select,button,area').attr('disabled', 'disabled');
$(this).find('[id]').removeAttr('id');
});
}
// We just added two items, time to re-cache the list, then get the dimensions of each panel
base.$items = base.$el.children().addClass('panel' + (o.vertical ? ' vertical' : ''));
base.setDimensions();
// Set the dimensions of each panel
if (o.resizeContents) {
base.$items.css('width', base.width);
base.$wrapper.css('width', base.getDim(base.currentPage)[0]);
base.$wrapper.add(base.$items).css('height', base.height);
} else {
base.$win.load(function(){ base.setDimensions(); }); // set dimensions after all images load
}
if (base.currentPage > base.pages) {
base.currentPage = base.pages;
}
base.setCurrentPage(base.currentPage, false);
base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection
};
// Creates the numbered navigation links
base.buildNavigation = function() {
if (o.buildNavigation && (base.pages > 1)) {
var t, $a;
base.$items.filter(':not(.cloned)').each(function(i) {
var index = i + 1;
t = ((index === 1) ? 'first' : '') + ((index === base.pages) ? 'last' : '');
$a = $('<a href="#"></a>').addClass('panel' + index).wrap('<li class="' + t + '" />');
base.$nav.append($a.parent()); // use $a.parent() so it will add <li> instead of only the <a> to the <ul>
// If a formatter function is present, use it
if ($.isFunction(o.navigationFormatter)) {
t = o.navigationFormatter(index, $(this));
$a.html('<span>' + t + '</span>');
// Add formatting to title attribute if text is hidden
if (parseInt($a.find('span').css('text-indent'),10) < 0) { $a.addClass(o.tooltipClass).attr('title', t); }
} else {
$a.html('<span>' + index + '</span>');
}
$a.bind(o.clickControls, function(e) {
if (!base.flag && o.enableNavigation) {
// prevent running functions twice (once for click, second time for focusin)
base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
base.gotoPage(index);
if (o.hashTags) { base.setHash(index); }
}
e.preventDefault();
});
});
// Add navigation tab scrolling - use !! in case someone sets the size to zero
if (!!o.navigationSize && o.navigationSize < base.pages) {
if (!base.$controls.find('.anythingNavWindow').length){
base.$nav
.before('<ul><li class="prev"><a href="#"><span>' + o.backText + '</span></a></li></ul>')
.after('<ul><li class="next"><a href="#"><span>' + o.forwardText + '</span></a></li></ul>')
.wrap('<div class="anythingNavWindow"></div>');
}
// include half of the left position to include extra width from themes like tabs-light and tabs-dark (still not perfect)
base.navWidths = base.$nav.find('li').map(function(){
return $(this).innerWidth() + Math.ceil(parseInt($(this).find('span').css('left'),10)/2 || 0);
}).get();
base.navLeft = 1;
// add 5 pixels to make sure the tabs don't wrap to the next line
base.$nav.width( base.navWidth( 1, base.pages + 1 ) + 5 );
base.$controls.find('.anythingNavWindow')
.width( base.navWidth( 1, o.navigationSize + 1 ) ).end()
.find('.prev,.next').bind(o.clickControls, function(e) {
if (!base.flag) {
base.flag = true; setTimeout(function(){ base.flag = false; }, 200);
base.navWindow( base.navLeft + o.navigationSize * ( $(this).is('.prev') ? -1 : 1 ) );
}
e.preventDefault();
});
}
}
};
base.navWidth = function(x,y){
var i, s = Math.min(x,y),
e = Math.max(x,y),
w = 0;
for (i = s; i < e; i++) {
w += base.navWidths[i-1] || 0;
}
return w;
};
base.navWindow = function(n){
if (!!o.navigationSize && o.navigationSize < base.pages && base.navWidths) {
var p = base.pages - o.navigationSize + 1;
n = (n <= 1) ? 1 : (n > 1 && n < p) ? n : p;
if (n !== base.navLeft) {
base.$controls.find('.anythingNavWindow').animate(
{ scrollLeft: base.navWidth(1, n), width: base.navWidth(n, n + o.navigationSize) },
{ queue: false, duration: o.animationTime });
base.navLeft = n;
}
}
};
// Creates the Forward/Backward buttons
base.buildNextBackButtons = function() {
base.$forward = $('<span class="arrow forward"><a href="#"><span>' + o.forwardText + '</span></a></span>');
base.$back = $('<span class="arrow back"><a href="#"><span>' + o.backText + '</span></a></span>');
// Bind to the forward and back buttons
base.$back.bind(o.clickBackArrow, function(e) {
// prevent running functions twice (once for click, second time for swipe)
if (o.enableArrows && !base.flag) {
base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
base.goBack();
}
e.preventDefault();
});
base.$forward.bind(o.clickForwardArrow, function(e) {
// prevent running functions twice (once for click, second time for swipe)
if (o.enableArrows && !base.flag) {
base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
base.goForward();
}
e.preventDefault();
});
// using tab to get to arrow links will show they have focus (outline is disabled in css)
base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){
$(this).toggleClass('hover');
});
// Append elements to page
base.$back.appendTo( (o.appendBackTo !== null && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper );
base.$forward.appendTo( (o.appendForwardTo !== null && $(o.appendForwardTo).length) ? $(o.appendForwardTo) : base.$wrapper );
base.$arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle
};
// Creates the Start/Stop button
base.buildAutoPlay = function(){
base.$startStop
.html('<span>' + (base.playing ? o.stopText : o.startText) + '</span>')
.bind(o.clickSlideshow, function(e) {
if (o.enableStartStop) {
base.startStop(!base.playing);
base.makeActive();
if (base.playing && !o.autoPlayDelayed) {
base.goForward(true);
}
}
e.preventDefault();
})
// show button has focus while tabbing
.bind('focusin focusout',function(){
$(this).toggleClass('hover');
});
};
// Adjust slider dimensions on parent element resize
base.checkResize = function(stopTimer){
clearTimeout(base.resizeTimer);
base.resizeTimer = setTimeout(function(){
var w = base.$outer.width() - base.outerPad[0],
h = (base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height()) - base.outerPad[1];
// base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows.
if (base.width * o.showMultiple !== w || base.height !== h) {
base.setDimensions(); // adjust panel sizes
// make sure page is lined up (use -1 animation time, so we can differeniate it from when animationTime = 0)
base.gotoPage(base.currentPage, base.playing, null, -1);
}
if (typeof(stopTimer) === 'undefined'){ base.checkResize(); }
}, 500);
};
// Set panel dimensions to either resize content or adjust panel to content
base.setDimensions = function(){
var w, h, c, edge = 0,
fullsize = { width: '100%', height: '100%' },
// determine panel width
pw = (o.showMultiple > 1) ? base.width || base.$window.width()/o.showMultiple : base.$window.width(),
winw = base.$win.width();
if (o.expand){
w = base.$outer.width() - base.outerPad[0];
base.height = h = base.$outer.height() - base.outerPad[1];
base.$wrapper.add(base.$window).add(base.$items).css({ width: w, height: h });
base.width = pw = (o.showMultiple > 1) ? w/o.showMultiple : w;
}
base.$items.each(function(i){
c = $(this).children();
if (o.resizeContents){
// resize panel
w = base.width;
h = base.height;
$(this).css({ width: w, height: h });
if (c.length) {
if (c[0].tagName === "EMBED") { c.attr(fullsize); } // needed for IE7; also c.length > 1 in IE7
if (c[0].tagName === "OBJECT") { c.find('embed').attr(fullsize); }
// resize panel contents, if solitary (wrapped content or solitary image)
if (c.length === 1){ c.css(fullsize); }
}
} else {
// get panel width & height and save it
w = $(this).width() || base.width; // if image hasn't finished loading, width will be zero, so set it to base width instead
if (c.length === 1 && w >= winw){
w = (c.width() >= winw) ? pw : c.width(); // get width of solitary child
c.css('max-width', w); // set max width for all children
}
$(this).css('width', w); // set width of panel
h = (c.length === 1 ? c.outerHeight(true) : $(this).height()); // get height after setting width
if (h <= base.outerPad[1]) { h = base.height; } // if height less than the outside padding, then set it to the preset height
$(this).css('height', h);
}
base.panelSize[i] = [w,h,edge];
edge += (o.vertical) ? h : w;
});
// Set total width of slider, Note that this is limited to 32766 by Opera - option removed
base.$el.css((o.vertical ? 'height' : 'width'), edge);
};
// get dimension of multiple panels, as needed
base.getDim = function(page){
if (base.pages < 1 || isNaN(page)) { return [ base.width, base.height ]; } // prevent errors when base.panelSize is empty
page = (o.infiniteSlides && base.pages > 1) ? page : page - 1;
var i,
w = base.panelSize[page][0],
h = base.panelSize[page][1];
if (o.showMultiple > 1) {
for (i=1; i < o.showMultiple; i++) {
w += base.panelSize[(page + i)%o.showMultiple][0];
h = Math.max(h, base.panelSize[page + i][1]);
}
}
return [w,h];
};
base.goForward = function(autoplay) {
base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? -1 : 1), autoplay);
};
base.goBack = function(autoplay) {
base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? 1 : -1), autoplay);
};
base.gotoPage = function(page, autoplay, callback, time) {
if (autoplay !== true) {
autoplay = false;
base.startStop(false);
base.makeActive();
}
// check if page is an id or class name
if (/^[#|.]/.test(page) && $(page).length) {
page = $(page).closest('.panel').index() + base.adj;
}
// rewind effect occurs here when changeBy > 1
if (o.changeBy !== 1){
if (page < 0) { page += base.pages; }
if (page > base.pages) { page -= base.pages; }
}
if (base.pages <= 1) { return; } // prevents animation
base.$lastPage = base.$currentPage;
if (typeof(page) !== "number") {
page = o.startPanel;
base.setCurrentPage(page);
}
// pause YouTube videos before scrolling or prevent change if playing
if (autoplay && o.isVideoPlaying(base)) { return; }
if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; }
if (page < base.adj ) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; }
base.currentPage = ( page > base.pages ) ? base.pages : ( page < 1 ) ? 1 : base.currentPage;
base.$currentPage = base.$items.eq(base.currentPage - base.adj);
base.exactPage = page;
base.targetPage = (page === 0) ? base.pages - base.adj : (page > base.pages) ? 1 - base.adj : page - base.adj;
base.$targetPage = base.$items.eq( base.targetPage );
time = time || o.animationTime;
// don't trigger events when time = 1 - to prevent FX from firing multiple times on page resize
if (time >= 0) { base.$el.trigger('slide_init', base); }
base.slideControls(true, false);
// When autoplay isn't passed, we stop the timer
if (autoplay !== true) { autoplay = false; }
// Stop the slider when we reach the last page, if the option stopAtEnd is set to true
if (!autoplay || (o.stopAtEnd && page === base.pages)) { base.startStop(false); }
if (time >= 0) { base.$el.trigger('slide_begin', base); }
// delay starting slide animation
setTimeout(function(d){
// resize slider if content size varies
if (!o.resizeContents) {
// animating the wrapper resize before the window prevents flickering in Firefox
d = base.getDim(page);
base.$wrapper.filter(':not(:animated)').animate(
// prevent animating a dimension to zero
{ width: d[0] || base.width, height: d[1] || base.height },
{ queue: false, duration: (time < 0 ? 0 : time), easing: o.easing }
);
}
d = {};
d[base.dir] = -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2];
// Animate Slider
base.$el.filter(':not(:animated)').animate(
d, { queue: false, duration: time, easing: o.easing, complete: function(){ base.endAnimation(page, callback, time); } }
);
}, parseInt(o.delayBeforeAnimate, 10) || 0);
};
base.endAnimation = function(page, callback, time){
if (page === 0) {
base.$el.css( base.dir, -base.panelSize[base.pages][2]);
page = base.pages;
} else if (page > base.pages) {
// reset back to start position
base.$el.css( base.dir, -base.panelSize[1][2]);
page = 1;
}
base.exactPage = page;
base.setCurrentPage(page, false);
// Add active panel class
base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
if (!base.hovered) { base.slideControls(false); }
if (time >= 0) { base.$el.trigger('slide_complete', base); }
// callback from external slide control: $('#slider').anythingSlider(4, function(slider){ })
if (typeof callback === 'function') { callback(base); }
// Continue slideshow after a delay
if (o.autoPlayLocked && !base.playing) {
setTimeout(function(){
base.startStop(true);
// subtract out slide delay as the slideshow waits that additional time.
}, o.resumeDelay - (o.autoPlayDelayed ? o.delay : 0));
}
};
base.setCurrentPage = function(page, move) {
page = parseInt(page, 10);
if (base.pages < 1 || page === 0 || isNaN(page)) { return; }
if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; }
if (page < base.adj ) { page = 1; }
// Set visual
if (o.buildNavigation){
base.$nav
.find('.cur').removeClass('cur').end()
.find('a').eq(page - 1).addClass('cur');
}
// hide/show arrows based on infinite scroll mode
if (!o.infiniteSlides && o.stopAtEnd){
base.$wrapper
.find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled').end()
.find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled');
if (page === base.pages && base.playing) { base.startStop(); }
}
// Only change left if move does not equal false
if (!move) {
var d = base.getDim(page);
base.$wrapper
.css({ width: d[0], height: d[1] })
.add(base.$window).scrollLeft(0); // reset in case tabbing changed this scrollLeft - probably overly redundant
base.$el.css( base.dir, -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2] );
}
// Update local variable
base.currentPage = page;
base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
};
base.makeActive = function(){
// Set current slider as active so keyboard navigation works properly
if (!base.$wrapper.is('.activeSlider')){
$('.activeSlider').removeClass('activeSlider');
base.$wrapper.addClass('activeSlider');
}
};
// This method tries to find a hash that matches an ID and panel-X
// If either found, it tries to find a matching item
// If that is found as well, then it returns the page number
base.gotoHash = function(){
var h = base.win.location.hash,
i = h.indexOf('&'),
n = h.match(base.regex);
// test for "/#/" or "/#!/" used by the jquery address plugin - $('#/') breaks jQuery
if (n === null && !/^#&/.test(h) && !/#!?\//.test(h)) {
// #quote2&panel1-3&panel3-3
h = h.substring(0, (i >= 0 ? i : h.length));
// ensure the element is in the same slider
n = ($(h).length && $(h).closest('.anythingBase')[0] === base.el) ? $(h).closest('.panel').index() : null;
} else if (n !== null) {
// #&panel1-3&panel3-3
n = (o.hashTags) ? parseInt(n[1],10) : null;
}
return n;
};
base.setHash = function(n){
var s = 'panel' + base.runTimes + '-',
h = base.win.location.hash;
if ( typeof h !== 'undefined' ) {
base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n;
}
};
// Slide controls (nav and play/stop button up or down)
base.slideControls = function(toggle){
//var dir = (toggle) ? 'slideDown' : 'slideUp',
var dir = (toggle) ? 'fadeIn' : 'fadeOut',
t1 = (toggle) ? 0 : o.animationTime,
t2 = (toggle) ? o.animationTime: 0,
op = (toggle) ? 1 : 0,
sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden
if (o.toggleControls) {
if (!base.hovered && base.playing) { dir = "fadeOut" } // don't animate arrows during slideshow
base.$controls.stop(true,true).delay(t1)[dir](o.animationTime/2).delay(t2);
}
if (o.buildArrows && o.toggleArrows) {
if (!base.hovered && base.playing) { sign = 1; op = 0; } // don't animate arrows during slideshow
base.$forward.stop(true,true).delay(t1).animate({ opacity: op }, o.animationTime/2);
//base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: op }, o.animationTime/2);
base.$back.stop(true,true).delay(t1).animate({ opacity: op }, o.animationTime/2);
//base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: op }, o.animationTime/2);
}
};
base.clearTimer = function(paused){
// Clear the timer only if it is set
if (base.timer) {
base.win.clearInterval(base.timer);
if (!paused && base.slideshow) {
base.$el.trigger('slideshow_stop', base);
base.slideshow = false;
}
}
};
// Pass startStop(false) to stop and startStop(true) to play
base.startStop = function(playing, paused) {
if (playing !== true) { playing = false; } // Default if not supplied is false
base.playing = playing;
if (playing && !paused) {
base.$el.trigger('slideshow_start', base);
base.slideshow = true;
}
// Toggle playing and text
if (o.buildStartStop) {
base.$startStop.toggleClass('playing', playing).find('span').html( playing ? o.stopText : o.startText );
// add button text to title attribute if it is hidden by text-indent
if (parseInt(base.$startStop.find('span').css('text-indent'),10) < 0) {
base.$startStop.addClass(o.tooltipClass).attr( 'title', playing ? o.stopText : o.startText );
}
}
// Pause slideshow while video is playing
if (playing){
base.clearTimer(true); // Just in case this was triggered twice in a row
base.timer = base.win.setInterval(function() {
// prevent autoplay if video is playing
if ( !o.isVideoPlaying(base) ) {
base.goForward(true);
// stop slideshow if resume if false
} else if (!o.resumeOnVideoEnd) {
base.startStop();
}
}, o.delay);
} else {
base.clearTimer();
}
};
// Trigger the initialization
base.init();
};
$.anythingSlider.defaults = {
// Appearance
theme : "default", // Theme name, add the css stylesheet manually
expand : false, // If true, the entire slider will expand to fit the parent element
resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport
vertical : false, // If true, all panels will slide vertically; they slide horizontally otherwise
showMultiple : false, // Set this value to a number and it will show that many slides at once
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI
buildArrows : true, // If true, builds the forwards and backwards buttons
buildNavigation : true, // If true, builds a list of anchor links to link to each panel
buildStartStop : true, // ** If true, builds the start/stop button
appendForwardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null
appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null
appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null
toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times
toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
startText : "Start", // Start button text
stopText : "Stop", // Stop button text
forwardText : "&raquo;", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
backText : "&laquo;", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
// Function
enableArrows : true, // if false, arrows will be visible, but not clickable.
enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay"
enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider.
// Navigation
startPanel : 1, // This sets the initial panel
changeBy : 1, // Amount to go forward or back when changing panels.
hashTags : true, // Should links change the hashtag in the URL?
infiniteSlides : true, // if false, the slider will not wrap & not clone any panels
navigationFormatter : null, // Details at the top of the file on this use (advanced use)
navigationSize : false, // Set this to the maximum number of visible navigation tabs; false to disable
// Slideshow options
autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option
autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts
pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
playRtl : false, // If true, the slideshow will move right-to-left
// Times
delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
delayBeforeAnimate : 0, // How long to pause slide animation before going to the desired slide (used if you want your "out" FX to show).
// Callbacks - removed from options to reduce size - they still work
// Interactivity
clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight")
clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft")
clickControls : "click focusin", // Events used to activate navigation control functionality
clickSlideshow : "click", // Event used to activate slideshow play/stop button
// Video
resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete
resumeOnVisible : true, // If true the video will resume playing (if previously paused, except for YouTube iframe - known issue); if false, the video remains paused.
addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension
};
$.fn.anythingSlider = function(options, callback) {
return this.each(function(){
var page, anySlide = $(this).data('AnythingSlider');
// initialize the slider but prevent multiple initializations
if ((typeof(options)).match('object|undefined')){
if (!anySlide) {
(new $.anythingSlider(this, options));
} else {
anySlide.updateSlider();
}
// If options is a number, process as an external link to page #: $(element).anythingSlider(#)
} else if (/\d/.test(options) && !isNaN(options) && anySlide) {
page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 "
// ignore out of bound pages
if ( page >= 1 && page <= anySlide.pages ) {
anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback
}
// Accept id or class name
} else if (/^[#|.]/.test(options) && $(options).length) {
anySlide.gotoPage(options, false, callback);
}
});
};
})(jQuery);
jQuery(document).ready(function() {
// Anything Slider Setting
ANYTHING.autoPlay = true;
ANYTHING.resumeOnVideoEnd = true;
ANYTHING.resizeContents = true;
ANYTHING.addWmodeToObject = 'transparent';
ANYTHING.pauseOnHover = (ANYTHING.pauseOnHover == 'enable')? true: false;
ANYTHING.buildNavigation = (ANYTHING.buildNavigation == 'enable')? true: false;
ANYTHING.buildArrows = (ANYTHING.buildArrows == 'enable')? true: false;
ANYTHING.toggleArrows = (ANYTHING.toggleArrows == 'enable')? true: false;
ANYTHING.toggleControls = (ANYTHING.toggleControls == 'enable')? true: false;
ANYTHING.buildStartStop = false;
ANYTHING.delay = parseInt(ANYTHING.delay);
ANYTHING.animationTime = parseInt(ANYTHING.animationTime);
jQuery('ul.anythingSlider').anythingSlider( ANYTHING );
});

View File

@@ -0,0 +1,379 @@
/*
* AnythingSlider Video Controller 1.3 beta for AnythingSlider v1.6+
* By Rob Garrison (aka Mottie & Fudgey)
* Dual licensed under the MIT and GPL licenses.
*/
(function($) {
$.fn.anythingSliderVideo = function(options){
//Set the default values, use comma to separate the settings, example:
var defaults = {
videoID : 'asvideo' // id prefix
};
return this.each(function(){
// make sure a AnythingSlider is attached
var video, tmp, service, sel, base = $(this).data('AnythingSlider');
if (!base) { return; }
video = base.video = {};
// Next update, I may just force users to call the video extension instead of it auto-running on window load
// then they can change the video options in that call instead of the base defaults, and maybe prevent the
// videos being initialized twice on startup (once as a regular video and second time with the API string)
video.options = $.extend({}, defaults, options);
// check if SWFObject is loaded
video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function') ? true : false;
video.list = {};
video.hasVid = false;
video.hasEmbed = false;
video.services = $.fn.anythingSliderVideo.services;
video.len = 0; // used to add a unique ID to videos "asvideo#"
video.hasEmbedCount = 0;
video.hasiframeCount = 0;
video.$items = base.$items.filter(':not(.cloned)');
// find and save all known videos
for (service in video.services) {
if (typeof(service) === 'string') {
sel = video.services[service].selector;
video.$items.find(sel).each(function(){
tmp = $(this);
// save panel and video selector in the list
tmp.attr('id', video.options.videoID + video.len);
video.list[video.len] = {
id : video.options.videoID + video.len++,
panel : tmp.closest('.panel')[0],
service : service,
selector : sel,
status : -1 // YouTube uses -1 to mean the video is unstarted
};
video.hasVid = true;
if (sel.match('embed|object')) {
video.hasEmbed = true;
video.hasEmbedCount++;
} else if (sel.match('iframe')) {
video.hasiframeCount++;
}
});
}
}
// Initialize each video, as needed
$.each(video.list, function(i,s){
// s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector'
var tmp, $tar, vidsrc, opts,
$vid = $(s.panel).find(s.selector),
service = video.services[s.service],
api = service.initAPI || '';
// Initialize embeded video javascript api using SWFObject, if loaded
if (video.hasEmbed && video.hasSwfo && s.selector.match('embed|object')) {
$vid.each(function(){
// Older IE doesn't have an object - just make sure we are wrapping the correct element
$tar = ($(this).parent()[0].tagName === 'OBJECT') ? $(this).parent() : $(this);
vidsrc = ($tar[0].tagName === 'EMBED') ? $tar.attr('src') : $tar.find('embed').attr('src') || $tar.children().filter('[name=movie]').attr('value');
opts = $.extend(true, {}, {
flashvars : null,
params : { allowScriptAccess: 'always', wmode : base.options.addWmodeToObject, allowfullscreen : true },
attr : { 'class' : $tar.attr('class'), 'style' : $tar.attr('style'), 'data-url' : vidsrc }
}, service.embedOpts);
$tar.wrap('<div id="' + s.id + '"></div>');
// use SWFObject if it exists, it replaces the wrapper with the object/embed
swfobject.embedSWF(vidsrc + (api === '' ? '': api + s.id), s.id,
$tar.attr('width'), $tar.attr('height'), '10', null,
opts.flashvars, opts.params, opts.attr, function(){
// run init code if it exists
if (service.hasOwnProperty('init')) {
video.list[i].player = service.init(base, s.id, i);
}
if (i >= video.hasEmbedCount) {
base.$el.trigger('swf_completed', base); // swf callback
}
}
);
});
} else if (s.selector.match('iframe')) {
$vid.each(function(i,v){
vidsrc = $(this).attr('src');
tmp = (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + base.options.addWmodeToObject; // string connector & wmode
$(this).attr('src', function(i,r){ return r + tmp + (api === '' ? '': api + s.id); });
});
}
});
// Returns URL parameter; url: http://www.somesite.com?name=hello&id=11111
// Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
video.gup = function(n,s){
n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href);
return (p===null) ? "" : p[1];
};
// postMessage to iframe - http://benalman.com/projects/jquery-postmessage-plugin/ (FOR IE7)
video.postMsg = function(data, vid){
var $vid = $('#' + vid);
if ($vid.length){
$vid[0].contentWindow.postMessage(data, $vid.attr('src').split('?')[0]);
}
};
// receive message from iframe
// no way to figure out which iframe since the message is from the window
video.message = function(e){
if (e.data) {
if (/infoDelivery/g.test(e.data)) { return; } // ignore youtube video loading spam
var data = $.parseJSON(e.data);
$.each(video.list, function(i,s){
if (video.services[video.list[i].service].hasOwnProperty('message')) {
video.services[video.list[i].service].message(base, data);
}
});
}
};
// toDO = 'cont', 'pause' or 'isPlaying'
video.control = function(toDo){
var i,
s = video.list,
slide = (toDo === 'pause') ? base.$lastPage[0] : base.$currentPage[0],
isPlaying = false;
for (i=0; i < video.len; i++){
if (s[i].panel === slide && video.services[s[i].service].hasOwnProperty(toDo)){
isPlaying = video.services[s[i].service][toDo](base, s[i].id, i);
}
}
return isPlaying;
};
// iframe event listener
if (video.hasiframeCount){
if (window.addEventListener){
window.addEventListener('message', video.message, false);
} else { // IE
window.attachEvent('onmessage', video.message, false);
}
}
// bind to events
base.$el
.bind('slide_init', function(){
video.control('pause');
})
.bind('slide_complete', function(){
video.control('cont');
});
base.options.isVideoPlaying = function(){ return video.control('isPlaying'); };
});
};
/* Each video service is set up as follows
* service-name : {
* // initialization
* selector : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples)
* initAPI : 'string added to the URL to initialize the API', // optional: the string must end with a parameter pointing to the video id (e.g. "&player_id=")
* embedOpts : { flashvars: {}, params: {}, attr: {} }, // optional: add any required flashvars, parameters or attributes to initialize the API
* // video startup functions
* init : function(base, vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject
* // required functions
* cont : function(base, vid, index){ }, // required: continue play if video was previously played
* pause : function(base, vid, index){ }, // required: pause ALL videos
* message : function(base, data){ }, // required for iframe: process data received from iframe and update the video status for the "isPlaying" function
* isPlaying : function(base, vid, index){ } // required: return true if video is playing and return false if not playing (paused or ended)
* }
*
* Function variables
* base (object) = plugin base, all video values/functions are stored in base.video
* vid (string) is the ID of the video: vid = "asvideo1"; so jQuery needs a "#" in front... "#" + videoID option default ("asvideo") + index (e.g. "1"); each video matching a service will have a unquie vid
* index (number) is the unique video number from the vid (starts from zero)
*
* var list = base.video.list[index]; list will contain:
* list.id = vid
* list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc)
* list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc)
* list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid)
* list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below
*/
$.fn.anythingSliderVideo.services = {
// *** HTML5 video ***
video : {
selector : 'video',
cont : function(base, vid, index){
var $vid = $('#' + vid);
if ($vid.length && $vid[0].paused && $vid[0].currentTime > 0 && !$vid[0].ended) {
$vid[0].play();
}
},
pause : function(base, vid){
// pause ALL videos on the page
$('video').each(function(){
if (typeof(this.pause) !== 'undefined') { this.pause(); } // throws an error in older ie without this
});
},
isPlaying : function(base, vid, index){
var $vid = $('#' + vid);
// media.paused seems to be the only way to determine if a video is playing
return ($vid.length && typeof($vid[0].pause) !== 'undefined' && !$vid[0].paused && !$vid[0].ended) ? true : false;
}
},
// *** Vimeo iframe *** isolated demo: http://jsfiddle.net/Mottie/GxwEX/
vimeo1 : {
selector : 'iframe[src*=vimeo]',
initAPI : '&api=1&player_id=', // video ID added to the end
cont : function(base, vid, index){
if (base.options.resumeOnVisible && base.video.list[index].status === 'pause'){
// Commands sent to the iframe originally had "JSON.stringify" applied to them,
// but not all browsers support this, so it's just as easy to wrap it in quotes.
base.video.postMsg('{"method":"play"}', vid);
}
},
pause : function(base, vid){
// pause ALL videos on the page
$('iframe[src*=vimeo]').each(function(){
base.video.postMsg('{"method":"pause"}', this.id);
});
},
message : function(base, data){
// *** VIMEO *** iframe uses data.player_id
var index, vid = data.player_id || ''; // vid = data.player_id (unique to vimeo)
if (vid !== ''){
index = vid.replace(base.video.options.videoID, '');
if (data.event === 'ready') {
// Vimeo ready, add additional event listeners for video status
base.video.postMsg('{"method":"addEventListener","value":"play"}', vid);
base.video.postMsg('{"method":"addEventListener","value":"pause"}', vid);
base.video.postMsg('{"method":"addEventListener","value":"finish"}', vid);
}
// update current status - vimeo puts it in data.event
if (base.video.list[index]) { base.video.list[index].status = data.event; }
}
},
isPlaying : function(base, vid, index){
return (base.video.list[index].status === 'play') ? true : false;
}
},
// *** Embeded Vimeo ***
// SWFObject adds the url to the object data
// using param as a selector, the script above looks for the parent if it sees "param"
vimeo2 : {
selector : 'object[data-url*=vimeo], embed[src*=vimeo]',
embedOpts : { flashvars : { api : 1 } },
cont : function(base, vid, index) {
if (base.options.resumeOnVisible) {
var $vid = $('#' + vid);
// continue video if previously played & not finished (api_finish doesn't seem to exist) - duration can be a decimal number, so subtract it and look at the difference (2 seconds here)
if (typeof($vid[0].api_play) === 'function' && $vid[0].api_paused() && $vid[0].api_getCurrentTime() !== 0 && ($vid[0].api_getDuration() - $vid[0].api_getCurrentTime()) > 2) {
$vid[0].api_play();
}
}
},
pause : function(base, vid){
// find ALL videos and pause them, just in case
$('object[data-url*=vimeo], embed[src*=vimeo]').each(function(){
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
if (typeof(el.api_pause) === 'function') {
el.api_pause();
}
});
},
isPlaying : function(base, vid, index){
var $vid = $('#' + vid);
return (typeof($vid[0].api_paused) === 'function' && !$vid[0].api_paused()) ? true : false;
}
},
// *** iframe YouTube *** isolated demo: http://jsfiddle.net/Mottie/qk5MY/
youtube1 : {
selector : 'iframe[src*=youtube]',
// "iv_load_policy=3" should turn off annotations on init, but doesn't seem to
initAPI : '&iv_load_policy=3&enablejsapi=1&playerapiid=',
cont : function(base, vid, index){
if (base.options.resumeOnVisible && base.video.list[index].status === 2){
base.video.postMsg('{"event":"command","func":"playVideo"}', vid);
}
},
pause : function(base, vid, index){
// pause ALL videos on the page - in IE, pausing a video means it will continue when next seen =(
$('iframe[src*=youtube]').each(function(){
// if (this.id !== vid || (this.id === vid && base.video.list[index].status >= 0)) { // trying to fix the continue video problem; this only breaks it
base.video.postMsg('{"event":"command","func":"pauseVideo"}', vid);
// }
});
},
message : function(base, data){
if (data.event === 'infoDelivery') { return; } // ignore youtube video loading spam
// *** YouTube *** iframe returns an embeded url (data.info.videoUrl) but no video id...
if (data.info && data.info.videoUrl) {
// figure out vid for youtube
// data.info.videoURL = http://www.youtube.com/watch?v=###########&feature=player_embedded
var url = base.video.gup('v', data.info.videoUrl), // end up with ###########, now find it
v = $('iframe[src*=' + url + ']'), vid, index;
// iframe src changes when watching related videos; so there is no way to tell which video has an update
if (v.length) {
vid = v[0].id;
index = vid.replace(base.video.options.videoID, '');
// YouTube ready, add additional event listeners for video status. BUT this never fires off =(
// Fixing this may solve the continue problem
if (data.event === 'onReady') {
base.video.postMsg('{"event":"listening","func":"onStateChange"}', vid);
}
// Update status, so the "isPlaying" function can access it
if (data.event === 'onStateChange' && base.video.list[index]) {
// update list with current status; data.info.playerState = YouTube
base.video.list[index].status = data.info.playerState;
}
}
}
},
isPlaying : function(base, vid, index){
var status = base.video.list[index].status;
// state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
return (status === 1 || status > 2) ? true : false;
}
},
// *** Embeded YouTube ***
// include embed for IE; SWFObject adds the url to the object data attribute
youtube2 : {
selector : 'object[data-url*=youtube], embed[src*=youtube]',
initAPI : '&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=', // video ID added to the end
// YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
cont : function(base, vid, index) {
if (base.options.resumeOnVisible) {
var $vid = $('#' + vid);
// continue video if previously played and not cued
if ($vid.length && typeof($vid[0].getPlayerState) === 'function' && $vid[0].getPlayerState() > 0) {
$vid[0].playVideo();
}
}
},
pause : function(base, vid){
// find ALL videos and pause them, just in case
$('object[data-url*=youtube], embed[src*=youtube]').each(function(){
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
if (typeof(el.getPlayerState) === 'function' && el.getPlayerState() > 0) {
// pause video if not autoplaying (if already initialized)
el.pauseVideo();
}
});
},
isPlaying : function(base, vid){
var $vid = $('#' + vid);
return (typeof($vid[0].getPlayerState) === 'function' && ($vid[0].getPlayerState() === 1 || $vid[0].getPlayerState() > 2)) ? true : false;
}
}
};
})(jQuery);
// Initialize video extension automatically
jQuery(window).load(function(){
jQuery('.anythingBase').anythingSliderVideo();
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
/*
* 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.
*
*/

View File

@@ -0,0 +1,85 @@
/*!
* Media helper for fancyBox
* version: 1.0.0
* @requires fancyBox v2.0 or later
*
* Usage:
* $(".fancybox").fancybox({
* media: {}
* });
*
* Supports:
* Youtube
* http://www.youtube.com/watch?v=opj24KnzrWo
* http://youtu.be/opj24KnzrWo
* Vimeo
* http://vimeo.com/25634903
* Metacafe
* http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
* http://www.metacafe.com/watch/7635964/
* Dailymotion
* http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
* Twitvid
* http://twitvid.com/QY7MD
* Twitpic
* http://twitpic.com/7p93st
* Instagram
* http://instagr.am/p/IejkuUGxQn/
* http://instagram.com/p/IejkuUGxQn/
* Google maps
* http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
* http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
* http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56
*/
(function ($) {
//Shortcut for fancyBox object
var F = $.fancybox;
//Add helper object
F.helpers.media = {
beforeLoad : function(opts, obj) {
var href = obj.href || '',
type = false,
rez;
if ((rez = href.match(/(youtube\.com|youtu\.be)\/(v\/|u\/|embed\/|watch\?v=)?([^#\&\?]*).*/i))) {
href = '//www.youtube.com/embed/' + rez[3] + '?autoplay=1&autohide=1&fs=1&rel=0&enablejsapi=1';
type = 'iframe';
} else if ((rez = href.match(/vimeo.com\/(\d+)\/?(.*)/))) {
href = '//player.vimeo.com/video/' + rez[1] + '?hd=1&autoplay=1&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1';
type = 'iframe';
} else if ((rez = href.match(/metacafe.com\/watch\/(\d+)\/?(.*)/))) {
href = '//www.metacafe.com/fplayer/' + rez[1] + '/.swf?playerVars=autoPlay=yes';
type = 'swf';
} else if ((rez = href.match(/dailymotion.com\/video\/(.*)\/?(.*)/))) {
href = '//www.dailymotion.com/swf/video/' + rez[1] + '?additionalInfos=0&autoStart=1';
type = 'swf';
} else if ((rez = href.match(/twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i))) {
href = '//www.twitvid.com/embed.php?autoplay=0&guid=' + rez[1];
type = 'iframe';
} else if ((rez = href.match(/twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i))) {
href = '//twitpic.com/show/full/' + rez[1];
type = 'image';
} else if ((rez = href.match(/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i))) {
href = '//' + rez[1] + '/p/' + rez[2] + '/media/?size=l';
type = 'image';
} else if ((rez = href.match(/maps\.google\.com\/(\?ll=|maps\/?\?q=)(.*)/i))) {
href = '//maps.google.com/' + rez[1] + '' + rez[2] + '&output=' + (rez[2].indexOf('layer=c') ? 'svembed' : 'embed');
type = 'iframe';
}
if (type) {
obj.href = href;
obj.type = type;
}
}
}
}(jQuery));

View File

@@ -0,0 +1,157 @@
/*!
* Thumbnail helper for fancyBox
* version: 1.0.4
* @requires fancyBox v2.0 or later
*
* Usage:
* $(".fancybox").fancybox({
* thumbs: {
* width : 50,
* height : 50
* }
* });
*
* Options:
* width - thumbnail width
* height - thumbnail height
* source - function to obtain the URL of the thumbnail image
* position - 'top' or 'bottom'
*
*/
(function ($) {
//Shortcut for fancyBox object
var F = $.fancybox;
//Add helper object
F.helpers.thumbs = {
wrap: null,
list: null,
width: 0,
//Default function to obtain the URL of the thumbnail image
source: function (el) {
var img;
if ($.type(el) === 'string') {
return el;
}
img = $(el).find('img');
return img.length ? img.attr('src') : el.href;
},
init: function (opts) {
var that = this,
list,
thumbWidth = opts.width || 50,
thumbHeight = opts.height || 50,
thumbSource = opts.source || this.source;
//Build list structure
list = '';
for (var n = 0; n < F.group.length; n++) {
list += '<li><a style="width:' + thumbWidth + 'px;height:' + thumbHeight + 'px;" href="javascript:jQuery.fancybox.jumpto(' + n + ');"></a></li>';
}
this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position || 'bottom').appendTo('body');
this.list = $('<ul>' + list + '</ul>').appendTo(this.wrap);
//Load each thumbnail
$.each(F.group, function (i) {
$("<img />").load(function () {
var width = this.width,
height = this.height,
widthRatio, heightRatio, parent;
if (!that.list || !width || !height) {
return;
}
//Calculate thumbnail width/height and center it
widthRatio = width / thumbWidth;
heightRatio = height / thumbHeight;
parent = that.list.children().eq(i).find('a');
if (widthRatio >= 1 && heightRatio >= 1) {
if (widthRatio > heightRatio) {
width = Math.floor(width / heightRatio);
height = thumbHeight;
} else {
width = thumbWidth;
height = Math.floor(height / widthRatio);
}
}
$(this).css({
width: width,
height: height,
top: Math.floor(thumbHeight / 2 - height / 2),
left: Math.floor(thumbWidth / 2 - width / 2)
});
parent.width(thumbWidth).height(thumbHeight);
$(this).hide().appendTo(parent).fadeIn(300);
}).attr('src', thumbSource( F.group[ i ] ));
});
//Set initial width
this.width = this.list.children().eq(0).outerWidth(true);
this.list.width(this.width * (F.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (F.current.index * this.width + this.width * 0.5)));
},
//Center list
update: function (opts) {
if (this.list) {
this.list.stop(true).animate({
'left': Math.floor($(window).width() * 0.5 - (F.current.index * this.width + this.width * 0.5))
}, 150);
}
},
beforeLoad: function (opts) {
//Remove self if gallery do not have at least two items
if (F.group.length < 2) {
F.coming.helpers.thumbs = false;
return;
}
//Increase bottom margin to give space for thumbs
F.coming.margin[ opts.position === 'top' ? 0 : 2 ] = opts.height + 30;
},
afterShow: function (opts) {
//Check if exists and create or update list
if (this.list) {
this.update(opts);
} else {
this.init(opts);
}
//Set active element
this.list.children().removeClass('active').eq(F.current.index).addClass('active');
},
onUpdate: function () {
this.update();
},
beforeClose: function () {
if (this.wrap) {
this.wrap.remove();
}
this.wrap = null;
this.list = null;
this.width = 0;
}
}
}(jQuery));

View File

@@ -0,0 +1,105 @@
/*! fancyBox v2.0.6 fancyapps.com | fancyapps.com/fancybox/#license */
(function(s,l,d,t){var m=d(s),q=d(l),a=d.fancybox=function(){a.open.apply(this,arguments)},u=!1,k=l.createTouch!==t,o=function(a){return"string"===d.type(a)},n=function(b,c){c&&o(b)&&0<b.indexOf("%")&&(b=a.getViewport()[c]/100*parseInt(b,10));return Math.round(b)+"px"};d.extend(a,{version:"2.0.5",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:!0,autoResize:!k,autoCenter:!k,fitToView:!0,aspectRatio:!1,topRatio:0.5,fixed:!1,scrolling:"auto",
wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},keys:{next:[13,32,34,39,40],prev:[8,33,37,38],close:[27]},tpl:{wrap:'<div class="fancybox-wrap"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0"'+
(d.browser.msie?' allowtransparency="true"':"")+"></iframe>",swf:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>',error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
closeBtn:'<div title="Close" class="fancybox-item fancybox-close"></div>',next:'<a title="Next" class="fancybox-nav fancybox-next"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev"><span></span></a>'},openEffect:"fade",openSpeed:300,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:300,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:300,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",
prevSpeed:300,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:{speedIn:0,speedOut:300,opacity:0.8,css:{cursor:"pointer"},closeClick:!0},title:{type:"float"}}},group:{},opts:{},coming:null,current:null,isOpen:!1,isOpened:!1,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(b,c){a.close(!0);b&&!d.isArray(b)&&(b=b instanceof d?d(b).get():[b]);a.isActive=!0;a.opts=d.extend(!0,{},a.defaults,c);d.isPlainObject(c)&&c.keys!==t&&(a.opts.keys=c.keys?
d.extend({},a.defaults.keys,c.keys):!1);a.group=b;a._start(a.opts.index||0)},cancel:function(){a.coming&&!1===a.trigger("onCancel")||(a.coming=null,a.hideLoading(),a.ajaxLoad&&a.ajaxLoad.abort(),a.ajaxLoad=null,a.imgPreload&&(a.imgPreload.onload=a.imgPreload.onabort=a.imgPreload.onerror=null))},close:function(b){a.cancel();a.current&&!1!==a.trigger("beforeClose")&&(a.unbindEvents(),!a.isOpen||b&&!0===b[0]?(d(".fancybox-wrap").stop().trigger("onReset").remove(),a._afterZoomOut()):(a.isOpen=a.isOpened=
!1,d(".fancybox-item, .fancybox-nav").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.inner.css("overflow","hidden"),a.transitions[a.current.closeMethod]()))},play:function(b){var c=function(){clearTimeout(a.player.timer)},e=function(){c();a.current&&a.player.isActive&&(a.player.timer=setTimeout(a.next,a.current.playSpeed))},f=function(){c();d("body").unbind(".player");a.player.isActive=!1;a.trigger("onPlayEnd")};if(a.player.isActive||b&&!1===b[0])f();else if(a.current&&(a.current.loop||
a.current.index<a.group.length-1))a.player.isActive=!0,d("body").bind({"afterShow.player onUpdate.player":e,"onCancel.player beforeClose.player":f,"beforeLoad.player":c}),e(),a.trigger("onPlayStart")},next:function(){a.current&&a.jumpto(a.current.index+1)},prev:function(){a.current&&a.jumpto(a.current.index-1)},jumpto:function(b){a.current&&(b=parseInt(b,10),1<a.group.length&&a.current.loop&&(b>=a.group.length?b=0:0>b&&(b=a.group.length-1)),a.group[b]!==t&&(a.cancel(),a._start(b)))},reposition:function(b,
c){var e;a.isOpen&&(e=a._getPosition(c),b&&"scroll"===b.type?(delete e.position,a.wrap.stop(!0,!0).animate(e,200)):a.wrap.css(e))},update:function(b){a.isOpen&&(u||setTimeout(function(){var c=a.current,e=!b||b&&"orientationchange"===b.type;if(u&&(u=!1,c)){if(!b||"scroll"!==b.type||e)c.autoSize&&"iframe"!==c.type&&(a.inner.height("auto"),c.height=a.inner.height()),(c.autoResize||e)&&a._setDimension(),c.canGrow&&"iframe"!==c.type&&a.inner.height("auto");(c.autoCenter||e)&&a.reposition(b);a.trigger("onUpdate")}},
200),u=!0)},toggle:function(){a.isOpen&&(a.current.fitToView=!a.current.fitToView,a.update())},hideLoading:function(){q.unbind("keypress.fb");d("#fancybox-loading").remove()},showLoading:function(){a.hideLoading();q.bind("keypress.fb",function(b){27===b.keyCode&&(b.preventDefault(),a.cancel())});d('<div id="fancybox-loading"><div></div></div>').click(a.cancel).appendTo("body")},getViewport:function(){return{x:m.scrollLeft(),y:m.scrollTop(),w:k&&s.innerWidth?s.innerWidth:m.width(),h:k&&s.innerHeight?
s.innerHeight:m.height()}},unbindEvents:function(){a.wrap&&a.wrap.unbind(".fb");q.unbind(".fb");m.unbind(".fb")},bindEvents:function(){var b=a.current,c=b.keys;b&&(m.bind("resize.fb orientationchange.fb"+(b.autoCenter&&!b.fixed?" scroll.fb":""),a.update),c&&q.bind("keydown.fb",function(b){var f;f=b.target||b.srcElement;if(!b.ctrlKey&&!b.altKey&&!b.shiftKey&&!b.metaKey&&(!f||!f.type&&!d(f).is("[contenteditable]")))f=b.keyCode,-1<d.inArray(f,c.close)?(a.close(),b.preventDefault()):-1<d.inArray(f,c.next)?
(a.next(),b.preventDefault()):-1<d.inArray(f,c.prev)&&(a.prev(),b.preventDefault())}),d.fn.mousewheel&&b.mouseWheel&&1<a.group.length&&a.wrap.bind("mousewheel.fb",function(b,c){var d=b.target||null;if(0!==c&&(!d||0===d.clientHeight||d.scrollHeight===d.clientHeight&&d.scrollWidth===d.clientWidth))b.preventDefault(),a[0<c?"prev":"next"]()}))},trigger:function(b,c){var e,f=c||a[-1<d.inArray(b,["onCancel","beforeLoad","afterLoad"])?"coming":"current"];if(f){d.isFunction(f[b])&&(e=f[b].apply(f,Array.prototype.slice.call(arguments,
1)));if(!1===e)return!1;f.helpers&&d.each(f.helpers,function(c,e){if(e&&d.isPlainObject(a.helpers[c])&&d.isFunction(a.helpers[c][b]))a.helpers[c][b](e,f)});d.event.trigger(b+".fb")}},isImage:function(a){return o(a)&&a.match(/\.(jpe?g|gif|png|bmp)((\?|#).*)?$/i)},isSWF:function(a){return o(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(b){var c={},e=a.group[b]||null,f,g,i;if(e&&(e.nodeType||e instanceof d))f=!0,d.metadata&&(c=d(e).metadata());c=d.extend(!0,{},a.opts,{index:b,element:e},d.isPlainObject(e)?
e:c);d.each(["href","title","content","type"],function(b,g){c[g]=a.opts[g]||f&&d(e).attr(g)||c[g]||null});"number"===typeof c.margin&&(c.margin=[c.margin,c.margin,c.margin,c.margin]);c.modal&&d.extend(!0,c,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{css:{cursor:"auto"},closeClick:!1}}});a.coming=c;if(!1===a.trigger("beforeLoad"))a.coming=null;else{g=c.type;b=c.href||e;g||(f&&(g=d(e).data("fancybox-type"),g||(g=(g=e.className.match(/fancybox\.(\w+)/))?
g[1]:null)),!g&&o(b)&&(a.isImage(b)?g="image":a.isSWF(b)?g="swf":b.match(/^#/)&&(g="inline")),g||(g=f?"inline":"html"),c.type=g);if("inline"===g||"html"===g){if(c.content||(c.content="inline"===g?d(o(b)?b.replace(/.*(?=#[^\s]+$)/,""):b):e),!c.content||!c.content.length)g=null}else b||(g=null);"ajax"===g&&o(b)&&(i=b.split(/\s+/,2),b=i.shift(),c.selector=i.shift());c.href=b;c.group=a.group;c.isDom=f;switch(g){case "image":a._loadImage();break;case "ajax":a._loadAjax();break;case "inline":case "iframe":case "swf":case "html":a._afterLoad();
break;default:a._error("type")}}},_error:function(b){a.hideLoading();d.extend(a.coming,{type:"html",autoSize:!0,minWidth:0,minHeight:0,padding:15,hasError:b,content:a.coming.tpl.error});a._afterLoad()},_loadImage:function(){var b=a.imgPreload=new Image;b.onload=function(){this.onload=this.onerror=null;a.coming.width=this.width;a.coming.height=this.height;a._afterLoad()};b.onerror=function(){this.onload=this.onerror=null;a._error("image")};b.src=a.coming.href;(b.complete===t||!b.complete)&&a.showLoading()},
_loadAjax:function(){a.showLoading();a.ajaxLoad=d.ajax(d.extend({},a.coming.ajax,{url:a.coming.href,error:function(b,c){a.coming&&"abort"!==c?a._error("ajax",b):a.hideLoading()},success:function(b,c){"success"===c&&(a.coming.content=b,a._afterLoad())}}))},_preloadImages:function(){var b=a.group,c=a.current,e=b.length,f,g,i,h=Math.min(c.preload,e-1);if(c.preload&&!(2>b.length))for(i=1;i<=h;i+=1)if(f=b[(c.index+i)%e],g=f.href||d(f).attr("href")||f,"image"===f.type||a.isImage(g))(new Image).src=g},_afterLoad:function(){a.hideLoading();
!a.coming||!1===a.trigger("afterLoad",a.current)?a.coming=!1:(a.isOpened?(d(".fancybox-item, .fancybox-nav").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.inner.css("overflow","hidden"),a.transitions[a.current.prevMethod]()):(d(".fancybox-wrap").stop().trigger("onReset").remove(),a.trigger("afterClose")),a.unbindEvents(),a.isOpen=!1,a.current=a.coming,a.wrap=d(a.current.tpl.wrap).addClass("fancybox-"+(k?"mobile":"desktop")+" fancybox-type-"+a.current.type+" fancybox-tmp "+a.current.wrapCSS).appendTo("body"),
a.skin=d(".fancybox-skin",a.wrap).css("padding",n(a.current.padding)),a.outer=d(".fancybox-outer",a.wrap),a.inner=d(".fancybox-inner",a.wrap),a._setContent())},_setContent:function(){var b=a.current,c=b.content,e=b.type,f=b.minWidth,g=b.minHeight,i=b.maxWidth,h=b.maxHeight;switch(e){case "inline":case "ajax":case "html":b.selector?c=d("<div>").html(c).find(b.selector):c instanceof d&&(c.parent().hasClass("fancybox-inner")&&c.parents(".fancybox-wrap").unbind("onReset"),c=c.show().detach(),d(a.wrap).bind("onReset",
function(){c.appendTo("body").hide()}));b.autoSize&&(f=d('<div class="fancybox-wrap '+a.current.wrapCSS+' fancybox-tmp"></div>').appendTo("body").css({minWidth:n(f,"w"),minHeight:n(g,"h"),maxWidth:n(i,"w"),maxHeight:n(h,"h")}).append(c),b.width=f.width(),b.height=f.height(),f.width(a.current.width),f.height()>b.height&&(f.width(b.width+1),b.width=f.width(),b.height=f.height()),c=f.contents().detach(),f.remove());break;case "image":c=b.tpl.image.replace("{href}",b.href);b.aspectRatio=!0;break;case "swf":c=
b.tpl.swf.replace(/\{width\}/g,b.width).replace(/\{height\}/g,b.height).replace(/\{href\}/g,b.href);break;case "iframe":c=d(b.tpl.iframe.replace("{rnd}",(new Date).getTime())).attr("scrolling",b.scrolling).attr("src",b.href),b.scrolling=k?"scroll":"auto"}if("image"===e||"swf"===e)b.autoSize=!1,b.scrolling="visible";"iframe"===e&&b.autoSize?(a.showLoading(),a._setDimension(),a.inner.css("overflow",b.scrolling),c.bind({onCancel:function(){d(this).unbind();a._afterZoomOut()},load:function(){a.hideLoading();
try{this.contentWindow.document.location&&(a.current.height=d(this).contents().find("body").height())}catch(b){a.current.autoSize=!1}a[a.isOpen?"_afterZoomIn":"_beforeShow"]()}}).appendTo(a.inner)):(a.inner.append(c),a._beforeShow())},_beforeShow:function(){a.coming=null;a.trigger("beforeShow");a._setDimension();a.wrap.hide().removeClass("fancybox-tmp");a.bindEvents();a._preloadImages();a.transitions[a.isOpened?a.current.nextMethod:a.current.openMethod]()},_setDimension:function(){var b=a.wrap,c=
a.inner,e=a.current,f=a.getViewport(),g=e.margin,i=2*e.padding,h=e.width,j=e.height,r=e.maxWidth+i,k=e.maxHeight+i,l=e.minWidth+i,m=e.minHeight+i,p;f.w-=g[1]+g[3];f.h-=g[0]+g[2];o(h)&&0<h.indexOf("%")&&(h=(f.w-i)*parseFloat(h)/100);o(j)&&0<j.indexOf("%")&&(j=(f.h-i)*parseFloat(j)/100);g=h/j;h+=i;j+=i;e.fitToView&&(r=Math.min(f.w,r),k=Math.min(f.h,k));if(e.aspectRatio){if(h>r&&(h=r,j=(h-i)/g+i),j>k&&(j=k,h=(j-i)*g+i),h<l&&(h=l,j=(h-i)/g+i),j<m)j=m,h=(j-i)*g+i}else h=Math.max(l,Math.min(h,r)),j=Math.max(m,
Math.min(j,k));h=Math.round(h);j=Math.round(j);d(b.add(c)).width("auto").height("auto");c.width(h-i).height(j-i);b.width(h);p=b.height();if(h>r||p>k)for(;(h>r||p>k)&&h>l&&p>m;)j-=10,e.aspectRatio?(h=Math.round((j-i)*g+i),h<l&&(h=l,j=(h-i)/g+i)):h-=10,c.width(h-i).height(j-i),b.width(h),p=b.height();e.dim={width:n(h),height:n(p)};e.canGrow=e.autoSize&&j>m&&j<k;e.canShrink=!1;e.canExpand=!1;if(h-i<e.width||j-i<e.height)e.canExpand=!0;else if((h>f.w||p>f.h)&&h>l&&j>m)e.canShrink=!0;a.innerSpace=p-i-
c.height()},_getPosition:function(b){var c=a.current,e=a.getViewport(),f=c.margin,d=a.wrap.width()+f[1]+f[3],i=a.wrap.height()+f[0]+f[2],h={position:"absolute",top:f[0]+e.y,left:f[3]+e.x};c.autoCenter&&c.fixed&&!b&&i<=e.h&&d<=e.w&&(h={position:"fixed",top:f[0],left:f[3]});h.top=n(Math.max(h.top,h.top+(e.h-i)*c.topRatio));h.left=n(Math.max(h.left,h.left+0.5*(e.w-d)));return h},_afterZoomIn:function(){var b=a.current,c=b?b.scrolling:"no";if(b&&(a.isOpen=a.isOpened=!0,a.wrap.addClass("fancybox-opened"),
a.inner.css("overflow","yes"===c?"scroll":"no"===c?"hidden":c),a.trigger("afterShow"),a.update(),(b.closeClick||b.nextClick)&&a.inner.css("cursor","pointer").bind("click.fb",function(c){if(!d(c.target).is("a")&&!d(c.target).parent().is("a"))a[b.closeClick?"close":"next"]()}),b.closeBtn&&d(b.tpl.closeBtn).appendTo(a.skin).bind("click.fb",a.close),b.arrows&&1<a.group.length&&((b.loop||0<b.index)&&d(b.tpl.prev).appendTo(a.outer).bind("click.fb",a.prev),(b.loop||b.index<a.group.length-1)&&d(b.tpl.next).appendTo(a.outer).bind("click.fb",
a.next)),a.opts.autoPlay&&!a.player.isActive))a.opts.autoPlay=!1,a.play()},_afterZoomOut:function(){var b=a.current;a.wrap.trigger("onReset").remove();d.extend(a,{group:{},opts:{},current:null,isActive:!1,isOpened:!1,isOpen:!1,wrap:null,skin:null,outer:null,inner:null});a.trigger("afterClose",b)}});a.transitions={getOrigPosition:function(){var b=a.current,c=b.element,e=b.padding,f=d(b.orig),g={},i=50,h=50;!f.length&&b.isDom&&d(c).is(":visible")&&(f=d(c).find("img:first"),f.length||(f=d(c)));f.length?
(g=f.offset(),f.is("img")&&(i=f.outerWidth(),h=f.outerHeight())):(b=a.getViewport(),g.top=b.y+0.5*(b.h-h),g.left=b.x+0.5*(b.w-i));return g={top:n(g.top-e),left:n(g.left-e),width:n(i+2*e),height:n(h+2*e)}},step:function(b,c){var e=c.prop,d,g;if("width"===e||"height"===e)d=Math.ceil(b-2*a.current.padding),"height"===e&&(g=(b-c.start)/(c.end-c.start),c.start>c.end&&(g=1-g),d-=a.innerSpace*g),a.inner[e](d)},zoomIn:function(){var b=a.wrap,c=a.current,e=c.openEffect,f="elastic"===e,g=d.extend({},c.dim,
a._getPosition(f)),i=d.extend({opacity:1},g);delete i.position;f?(g=this.getOrigPosition(),c.openOpacity&&(g.opacity=0),a.outer.add(a.inner).width("auto").height("auto")):"fade"===e&&(g.opacity=0);b.css(g).show().animate(i,{duration:"none"===e?0:c.openSpeed,easing:c.openEasing,step:f?this.step:null,complete:a._afterZoomIn})},zoomOut:function(){var b=a.wrap,c=a.current,d=c.openEffect,f="elastic"===d,g={opacity:0};f&&("fixed"===b.css("position")&&b.css(a._getPosition(!0)),g=this.getOrigPosition(),c.closeOpacity&&
(g.opacity=0));b.animate(g,{duration:"none"===d?0:c.closeSpeed,easing:c.closeEasing,step:f?this.step:null,complete:a._afterZoomOut})},changeIn:function(){var b=a.wrap,c=a.current,d=c.nextEffect,f="elastic"===d,g=a._getPosition(f),i={opacity:1};g.opacity=0;f&&(g.top=n(parseInt(g.top,10)-200),i.top="+=200px");b.css(g).show().animate(i,{duration:"none"===d?0:c.nextSpeed,easing:c.nextEasing,complete:a._afterZoomIn})},changeOut:function(){var b=a.wrap,c=a.current,e=c.prevEffect,f={opacity:0};b.removeClass("fancybox-opened");
"elastic"===e&&(f.top="+=200px");b.animate(f,{duration:"none"===e?0:c.prevSpeed,easing:c.prevEasing,complete:function(){d(this).trigger("onReset").remove()}})}};a.helpers.overlay={overlay:null,update:function(){var a,c;this.overlay.width("100%").height("100%");d.browser.msie||k?(a=Math.max(l.documentElement.scrollWidth,l.body.scrollWidth),c=Math.max(l.documentElement.offsetWidth,l.body.offsetWidth),a=a<c?m.width():a):a=q.width();this.overlay.width(a).height(q.height())},beforeShow:function(b){this.overlay||
(b=d.extend(!0,{},a.defaults.helpers.overlay,b),this.overlay=d('<div id="fancybox-overlay"></div>').css(b.css).appendTo("body"),b.closeClick&&this.overlay.bind("click.fb",a.close),a.current.fixed&&!k?this.overlay.addClass("overlay-fixed"):(this.update(),this.onUpdate=function(){this.update()}),this.overlay.fadeTo(b.speedIn,b.opacity))},afterClose:function(a){this.overlay&&this.overlay.fadeOut(a.speedOut||0,function(){d(this).remove()});this.overlay=null}};a.helpers.title={beforeShow:function(b){var c;
if(c=a.current.title)c=d('<div class="fancybox-title fancybox-title-'+b.type+'-wrap">'+c+"</div>").appendTo("body"),"float"===b.type&&(c.width(c.width()),c.wrapInner('<span class="child"></span>'),a.current.margin[2]+=Math.abs(parseInt(c.css("margin-bottom"),10))),c.appendTo("over"===b.type?a.inner:"outside"===b.type?a.wrap:a.skin)}};d.fn.fancybox=function(b){var c=d(this),e=this.selector||"",f,g=function(g){var h=this,j=f,k;!g.ctrlKey&&!g.altKey&&!g.shiftKey&&!g.metaKey&&!d(h).is(".fancybox-wrap")&&
(g.preventDefault(),g=b.groupAttr||"data-fancybox-group",k=d(h).attr(g),k||(g="rel",k=h[g]),k&&""!==k&&"nofollow"!==k&&(h=e.length?d(e):c,h=h.filter("["+g+'="'+k+'"]'),j=h.index(this)),b.index=j,a.open(h,b))},b=b||{};f=b.index||0;e?q.undelegate(e,"click.fb-start").delegate(e,"click.fb-start",g):c.unbind("click.fb-start").bind("click.fb-start",g);return this};d(l).ready(function(){a.defaults.fixed=d.support.fixedPosition||!(d.browser.msie&&6>=d.browser.version)&&!k})})(window,document,jQuery);
// transition effect
(function ($, F) {
F.transitions.resizeIn = function() {
var endPos = $.extend({}, F.current.dim, F._getPosition(true));
var startPos;
startPos = F.tmpWrap.position();
startPos.width = F.tmpWrap.width();
startPos.height = F.tmpWrap.height();
F.inner
.css('overflow', 'hidden')
.width( F.tmpInner.width() )
.height( F.tmpInner.height() )
.css('opacity', 0);
F.wrap.css(startPos).show();
F.tmpWrap.trigger('onReset').remove();
F.wrap.animate(endPos, {
duration: F.current.nextSpeed,
step : F.transitions.step,
complete: function() {
setTimeout(function() {
F.inner.fadeTo("fast", 1, F._afterZoomIn);
}, 1);
}
});
};
F.transitions.resizeOut = function() {
if (F.tmpWrap) {
F.tmpWrap.stop(true).trigger('onReset').remove();
}
F.tmpWrap = F.wrap.stop(true, true);
F.tmpInner = F.inner.stop(true, true);
};
}(jQuery, jQuery.fancybox));
// theme script
jQuery(document).ready(function() {
//jQuery('a[href$=".jpg"],a[href$=".png"],a[href$=".gif"]').not('[data-rel="fancybox"]').attr("data-rel", "fancybox");
if( ATTR.enable == 'enable' ){
jQuery('[data-rel="fancybox"]').fancybox({
nextMethod : 'resizeIn',
nextSpeed : 250,
prevMethod : 'resizeOut',
prevSpeed : 250,
helpers : {
media : {},
thumbs : { width: parseInt(ATTR.width), height: parseInt(ATTR.height) }
}
});
}else{
jQuery('[data-rel="fancybox"]').fancybox({
nextMethod : 'resizeIn',
nextSpeed : 250,
prevMethod : 'resizeOut',
prevSpeed : 250,
helpers : {
media : {}
}
});
}
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,79 @@
/*global jQuery */
/*!
* FitVids 1.0
*
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
* Date: Thu Sept 01 18:00:00 2011 -0500
*/
(function( $ ){
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null
}
var div = document.createElement('div'),
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
div.className = 'fit-vids-style';
div.innerHTML = '&shy;<style> \
.fluid-width-video-wrapper { \
width: 100%; \
position: relative; \
padding: 0; \
} \
\
.fluid-width-video-wrapper iframe, \
.fluid-width-video-wrapper object, \
.fluid-width-video-wrapper embed { \
position: absolute; \
top: 0; \
left: 0; \
width: 100%; \
height: 100%; \
} \
</style>';
ref.parentNode.insertBefore(div,ref);
if ( options ) {
$.extend( settings, options );
}
return this.each(function(){
var selectors = [
"iframe[src^='http://player.vimeo.com']",
"iframe[src^='http://www.youtube.com']",
"iframe[src^='http://www.kickstarter.com']"
];
if (settings.customSelector) {
selectors.push(settings.customSelector);
}
var $allVideos = $(this).find(selectors.join(','));
$allVideos.each(function(){
var $this = $(this);
if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
var height = this.tagName.toLowerCase() == 'object' ? $this.attr('height') : $this.height(),
aspectRatio = height / $this.width();
if(!$this.attr('id')){
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
$this.attr('id', videoID);
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
$this.removeAttr('height').removeAttr('width');
});
});
}
})( jQuery );
jQuery(document).ready(function(){
jQuery(".gdl-page-row-wrapper, .footer-wrapper").fitVids();
});

View File

@@ -0,0 +1,958 @@
/*
* jQuery FlexSlider v2.1
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*/
;(function ($) {
//FlexSlider: Object Instance
$.flexslider = function(el, options) {
var slider = $(el),
vars = $.extend({}, $.flexslider.defaults, options),
namespace = vars.namespace,
touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
eventType = (touch) ? "touchend" : "click",
vertical = vars.direction === "vertical",
reverse = vars.reverse,
carousel = (vars.itemWidth > 0),
fade = vars.animation === "fade",
asNav = vars.asNavFor !== "",
methods = {};
// Store a reference to the slider object
$.data(el, "flexslider", slider);
// Privat slider methods
methods = {
init: function() {
slider.animating = false;
slider.currentSlide = vars.startAt;
slider.animatingTo = slider.currentSlide;
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
slider.slides = $(vars.selector, slider);
slider.container = $(slider.containerSelector, slider);
slider.count = slider.slides.length;
// SYNC:
slider.syncExists = $(vars.sync).length > 0;
// SLIDE:
if (vars.animation === "slide") vars.animation = "swing";
slider.prop = (vertical) ? "top" : "marginLeft";
slider.args = {};
// SLIDESHOW:
slider.manualPause = false;
// TOUCH/USECSS:
slider.transitions = !vars.video && !fade && vars.useCSS && (function() {
var obj = document.createElement('div'),
props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
for (var i in props) {
if ( obj.style[ props[i] ] !== undefined ) {
slider.pfx = props[i].replace('Perspective','').toLowerCase();
slider.prop = "-" + slider.pfx + "-transform";
return true;
}
}
return false;
}());
// CONTROLSCONTAINER:
if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
// MANUAL:
if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
// RANDOMIZE:
if (vars.randomize) {
slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
slider.container.empty().append(slider.slides);
}
slider.doMath();
// ASNAV:
if (asNav) methods.asNav.setup();
// INIT
slider.setup("init");
// CONTROLNAV:
if (vars.controlNav) methods.controlNav.setup();
// DIRECTIONNAV:
if (vars.directionNav) methods.directionNav.setup();
// KEYBOARD:
if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) {
$(document).bind('keyup', function(event) {
var keycode = event.keyCode;
if (!slider.animating && (keycode === 39 || keycode === 37)) {
var target = (keycode === 39) ? slider.getTarget('next') :
(keycode === 37) ? slider.getTarget('prev') : false;
slider.flexAnimate(target, vars.pauseOnAction);
}
});
}
// MOUSEWHEEL:
if (vars.mousewheel) {
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault();
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, vars.pauseOnAction);
});
}
// PAUSEPLAY
if (vars.pausePlay) methods.pausePlay.setup();
// SLIDSESHOW
if (vars.slideshow) {
if (vars.pauseOnHover) {
slider.hover(function() {
if (!slider.manualPlay && !slider.manualPause) slider.pause();
}, function() {
if (!slider.manualPause && !slider.manualPlay) slider.play();
});
}
// initialize animation
(vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
}
// TOUCH
if (touch && vars.touch) methods.touch();
// FADE&&SMOOTHHEIGHT || SLIDE:
if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
// API: start() Callback
setTimeout(function(){
vars.start(slider);
}, 200);
},
asNav: {
setup: function() {
slider.asNav = true;
slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
slider.currentItem = slider.currentSlide;
slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
slider.slides.click(function(e){
e.preventDefault();
var $slide = $(this),
target = $slide.index();
if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
slider.direction = (slider.currentItem < target) ? "next" : "prev";
slider.flexAnimate(target, vars.pauseOnAction, false, true, true);
}
});
}
},
controlNav: {
setup: function() {
if (!slider.manualControls) {
methods.controlNav.setupPaging();
} else { // MANUALCONTROLS:
methods.controlNav.setupManual();
}
},
setupPaging: function() {
var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
j = 1,
item;
var controlNavWrapper = $('<div class="flex-control-nav-wrapper"></div>');
slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
if (slider.pagingCount > 1) {
for (var i = 0; i < slider.pagingCount; i++) {
item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
slider.controlNavScaffold.append('<li>' + item + '</li>');
j++;
}
}
// CONTROLSCONTAINER:
controlNavWrapper.append(slider.controlNavScaffold);
(slider.controlsContainer) ? $(slider.controlsContainer).append(controlNavWrapper) : slider.append(controlNavWrapper);
methods.controlNav.set();
methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
event.preventDefault();
var $this = $(this),
target = slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
slider.direction = (target > slider.currentSlide) ? "next" : "prev";
slider.flexAnimate(target, vars.pauseOnAction);
}
});
// Prevent iOS click event bug
if (touch) {
slider.controlNavScaffold.delegate('a', "click touchstart", function(event) {
event.preventDefault();
});
}
},
setupManual: function() {
slider.controlNav = slider.manualControls;
methods.controlNav.active();
slider.controlNav.live(eventType, function(event) {
event.preventDefault();
var $this = $(this),
target = slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
(target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
slider.flexAnimate(target, vars.pauseOnAction);
}
});
// Prevent iOS click event bug
if (touch) {
slider.controlNav.live("click touchstart", function(event) {
event.preventDefault();
});
}
},
set: function() {
var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
},
active: function() {
slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
},
update: function(action, pos) {
if (slider.pagingCount > 1 && action === "add") {
slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
} else if (slider.pagingCount === 1) {
slider.controlNavScaffold.find('li').remove();
} else {
slider.controlNav.eq(pos).closest('li').remove();
}
methods.controlNav.set();
(slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
}
},
directionNav: {
setup: function() {
var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>');
// CONTROLSCONTAINER:
if (slider.controlsContainer) {
$(slider.controlsContainer).append(directionNavScaffold);
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
} else {
slider.append(directionNavScaffold);
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
}
methods.directionNav.update();
slider.directionNav.bind(eventType, function(event) {
event.preventDefault();
var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, vars.pauseOnAction);
});
// Prevent iOS click event bug
if (touch) {
slider.directionNav.bind("click touchstart", function(event) {
event.preventDefault();
});
}
},
update: function() {
var disabledClass = namespace + 'disabled';
if (slider.pagingCount === 1) {
slider.directionNav.addClass(disabledClass);
} else if (!vars.animationLoop) {
if (slider.animatingTo === 0) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
} else if (slider.animatingTo === slider.last) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
} else {
slider.directionNav.removeClass(disabledClass);
}
} else {
slider.directionNav.removeClass(disabledClass);
}
}
},
pausePlay: {
setup: function() {
var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
// CONTROLSCONTAINER:
if (slider.controlsContainer) {
slider.controlsContainer.append(pausePlayScaffold);
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
} else {
slider.append(pausePlayScaffold);
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
}
methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play');
slider.pausePlay.bind(eventType, function(event) {
event.preventDefault();
if ($(this).hasClass(namespace + 'pause')) {
slider.manualPause = true;
slider.manualPlay = false;
slider.pause();
} else {
slider.manualPause = false;
slider.manualPlay = true;
slider.play();
}
});
// Prevent iOS click event bug
if (touch) {
slider.pausePlay.bind("click touchstart", function(event) {
event.preventDefault();
});
}
},
update: function(state) {
(state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
}
},
touch: function() {
var startX,
startY,
offset,
cwidth,
dx,
startT,
scrolling = false;
el.addEventListener('touchstart', onTouchStart, false);
function onTouchStart(e) {
if (slider.animating) {
e.preventDefault();
} else if (e.touches.length === 1) {
slider.pause();
// CAROUSEL:
cwidth = (vertical) ? slider.h : slider. w;
startT = Number(new Date());
// CAROUSEL:
offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
(carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
(carousel && slider.currentSlide === slider.last) ? slider.limit :
(carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide :
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX;
startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY;
el.addEventListener('touchmove', onTouchMove, false);
el.addEventListener('touchend', onTouchEnd, false);
}
}
function onTouchMove(e) {
dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX;
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY));
if (!scrolling || Number(new Date()) - startT > 500) {
e.preventDefault();
if (!fade && slider.transitions) {
if (!vars.animationLoop) {
dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
}
slider.setProps(offset + dx, "setTouch");
}
}
}
function onTouchEnd(e) {
// finish the touch by undoing the touch session
el.removeEventListener('touchmove', onTouchMove, false);
if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
var updateDx = (reverse) ? -dx : dx,
target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
slider.flexAnimate(target, vars.pauseOnAction);
} else {
if (!fade) slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
}
}
el.removeEventListener('touchend', onTouchEnd, false);
startX = null;
startY = null;
dx = null;
offset = null;
}
},
resize: function() {
if (!slider.animating && slider.is(':visible')) {
if (!carousel) slider.doMath();
if (fade) {
// SMOOTH HEIGHT:
methods.smoothHeight();
} else if (carousel) { //CAROUSEL:
slider.slides.width(slider.computedW);
slider.update(slider.pagingCount);
slider.setProps();
}
else if (vertical) { //VERTICAL:
slider.viewport.height(slider.h);
slider.setProps(slider.h, "setTotal");
} else {
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
slider.newSlides.width(slider.computedW);
slider.setProps(slider.computedW, "setTotal");
}
}
},
smoothHeight: function(dur) {
if (!vertical || fade) {
var $obj = (fade) ? slider : slider.viewport;
(dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
}
},
sync: function(action) {
var $obj = $(vars.sync).data("flexslider"),
target = slider.animatingTo;
switch (action) {
case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
case "pause": $obj.pause(); break;
}
}
}
// public methods
slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
if (asNav && withSync) {
var master = $(vars.asNavFor).data('flexslider');
slider.atEnd = target === 0 || target === slider.count - 1;
master.flexAnimate(target, true, false, true, fromNav);
slider.direction = (slider.currentItem < target) ? "next" : "prev";
master.direction = slider.direction;
if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
slider.currentItem = target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
target = Math.floor(target/slider.visible);
} else {
slider.currentItem = target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
return false;
}
}
slider.animating = true;
slider.animatingTo = target;
// API: before() animation Callback
vars.before(slider);
// SLIDESHOW:
if (pause) slider.pause();
// SYNC:
if (slider.syncExists && !fromNav) methods.sync("animate");
// CONTROLNAV
if (vars.controlNav) methods.controlNav.active();
// !CAROUSEL:
// CANDIDATE: slide active class (for add/remove slide)
if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
// INFINITE LOOP:
// CANDIDATE: atEnd
slider.atEnd = target === 0 || target === slider.last;
// DIRECTIONNAV:
if (vars.directionNav) methods.directionNav.update();
if (target === slider.last) {
// API: end() of cycle Callback
vars.end(slider);
// SLIDESHOW && !INFINITE LOOP:
if (!vars.animationLoop) slider.pause();
}
// SLIDE:
if (!fade) {
var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
margin, slideString, calcNext;
// INFINITE LOOP / REVERSE:
if (carousel) {
margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin;
calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
} else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") {
slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
} else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") {
slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
} else {
slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
}
slider.setProps(slideString, "", vars.animationSpeed);
if (slider.transitions) {
if (!vars.animationLoop || !slider.atEnd) {
slider.animating = false;
slider.currentSlide = slider.animatingTo;
}
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() {
slider.wrapup(dimension);
});
} else {
slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
slider.wrapup(dimension);
});
}
} else { // FADE:
if (!touch) {
slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing);
slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup);
} else {
slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
slider.slides.unbind("webkitTransitionEnd transitionend");
slider.slides.eq(slider.currentSlide).bind("webkitTransitionEnd transitionend", function() {
// API: after() animation Callback
vars.after(slider);
});
slider.animating = false;
slider.currentSlide = slider.animatingTo;
}
}
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
}
}
slider.wrapup = function(dimension) {
// SLIDE:
if (!fade && !carousel) {
if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
slider.setProps(dimension, "jumpEnd");
} else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
slider.setProps(dimension, "jumpStart");
}
}
slider.animating = false;
slider.currentSlide = slider.animatingTo;
// API: after() animation Callback
vars.after(slider);
}
// SLIDESHOW:
slider.animateSlides = function() {
if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
}
// SLIDESHOW:
slider.pause = function() {
clearInterval(slider.animatedSlides);
slider.playing = false;
// PAUSEPLAY:
if (vars.pausePlay) methods.pausePlay.update("play");
// SYNC:
if (slider.syncExists) methods.sync("pause");
}
// SLIDESHOW:
slider.play = function() {
slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
slider.playing = true;
// PAUSEPLAY:
if (vars.pausePlay) methods.pausePlay.update("pause");
// SYNC:
if (slider.syncExists) methods.sync("play");
}
slider.canAdvance = function(target, fromNav) {
// ASNAV:
var last = (asNav) ? slider.pagingCount - 1 : slider.last;
return (fromNav) ? true :
(asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
(asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
(target === slider.currentSlide && !asNav) ? false :
(vars.animationLoop) ? true :
(slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
(slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
true;
}
slider.getTarget = function(dir) {
slider.direction = dir;
if (dir === "next") {
return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
} else {
return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
}
}
// SLIDE:
slider.setProps = function(pos, special, dur) {
var target = (function() {
var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
posCalc = (function() {
if (carousel) {
return (special === "setTouch") ? pos :
(reverse && slider.animatingTo === slider.last) ? 0 :
(reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
(slider.animatingTo === slider.last) ? slider.limit : posCheck;
} else {
switch (special) {
case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
case "setTouch": return (reverse) ? pos : pos;
case "jumpEnd": return (reverse) ? pos : slider.count * pos;
case "jumpStart": return (reverse) ? slider.count * pos : pos;
default: return pos;
}
}
}());
return (posCalc * -1) + "px";
}());
if (slider.transitions) {
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
}
slider.args[slider.prop] = target;
if (slider.transitions || dur === undefined) slider.container.css(slider.args);
}
slider.setup = function(type) {
// SLIDE:
if (!fade) {
var sliderOffset, arr;
if (type === "init") {
slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
// INFINITE LOOP:
slider.cloneCount = 0;
slider.cloneOffset = 0;
// REVERSE:
if (reverse) {
arr = $.makeArray(slider.slides).reverse();
slider.slides = $(arr);
slider.container.empty().append(slider.slides);
}
}
// INFINITE LOOP && !CAROUSEL:
if (vars.animationLoop && !carousel) {
slider.cloneCount = 2;
slider.cloneOffset = 1;
// clear out old clones
if (type !== "init") slider.container.find('.clone').remove();
slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));
}
slider.newSlides = $(vars.selector, slider);
sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
// VERTICAL:
if (vertical && !carousel) {
slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
setTimeout(function(){
slider.newSlides.css({"display": "block"});
slider.doMath();
slider.viewport.height(slider.h);
slider.setProps(sliderOffset * slider.h, "init");
}, (type === "init") ? 100 : 0);
} else {
slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
slider.setProps(sliderOffset * slider.computedW, "init");
setTimeout(function(){
slider.doMath();
slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
}, (type === "init") ? 100 : 0);
}
} else { // FADE:
slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
if (type === "init") {
if (!touch) {
slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing);
} else {
slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
}
}
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
}
// !CAROUSEL:
// CANDIDATE: active slide
if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
}
slider.doMath = function() {
var slide = slider.slides.first(),
slideMargin = vars.itemMargin,
minItems = vars.minItems,
maxItems = vars.maxItems;
slider.w = slider.width();
slider.h = slide.height();
slider.boxPadding = slide.outerWidth() - slide.width();
// CAROUSEL:
if (carousel) {
slider.itemT = vars.itemWidth + slideMargin;
slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
(slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
(vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
slider.last = slider.pagingCount - 1;
slider.limit = (slider.pagingCount === 1) ? 0 :
(vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
} else {
slider.itemW = slider.w;
slider.pagingCount = slider.count;
slider.last = slider.count - 1;
}
slider.computedW = slider.itemW - slider.boxPadding;
}
slider.update = function(pos, action) {
slider.doMath();
// update currentSlide and slider.animatingTo if necessary
if (!carousel) {
if (pos < slider.currentSlide) {
slider.currentSlide += 1;
} else if (pos <= slider.currentSlide && pos !== 0) {
slider.currentSlide -= 1;
}
slider.animatingTo = slider.currentSlide;
}
// update controlNav
if (vars.controlNav && !slider.manualControls) {
if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
methods.controlNav.update("add");
} else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
if (carousel && slider.currentSlide > slider.last) {
slider.currentSlide -= 1;
slider.animatingTo -= 1;
}
methods.controlNav.update("remove", slider.last);
}
}
// update directionNav
if (vars.directionNav) methods.directionNav.update();
}
slider.addSlide = function(obj, pos) {
var $obj = $(obj);
slider.count += 1;
slider.last = slider.count - 1;
// append new slide
if (vertical && reverse) {
(pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
} else {
(pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
}
// update currentSlide, animatingTo, controlNav, and directionNav
slider.update(pos, "add");
// update slider.slides
slider.slides = $(vars.selector + ':not(.clone)', slider);
// re-setup the slider to accomdate new slide
slider.setup();
//FlexSlider: added() Callback
vars.added(slider);
}
slider.removeSlide = function(obj) {
var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
// update count
slider.count -= 1;
slider.last = slider.count - 1;
// remove slide
if (isNaN(obj)) {
$(obj, slider.slides).remove();
} else {
(vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
}
// update currentSlide, animatingTo, controlNav, and directionNav
slider.doMath();
slider.update(pos, "remove");
// update slider.slides
slider.slides = $(vars.selector + ':not(.clone)', slider);
// re-setup the slider to accomdate new slide
slider.setup();
// FlexSlider: removed() Callback
vars.removed(slider);
}
//FlexSlider: Initialize
methods.init();
}
//FlexSlider: Default Settings
$.flexslider.defaults = {
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false, //Boolean: Randomize slide order
// Usability features
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
// Primary Controls
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
prevText: "Previous", //String: Set the text for the "previous" directionNav item
nextText: "Next", //String: Set the text for the "next" directionNav item
// Secondary Navigation
keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
pausePlay: false, //Boolean: Create pause/play dynamic element
pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
playText: "Play", //String: Set the text for the "play" pausePlay item
// Special properties
controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
// Carousel Options
itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
itemMargin: 0, //{NEW} Integer: Margin between carousel items.
minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
// Callback API
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
}
//FlexSlider: Plugin Function
$.fn.flexslider = function(options) {
if (options === undefined) options = {};
if (typeof options === "object") {
return this.each(function() {
var $this = $(this),
selector = (options.selector) ? options.selector : ".slides > li",
$slides = $this.find(selector);
if ($slides.length === 1) {
$slides.fadeIn(400);
if (options.start) options.start($this);
} else if ($this.data('flexslider') == undefined) {
new $.flexslider(this, options);
}
});
} else {
// Helper strings to quickly perform functions on the slider
var $slider = $(this).data('flexslider');
switch (options) {
case "play": $slider.play(); break;
case "pause": $slider.pause(); break;
case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
case "prev":
case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
default: if (typeof options === "number") $slider.flexAnimate(options, true);
}
}
}
})(jQuery);
jQuery(document).ready(function() {
// Flex Slider Setting
FLEX.pauseOnHover = (FLEX.pauseOnHover == 'enable')? true: false;
FLEX.pauseOnAction = (FLEX.pauseOnAction == 'enable')? true: false;
FLEX.controlNav = (FLEX.controlNav == 'enable')? true: false;
FLEX.directionNav = (FLEX.directionNav == 'enable')? true: false;
jQuery('.flexslider').not('.carousel-included').flexslider({
animation: FLEX.animation,
slideshowSpeed: parseInt(FLEX.slideshowSpeed),
animationSpeed: parseInt(FLEX.animationSpeed),
controlNav: FLEX.controlNav,
directionNav: FLEX.directionNav,
pauseOnHover: FLEX.pauseOnHover,
pauseOnAction: FLEX.pauseOnAction,
start: function(slider){ jQuery('body').removeClass('loading'); }
});
// carousel slider
var flex_carousel = jQuery('.flexslider.carousel-included');
flex_carousel.each(function(){
var top_slider = (jQuery(this).parents('.gdl-top-slider-wrapper').length > 0);
var item_width = parseInt(jQuery(this).attr('data-width'));
jQuery(this).flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
itemWidth: item_width,
itemMargin: 0
});
jQuery(this).find('ul li').hover(function(){
jQuery(this).find('.gdl-caption-overlay').animate({opacity: 0.2}, 200);
if( top_slider ){
jQuery(this).find('.gdl-slider-caption').slideDown(200);
jQuery(this).find('.post-slider-comment').fadeIn(200);
}
}, function(){
jQuery(this).find('.gdl-caption-overlay').animate({opacity: 0.5}, 200);
if( top_slider ){
jQuery(this).find('.gdl-slider-caption').slideUp(200);
jQuery(this).find('.post-slider-comment').fadeOut(200);
}
});
});
});

View File

@@ -0,0 +1,715 @@
/*
* jQuery Nivo Slider v3.0.1
* http://nivo.dev7studios.com
*
* Copyright 2012, Dev7studios
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
var NivoSlider = function(element, options){
// Defaults are below
var settings = $.extend({}, $.fn.nivoSlider.defaults, options);
// Useful variables. Play carefully.
var vars = {
currentSlide: 0,
currentImage: '',
totalSlides: 0,
running: false,
paused: false,
stop: false,
controlNavEl: false
};
// Get this slider
var slider = $(element);
slider.data('nivo:vars', vars).addClass('nivoSlider');
// Find our slider children
var kids = slider.children();
kids.each(function() {
var child = $(this);
var link = '';
if(!child.is('img')){
if(child.is('a')){
child.addClass('nivo-imageLink');
link = child;
}
child = child.find('img:first');
}
// Get img width & height
var childWidth = (childWidth === 0) ? child.attr('width') : child.width(),
childHeight = (childHeight === 0) ? child.attr('height') : child.height();
if(link !== ''){
link.css('display','none');
}
child.css('display','none');
vars.totalSlides++;
});
// If randomStart
if(settings.randomStart){
settings.startSlide = Math.floor(Math.random() * vars.totalSlides);
}
// Set startSlide
if(settings.startSlide > 0){
if(settings.startSlide >= vars.totalSlides) { settings.startSlide = vars.totalSlides - 1; }
vars.currentSlide = settings.startSlide;
}
// Get initial image
if($(kids[vars.currentSlide]).is('img')){
vars.currentImage = $(kids[vars.currentSlide]);
} else {
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
}
// Show initial link
if($(kids[vars.currentSlide]).is('a')){
$(kids[vars.currentSlide]).css('display','block');
}
// Set first background
var sliderImg = $('<img class="nivo-main-image" src="#" />');
sliderImg.attr('src', vars.currentImage.attr('src')).show();
slider.append(sliderImg);
// Detect Window Resize
$(window).resize(function() {
slider.children('img').width(slider.width());
sliderImg.attr('src', vars.currentImage.attr('src'));
sliderImg.stop().height('auto');
$('.nivo-slice').remove();
$('.nivo-box').remove();
});
//Create caption
slider.append($('<div class="nivo-caption"></div>'));
// Process caption function
var processCaption = function(settings){
var nivoCaption = $('.nivo-caption', slider);
if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
var title = vars.currentImage.attr('title');
if(title.substr(0,1) == '#') title = $(title).html();
if(nivoCaption.css('display') == 'block'){
nivoCaption.stop().fadeTo(settings.animSpeed, 0, function(){
$(this).html(title);
/*Using Cufon in title*/
if( typeof(Cufon) != 'undefined' ){
var gdl_font_fam = nivoCaption.find('.gdl-slider-title').css('font-family');
gdl_font_fam = gdl_font_fam.replace(/'/g,"");
if( Cufon.hasFont( gdl_font_fam ) ){
Cufon.replace(nivoCaption.find('.gdl-slider-title'), {fontFamily: gdl_font_fam});
}
}
$(this).stop().fadeTo(settings.animSpeed, 1);
});
} else {
nivoCaption.html(title);
/*Using Cufon in title*/
if( typeof(Cufon) != 'undefined' ){
var gdl_font_fam = nivoCaption.find('.gdl-slider-title').css('font-family');
gdl_font_fam = gdl_font_fam.replace(/'/g,"");
if( Cufon.hasFont( gdl_font_fam ) ){
Cufon.replace(nivoCaption.find('.gdl-slider-title'), {fontFamily: gdl_font_fam});
}
}
nivoCaption.stop().fadeIn(settings.animSpeed);
}
} else {
nivoCaption.stop().fadeOut(settings.animSpeed);
}
}
//Process initial caption
processCaption(settings);
// In the words of Super Mario "let's a go!"
var timer = 0;
if(!settings.manualAdvance && kids.length > 1){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
// Add Direction nav
if(settings.directionNav){
var direction_nav = $('<div class="nivo-directionNav"></div>');
var prev_nav = $('<a class="nivo-prevNav">'+ settings.prevText +'</a>');
var next_nav = $('<a class="nivo-nextNav">'+ settings.nextText +'</a>');
direction_nav.append(prev_nav);
direction_nav.append(next_nav);
slider.after(direction_nav);
// Hide Direction nav
if(settings.directionNavHide){
$('.nivo-directionNav', slider).hide();
slider.hover(function(){
$('.nivo-directionNav', slider).show();
}, function(){
$('.nivo-directionNav', slider).hide();
});
}
prev_nav.click( function(){
if(vars.running) { return false; }
clearInterval(timer);
timer = '';
vars.currentSlide -= 2;
nivoRun(slider, kids, settings, 'prev');
});
next_nav.click( function(){
if(vars.running) { return false; }
clearInterval(timer);
timer = '';
nivoRun(slider, kids, settings, 'next');
});
}
// Add Control nav
if(settings.controlNav){
var controlNavWrapper = $('<div class="nivo-controlNav-wrapper"></div>');
vars.controlNavEl = $('<div class="nivo-controlNav"></div>');
controlNavWrapper.append( vars.controlNavEl );
slider.after(controlNavWrapper);
for(var i = 0; i < kids.length; i++){
if(settings.controlNavThumbs){
vars.controlNavEl.addClass('nivo-thumbs-enabled');
var child = kids.eq(i);
if(!child.is('img')){
child = child.find('img:first');
}
if(child.attr('data-thumb')) vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('data-thumb') +'" alt="" /></a>');
} else {
vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
}
}
//Set initial active link
$('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
$('a', vars.controlNavEl).bind('click', function(){
if(vars.running) return false;
if($(this).hasClass('active')) return false;
clearInterval(timer);
timer = '';
sliderImg.attr('src', vars.currentImage.attr('src'));
vars.currentSlide = $(this).attr('rel') - 1;
nivoRun(slider, kids, settings, 'control');
});
}
//For pauseOnHover setting
if(settings.pauseOnHover){
slider.hover(function(){
vars.paused = true;
clearInterval(timer);
timer = '';
}, function(){
vars.paused = false;
// Restart the timer
if(timer === '' && !settings.manualAdvance){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
});
}
// Event when Animation finishes
slider.bind('nivo:animFinished', function(){
sliderImg.attr('src', vars.currentImage.attr('src'));
vars.running = false;
// Hide child links
$(kids).each(function(){
if($(this).is('a')){
$(this).css('display','none');
}
});
// Show current link
if($(kids[vars.currentSlide]).is('a')){
$(kids[vars.currentSlide]).css('display','block');
}
// Restart the timer
if(timer === '' && !vars.paused && !settings.manualAdvance){
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
}
// Trigger the afterChange callback
settings.afterChange.call(this);
});
// Add slices for slice animations
var createSlices = function(slider, settings, vars) {
if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
$('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
var sliceHeight = ($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().is('a')) ? $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().height() : $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height();
for(var i = 0; i < settings.slices; i++){
var sliceWidth = Math.round(slider.width()/settings.slices);
if(i === settings.slices-1){
slider.append(
$('<div class="nivo-slice" name="'+i+'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" /></div>').css({
left:(sliceWidth*i)+'px',
width:(slider.width()-(sliceWidth*i))+'px',
height:sliceHeight+'px',
opacity:'0',
overflow:'hidden'
})
);
} else {
slider.append(
$('<div class="nivo-slice" name="'+i+'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" /></div>').css({
left:(sliceWidth*i)+'px',
width:sliceWidth+'px',
height:sliceHeight+'px',
opacity:'0',
overflow:'hidden'
})
);
}
}
$('.nivo-slice', slider).height(sliceHeight);
sliderImg.stop().animate({
height: $(vars.currentImage).height()
}, settings.animSpeed);
};
// Add boxes for box animations
var createBoxes = function(slider, settings, vars){
if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
$('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
var boxWidth = Math.round(slider.width()/settings.boxCols),
boxHeight = Math.round($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height() / settings.boxRows);
for(var rows = 0; rows < settings.boxRows; rows++){
for(var cols = 0; cols < settings.boxCols; cols++){
if(cols === settings.boxCols-1){
slider.append(
$('<div class="nivo-box" name="'+ cols +'" rel="'+ rows +'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" /></div>').css({
opacity:0,
left:(boxWidth*cols)+'px',
top:(boxHeight*rows)+'px',
width:(slider.width()-(boxWidth*cols))+'px'
})
);
$('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
} else {
slider.append(
$('<div class="nivo-box" name="'+ cols +'" rel="'+ rows +'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" /></div>').css({
opacity:0,
left:(boxWidth*cols)+'px',
top:(boxHeight*rows)+'px',
width:boxWidth+'px'
})
);
$('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
}
}
}
sliderImg.stop().animate({
height: $(vars.currentImage).height()
}, settings.animSpeed);
};
// Private run method
var nivoRun = function(slider, kids, settings, nudge){
// Get our vars
var vars = slider.data('nivo:vars');
// Trigger the lastSlide callback
if(vars && (vars.currentSlide === vars.totalSlides - 1)){
settings.lastSlide.call(this);
}
// Stop
if((!vars || vars.stop) && !nudge) { return false; }
// Trigger the beforeChange callback
settings.beforeChange.call(this);
// Set current background before change
if(!nudge){
sliderImg.attr('src', vars.currentImage.attr('src'));
} else {
if(nudge === 'prev'){
sliderImg.attr('src', vars.currentImage.attr('src'));
}
if(nudge === 'next'){
sliderImg.attr('src', vars.currentImage.attr('src'));
}
}
vars.currentSlide++;
// Trigger the slideshowEnd callback
if(vars.currentSlide === vars.totalSlides){
vars.currentSlide = 0;
settings.slideshowEnd.call(this);
}
if(vars.currentSlide < 0) { vars.currentSlide = (vars.totalSlides - 1); }
// Set vars.currentImage
if($(kids[vars.currentSlide]).is('img')){
vars.currentImage = $(kids[vars.currentSlide]);
} else {
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
}
// Set active links
if(settings.controlNav){
$('a', vars.controlNavEl).removeClass('active');
$('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
}
// Process caption
processCaption(settings);
// Remove any slices from last transition
$('.nivo-slice', slider).remove();
// Remove any boxes from last transition
$('.nivo-box', slider).remove();
var currentEffect = settings.effect,
anims = '';
// Generate random effect
if(settings.effect === 'random'){
anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade',
'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');
currentEffect = anims[Math.floor(Math.random()*(anims.length + 1))];
if(currentEffect === undefined) { currentEffect = 'fade'; }
}
// Run random effect from specified set (eg: effect:'fold,fade')
if(settings.effect.indexOf(',') !== -1){
anims = settings.effect.split(',');
currentEffect = anims[Math.floor(Math.random()*(anims.length))];
if(currentEffect === undefined) { currentEffect = 'fade'; }
}
// Custom transition as defined by "data-transition" attribute
if(vars.currentImage.attr('data-transition')){
currentEffect = vars.currentImage.attr('data-transition');
}
// Run effects
vars.running = true;
var timeBuff = 0,
i = 0,
slices = '',
firstSlice = '',
totalBoxes = '',
boxes = '';
if(currentEffect === 'sliceDown' || currentEffect === 'sliceDownRight' || currentEffect === 'sliceDownLeft'){
createSlices(slider, settings, vars);
timeBuff = 0;
i = 0;
slices = $('.nivo-slice', slider);
if(currentEffect === 'sliceDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
slices.each(function(){
var slice = $(this);
slice.css({ 'top': '0px' });
if(i === settings.slices-1){
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
} else if(currentEffect === 'sliceUp' || currentEffect === 'sliceUpRight' || currentEffect === 'sliceUpLeft'){
createSlices(slider, settings, vars);
timeBuff = 0;
i = 0;
slices = $('.nivo-slice', slider);
if(currentEffect === 'sliceUpLeft') { slices = $('.nivo-slice', slider)._reverse(); }
slices.each(function(){
var slice = $(this);
slice.css({ 'bottom': '0px' });
if(i === settings.slices-1){
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
} else if(currentEffect === 'sliceUpDown' || currentEffect === 'sliceUpDownRight' || currentEffect === 'sliceUpDownLeft'){
createSlices(slider, settings, vars);
timeBuff = 0;
i = 0;
var v = 0;
slices = $('.nivo-slice', slider);
if(currentEffect === 'sliceUpDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
slices.each(function(){
var slice = $(this);
if(i === 0){
slice.css('top','0px');
i++;
} else {
slice.css('bottom','0px');
i = 0;
}
if(v === settings.slices-1){
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
v++;
});
} else if(currentEffect === 'fold'){
createSlices(slider, settings, vars);
timeBuff = 0;
i = 0;
$('.nivo-slice', slider).each(function(){
var slice = $(this);
var origWidth = slice.width();
slice.css({ top:'0px', width:'0px' });
if(i === settings.slices-1){
setTimeout(function(){
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 50;
i++;
});
} else if(currentEffect === 'fade'){
createSlices(slider, settings, vars);
firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'width': slider.width() + 'px'
});
firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
} else if(currentEffect === 'slideInRight'){
createSlices(slider, settings, vars);
firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'width': '0px',
'opacity': '1'
});
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
} else if(currentEffect === 'slideInLeft'){
createSlices(slider, settings, vars);
firstSlice = $('.nivo-slice:first', slider);
firstSlice.css({
'width': '0px',
'opacity': '1',
'left': '',
'right': '0px'
});
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){
// Reset positioning
firstSlice.css({
'left': '0px',
'right': ''
});
slider.trigger('nivo:animFinished');
});
} else if(currentEffect === 'boxRandom'){
createBoxes(slider, settings, vars);
totalBoxes = settings.boxCols * settings.boxRows;
i = 0;
timeBuff = 0;
boxes = shuffle($('.nivo-box', slider));
boxes.each(function(){
var box = $(this);
if(i === totalBoxes-1){
setTimeout(function(){
box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + timeBuff));
} else {
setTimeout(function(){
box.animate({ opacity:'1' }, settings.animSpeed);
}, (100 + timeBuff));
}
timeBuff += 20;
i++;
});
} else if(currentEffect === 'boxRain' || currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
createBoxes(slider, settings, vars);
totalBoxes = settings.boxCols * settings.boxRows;
i = 0;
timeBuff = 0;
// Split boxes into 2D array
var rowIndex = 0;
var colIndex = 0;
var box2Darr = [];
box2Darr[rowIndex] = [];
boxes = $('.nivo-box', slider);
if(currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrowReverse'){
boxes = $('.nivo-box', slider)._reverse();
}
boxes.each(function(){
box2Darr[rowIndex][colIndex] = $(this);
colIndex++;
if(colIndex === settings.boxCols){
rowIndex++;
colIndex = 0;
box2Darr[rowIndex] = [];
}
});
// Run animation
for(var cols = 0; cols < (settings.boxCols * 2); cols++){
var prevCol = cols;
for(var rows = 0; rows < settings.boxRows; rows++){
if(prevCol >= 0 && prevCol < settings.boxCols){
/* Due to some weird JS bug with loop vars
being used in setTimeout, this is wrapped
with an anonymous function call */
(function(row, col, time, i, totalBoxes) {
var box = $(box2Darr[row][col]);
var w = box.width();
var h = box.height();
if(currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
box.width(0).height(0);
}
if(i === totalBoxes-1){
setTimeout(function(){
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); });
}, (100 + time));
} else {
setTimeout(function(){
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3);
}, (100 + time));
}
})(rows, prevCol, timeBuff, i, totalBoxes);
i++;
}
prevCol--;
}
timeBuff += 100;
}
}
};
// Shuffle an array
var shuffle = function(arr){
for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i, 10), x = arr[--i], arr[i] = arr[j], arr[j] = x);
return arr;
};
// For debugging
var trace = function(msg){
if(this.console && typeof console.log !== 'undefined') { console.log(msg); }
};
// Start / Stop
this.stop = function(){
if(!$(element).data('nivo:vars').stop){
$(element).data('nivo:vars').stop = true;
trace('Stop Slider');
}
};
this.start = function(){
if($(element).data('nivo:vars').stop){
$(element).data('nivo:vars').stop = false;
trace('Start Slider');
}
};
// Trigger the afterLoad callback
settings.afterLoad.call(this);
return this;
};
$.fn.nivoSlider = function(options) {
return this.each(function(key, value){
var element = $(this);
// Return early if this element already has a plugin instance
if (element.data('nivoslider')) { return element.data('nivoslider'); }
// Pass options to plugin constructor
var nivoslider = new NivoSlider(this, options);
// Store plugin object in this element's data
element.data('nivoslider', nivoslider);
});
};
//Default settings
$.fn.nivoSlider.defaults = {
effect: 'random',
slices: 15,
boxCols: 8,
boxRows: 4,
animSpeed: 500,
pauseTime: 3000,
startSlide: 0,
directionNav: true,
directionNavHide: true,
controlNav: true,
controlNavThumbs: false,
pauseOnHover: true,
manualAdvance: false,
prevText: 'Prev',
nextText: 'Next',
randomStart: false,
beforeChange: function(){},
afterChange: function(){},
slideshowEnd: function(){},
lastSlide: function(){},
afterLoad: function(){}
};
$.fn._reverse = [].reverse;
})(jQuery);
jQuery(window).load(function() {
// Nivo Slider Setting
NIVO.pauseOnHover = (NIVO.pauseOnHover == 'enable')? true: false;
NIVO.controlNav = (NIVO.controlNav == 'enable')? true: false;
NIVO.directionNav = (NIVO.directionNav == 'enable')? true: false;
NIVO.directionNavHide = false;
NIVO.animSpeed = parseInt(NIVO.animSpeed);
NIVO.pauseTime = parseInt(NIVO.pauseTime);
jQuery('.nivoSlider').nivoSlider( NIVO );
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
/*
* Pause jQuery plugin v0.1
*
* Copyright 2010 by Tobia Conforto <tobia.conforto@gmail.com>
*
* Based on Pause-resume-animation jQuery plugin by Joe Weitzel
*
* 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 2 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, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
(function(){var e=jQuery,f="jQuery.pause",d=1,b=e.fn.animate,a={};function c(){return new Date().getTime()}e.fn.animate=function(k,h,j,i){var g=e.speed(h,j,i);g.complete=g.old;return this.each(function(){if(!this[f]){this[f]=d++}var l=e.extend({},g);b.apply(e(this),[k,e.extend({},l)]);a[this[f]]={run:true,prop:k,opt:l,start:c(),done:0}})};e.fn.pause=function(){return this.each(function(){if(!this[f]){this[f]=d++}var g=a[this[f]];if(g&&g.run){g.done+=c()-g.start;if(g.done>g.opt.duration){delete a[this[f]]}else{e(this).stop();g.run=false}}})};e.fn.resume=function(){return this.each(function(){if(!this[f]){this[f]=d++}var g=a[this[f]];if(g&&!g.run){g.opt.duration-=g.done;g.done=0;g.run=true;g.start=c();b.apply(e(this),[g.prop,e.extend({},g.opt)])}})}})();
jQuery(document).ready(function(){
var marquee = jQuery("#marquee");
var time_multiplier = 20;
var current;
marquee.hover(function(){
current.pause();
}, function(){
current.resume();
})
var reset = function() {
current = jQuery(this);
var item_width = jQuery(this).outerWidth();
var time = time_multiplier * jQuery(this).outerWidth();
jQuery(this).animate({ 'margin-left': -item_width }, time, 'linear', function(){
var clone_item = jQuery(this).clone();
clone_item.css({ 'margin-left': '0' });
marquee.append(clone_item);
jQuery(this).remove();
reset.call(marquee.children().filter(':first'));
});
};
reset.call(marquee.children().filter(':first'));
});

View File

@@ -0,0 +1,85 @@
jQuery(document).ready(function(){
var port_carousel_wrapper = jQuery('.portfolio-carousel-wrapper');
function carousel_port_init(){
port_carousel_wrapper.each(function(){
var port_carousel = jQuery(this);
var port_holder = port_carousel.children('.portfolio-item-holder');
var port_item = port_carousel.find('.portfolio-item');
port_item.css('float', 'left');
var child_size;
if( port_item.filter(':first').hasClass('three') ){
port_holder.attr('data-num', 4);
child_size = port_carousel.parents('.row').width() / 4;
}else if( port_item.filter(':first').hasClass('four') ){
port_holder.attr('data-num', 3);
child_size = port_carousel.parents('.row').width() / 3;
}else if( port_item.filter(':first').hasClass('six') ){
port_holder.attr('data-num', 2);
child_size = port_carousel.parents('.row').width() / 2;
}
if( jQuery('html').filter(':first').width() <= '767' ){
port_holder.attr('data-num', 1);
child_size = port_carousel.parents('.row').width();
}
port_item.css('width', child_size );
port_holder.attr('data-width', child_size);
port_holder.attr('data-max', port_item.length);
port_holder.width( port_item.length * child_size );
var cur_index = parseInt(port_holder.attr('data-index'));
port_holder.css({ 'margin-left': -(cur_index * child_size + 10) });
});
}
// bind the navigation
var port_nav = port_carousel_wrapper.children('.port-nav-wrapper');
if( port_nav.length == 0 ){
port_nav = port_carousel_wrapper.siblings('.portfolio-carousel-description').children('.port-nav-wrapper');
}
port_nav.children('.port-nav.left').click(function(){
var port_holder = jQuery(this).parent('.port-nav-wrapper').siblings('.portfolio-item-holder');
if( port_holder.length == 0 ){
port_holder = jQuery(this).parent('.port-nav-wrapper').parent().siblings('.portfolio-carousel-wrapper').children('.portfolio-item-holder');
}
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index > 0 ){ cur_index--; }
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width')) + 10) });
});
port_nav.children('.port-nav.right').click(function(){
var port_holder = jQuery(this).parent('.port-nav-wrapper').siblings('.portfolio-item-holder');
if( port_holder.length == 0 ){
port_holder = jQuery(this).parent('.port-nav-wrapper').parent().siblings('.portfolio-carousel-wrapper').children('.portfolio-item-holder');
}
var cur_index = parseInt(port_holder.attr('data-index'));
if( cur_index + parseInt(port_holder.attr('data-num')) < parseInt(port_holder.attr('data-max')) ){
cur_index++;
}
port_holder.attr('data-index', cur_index);
port_holder.animate({ 'margin-left': -(cur_index * parseInt(port_holder.attr('data-width')) + 10) });
});
carousel_port_init();
//Auto animate
//var infiniteLoop = setInterval(function(){
// port_nav.children('.port-nav.right').trigger('click');
//}, 1000);
jQuery(window).resize(function(){
carousel_port_init();
});
});

View File

@@ -0,0 +1,232 @@
/*
* Superfish v1.6.9 - jQuery menu widget
* Copyright (c) 2013 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
;(function($) {
$.fn.superfish = function(op) {
var sf = $.fn.superfish,
c = sf.c,
$arrow = $('<span class="' + c.arrowClass + '"> &#187;</span>'),
over = function() {
var $this = $(this),
o = getOptions($this);
clearTimeout(o.sfTimer);
$this.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(e) {
var $this = $(this),
o = getOptions($this);
if (e.type === 'click' || sf.ios) {
$.proxy(close, $this, o)();
}
else {
clearTimeout(o.sfTimer);
o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
}
},
close = function(o) {
o.retainPath = ( $.inArray(this[0], o.$path) > -1);
this.hideSuperfishUl();
if (!this.parents('.' + o.hoverClass).length) {
o.onIdle.call(getMenu(this));
if (o.$path.length) {
$.proxy(over, o.$path)();
}
}
},
getMenu = function($el) {
return $el.closest('.' + c.menuClass);
},
getOptions = function($el) {
return getMenu($el).data('sf-options');
},
applyTouchAction = function($menu) {
// needed by MS pointer events
$menu.css('ms-touch-action', 'none');
},
applyHandlers = function($menu,o) {
var targets = 'li:has(ul)';
if (!o.useClick) {
if ($.fn.hoverIntent && !o.disableHI) {
$menu.hoverIntent(over, out, targets);
}
else {
$menu
.on('mouseenter', targets, over)
.on('mouseleave', targets, out);
}
}
var touchstart = 'MSPointerDown';
if (!sf.ios) {
touchstart += ' touchstart';
}
if (sf.wp7) {
touchstart += ' mousedown';
}
$menu
.on('focusin', 'li', over)
.on('focusout', 'li', out)
.on('click', 'a', o, clickHandler)
.on(touchstart, 'a', touchHandler);
},
touchHandler = function(e) {
var $this = $(this),
$ul = $this.siblings('ul');
if ($ul.length > 0 && $ul.is(':hidden')) {
$this.data('follow', false);
if (e.type === 'MSPointerDown') {
$this.trigger('focus');
return false;
}
}
},
clickHandler = function(e) {
var $a = $(this),
o = e.data,
$submenu = $a.siblings('ul'),
follow = ($a.data('follow') === false) ? false : true;
if ($submenu.length && (o.useClick || !follow)) {
e.preventDefault();
if ($submenu.is(':hidden')) {
$.proxy(over, $a.parent('li'))();
}
else if (o.useClick && follow) {
$.proxy(out, $a.parent('li'), e)();
}
}
},
setPathToCurrent = function($menu, o) {
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
.addClass(o.hoverClass + ' ' + c.bcClass)
.filter(function() {
return ($(this).children('ul').hide().show().length);
}).removeClass(o.pathClass);
},
addArrows = function($li, o) {
if (o.autoArrows) {
$li.children('a').each(function() {
addArrow( $(this) );
});
}
},
addArrow = function($a) {
$a.addClass(c.anchorClass).append($arrow.clone());
};
sf.getOptions = getOptions;
return this.addClass(c.menuClass).each(function() {
var $this = $(this),
o = $.extend({}, sf.defaults, op),
$liHasUl = $this.find('li:has(ul)');
o.$path = setPathToCurrent($this, o);
$this.data('sf-options', o);
addArrows($liHasUl, o);
applyTouchAction($this);
applyHandlers($this, o);
$liHasUl.not('.' + c.bcClass).hideSuperfishUl(true);
o.onInit.call(this);
});
};
var sf = $.fn.superfish;
sf.o = [];
sf.op = {};
sf.c = {
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
anchorClass: 'sf-with-ul',
arrowClass: 'sf-sub-indicator'
};
sf.defaults = {
hoverClass: 'sfHover',
pathClass: 'overrideThisToUse',
pathLevels: 1,
delay: 800,
animation: {opacity:'show'},
animationOut: {opacity:'hide'},
speed: 'normal',
speedOut: 'fast',
autoArrows: true,
disableHI: false, // true disables hoverIntent detection
useClick: false,
onInit: $.noop, // callback functions
onBeforeShow: $.noop,
onShow: $.noop,
onBeforeHide: $.noop,
onHide: $.noop,
onIdle: $.noop
};
sf.ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
sf.wp7 = (function() {
var style = document.documentElement.style;
return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
})();
$.fn.extend({
hideSuperfishUl: function(instant) {
if (this.length) {
var $this = this,
o = sf.getOptions($this),
not = (o.retainPath === true) ? o.$path : '',
$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children('ul'),
speed = o.speedOut;
if (instant) {
$ul.show();
speed = 0;
}
o.retainPath = false;
o.onBeforeHide.call($ul);
$ul.stop(true, true).animate(o.animationOut, speed, function() {
var $this = $(this);
o.onHide.call($this);
if (o.useClick) {
$this.siblings('a').data('follow', false);
}
});
}
return this;
},
showSuperfishUl: function() {
var o = sf.getOptions(this),
$this = this.addClass(o.hoverClass),
$ul = $this.children('ul');
o.onBeforeShow.call($ul);
$ul.stop(true, true).animate(o.animation, o.speed, function() {
o.onShow.call($ul);
$this.children('a').data('follow', true);
});
return this;
}
});
if (sf.ios) {
// iOS click won't bubble to body, attach to closest possible
$(window).load(function() {
$('body').children().on('click', $.noop);
});
}
})(jQuery);

View File

@@ -0,0 +1,89 @@
/*
* Supersubs v0.2b - jQuery plugin
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*
* This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
* their longest list item children. If you use this, please expect bugs and report them
* to the jQuery Google Group with the word 'Superfish' in the subject line.
*
*/
;(function($){ // $ will refer to jQuery within this closure
$.fn.supersubs = function(options){
var opts = $.extend({}, $.fn.supersubs.defaults, options);
// return original object to support chaining
return this.each(function() {
// cache selections
var $$ = $(this);
// support metadata
var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
// get the font size of menu.
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
'padding' : 0,
'position' : 'absolute',
'top' : '-999em',
'width' : 'auto'
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
// remove em dash
$('#menu-fontsize').remove();
// cache all ul elements
$ULs = $$.find('ul');
// loop through each ul in menu
$ULs.each(function(i) {
// cache this ul
var $ul = $ULs.eq(i);
// get all (li) children of this ul
var $LIs = $ul.children();
// get all anchor grand-children
var $As = $LIs.children('a');
// force content to one line and save current float property
var liFloat = $LIs.css('white-space','nowrap').css('float');
// remove width restrictions and floats so elements remain vertically stacked
var emWidth = $ul.add($LIs).add($As).css({
'float' : 'none',
'width' : 'auto'
})
// this ul will now be shrink-wrapped to longest li due to position:absolute
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
.end().end()[0].clientWidth / fontsize;
// add more width to ensure lines don't turn over at certain sizes in various browsers
emWidth += o.extraWidth;
// restrict to at least minWidth and at most maxWidth
if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
emWidth += 'em';
// set ul to width in ems
$ul.css('width',emWidth);
// restore li floats to avoid IE bugs
// set li width to full width of this ul
// revert white-space to normal
$LIs.css({
'float' : liFloat,
'width' : '100%',
'white-space' : 'normal'
})
// update offset position of descendant ul to reflect new width of parent
.each(function(){
var $childUl = $('>ul',this);
var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
$childUl.css(offsetDirection,emWidth);
});
});
});
};
// expose defaults
$.fn.supersubs.defaults = {
minWidth : 9, // requires em unit.
maxWidth : 25, // requires em unit.
extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
};
})(jQuery); // plugin code ends