spree_slider 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +210 -0
- data/LICENSE +26 -0
- data/README.textile +43 -0
- data/Rakefile +1 -0
- data/Versionfile +10 -0
- data/app/controllers/spree/admin/slides_controller.rb +8 -0
- data/app/models/spree/slide.rb +4 -0
- data/app/overrides/add_slider_to_layout.rb +8 -0
- data/app/overrides/add_slides_to_admin_configurations_menu.rb +9 -0
- data/app/overrides/add_slides_to_admin_configurations_sidebar_menu.rb +7 -0
- data/app/views/spree/admin/slides/_form.html.erb +21 -0
- data/app/views/spree/admin/slides/edit.html.erb +10 -0
- data/app/views/spree/admin/slides/index.html.erb +35 -0
- data/app/views/spree/admin/slides/new.html.erb +9 -0
- data/app/views/spree/admin/slides/show.html.erb +41 -0
- data/app/views/spree/home/index.html.erb +14 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20120222184238_create_slides.rb +16 -0
- data/lib/generators/spree_slider/install_anything_generator.rb +30 -0
- data/lib/generators/spree_slider/install_nivo_generator.rb +34 -0
- data/lib/generators/spree_slider/templates/anything_slider.html.erb +26 -0
- data/lib/generators/spree_slider/templates/nivo_slider.html.erb +38 -0
- data/lib/spree_slider/engine.rb +23 -0
- data/lib/spree_slider.rb +2 -0
- data/script/rails +5 -0
- data/spec/spec_helper.rb +32 -0
- data/spree_slider.gemspec +26 -0
- data/vendor/assets/anything-slider/README.textile +13 -0
- data/vendor/assets/anything-slider/css/anythingslider-ie.css +45 -0
- data/vendor/assets/anything-slider/css/anythingslider.css +204 -0
- data/vendor/assets/anything-slider/css/theme-construction.css +142 -0
- data/vendor/assets/anything-slider/css/theme-cs-portfolio.css +148 -0
- data/vendor/assets/anything-slider/css/theme-metallic.css +146 -0
- data/vendor/assets/anything-slider/css/theme-minimalist-round.css +144 -0
- data/vendor/assets/anything-slider/css/theme-minimalist-square.css +144 -0
- data/vendor/assets/anything-slider/demos/colorbox/border.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/colorbox.css +62 -0
- data/vendor/assets/anything-slider/demos/colorbox/controls.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopCenter.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopLeft.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopRight.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox-min.js +4 -0
- data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox.js +769 -0
- data/vendor/assets/anything-slider/demos/colorbox/loading.gif +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/loading_background.png +0 -0
- data/vendor/assets/anything-slider/demos/colorbox/overlay.png +0 -0
- data/vendor/assets/anything-slider/demos/css/page.css +148 -0
- data/vendor/assets/anything-slider/demos/images/251356.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/apple-touch-icon.png +0 -0
- data/vendor/assets/anything-slider/demos/images/favicon.ico +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/slide-tele-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-civil-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-1.jpg +0 -0
- data/vendor/assets/anything-slider/demos/images/th-slide-env-2.jpg +0 -0
- data/vendor/assets/anything-slider/demos/js/demo.js +132 -0
- data/vendor/assets/anything-slider/demos/video/movie.mp4 +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.ogg +0 -0
- data/vendor/assets/anything-slider/demos/video/movie.webm +0 -0
- data/vendor/assets/anything-slider/demos.html +740 -0
- data/vendor/assets/anything-slider/expand.html +97 -0
- data/vendor/assets/anything-slider/images/arrows-metallic.png +0 -0
- data/vendor/assets/anything-slider/images/arrows-minimalist.png +0 -0
- data/vendor/assets/anything-slider/images/construction.gif +0 -0
- data/vendor/assets/anything-slider/images/cs-portfolio.png +0 -0
- data/vendor/assets/anything-slider/images/default.png +0 -0
- data/vendor/assets/anything-slider/index.html +470 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.fx.js +165 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.fx.min.js +6 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.js +791 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.min.js +7 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.video.js +367 -0
- data/vendor/assets/anything-slider/js/jquery.anythingslider.video.min.js +8 -0
- data/vendor/assets/anything-slider/js/jquery.easing.1.2.js +140 -0
- data/vendor/assets/anything-slider/js/jquery.min.js +18 -0
- data/vendor/assets/anything-slider/js/swfobject.js +4 -0
- data/vendor/assets/anything-slider/license.txt +165 -0
- data/vendor/assets/anything-slider/simple.html +79 -0
- data/vendor/assets/anything-slider/video.html +341 -0
- data/vendor/assets/nivo-slider/README +1 -0
- data/vendor/assets/nivo-slider/demo/demo.html +39 -0
- data/vendor/assets/nivo-slider/demo/images/dev7logo.png +0 -0
- data/vendor/assets/nivo-slider/demo/images/nemo.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/toystory.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/up.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/images/walle.jpg +0 -0
- data/vendor/assets/nivo-slider/demo/scripts/jquery-1.6.1.min.js +18 -0
- data/vendor/assets/nivo-slider/demo/style.css +100 -0
- data/vendor/assets/nivo-slider/jquery.nivo.slider.js +685 -0
- data/vendor/assets/nivo-slider/jquery.nivo.slider.pack.js +67 -0
- data/vendor/assets/nivo-slider/license.txt +22 -0
- data/vendor/assets/nivo-slider/nivo-slider.css +89 -0
- data/vendor/assets/nivo-slider/themes/default/arrows.png +0 -0
- data/vendor/assets/nivo-slider/themes/default/bullets.png +0 -0
- data/vendor/assets/nivo-slider/themes/default/default.css +74 -0
- data/vendor/assets/nivo-slider/themes/default/loading.gif +0 -0
- data/vendor/assets/nivo-slider/themes/orman/arrows.png +0 -0
- data/vendor/assets/nivo-slider/themes/orman/bullets.png +0 -0
- data/vendor/assets/nivo-slider/themes/orman/loading.gif +0 -0
- data/vendor/assets/nivo-slider/themes/orman/orman.css +98 -0
- data/vendor/assets/nivo-slider/themes/orman/readme.txt +1 -0
- data/vendor/assets/nivo-slider/themes/orman/ribbon.png +0 -0
- data/vendor/assets/nivo-slider/themes/orman/slider.png +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/bullets.png +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/controlnav.png +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/featured.png +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/loading.gif +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/pascal.css +102 -0
- data/vendor/assets/nivo-slider/themes/pascal/readme.txt +1 -0
- data/vendor/assets/nivo-slider/themes/pascal/ribbon.png +0 -0
- data/vendor/assets/nivo-slider/themes/pascal/slider.png +0 -0
- metadata +236 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
AnythingSlider v1.7.13 minified using Google Closure Compiler
|
3
|
+
Original by Chris Coyier: http://css-tricks.com
|
4
|
+
Get the latest version: https://github.com/ProLoser/AnythingSlider
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function(d){d.anythingSlider=function(h,i){var a=this,b;a.el=h;a.$el=d(h).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,i);a.initialized=false;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+ b.theme);a.$window=a.$el.closest("div.anythingWindow");a.win=window;a.$win=d(a.win);a.$controls=d('<div class="anythingControls"></div>').appendTo(b.appendControlsTo!==null&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);a.$startStop=d('<a href="#" class="start-stop"></a>');b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo!==null&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.$nav=d('<ul class="thumbNav" />').appendTo(b.appendNavigationTo!==null&&d(b.appendNavigationTo).length? d(b.appendNavigationTo):a.$controls);a.flag=false;a.playing=b.autoPlay;a.slideshow=false;a.hovered=false;a.panelSize=[];a.currentPage=b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;a.adj=b.infiniteSlides?0:1;a.width=a.$el.width();a.height=a.$el.height();a.outerPad=[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];b.playRtl&&a.$wrapper.addClass("rtl");if(b.expand)a.$outer=a.$wrapper.parent(),a.$window.css({width:"100%",height:"100%"}), a.checkResize();b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();if(!b.autoPlay)b.autoPlayLocked=false;a.updateSlider();a.$lastPage=a.$currentPage;a.runTimes=d("div.anythingSlider").index(a.$wrapper)+1;a.regex=RegExp("panel"+a.runTimes+"-(\\d+)","i");a.runTimes===1&&a.makeActive();if(!d.isFunction(d.easing[b.easing]))b.easing="swing";b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(true))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused", a),a.startStop(a.playing,true))});a.setCurrentPage(a.gotoHash()||b.startPage,false);a.slideControls(false);a.$wrapper.bind("mouseenter mouseleave",function(b){a.hovered=b.type==="mouseenter"?true:false;a.slideControls(a.hovered,false)});d(document).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.is(".activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT")&&(b.vertical||!(c.which===38||c.which===40)))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}});a.$items.delegate("a", "focus.AnythingSlider",function(c){var e=d(this).closest(".panel"),e=a.$items.index(e)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0);if(e>=a.currentPage+b.showMultiple||e<a.currentPage)a.gotoPage(e),c.preventDefault()});var c="slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(f,e){d.isFunction(b[e])&&a.$el.bind(c[f],b[e])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete",function(){setTimeout(function(){b.onSlideComplete(a)},0)});a.initialized=true;a.$el.trigger("initialized",a);a.startStop(a.playing)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir=b.vertical?"top":"left";b.showMultiple=b.vertical?1:parseInt(b.showMultiple,10)||1;if(b.showMultiple> 1){if(b.showMultiple>a.pages)b.showMultiple=a.pages;a.adjustMultiple=b.infiniteSlides&&a.pages>1?0:b.showMultiple-1;a.pages=a.$items.length-a.adjustMultiple}a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[a.pages<=1?"hide":"show"]();a.pages>1&&a.buildNavigation();b.infiniteSlides&&a.pages>1&&(a.$el.prepend(a.$items.filter(":last").clone().removeAttr("id").addClass("cloned")),b.showMultiple>1?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().removeAttr("id").addClass("cloned").addClass("multiple")): a.$el.append(a.$items.filter(":first").clone().removeAttr("id").addClass("cloned")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area").attr("disabled","disabled");d(this).find("[id]").removeAttr("id")}));a.$items=a.$el.children().addClass("panel"+(b.vertical?" vertical":""));a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]),a.$wrapper.add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions()}); if(a.currentPage>a.pages)a.currentPage=a.pages;a.setCurrentPage(a.currentPage,false);a.$nav.find("a").eq(a.currentPage-1).addClass("cur")};a.buildNavigation=function(){if(b.buildNavigation&&a.pages>1){var c,f;a.$items.filter(":not(.cloned)").each(function(e){var g=e+1;c=(g===1?"first":"")+(g===a.pages?"last":"");f=d('<a href="#"></a>').addClass("panel"+g).wrap('<li class="'+c+'" />');a.$nav.append(f.parent());d.isFunction(b.navigationFormatter)?(c=b.navigationFormatter(g,d(this)),f.html("<span>"+ c+"</span>"),parseInt(f.find("span").css("text-indent"),10)<0&&f.addClass(b.tooltipClass).attr("title",c)):f.html("<span>"+g+"</span>");f.bind(b.clickControls,function(c){if(!a.flag&&b.enableNavigation)a.flag=true,setTimeout(function(){a.flag=false},100),a.gotoPage(g),b.hashTags&&a.setHash(g);c.preventDefault()})});if(b.navigationSize!==false&&parseInt(b.navigationSize,10)<a.pages)a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+ b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).innerWidth()+Math.ceil(parseInt(d(this).find("span").css("left"),10)/2||0)}).get(),a.navLeft=1,a.$nav.width(a.navWidth(1,a.pages+1)+5),a.$controls.find(".anythingNavWindow").width(a.navWidth(1,b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){if(!a.flag)a.flag=true,setTimeout(function(){a.flag=false},200),a.navWindow(a.navLeft+ b.navigationSize*(d(this).is(".prev")?-1:1));c.preventDefault()})}};a.navWidth=function(b,f){var d;d=Math.min(b,f);for(var g=Math.max(b,f),j=0;d<g;d++)j+=a.navWidths[d-1]||0;return j};a.navWindow=function(c){var d=a.pages-b.navigationSize+1,c=c<=1?1:c>1&&c<d?c:d;if(c!==a.navLeft)a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1,c),width:a.navWidth(c,c+b.navigationSize)},{queue:false,duration:b.animationTime}),a.navLeft=c};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+ b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){if(b.enableArrows&&!a.flag)a.flag=true,setTimeout(function(){a.flag=false},100),a.goBack();c.preventDefault()});a.$forward.bind(b.clickForwardArrow,function(c){if(b.enableArrows&&!a.flag)a.flag=true,setTimeout(function(){a.flag=false},100),a.goForward();c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")}); a.$back.appendTo(b.appendBackTo!==null&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo!==null&&d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(true));c.preventDefault()}).bind("focusin focusout", function(){d(this).toggleClass("hover")})};a.checkResize=function(c){clearTimeout(a.resizeTimer);a.resizeTimer=setTimeout(function(){var d=a.$outer.width()-a.outerPad[0],e=(a.$outer[0].tagName==="BODY"?a.$win.height():a.$outer.height())-a.outerPad[1];if(a.width*b.showMultiple!==d||a.height!==e)a.setDimensions(),a.gotoPage(a.currentPage,a.playing,null,-1);typeof c==="undefined"&&a.checkResize()},500)};a.setDimensions=function(){var c,f,e,g=0,j={width:"100%",height:"100%"},h=b.showMultiple>1?a.width|| a.$window.width()/b.showMultiple:a.$window.width(),i=a.$win.width();if(b.expand)c=a.$outer.width()-a.outerPad[0],a.height=f=a.$outer.height()-a.outerPad[1],a.$wrapper.add(a.$window).add(a.$items).css({width:c,height:f}),a.width=h=b.showMultiple>1?c/b.showMultiple:c;a.$items.each(function(k){e=d(this).children();if(b.resizeContents)c=a.width,f=a.height,d(this).css({width:c,height:f}),e.length&&e[0].tagName==="EMBED"&&e.attr(j),e[0].tagName==="OBJECT"&&e.find("embed").attr(j),e.length===1&&e.css(j); else{c=d(this).width()||a.width;e.length===1&&c>=i&&(c=e.width()>=i?h:e.width(),e.css("max-width",c));d(this).css("width",c);f=e.length===1?e.outerHeight(true):d(this).height();if(f<=a.outerPad)f=a.height;d(this).css("height",f)}a.panelSize[k]=[c,f,g];g+=b.vertical?f:c});a.$el.css(b.vertical?"height":"width",g)};a.getDim=function(c){if(a.pages<1||isNaN(c))return[a.width,a.height];var c=b.infiniteSlides&&a.pages>1?c:c-1,d,e=a.panelSize[c][0],g=a.panelSize[c][1];if(b.showMultiple>1)for(d=1;d<b.showMultiple;d++)e+= a.panelSize[(c+d)%b.showMultiple][0],g=Math.max(g,a.panelSize[c+d][1]);return[e,g]};a.goForward=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?-1:1),c)};a.goBack=function(c){a.gotoPage(a.currentPage+b.changeBy*(b.playRtl?1:-1),c)};a.gotoPage=function(c,f,e,g){f!==true&&(f=false,a.startStop(false),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);b.changeBy!==1&&(c<0&&(c+=a.pages),c>a.pages&&(c-=a.pages));if(!(a.pages<=1)){a.$lastPage=a.$currentPage; if(typeof c!=="number")c=b.startPanel,a.setCurrentPage(c);if(!f||!b.isVideoPlaying(a))c>a.pages+1-a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?1:a.pages),c<a.adj&&(c=!b.infiniteSlides&&!b.stopAtEnd?a.pages:1),a.currentPage=c>a.pages?a.pages:c<1?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.exactPage=c,a.targetPage=c===0?a.pages-a.adj:c>a.pages?1-a.adj:c-a.adj,a.$targetPage=a.$items.eq(a.targetPage),g=g||b.animationTime,g>=0&&a.$el.trigger("slide_init",a),a.slideControls(true,false), f!==true&&(f=false),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(false),g>=0&&a.$el.trigger("slide_begin",a),setTimeout(function(d){b.resizeContents||(d=a.getDim(c),a.$wrapper.filter(":not(:animated)").animate({width:d[0]||a.width,height:d[1]||a.height},{queue:false,duration:g<0?0:g,easing:b.easing}));d={};d[a.dir]=-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2];a.$el.filter(":not(:animated)").animate(d,{queue:false,duration:g,easing:b.easing,complete:function(){a.endAnimation(c,e,g)}})},parseInt(b.delayBeforeAnimate, 10)||0)}};a.endAnimation=function(c,d,e){c===0?(a.$el.css(a.dir,-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css(a.dir,-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,false);a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");a.hovered||a.slideControls(false);e>=0&&a.$el.trigger("slide_complete",a);typeof d==="function"&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(true)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.setCurrentPage=function(c, d){c=parseInt(c,10);if(!(a.pages<1||c===0||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildNavigation&&a.$nav.find(".cur").removeClass("cur").end().find("a").eq(c-1).addClass("cur");!b.infiniteSlides&&b.stopAtEnd&&(a.$wrapper.find("span.forward")[c===a.pages?"addClass":"removeClass"]("disabled").end().find("span.back")[c===1?"addClass":"removeClass"]("disabled"),c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0); a.$el.css(a.dir,-a.panelSize[b.infiniteSlides&&a.pages>1?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage")}};a.makeActive=function(){a.$wrapper.is(".activeSlider")||(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=a.win.location.hash,f=c.indexOf("&"),e=c.match(a.regex);e===null&&!/^#&/.test(c)?(c=c.substring(0,f>=0?f:c.length),e=d(c).closest(".anythingBase")[0]===a.el?d(c).closest(".panel").index(): null):e!==null&&(e=b.hashTags?parseInt(e[1],10):null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=a.win.location.hash;if(typeof e!=="undefined")a.win.location.hash=e.indexOf(d)>0?e.replace(a.regex,d+b):e+"&"+d+b};a.slideControls=function(c){var d=c?0:b.animationTime,e=c?b.animationTime:0,g=c?1:0,h=c?0:1;b.toggleControls&&a.$controls.stop(true,true).delay(d)[c?"slideDown":"slideUp"](b.animationTime/2).delay(e);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(h=1,g=0),a.$forward.stop(true, true).delay(d).animate({right:h*a.$arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(true,true).delay(d).animate({left:h*a.$arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){if(a.timer&&(a.win.clearInterval(a.timer),!b&&a.slideshow))a.$el.trigger("slideshow_stop",a),a.slideshow=false};a.startStop=function(c,d){c!==true&&(c=false);if((a.playing=c)&&!d)a.$el.trigger("slideshow_start",a),a.slideshow=true;b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c? b.stopText:b.startText),parseInt(a.$startStop.find("span").css("text-indent"),10)<0&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText:b.startText));c?(a.clearTimer(true),a.timer=a.win.setInterval(function(){b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(true)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",expand:false,resizeContents:true,vertical:false,showMultiple:false,easing:"swing",buildArrows:true,buildNavigation:true,buildStartStop:true, appendForwardTo:null,appendBackTo:null,appendControlsTo:null,appendNavigationTo:null,appendStartStopTo:null,toggleArrows:false,toggleControls:false,startText:"Start",stopText:"Stop",forwardText:"»",backText:"«",tooltipClass:"tooltip",enableArrows:true,enableNavigation:true,enableStartStop:true,enableKeyboard:true,startPanel:1,changeBy:1,hashTags:true,infiniteSlides:true,navigationFormatter:null,navigationSize:false,autoPlay:false,autoPlayLocked:false,autoPlayDelayed:false,pauseOnHover:true, stopAtEnd:false,playRtl:false,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",resumeOnVideoEnd:true,addWmodeToObject:"opaque",isVideoPlaying:function(){return false}};d.fn.anythingSlider=function(h,i){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof h).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,h):/\d/.test(h)&&!isNaN(h)&&b?(a= typeof h==="number"?h:parseInt(d.trim(h),10),a>=1&&a<=b.pages&&b.gotoPage(a,false,i)):/^[#|.]/.test(h)&&d(h).length&&b.gotoPage(h,false,i)})}})(jQuery);
|
@@ -0,0 +1,367 @@
|
|
1
|
+
/*
|
2
|
+
* AnythingSlider Video Controller 1.0 beta for AnythingSlider v1.6+
|
3
|
+
* By Rob Garrison (aka Mottie & Fudgey)
|
4
|
+
* Dual licensed under the MIT and GPL licenses.
|
5
|
+
*/
|
6
|
+
(function($) {
|
7
|
+
$.fn.anythingSliderVideo = function(options){
|
8
|
+
|
9
|
+
//Set the default values, use comma to separate the settings, example:
|
10
|
+
var defaults = {
|
11
|
+
videoID : 'asvideo' // id prefix
|
12
|
+
};
|
13
|
+
|
14
|
+
return this.each(function(){
|
15
|
+
// make sure a AnythingSlider is attached
|
16
|
+
var video, tmp, service, sel, base = $(this).data('AnythingSlider');
|
17
|
+
if (!base) { return; }
|
18
|
+
video = base.video = {};
|
19
|
+
video.options = $.extend({}, defaults, options);
|
20
|
+
|
21
|
+
// check if SWFObject is loaded
|
22
|
+
video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function') ? true : false;
|
23
|
+
|
24
|
+
video.list = {};
|
25
|
+
video.hasVid = false;
|
26
|
+
video.hasEmbed = false;
|
27
|
+
video.services = $.fn.anythingSliderVideo.services;
|
28
|
+
video.len = 0; // used to add a unique ID to videos "asvideo#"
|
29
|
+
video.hasEmbedCount = 0;
|
30
|
+
video.hasiframeCount = 0;
|
31
|
+
video.$items = base.$items.filter(':not(.cloned)');
|
32
|
+
|
33
|
+
// find and save all known videos
|
34
|
+
for (service in video.services) {
|
35
|
+
if (typeof(service) === 'string') {
|
36
|
+
sel = video.services[service].selector;
|
37
|
+
video.$items.find(sel).each(function(){
|
38
|
+
tmp = $(this);
|
39
|
+
// save panel and video selector in the list
|
40
|
+
tmp.attr('id', video.options.videoID + video.len);
|
41
|
+
video.list[video.len] = {
|
42
|
+
id : video.options.videoID + video.len++,
|
43
|
+
panel : tmp.closest('.panel')[0],
|
44
|
+
service : service,
|
45
|
+
selector : sel,
|
46
|
+
status : -1 // YouTube uses -1 to mean the video is unstarted
|
47
|
+
};
|
48
|
+
video.hasVid = true;
|
49
|
+
if (sel.match('embed|object')) {
|
50
|
+
video.hasEmbed = true;
|
51
|
+
video.hasEmbedCount++;
|
52
|
+
} else if (sel.match('iframe')) {
|
53
|
+
video.hasiframeCount++;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
// Initialize each video, as needed
|
60
|
+
$.each(video.list, function(i,s){
|
61
|
+
// s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector'
|
62
|
+
var tmp, $tar, vidsrc, opts,
|
63
|
+
$vid = $(s.panel).find(s.selector),
|
64
|
+
service = video.services[s.service],
|
65
|
+
api = service.initAPI || '';
|
66
|
+
// Initialize embeded video javascript api using SWFObject, if loaded
|
67
|
+
if (video.hasEmbed && video.hasSwfo && s.selector.match('embed|object')) {
|
68
|
+
$vid.each(function(){
|
69
|
+
// Older IE doesn't have an object - just make sure we are wrapping the correct element
|
70
|
+
$tar = ($(this).parent()[0].tagName === 'OBJECT') ? $(this).parent() : $(this);
|
71
|
+
vidsrc = ($tar[0].tagName === 'EMBED') ? $tar.attr('src') : $tar.find('embed').attr('src') || $tar.children().filter('[name=movie]').attr('value');
|
72
|
+
opts = $.extend(true, {}, {
|
73
|
+
flashvars : null,
|
74
|
+
params : { allowScriptAccess: 'always', wmode : base.options.addWmodeToObject, allowfullscreen : true },
|
75
|
+
attr : { 'class' : $tar.attr('class'), 'style' : $tar.attr('style'), 'data-url' : vidsrc }
|
76
|
+
}, service.embedOpts);
|
77
|
+
$tar.wrap('<div id="' + s.id + '"></div>');
|
78
|
+
// use SWFObject if it exists, it replaces the wrapper with the object/embed
|
79
|
+
swfobject.embedSWF(vidsrc + (api === '' ? '': api + s.id), s.id,
|
80
|
+
$tar.attr('width'), $tar.attr('height'), '10', null,
|
81
|
+
opts.flashvars, opts.params, opts.attr, function(){
|
82
|
+
// run init code if it exists
|
83
|
+
if (service.hasOwnProperty('init')) {
|
84
|
+
video.list[i].player = service.init(base, s.id, i);
|
85
|
+
}
|
86
|
+
if (i >= video.hasEmbedCount) {
|
87
|
+
base.$el.trigger('swf_completed', base); // swf callback
|
88
|
+
}
|
89
|
+
}
|
90
|
+
);
|
91
|
+
});
|
92
|
+
} else if (s.selector.match('iframe')) {
|
93
|
+
$vid.each(function(i,v){
|
94
|
+
vidsrc = $(this).attr('src');
|
95
|
+
tmp = (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + base.options.addWmodeToObject; // string connector & wmode
|
96
|
+
$(this).attr('src', function(i,r){ return r + tmp + (api === '' ? '': api + s.id); });
|
97
|
+
});
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
// Returns URL parameter; url: http://www.somesite.com?name=hello&id=11111
|
102
|
+
// Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
|
103
|
+
video.gup = function(n,s){
|
104
|
+
n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
|
105
|
+
var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href);
|
106
|
+
return (p===null) ? "" : p[1];
|
107
|
+
};
|
108
|
+
|
109
|
+
// postMessage to iframe - http://benalman.com/projects/jquery-postmessage-plugin/ (FOR IE7)
|
110
|
+
video.postMsg = function(data, vid){
|
111
|
+
var $vid = $('#' + vid);
|
112
|
+
if ($vid.length){
|
113
|
+
$vid[0].contentWindow.postMessage(data, $vid.attr('src').split('?')[0]);
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
// receive message from iframe
|
118
|
+
video.message = function(e){
|
119
|
+
if (e.data) {
|
120
|
+
if (/infoDelivery/g.test(e.data)) { return; } // ignore youtube video loading spam
|
121
|
+
var data = $.parseJSON(e.data);
|
122
|
+
$.each(video.list, function(i,s){
|
123
|
+
if (video.services[video.list[i].service].hasOwnProperty('message')) {
|
124
|
+
video.services[video.list[i].service].message(base, data);
|
125
|
+
}
|
126
|
+
});
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
// toDO = 'cont', 'pause' or 'isPlaying'
|
131
|
+
video.control = function(toDo){
|
132
|
+
var i,
|
133
|
+
s = video.list,
|
134
|
+
slide = (toDo === 'pause') ? base.$lastPage[0] : base.$currentPage[0],
|
135
|
+
isPlaying = false;
|
136
|
+
for (i=0; i < video.len; i++){
|
137
|
+
if (s[i].panel === slide && video.services[s[i].service].hasOwnProperty(toDo)){
|
138
|
+
isPlaying = video.services[s[i].service][toDo](base, s[i].id, i);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return isPlaying;
|
142
|
+
};
|
143
|
+
|
144
|
+
// iframe event listener
|
145
|
+
if (video.hasiframeCount){
|
146
|
+
if (window.addEventListener){
|
147
|
+
window.addEventListener('message', video.message, false);
|
148
|
+
} else { // IE
|
149
|
+
window.attachEvent('onmessage', video.message, false);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
// bind to events
|
154
|
+
base.$el
|
155
|
+
.bind('slide_init', function(){
|
156
|
+
video.control('pause');
|
157
|
+
})
|
158
|
+
.bind('slide_complete', function(){
|
159
|
+
video.control('cont');
|
160
|
+
});
|
161
|
+
|
162
|
+
base.options.isVideoPlaying = function(){ return video.control('isPlaying'); };
|
163
|
+
|
164
|
+
});
|
165
|
+
};
|
166
|
+
|
167
|
+
/* Each video service is set up as follows
|
168
|
+
* service-name : {
|
169
|
+
* // initialization
|
170
|
+
* selector : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples)
|
171
|
+
* 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=")
|
172
|
+
* embedOpts : { flashvars: {}, params: {}, attr: {} }, // optional: add any required flashvars, parameters or attributes to initialize the API
|
173
|
+
* // video startup functions
|
174
|
+
* init : function(base, vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject
|
175
|
+
* // required functions
|
176
|
+
* cont : function(base, vid, index){ }, // required: continue play if video was previously played
|
177
|
+
* pause : function(base, vid, index){ }, // required: pause ALL videos
|
178
|
+
* message : function(base, data){ }, // required for iframe: process data received from iframe and update the video status for the "isPlaying" function
|
179
|
+
* isPlaying : function(base, vid, index){ } // required: return true if video is playing and return false if not playing (paused or ended)
|
180
|
+
* }
|
181
|
+
*
|
182
|
+
* Function variables
|
183
|
+
* base (object) = plugin base, all video values/functions are stored in base.video
|
184
|
+
* 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
|
185
|
+
* index (number) is the unique video number from the vid (starts from zero)
|
186
|
+
*
|
187
|
+
* var list = base.video.list[index]; list will contain:
|
188
|
+
* list.id = vid
|
189
|
+
* list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc)
|
190
|
+
* list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc)
|
191
|
+
* list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid)
|
192
|
+
* list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below
|
193
|
+
*/
|
194
|
+
|
195
|
+
$.fn.anythingSliderVideo.services = {
|
196
|
+
|
197
|
+
// *** HTML5 video ***
|
198
|
+
video : {
|
199
|
+
selector : 'video',
|
200
|
+
cont : function(base, vid, index){
|
201
|
+
var $vid = $('#' + vid);
|
202
|
+
if ($vid.length && $vid[0].paused && $vid[0].currentTime > 0 && !$vid[0].ended) {
|
203
|
+
$vid[0].play();
|
204
|
+
}
|
205
|
+
},
|
206
|
+
pause : function(base, vid){
|
207
|
+
// pause ALL videos on the page
|
208
|
+
$('video').each(function(){
|
209
|
+
if (typeof(this.pause) !== 'undefined') { this.pause(); } // throws an error in older ie without this
|
210
|
+
});
|
211
|
+
},
|
212
|
+
isPlaying : function(base, vid, index){
|
213
|
+
var $vid = $('#' + vid);
|
214
|
+
// media.paused seems to be the only way to determine if a video is playing
|
215
|
+
return ($vid.length && typeof($vid[0].pause) !== 'undefined' && !$vid[0].paused && !$vid[0].ended) ? true : false;
|
216
|
+
}
|
217
|
+
},
|
218
|
+
|
219
|
+
// *** Vimeo iframe *** isolated demo: http://jsfiddle.net/Mottie/GxwEX/
|
220
|
+
vimeo1 : {
|
221
|
+
selector : 'iframe[src*=vimeo]',
|
222
|
+
initAPI : '&api=1&player_id=', // video ID added to the end
|
223
|
+
cont : function(base, vid, index){
|
224
|
+
if (base.video.list[index].status === 'pause'){
|
225
|
+
// Commands sent to the iframe originally had "JSON.stringify" applied to them,
|
226
|
+
// but not all browsers support this, so it's just as easy to wrap it in quotes.
|
227
|
+
base.video.postMsg('{"method":"play"}', vid);
|
228
|
+
}
|
229
|
+
},
|
230
|
+
pause : function(base, vid){
|
231
|
+
// pause ALL videos on the page
|
232
|
+
$('iframe[src*=vimeo]').each(function(){
|
233
|
+
base.video.postMsg('{"method":"pause"}', this.id);
|
234
|
+
});
|
235
|
+
},
|
236
|
+
message : function(base, data){
|
237
|
+
// *** VIMEO *** iframe uses data.player_id
|
238
|
+
var index, vid = data.player_id || ''; // vid = data.player_id (unique to vimeo)
|
239
|
+
if (vid !== ''){
|
240
|
+
index = vid.replace(base.video.options.videoID, '');
|
241
|
+
if (data.event === 'ready') {
|
242
|
+
// Vimeo ready, add additional event listeners for video status
|
243
|
+
base.video.postMsg('{"method":"addEventListener","value":"play"}', vid);
|
244
|
+
base.video.postMsg('{"method":"addEventListener","value":"pause"}', vid);
|
245
|
+
base.video.postMsg('{"method":"addEventListener","value":"finish"}', vid);
|
246
|
+
}
|
247
|
+
// update current status - vimeo puts it in data.event
|
248
|
+
if (base.video.list[index]) { base.video.list[index].status = data.event; }
|
249
|
+
}
|
250
|
+
},
|
251
|
+
isPlaying : function(base, vid, index){
|
252
|
+
return (base.video.list[index].status === 'play') ? true : false;
|
253
|
+
}
|
254
|
+
},
|
255
|
+
|
256
|
+
// *** Embeded Vimeo ***
|
257
|
+
// SWFObject adds the url to the object data
|
258
|
+
// using param as a selector, the script above looks for the parent if it sees "param"
|
259
|
+
vimeo2 : {
|
260
|
+
selector : 'object[data-url*=vimeo], embed[src*=vimeo]',
|
261
|
+
embedOpts : { flashvars : { api : 1 } },
|
262
|
+
cont : function(base, vid, index) {
|
263
|
+
var $vid = $('#' + vid);
|
264
|
+
// 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)
|
265
|
+
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) {
|
266
|
+
$vid[0].api_play();
|
267
|
+
}
|
268
|
+
},
|
269
|
+
pause : function(base, vid){
|
270
|
+
// find ALL videos and pause them, just in case
|
271
|
+
$('object[data-url*=vimeo], embed[src*=vimeo]').each(function(){
|
272
|
+
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
|
273
|
+
if (typeof(el.api_pause) === 'function') {
|
274
|
+
el.api_pause();
|
275
|
+
}
|
276
|
+
});
|
277
|
+
},
|
278
|
+
isPlaying : function(base, vid, index){
|
279
|
+
var $vid = $('#' + vid);
|
280
|
+
return (typeof($vid[0].api_paused) === 'function' && !$vid[0].api_paused()) ? true : false;
|
281
|
+
}
|
282
|
+
},
|
283
|
+
|
284
|
+
// *** iframe YouTube *** isolated demo: http://jsfiddle.net/Mottie/qk5MY/
|
285
|
+
youtube1 : {
|
286
|
+
selector : 'iframe[src*=youtube]',
|
287
|
+
// "iv_load_policy=3" should turn off annotations on init, but doesn't seem to
|
288
|
+
initAPI : '&iv_load_policy=3&enablejsapi=1&playerapiid=',
|
289
|
+
cont : function(base, vid, index){
|
290
|
+
if (base.video.list[index].status === 2){
|
291
|
+
base.video.postMsg('{"event":"command","func":"playVideo"}', vid);
|
292
|
+
}
|
293
|
+
},
|
294
|
+
pause : function(base, vid, index){
|
295
|
+
// pause ALL videos on the page - in IE, pausing a video means it will continue when next seen =(
|
296
|
+
$('iframe[src*=youtube]').each(function(){
|
297
|
+
// if (this.id !== vid || (this.id === vid && base.video.list[index].status >= 0)) { // trying to fix the continue video problem; this only breaks it
|
298
|
+
base.video.postMsg('{"event":"command","func":"pauseVideo"}', vid);
|
299
|
+
// }
|
300
|
+
});
|
301
|
+
},
|
302
|
+
message : function(base, data){
|
303
|
+
if (data.event === 'infoDelivery') { return; } // ignore youtube video loading spam
|
304
|
+
// *** YouTube *** iframe returns an embeded url (data.info.videoUrl) but no video id...
|
305
|
+
if (data.info && data.info.videoUrl) {
|
306
|
+
// figure out vid for youtube
|
307
|
+
// data.info.videoURL = http://www.youtube.com/watch?v=###########&feature=player_embedded
|
308
|
+
var url = base.video.gup('v', data.info.videoUrl), // end up with ###########, now find it
|
309
|
+
vid = $('iframe[src*=' + url + ']')[0].id,
|
310
|
+
index = vid.replace(base.video.options.videoID, '');
|
311
|
+
// YouTube ready, add additional event listeners for video status. BUT this never fires off =(
|
312
|
+
// Fixing this may solve the continue problem
|
313
|
+
if (data.event === 'onReady') {
|
314
|
+
base.video.postMsg('{"event":"listening","func":"onStateChange"}', vid); // **** FIX: NEED TO DETERMINE VID ***
|
315
|
+
}
|
316
|
+
// Update status, so the "isPlaying" function can access it
|
317
|
+
if (data.event === 'onStateChange' && base.video.list[index]) {
|
318
|
+
// update list with current status; data.state = YouTube
|
319
|
+
base.video.list[index].status = data.state;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
},
|
323
|
+
isPlaying : function(base, vid, index){
|
324
|
+
var status = base.video.list[index].status;
|
325
|
+
// state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
326
|
+
return (status === 1 || status > 2) ? true : false;
|
327
|
+
}
|
328
|
+
},
|
329
|
+
|
330
|
+
// *** Embeded YouTube ***
|
331
|
+
// include embed for IE; SWFObject adds the url to the object data attribute
|
332
|
+
youtube2 : {
|
333
|
+
selector : 'object[data-url*=youtube], embed[src*=youtube]',
|
334
|
+
initAPI : '&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=', // video ID added to the end
|
335
|
+
// YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
336
|
+
cont : function(base, vid, index) {
|
337
|
+
var $vid = $('#' + vid);
|
338
|
+
// continue video if previously played and not cued
|
339
|
+
if ($vid.length && typeof($vid[0].getPlayerState) === 'function' && $vid[0].getPlayerState() > 0) {
|
340
|
+
$vid[0].playVideo();
|
341
|
+
}
|
342
|
+
},
|
343
|
+
pause : function(base, vid){
|
344
|
+
// find ALL videos and pause them, just in case
|
345
|
+
$('object[data-url*=youtube], embed[src*=youtube]').each(function(){
|
346
|
+
var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
|
347
|
+
// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
|
348
|
+
if (typeof(el.getPlayerState) === 'function' && el.getPlayerState() > 0) {
|
349
|
+
// pause video if not autoplaying (if already initialized)
|
350
|
+
el.pauseVideo();
|
351
|
+
}
|
352
|
+
});
|
353
|
+
},
|
354
|
+
isPlaying : function(base, vid){
|
355
|
+
var $vid = $('#' + vid);
|
356
|
+
return (typeof($vid[0].getPlayerState) === 'function' && ($vid[0].getPlayerState() === 1 || $vid[0].getPlayerState() > 2)) ? true : false;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
};
|
361
|
+
|
362
|
+
})(jQuery);
|
363
|
+
|
364
|
+
// Initialize video extension automatically
|
365
|
+
jQuery(window).load(function(){
|
366
|
+
jQuery('.anythingBase').anythingSliderVideo();
|
367
|
+
});
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* AnythingSlider Video Controller 1.0 beta minified
|
3
|
+
* for AnythingSlider v1.6+
|
4
|
+
* By Rob Garrison (aka Mottie & Fudgey)
|
5
|
+
* Dual licensed under the MIT and GPL licenses.
|
6
|
+
*/
|
7
|
+
|
8
|
+
(function(d){d.fn.anythingSliderVideo=function(b){var c={videoID:"asvideo"};return this.each(function(){var a,e,h,g,f=d(this).data("AnythingSlider");if(f){a=f.video={};a.options=d.extend({},c,b);a.hasSwfo=typeof swfobject!=="undefined"&&swfobject.hasOwnProperty("embedSWF")&&typeof swfobject.embedSWF==="function"?!0:!1;a.list={};a.hasVid=!1;a.hasEmbed=!1;a.services=d.fn.anythingSliderVideo.services;a.len=0;a.hasEmbedCount=0;a.hasiframeCount=0;a.$items=f.$items.filter(":not(.cloned)");for(h in a.services)if(typeof h=== "string")g=a.services[h].selector,a.$items.find(g).each(function(){e=d(this);e.attr("id",a.options.videoID+a.len);a.list[a.len]={id:a.options.videoID+a.len++,panel:e.closest(".panel")[0],service:h,selector:g,status:-1};a.hasVid=!0;g.match("embed|object")?(a.hasEmbed=!0,a.hasEmbedCount++):g.match("iframe")&&a.hasiframeCount++});d.each(a.list,function(b,c){var l,e,i,g,h=d(c.panel).find(c.selector),j=a.services[c.service],k=j.initAPI||"";a.hasEmbed&&a.hasSwfo&&c.selector.match("embed|object")?h.each(function(){e= d(this).parent()[0].tagName==="OBJECT"?d(this).parent():d(this);i=e[0].tagName==="EMBED"?e.attr("src"):e.find("embed").attr("src")||e.children().filter("[name=movie]").attr("value");g=d.extend(!0,{},{flashvars:null,params:{allowScriptAccess:"always",wmode:f.options.addWmodeToObject,allowfullscreen:!0},attr:{"class":e.attr("class"),style:e.attr("style"),"data-url":i}},j.embedOpts);e.wrap('<div id="'+c.id+'"></div>');swfobject.embedSWF(i+(k===""?"":k+c.id),c.id,e.attr("width"),e.attr("height"),"10", null,g.flashvars,g.params,g.attr,function(){if(j.hasOwnProperty("init"))a.list[b].player=j.init(f,c.id,b);b>=a.hasEmbedCount&&f.$el.trigger("swf_completed",f)})}):c.selector.match("iframe")&&h.each(function(){i=d(this).attr("src");l=(i.match(/\?/g)?"":"?")+"&wmode="+f.options.addWmodeToObject;d(this).attr("src",function(a,b){return b+l+(k===""?"":k+c.id)})})});a.gup=function(a,b){var a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),c=RegExp("[\\?&]"+a+"=([^&#]*)").exec(b||window.location.href);return c=== null?"":c[1]};a.postMsg=function(a,b){var c=d("#"+b);c.length&&c[0].contentWindow.postMessage(a,c.attr("src").split("?")[0])};a.message=function(b){if(b.data&&!/infoDelivery/g.test(b.data)){var c=d.parseJSON(b.data);d.each(a.list,function(b){a.services[a.list[b].service].hasOwnProperty("message")&&a.services[a.list[b].service].message(f,c)})}};a.control=function(b){var c,d=a.list,e=b==="pause"?f.$lastPage[0]:f.$currentPage[0],g=!1;for(c=0;c<a.len;c++)d[c].panel===e&&a.services[d[c].service].hasOwnProperty(b)&& (g=a.services[d[c].service][b](f,d[c].id,c));return g};a.hasiframeCount&&(window.addEventListener?window.addEventListener("message",a.message,!1):window.attachEvent("onmessage",a.message,!1));f.$el.bind("slide_init",function(){a.control("pause")}).bind("slide_complete",function(){a.control("cont")});f.options.isVideoPlaying=function(){return a.control("isPlaying")}}})};d.fn.anythingSliderVideo.services={video:{selector:"video",cont:function(b,c){var a=d("#"+c);a.length&&a[0].paused&&a[0].currentTime> 0&&!a[0].ended&&a[0].play()},pause:function(){d("video").each(function(){typeof this.pause!=="undefined"&&this.pause()})},isPlaying:function(b,c){var a=d("#"+c);return a.length&&typeof a[0].pause!=="undefined"&&!a[0].paused&&!a[0].ended?!0:!1}},vimeo1:{selector:"iframe[src*=vimeo]",initAPI:"&api=1&player_id=",cont:function(b,c,a){b.video.list[a].status==="pause"&&b.video.postMsg('{"method":"play"}',c)},pause:function(b){d("iframe[src*=vimeo]").each(function(){b.video.postMsg('{"method":"pause"}', this.id)})},message:function(b,c){var a,d=c.player_id||"";if(d!==""&&(a=d.replace(b.video.options.videoID,""),c.event==="ready"&&(b.video.postMsg('{"method":"addEventListener","value":"play"}',d),b.video.postMsg('{"method":"addEventListener","value":"pause"}',d),b.video.postMsg('{"method":"addEventListener","value":"finish"}',d)),b.video.list[a]))b.video.list[a].status=c.event},isPlaying:function(b,c,a){return b.video.list[a].status==="play"?!0:!1}},vimeo2:{selector:"object[data-url*=vimeo], embed[src*=vimeo]", embedOpts:{flashvars:{api:1}},cont:function(b,c){var a=d("#"+c);typeof a[0].api_play==="function"&&a[0].api_paused()&&a[0].api_getCurrentTime()!==0&&a[0].api_getDuration()-a[0].api_getCurrentTime()>2&&a[0].api_play()},pause:function(){d("object[data-url*=vimeo], embed[src*=vimeo]").each(function(){var b=this.tagName==="EMBED"?d(this).parent()[0]:this;typeof b.api_pause==="function"&&b.api_pause()})},isPlaying:function(b,c){var a=d("#"+c);return typeof a[0].api_paused==="function"&&!a[0].api_paused()? !0:!1}},youtube1:{selector:"iframe[src*=youtube]",initAPI:"&iv_load_policy=3&enablejsapi=1&playerapiid=",cont:function(b,c,a){b.video.list[a].status===2&&b.video.postMsg('{"event":"command","func":"playVideo"}',c)},pause:function(b,c){d("iframe[src*=youtube]").each(function(){b.video.postMsg('{"event":"command","func":"pauseVideo"}',c)})},message:function(b,c){if(c.event!=="infoDelivery"&&c.info&&c.info.videoUrl){var a=b.video.gup("v",c.info.videoUrl),a=d("iframe[src*="+a+"]")[0].id,e=a.replace(b.video.options.videoID, "");c.event==="onReady"&&b.video.postMsg('{"event":"listening","func":"onStateChange"}',a);if(c.event==="onStateChange"&&b.video.list[e])b.video.list[e].status=c.state}},isPlaying:function(b,c,a){b=b.video.list[a].status;return b===1||b>2?!0:!1}},youtube2:{selector:"object[data-url*=youtube], embed[src*=youtube]",initAPI:"&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=",cont:function(b,c){var a=d("#"+c);a.length&&typeof a[0].getPlayerState==="function"&&a[0].getPlayerState()>0&&a[0].playVideo()}, pause:function(){d("object[data-url*=youtube], embed[src*=youtube]").each(function(){var b=this.tagName==="EMBED"?d(this).parent()[0]:this;typeof b.getPlayerState==="function"&&b.getPlayerState()>0&&b.pauseVideo()})},isPlaying:function(b,c){var a=d("#"+c);return typeof a[0].getPlayerState==="function"&&(a[0].getPlayerState()===1||a[0].getPlayerState()>2)?!0:!1}}}})(jQuery);jQuery(window).load(function(){jQuery(".anythingBase").anythingSliderVideo()});
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
|
3
|
+
*
|
4
|
+
* Uses the built In easIng capabilities added In jQuery 1.1
|
5
|
+
* to offer multiple easIng options
|
6
|
+
*
|
7
|
+
* Copyright (c) 2007 George Smith
|
8
|
+
* Licensed under the MIT License:
|
9
|
+
* http://www.opensource.org/licenses/mit-license.php
|
10
|
+
*/
|
11
|
+
|
12
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
13
|
+
|
14
|
+
jQuery.extend( jQuery.easing,
|
15
|
+
{
|
16
|
+
easeInQuad: function (x, t, b, c, d) {
|
17
|
+
return c*(t/=d)*t + b;
|
18
|
+
},
|
19
|
+
easeOutQuad: function (x, t, b, c, d) {
|
20
|
+
return -c *(t/=d)*(t-2) + b;
|
21
|
+
},
|
22
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
23
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
24
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
25
|
+
},
|
26
|
+
easeInCubic: function (x, t, b, c, d) {
|
27
|
+
return c*(t/=d)*t*t + b;
|
28
|
+
},
|
29
|
+
easeOutCubic: function (x, t, b, c, d) {
|
30
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
31
|
+
},
|
32
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
33
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
34
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
35
|
+
},
|
36
|
+
easeInQuart: function (x, t, b, c, d) {
|
37
|
+
return c*(t/=d)*t*t*t + b;
|
38
|
+
},
|
39
|
+
easeOutQuart: function (x, t, b, c, d) {
|
40
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
41
|
+
},
|
42
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
43
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
44
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
45
|
+
},
|
46
|
+
easeInQuint: function (x, t, b, c, d) {
|
47
|
+
return c*(t/=d)*t*t*t*t + b;
|
48
|
+
},
|
49
|
+
easeOutQuint: function (x, t, b, c, d) {
|
50
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
51
|
+
},
|
52
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
53
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
54
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
55
|
+
},
|
56
|
+
easeInSine: function (x, t, b, c, d) {
|
57
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
58
|
+
},
|
59
|
+
easeOutSine: function (x, t, b, c, d) {
|
60
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
61
|
+
},
|
62
|
+
easeInOutSine: function (x, t, b, c, d) {
|
63
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
64
|
+
},
|
65
|
+
easeInExpo: function (x, t, b, c, d) {
|
66
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
67
|
+
},
|
68
|
+
easeOutExpo: function (x, t, b, c, d) {
|
69
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
70
|
+
},
|
71
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
72
|
+
if (t==0) return b;
|
73
|
+
if (t==d) return b+c;
|
74
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
75
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
76
|
+
},
|
77
|
+
easeInCirc: function (x, t, b, c, d) {
|
78
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
79
|
+
},
|
80
|
+
easeOutCirc: function (x, t, b, c, d) {
|
81
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
82
|
+
},
|
83
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
84
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
85
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
86
|
+
},
|
87
|
+
easeInElastic: function (x, t, b, c, d) {
|
88
|
+
var s=1.70158;var p=0;var a=c;
|
89
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
90
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
91
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
92
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
93
|
+
},
|
94
|
+
easeOutElastic: function (x, t, b, c, d) {
|
95
|
+
var s=1.70158;var p=0;var a=c;
|
96
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
97
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
98
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
99
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
100
|
+
},
|
101
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
102
|
+
var s=1.70158;var p=0;var a=c;
|
103
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
104
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
105
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
106
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
107
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
108
|
+
},
|
109
|
+
easeInBack: function (x, t, b, c, d, s) {
|
110
|
+
if (s == undefined) s = 1.70158;
|
111
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
112
|
+
},
|
113
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
114
|
+
if (s == undefined) s = 1.70158;
|
115
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
116
|
+
},
|
117
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
118
|
+
if (s == undefined) s = 1.70158;
|
119
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
120
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
121
|
+
},
|
122
|
+
easeInBounce: function (x, t, b, c, d) {
|
123
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
124
|
+
},
|
125
|
+
easeOutBounce: function (x, t, b, c, d) {
|
126
|
+
if ((t/=d) < (1/2.75)) {
|
127
|
+
return c*(7.5625*t*t) + b;
|
128
|
+
} else if (t < (2/2.75)) {
|
129
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
130
|
+
} else if (t < (2.5/2.75)) {
|
131
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
132
|
+
} else {
|
133
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
134
|
+
}
|
135
|
+
},
|
136
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
137
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
138
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
139
|
+
}
|
140
|
+
});
|