Skip to content
This repository
Browse code

Added missing default.png and minor scripts for optional effects

  • Loading branch information...
commit cf9b5fcfd160929395c44632e6f6082391f283c0 1 parent bb8d116
Lorenzo authored April 05, 2013
4  ajax/libs/anythingslider/1.8.17/anythingslider.css 100644 → 100755
@@ -38,7 +38,7 @@
38 38
 /* Navigation buttons + start/stop button, default state */
39 39
 .anythingSlider-default .anythingControls a {
40 40
 	/* top shadow */
41  
-	background: #777 url(../images/default.png) center -288px repeat-x;
  41
+	background: #777 url(default.png) center -288px repeat-x;
42 42
 	color: #000;
43 43
 	border-radius: 0 0 5px 5px;
44 44
 	-moz-border-radius: 0 0 5px 5px;
@@ -127,7 +127,7 @@
127 127
 	margin: -70px 0 0 0; /* half height of image */
128 128
 	text-align: center;
129 129
 	outline: 0;
130  
-	background: url(../images/default.png) no-repeat;
  130
+	background: url(default.png) no-repeat;
131 131
 }
132 132
 
133 133
 /* back arrow */
BIN  ajax/libs/anythingslider/1.8.17/default.png
188  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.fx.js
... ...
@@ -0,0 +1,188 @@
  1
+/*
  2
+ * AnythingSlider Slide FX 1.6 for AnythingSlider v1.7.11+
  3
+ * By Rob Garrison (aka Mottie & Fudgey)
  4
+ * Dual licensed under the MIT and GPL licenses.
  5
+ */
  6
+(function($) {
  7
+	$.fn.anythingSliderFx = function(effects, options){
  8
+
  9
+		// variable sizes shouldn't matter - it's just to get an idea to get the elements out of view
  10
+		var wrap = $(this).closest('.anythingSlider'),
  11
+		sliderWidth = wrap.width(),
  12
+		sliderHeight = wrap.height(),
  13
+		getBaseFx = function(s){
  14
+			var size = s, size2;
  15
+			// allow for start and end sizes/dimensions
  16
+			if (s && typeof s === 'string' && s.indexOf(',') > 0) {
  17
+				s = s.split(',');
  18
+				size = $.trim(s[0]); size2 = $.trim(s[1]);
  19
+			}
  20
+			return {
  21
+				// 'name' : [{ inFx: {effects}, { outFx: {effects} }, selector: []]
  22
+				'top'    : [{ inFx: { top: 0 }, outFx: { top: '-' + (size || sliderHeight) } }],
  23
+				'bottom' : [{ inFx: { top: 0 }, outFx: { top: (size || sliderHeight) } }],
  24
+				'left'   : [{ inFx: { left: 0 }, outFx: { left: '-' + (size || sliderWidth) } }],
  25
+				'right'  : [{ inFx: { left: 0 }, outFx: { left: (size || sliderWidth) } }],
  26
+				'fade'   : [{ inFx: { opacity: size || 1 }, outFx: { opacity: 0 } }],
  27
+				'expand' : [{ inFx: { width: size2 || '100%', height: size2 || '100%', top: '0%', left: '0%' } , outFx: { width: (size || '10%'), height: (size || '10%'), top: '50%', left: '50%' } }],
  28
+				'grow'   : [{ inFx: { top: 0, fontSize: size || '16px', opacity : 1 }, outFx: { top: '-200px', fontSize: size2 || '80px', opacity: 0 } }],
  29
+				'listLR' : [{ inFx: { left: 0, opacity: 1 }, outFx: [{ left: (size || sliderWidth), opacity: 0 }, { left: '-' + (size || sliderWidth), opacity: 0 }], selector: [':odd', ':even'] }],
  30
+				'listRL' : [{ inFx: { left: 0, opacity: 1 }, outFx: [{ left: (size || sliderWidth), opacity: 0 }, { left: '-' + (size || sliderWidth), opacity: 0 }], selector: [':even', ':odd'] }],
  31
+
  32
+				'caption-Top'    : [{ inFx: { top: 0, opacity: 0.8 }, outFx: { top: ( '-' + size || -50 ), opacity: 0 } }],
  33
+				'caption-Right'  : [{ inFx: { right: 0, opacity: 0.8 }, outFx: { right: ( '-' + size || -150 ), opacity: 0 } }],
  34
+				'caption-Bottom' : [{ inFx: { bottom: 0, opacity: 0.8 }, outFx: { bottom: ( '-' + size || -50 ), opacity: 0 } }],
  35
+				'caption-Left'   : [{ inFx: { left: 0, opacity: 0.8 }, outFx: { left: ( '-' + size || -150 ), opacity: 0 } }]
  36
+			};
  37
+		};
  38
+
  39
+		return this.each(function(){
  40
+
  41
+			$(this).data('AnythingSlider').fx = effects; // store fx list to allow dynamic modification
  42
+
  43
+			var defaults = $.extend({
  44
+				easing     : 'swing', // Default FX easing
  45
+				timeIn     : 400,     // Default time for in FX animation
  46
+				timeOut    : 350,     // Default time for out FX animation - when using predefined FX, this number gets divided by 2
  47
+				stopRepeat : false,   // stops repeating FX animation when clicking on the same navigation tab
  48
+				outFxBind  : 'slide_init',    // When outFx animations are called
  49
+				inFxBind   : 'slide_complete', // When inFx animations are called
  50
+				dataAnimate: 'data-animate' // data attribute containing the animate.css class names to add for in and out fx
  51
+			}, options),
  52
+
  53
+			baseFx = getBaseFx(), // get base FX with standard sizes
  54
+
  55
+			// Animate FX
  56
+			animateFx = function(el, opt, isOut, time){
  57
+				if (el.length === 0 || typeof opt === 'undefined') { return; } // no fx
  58
+				var o = opt[0] || opt,
  59
+					s = o[1] || '',
  60
+					// time needs to be a number, not a string
  61
+					t = time || parseInt( ((s === '') ? o.duration : o[0].duration), 10);
  62
+				if (isOut) {
  63
+					// don't change caption position from absolute
  64
+					if (el.css('position') !== 'absolute') { el.css({ position : 'relative' }); }
  65
+					el.stop();
  66
+					// multiple selectors for out animation
  67
+					if (s !== ''){
  68
+						el.filter(opt[1][0]).animate(o[0], { queue : false, duration : t, easing : o[0].easing });
  69
+						el.filter(opt[1][1]).animate(s, { queue : true, duration : t, easing : o[0].easing });
  70
+						return;
  71
+					}
  72
+				}
  73
+				// animation for no extra selectors
  74
+				el.animate(o, { queue : true, duration : t, easing : o.easing });
  75
+			},
  76
+
  77
+			// Extract FX
  78
+			getFx = function(opts, isOut){
  79
+				// example: '.textSlide h3' : [ 'top fade', '200px' '500', 'easeOutBounce' ],
  80
+				var tmp, bfx2,
  81
+				ex  = (isOut) ? 'outFx' : 'inFx', // object key
  82
+				bfx = {}, // base effects
  83
+				time = (isOut) ? defaults.timeOut : defaults.timeIn, // default duration settings
  84
+				// split & process multiple built-in effects (e.g. 'top fade')
  85
+				fx = $.trim(opts[0].replace(/\s+/g,' ')).split(' ');
  86
+
  87
+				// look for multiple selectors in the Out effects
  88
+				if (isOut && fx.length === 1 && baseFx.hasOwnProperty(fx) && typeof (baseFx[fx][0].selector) !== 'undefined') {
  89
+					bfx2 = baseFx[fx][0].outFx;
  90
+					// add time and easing to first set, the animation will use it for both
  91
+					bfx2[0].duration = opts[2] || defaults.timeOut;
  92
+					bfx2[0].easing = opts[3] || defaults.easing;
  93
+					return [bfx2, baseFx[fx][0].selector || [] ];
  94
+				}
  95
+
  96
+				// combine base effects
  97
+				$.each(fx, function(i,f){
  98
+					// check if built-in effect exists
  99
+					if (baseFx.hasOwnProperty(f)) {
  100
+						var t = typeof opts[1] === 'undefined' || opts[1] === '',
  101
+						// if size option is defined, get new base fx
  102
+						tmp = (t) ? baseFx : getBaseFx(opts[1]);
  103
+						$.extend(true, bfx, tmp[f][0][ex]);
  104
+						t = opts[2] || bfx.duration || time; // user set time || built-in time || default time set above
  105
+						bfx.duration = (isOut) ? t/2 : t; // out animation time is 1/2 of in time for predefined fx only
  106
+						bfx.easing = isNaN(opts[3]) ? opts[3] || defaults.easing : opts[4] || defaults.easing;
  107
+					}
  108
+				});
  109
+				return [bfx];
  110
+			},
  111
+
  112
+			base = $(this)
  113
+
  114
+			// bind events for "OUT" effects - occur when leaving a page
  115
+			.bind(defaults.outFxBind, function(e, slider){
  116
+				if (defaults.stopRepeat && slider.$lastPage[0] === slider.$targetPage[0]) { return; }
  117
+				var el, elOut, time, page = slider.$lastPage.add( slider.$items.eq(slider.exactPage) ).add( slider.$targetPage ),
  118
+				FX = slider.fx; // allow dynamically added FX
  119
+				if (slider.exactPage === 0) { page = page.add( slider.$items.eq( slider.pages ) ); } // add last (non-cloned) page if on first
  120
+				if (slider.options.animationTime < defaults.timeOut) {
  121
+					time = slider.options.animationTime || defaults.timeOut;
  122
+				}
  123
+				page = page.find('*').andSelf(); // include the panel in the selectors
  124
+				for (el in FX) {
  125
+					if (el === 'outFx') {
  126
+						// process "out" custom effects
  127
+						for (elOut in FX.outFx) {
  128
+							// animate current/last slide, unless it's a clone, then effect the original
  129
+							if (page.filter(elOut).length) { animateFx( page.filter(elOut), FX.outFx[elOut], true); }
  130
+						}
  131
+					} else if (el !== 'inFx') {
  132
+						// Use built-in effects
  133
+						if ($.isArray(FX[el]) && page.filter(el).length) {
  134
+							animateFx( page.filter(el), getFx(FX[el],true), true, time);
  135
+						}
  136
+					}
  137
+				}
  138
+				el = page.filter('[' + defaults.dataAnimate + ']');
  139
+				if (el.length) {
  140
+					el.each(function(){
  141
+						FX = $(this).attr(defaults.dataAnimate).split(',');
  142
+						if (FX[0] !== '') {
  143
+							$(this)
  144
+								.removeClass(FX[0])
  145
+								.addClass(FX[1] || FX[0]);
  146
+						}
  147
+					});
  148
+				}
  149
+			})
  150
+
  151
+			// bind events for "IN" effects - occurs on target page
  152
+			.bind(defaults.inFxBind, function(e, slider){
  153
+				if (defaults.stopRepeat && slider.$lastPage[0] === slider.$targetPage[0]) { return; }
  154
+				var el, elIn, page = slider.$currentPage.add( slider.$items.eq(slider.exactPage) ),
  155
+				FX = slider.fx; // allow dynamically added FX
  156
+				page = page.find('*').andSelf(); // include the panel in the selectors
  157
+				for (el in FX) {
  158
+					if (el === 'inFx') {
  159
+						// process "in" custom effects
  160
+						for (elIn in FX.inFx) {
  161
+							// animate current page
  162
+							if (page.filter(elIn).length) { animateFx( page.filter(elIn), FX.inFx[elIn], false); }
  163
+						}
  164
+						// Use built-in effects
  165
+					} else if (el !== 'outFx' && $.isArray(FX[el]) && page.filter(el).length) {
  166
+						animateFx( page.filter(el), getFx(FX[el],false), false);
  167
+					}
  168
+				}
  169
+				el = page.filter('[' + defaults.dataAnimate + ']');
  170
+				if (el.length) {
  171
+					el.each(function(){
  172
+						FX = $(this).attr(defaults.dataAnimate).split(',');
  173
+						if (FX[0] !== '') {
  174
+							$(this)
  175
+								.removeClass(FX[1] || FX[0])
  176
+								.addClass(FX[0]);
  177
+						}
  178
+					});
  179
+				}
  180
+			})
  181
+			.data('AnythingSlider');
  182
+
  183
+			// call gotoPage to trigger intro animation
  184
+			$(window).load(function(){ base.gotoPage(base.currentPage, base.playing); });
  185
+
  186
+		});
  187
+	};
  188
+})(jQuery);
6  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.fx.min.js
... ...
@@ -0,0 +1,6 @@
  1
+/*
  2
+ * AnythingSlider Slide FX 1.6 minified for AnythingSlider v1.7.11+
  3
+ * By Rob Garrison (aka Mottie & Fudgey)
  4
+ * Dual licensed under the MIT and GPL licenses.
  5
+ */
  6
+(function(h){h.fn.anythingSliderFx=function(q,r){var n=h(this).closest(".anythingSlider"),i=n.width(),o=n.height(),p=function(a){var b=a,l;a&&"string"===typeof a&&0<a.indexOf(",")&&(a=a.split(","),b=h.trim(a[0]),l=h.trim(a[1]));return{top:[{inFx:{top:0},outFx:{top:"-"+(b||o)}}],bottom:[{inFx:{top:0},outFx:{top:b||o}}],left:[{inFx:{left:0},outFx:{left:"-"+(b||i)}}],right:[{inFx:{left:0},outFx:{left:b||i}}],fade:[{inFx:{opacity:b||1},outFx:{opacity:0}}],expand:[{inFx:{width:l||"100%",height:l||"100%", top:"0%",left:"0%"},outFx:{width:b||"10%",height:b||"10%",top:"50%",left:"50%"}}],grow:[{inFx:{top:0,fontSize:b||"16px",opacity:1},outFx:{top:"-200px",fontSize:l||"80px",opacity:0}}],listLR:[{inFx:{left:0,opacity:1},outFx:[{left:b||i,opacity:0},{left:"-"+(b||i),opacity:0}],selector:[":odd",":even"]}],listRL:[{inFx:{left:0,opacity:1},outFx:[{left:b||i,opacity:0},{left:"-"+(b||i),opacity:0}],selector:[":even",":odd"]}],"caption-Top":[{inFx:{top:0,opacity:0.8},outFx:{top:"-"+b||-50,opacity:0}}],"caption-Right":[{inFx:{right:0, opacity:0.8},outFx:{right:"-"+b||-150,opacity:0}}],"caption-Bottom":[{inFx:{bottom:0,opacity:0.8},outFx:{bottom:"-"+b||-50,opacity:0}}],"caption-Left":[{inFx:{left:0,opacity:0.8},outFx:{left:"-"+b||-150,opacity:0}}]}};return this.each(function(){h(this).data("AnythingSlider").fx=q;var a=h.extend({easing:"swing",timeIn:400,timeOut:350,stopRepeat:!1,outFxBind:"slide_init",inFxBind:"slide_complete",dataAnimate:"data-animate"},r),b=p(),l=function(a,c,d,b){if(!(0===a.length||"undefined"===typeof c)){var f= c[0]||c,e=f[1]||"",b=b||parseInt(""===e?f.duration:f[0].duration,10);if(d&&("absolute"!==a.css("position")&&a.css({position:"relative"}),a.stop(),""!==e)){a.filter(c[1][0]).animate(f[0],{queue:!1,duration:b,easing:f[0].easing});a.filter(c[1][1]).animate(e,{queue:!0,duration:b,easing:f[0].easing});return}a.animate(f,{queue:!0,duration:b,easing:f.easing})}},i=function(k,c){var d,j=c?"outFx":"inFx",f={},e=c?a.timeOut:a.timeIn,g=h.trim(k[0].replace(/\s+/g," ")).split(" ");if(c&&1===g.length&&b.hasOwnProperty(g)&& "undefined"!==typeof b[g][0].selector)return d=b[g][0].outFx,d[0].duration=k[2]||a.timeOut,d[0].easing=k[3]||a.easing,[d,b[g][0].selector||[]];h.each(g,function(d,g){if(b.hasOwnProperty(g)){var i="undefined"===typeof k[1]||""===k[1],i=i?b:p(k[1]);h.extend(!0,f,i[g][0][j]);i=k[2]||f.duration||e;f.duration=c?i/2:i;f.easing=isNaN(k[3])?k[3]||a.easing:k[4]||a.easing}});return[f]},m=h(this).bind(a.outFxBind,function(b,c){if(!(a.stopRepeat&&c.$lastPage[0]===c.$targetPage[0])){var d,j,f,e=c.$lastPage.add(c.$items.eq(c.exactPage)).add(c.$targetPage), g=c.fx;0===c.exactPage&&(e=e.add(c.$items.eq(c.pages)));c.options.animationTime<a.timeOut&&(f=c.options.animationTime||a.timeOut);e=e.find("*").andSelf();for(d in g)if("outFx"===d)for(j in g.outFx)e.filter(j).length&&l(e.filter(j),g.outFx[j],!0);else"inFx"!==d&&h.isArray(g[d])&&e.filter(d).length&&l(e.filter(d),i(g[d],!0),!0,f);d=e.filter("["+a.dataAnimate+"]");d.length&&d.each(function(){g=h(this).attr(a.dataAnimate).split(",");""!==g[0]&&h(this).removeClass(g[0]).addClass(g[1]||g[0])})}}).bind(a.inFxBind, function(b,c){if(!(a.stopRepeat&&c.$lastPage[0]===c.$targetPage[0])){var d,j,f=c.$currentPage.add(c.$items.eq(c.exactPage)),e=c.fx,f=f.find("*").andSelf();for(d in e)if("inFx"===d)for(j in e.inFx)f.filter(j).length&&l(f.filter(j),e.inFx[j],!1);else"outFx"!==d&&h.isArray(e[d])&&f.filter(d).length&&l(f.filter(d),i(e[d],!1),!1);d=f.filter("["+a.dataAnimate+"]");d.length&&d.each(function(){e=h(this).attr(a.dataAnimate).split(",");""!==e[0]&&h(this).removeClass(e[1]||e[0]).addClass(e[0])})}}).data("AnythingSlider"); h(window).load(function(){m.gotoPage(m.currentPage,m.playing)})})}})(jQuery);
0  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.js 100644 → 100755
File mode changed
0  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.min.js 100644 → 100755
File mode changed
379  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.video.js
... ...
@@ -0,0 +1,379 @@
  1
+/*
  2
+ * AnythingSlider Video Controller 1.3.1 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
+			// Next update, I may just force users to call the video extension instead of it auto-running on window load
  20
+			// then they can change the video options in that call instead of the base defaults, and maybe prevent the
  21
+			// videos being initialized twice on startup (once as a regular video and second time with the API string)
  22
+			video.options = $.extend({}, defaults, options);
  23
+
  24
+			// check if SWFObject is loaded
  25
+			video.hasSwfo = (typeof(swfobject) !== 'undefined' && swfobject.hasOwnProperty('embedSWF') && typeof(swfobject.embedSWF) === 'function' && swfobject.hasFlashPlayerVersion('1'));
  26
+
  27
+			video.list = {};
  28
+			video.hasVid = false;
  29
+			video.hasEmbed = false;
  30
+			video.services = $.fn.anythingSliderVideo.services;
  31
+			video.len = 0; // used to add a unique ID to videos "asvideo#"
  32
+			video.hasEmbedCount = 0;
  33
+			video.hasiframeCount = 0;
  34
+			video.$items = base.$items.filter(':not(.cloned)');
  35
+
  36
+			// find and save all known videos
  37
+			for (service in video.services) {
  38
+				if (typeof(service) === 'string') {
  39
+					sel = video.services[service].selector;
  40
+					video.$items.find(sel).each(function(){
  41
+						tmp = $(this);
  42
+						// save panel and video selector in the list
  43
+						tmp.attr('id', video.options.videoID + video.len);
  44
+						video.list[video.len] = {
  45
+							id       : video.options.videoID + video.len++,
  46
+							panel    : tmp.closest('.panel')[0],
  47
+							service  : service,
  48
+							selector : sel,
  49
+							status   : -1 // YouTube uses -1 to mean the video is unstarted 
  50
+						};
  51
+						video.hasVid = true;
  52
+						if (sel.match('embed|object')) {
  53
+							video.hasEmbed = true;
  54
+							video.hasEmbedCount++;
  55
+						} else if (sel.match('iframe')) {
  56
+							video.hasiframeCount++;
  57
+						}
  58
+					});
  59
+				}
  60
+			}
  61
+
  62
+			// Initialize each video, as needed
  63
+			$.each(video.list, function(i,s){
  64
+				// s.id = ID, s.panel = slider panel (DOM), s.selector = 'jQuery selector'
  65
+				var tmp, $tar, vidsrc, opts,
  66
+					$vid = $(s.panel).find(s.selector),
  67
+					service = video.services[s.service],
  68
+					api = service.initAPI || '';
  69
+				// Initialize embeded video javascript api using SWFObject, if loaded
  70
+				if (video.hasEmbed && video.hasSwfo && s.selector.match('embed|object')) {
  71
+					$vid.each(function(){
  72
+						// Older IE doesn't have an object - just make sure we are wrapping the correct element
  73
+						$tar = ($(this).parent()[0].tagName === 'OBJECT') ? $(this).parent() : $(this);
  74
+						vidsrc = ($tar[0].tagName === 'EMBED') ? $tar.attr('src') : $tar.find('embed').attr('src') || $tar.children().filter('[name=movie]').attr('value');
  75
+						opts = $.extend(true, {}, {
  76
+							flashvars : null,
  77
+							params    : { allowScriptAccess: 'always', wmode : base.options.addWmodeToObject, allowfullscreen : true },
  78
+							attr      : { 'class' : $tar.attr('class'), 'style' : $tar.attr('style'), 'data-url' : vidsrc }
  79
+						}, service.embedOpts);
  80
+						$tar.wrap('<div id="' + s.id + '"></div>');
  81
+						// use SWFObject if it exists, it replaces the wrapper with the object/embed
  82
+						swfobject.embedSWF(vidsrc + (api === '' ? '': api + s.id), s.id,
  83
+							$tar.attr('width'), $tar.attr('height'), '10', null,
  84
+							opts.flashvars, opts.params, opts.attr, function(){
  85
+								// run init code if it exists
  86
+								if (service.hasOwnProperty('init')) {
  87
+									video.list[i].player = service.init(base, s.id, i);
  88
+								}
  89
+								if (i >= video.hasEmbedCount) {
  90
+									base.$el.trigger('swf_completed', base); // swf callback
  91
+								}
  92
+							}
  93
+						);
  94
+					});
  95
+				} else if (s.selector.match('iframe')) {
  96
+					$vid.each(function(i,v){
  97
+						vidsrc = $(this).attr('src');
  98
+						tmp = (vidsrc.match(/\?/g) ? '' : '?') + '&wmode=' + base.options.addWmodeToObject; // string connector & wmode
  99
+						$(this).attr('src', function(i,r){ return r + tmp + (api === '' ? '': api + s.id); });
  100
+					});
  101
+				}
  102
+			});
  103
+
  104
+			// Returns URL parameter; url: http://www.somesite.com?name=hello&id=11111
  105
+			// Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
  106
+			video.gup = function(n,s){
  107
+				n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
  108
+				var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href);
  109
+				return (p===null) ? "" : p[1];
  110
+			};
  111
+
  112
+			// postMessage to iframe - http://benalman.com/projects/jquery-postmessage-plugin/ (FOR IE7)
  113
+			video.postMsg = function(data, vid){
  114
+				var $vid = $('#' + vid);
  115
+				if ($vid.length){
  116
+					$vid[0].contentWindow.postMessage(data, $vid.attr('src').split('?')[0]);
  117
+				}
  118
+			};
  119
+
  120
+			// receive message from iframe
  121
+			// no way to figure out which iframe since the message is from the window
  122
+			video.message = function(e){
  123
+				if (e.data) {
  124
+					if (/infoDelivery/g.test(e.data)) { return; } // ignore youtube video loading spam
  125
+					var data = $.parseJSON(e.data);
  126
+					$.each(video.list, function(i,s){
  127
+						if (video.services[video.list[i].service].hasOwnProperty('message')) {
  128
+							video.services[video.list[i].service].message(base, data);
  129
+						}
  130
+					});
  131
+				}
  132
+			};
  133
+
  134
+			// toDO = 'cont', 'pause' or 'isPlaying'
  135
+			video.control = function(toDo){
  136
+				var i,
  137
+					s = video.list,
  138
+					slide = (toDo === 'pause') ? base.$lastPage[0] : base.$currentPage[0],
  139
+					isPlaying = false;
  140
+				for (i=0; i < video.len; i++){
  141
+					if (s[i].panel === slide && video.services[s[i].service].hasOwnProperty(toDo)){
  142
+						isPlaying = video.services[s[i].service][toDo](base, s[i].id, i);
  143
+					}
  144
+				}
  145
+				return isPlaying;
  146
+			};
  147
+
  148
+			// iframe event listener
  149
+			if (video.hasiframeCount){
  150
+				if (window.addEventListener){
  151
+					window.addEventListener('message', video.message, false);
  152
+				} else { // IE
  153
+					window.attachEvent('onmessage', video.message, false);
  154
+				}
  155
+			}
  156
+
  157
+			// bind to events
  158
+			base.$el
  159
+				.bind('slide_init', function(){
  160
+					video.control('pause');
  161
+				})
  162
+				.bind('slide_complete', function(){
  163
+					video.control('cont');
  164
+				});
  165
+
  166
+			base.options.isVideoPlaying = function(){ return video.control('isPlaying'); };
  167
+
  168
+		});
  169
+	};
  170
+
  171
+/* Each video service is set up as follows
  172
+ * service-name : {
  173
+ *  // initialization
  174
+ *  selector  : 'object[data-url*=service], embed[src*=service]', // required: jQuery selector used to find the video ('video' or 'iframe[src*=service]' are other examples)
  175
+ *  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=")
  176
+ *  embedOpts : { flashvars: {}, params: {}, attr: {} },          // optional: add any required flashvars, parameters or attributes to initialize the API
  177
+ *  // video startup functions
  178
+ *  init      : function(base, vid, index){ }, // optional: include any additional initialization code here; function called AFTER the embeded video is added using SWFObject
  179
+ *  // required functions
  180
+ *  cont      : function(base, vid, index){ }, // required: continue play if video was previously played
  181
+ *  pause     : function(base, vid, index){ }, // required: pause ALL videos
  182
+ *  message   : function(base, data){ },       // required for iframe: process data received from iframe and update the video status for the "isPlaying" function
  183
+ *  isPlaying : function(base, vid, index){ }  // required: return true if video is playing and return false if not playing (paused or ended)
  184
+ * }
  185
+ *
  186
+ * Function variables
  187
+ *  base (object) = plugin base, all video values/functions are stored in base.video
  188
+ *  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
  189
+ *  index (number) is the unique video number from the vid (starts from zero)
  190
+ *
  191
+ *  var list = base.video.list[index]; list will contain:
  192
+ *   list.id = vid
  193
+ *   list.service = service name (e.g. 'video', 'vimeo1', 'vimeo2', etc)
  194
+ *   list.selector = 'jQuery selector' (e.g. 'video', 'object[data-url*=vimeo]', 'iframe[src*=vimeo]', etc)
  195
+ *   list.panel = AnythingSlider panel DOM object. So you can target the video using $(list[index].panel).find(list[index].service) or $('#' + vid)
  196
+ *   list.status = video status, updated by the iframe event listeners added in the video service "ready" function; see examples below
  197
+ */
  198
+
  199
+$.fn.anythingSliderVideo.services = {
  200
+
  201
+	// *** HTML5 video ***
  202
+	video : {
  203
+		selector : 'video',
  204
+		cont : function(base, vid, index){
  205
+			var $vid = $('#' + vid);
  206
+			if ($vid.length && $vid[0].paused && $vid[0].currentTime > 0 && !$vid[0].ended) {
  207
+				$vid[0].play();
  208
+			}
  209
+		},
  210
+		pause : function(base, vid){
  211
+			// pause ALL videos on the page
  212
+			$('video').each(function(){
  213
+				if (typeof(this.pause) !== 'undefined') { this.pause(); } // throws an error in older ie without this
  214
+			});
  215
+		},
  216
+		isPlaying : function(base, vid, index){
  217
+			var $vid = $('#' + vid);
  218
+			// media.paused seems to be the only way to determine if a video is playing
  219
+			return ($vid.length && typeof($vid[0].pause) !== 'undefined' && !$vid[0].paused && !$vid[0].ended) ? true : false;
  220
+		}
  221
+	},
  222
+
  223
+	// *** Vimeo iframe *** isolated demo: http://jsfiddle.net/Mottie/GxwEX/
  224
+	vimeo1 : {
  225
+		selector : 'iframe[src*=vimeo]',
  226
+		initAPI : '&api=1&player_id=', // video ID added to the end
  227
+		cont : function(base, vid, index){
  228
+			if (base.options.resumeOnVisible && base.video.list[index].status === 'pause'){
  229
+				// Commands sent to the iframe originally had "JSON.stringify" applied to them,
  230
+				// but not all browsers support this, so it's just as easy to wrap it in quotes.
  231
+				base.video.postMsg('{"method":"play"}', vid);
  232
+			}
  233
+		},
  234
+		pause : function(base, vid){
  235
+			// pause ALL videos on the page
  236
+			$('iframe[src*=vimeo]').each(function(){
  237
+				base.video.postMsg('{"method":"pause"}', this.id);
  238
+			});
  239
+		},
  240
+		message : function(base, data){
  241
+			// *** VIMEO *** iframe uses data.player_id
  242
+			var index, vid = data.player_id || ''; // vid = data.player_id (unique to vimeo)
  243
+			if (vid !== ''){
  244
+				index = vid.replace(base.video.options.videoID, '');
  245
+				if (data.event === 'ready') {
  246
+					// Vimeo ready, add additional event listeners for video status
  247
+					base.video.postMsg('{"method":"addEventListener","value":"play"}', vid);
  248
+					base.video.postMsg('{"method":"addEventListener","value":"pause"}', vid);
  249
+					base.video.postMsg('{"method":"addEventListener","value":"finish"}', vid);
  250
+				}
  251
+				// update current status - vimeo puts it in data.event
  252
+				if (base.video.list[index]) { base.video.list[index].status = data.event; }
  253
+			}
  254
+		},
  255
+		isPlaying : function(base, vid, index){
  256
+			return (base.video.list[index].status === 'play') ? true : false;
  257
+		}
  258
+	},
  259
+
  260
+	// *** Embeded Vimeo ***
  261
+	// SWFObject adds the url to the object data
  262
+	// using param as a selector, the script above looks for the parent if it sees "param"
  263
+	vimeo2 : {
  264
+		selector : 'object[data-url*=vimeo], embed[src*=vimeo]',
  265
+		embedOpts : { flashvars : { api : 1 } },
  266
+		cont : function(base, vid, index) {
  267
+			if (base.options.resumeOnVisible) {
  268
+				var $vid = $('#' + vid);
  269
+				// 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)
  270
+				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) {
  271
+					$vid[0].api_play();
  272
+				}
  273
+			}
  274
+		},
  275
+		pause : function(base, vid){
  276
+			// find ALL videos and pause them, just in case
  277
+			$('object[data-url*=vimeo], embed[src*=vimeo]').each(function(){
  278
+				var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
  279
+				if (typeof(el.api_pause) === 'function') {
  280
+					el.api_pause();
  281
+				}
  282
+			});
  283
+		},
  284
+		isPlaying : function(base, vid, index){
  285
+			var $vid = $('#' + vid);
  286
+			return (typeof($vid[0].api_paused) === 'function' && !$vid[0].api_paused()) ? true : false;
  287
+		}
  288
+	},
  289
+
  290
+	// *** iframe YouTube *** isolated demo: http://jsfiddle.net/Mottie/qk5MY/
  291
+	youtube1 : {
  292
+		selector : 'iframe[src*=youtube]',
  293
+		// "iv_load_policy=3" should turn off annotations on init, but doesn't seem to
  294
+		initAPI : '&iv_load_policy=3&enablejsapi=1&playerapiid=',
  295
+		cont : function(base, vid, index){
  296
+			if (base.options.resumeOnVisible && base.video.list[index].status === 2){
  297
+				base.video.postMsg('{"event":"command","func":"playVideo"}', vid);
  298
+			}
  299
+		},
  300
+		pause : function(base, vid, index){
  301
+			// pause ALL videos on the page - in IE, pausing a video means it will continue when next seen =(
  302
+			$('iframe[src*=youtube]').each(function(){
  303
+//			if (this.id !== vid || (this.id === vid && base.video.list[index].status >= 0)) { // trying to fix the continue video problem; this only breaks it
  304
+				base.video.postMsg('{"event":"command","func":"pauseVideo"}', vid);
  305
+//			}
  306
+			});
  307
+		},
  308
+		message : function(base, data){
  309
+			if (data.event === 'infoDelivery') { return; } // ignore youtube video loading spam
  310
+			// *** YouTube *** iframe returns an embeded url (data.info.videoUrl) but no video id...
  311
+			if (data.info && data.info.videoUrl) {
  312
+				// figure out vid for youtube
  313
+				// data.info.videoURL = http://www.youtube.com/watch?v=###########&feature=player_embedded
  314
+				var url = base.video.gup('v', data.info.videoUrl), // end up with ###########, now find it
  315
+					v = $('iframe[src*=' + url + ']'), vid, index;
  316
+					// iframe src changes when watching related videos; so there is no way to tell which video has an update
  317
+					if (v.length) {
  318
+						vid = v[0].id;
  319
+						index = vid.replace(base.video.options.videoID, '');
  320
+					// YouTube ready, add additional event listeners for video status. BUT this never fires off =(
  321
+					// Fixing this may solve the continue problem
  322
+					if (data.event === 'onReady') {
  323
+						base.video.postMsg('{"event":"listening","func":"onStateChange"}', vid);
  324
+					}
  325
+					// Update status, so the "isPlaying" function can access it
  326
+					if (data.event === 'onStateChange' && base.video.list[index]) {
  327
+						// update list with current status; data.info.playerState = YouTube
  328
+						base.video.list[index].status = data.info.playerState;
  329
+					}
  330
+				}
  331
+			}
  332
+		},
  333
+		isPlaying : function(base, vid, index){
  334
+			var status = base.video.list[index].status;
  335
+			// state: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
  336
+			return (status === 1 || status > 2) ? true : false;
  337
+		}
  338
+	},
  339
+
  340
+	// *** Embeded YouTube ***
  341
+	// include embed for IE; SWFObject adds the url to the object data attribute
  342
+	youtube2 : {
  343
+		selector : 'object[data-url*=youtube], embed[src*=youtube]',
  344
+		initAPI : '&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=', // video ID added to the end
  345
+		// YouTube - player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
  346
+		cont : function(base, vid, index) {
  347
+			if (base.options.resumeOnVisible) {
  348
+				var $vid = $('#' + vid);
  349
+				// continue video if previously played and not cued
  350
+				if ($vid.length && typeof($vid[0].getPlayerState) === 'function' && $vid[0].getPlayerState() > 0) {
  351
+					$vid[0].playVideo();
  352
+				}
  353
+			}
  354
+		},
  355
+		pause : function(base, vid){
  356
+			// find ALL videos and pause them, just in case
  357
+			$('object[data-url*=youtube], embed[src*=youtube]').each(function(){
  358
+				var el = (this.tagName === 'EMBED') ? $(this).parent()[0] : this;
  359
+				// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
  360
+				if (typeof(el.getPlayerState) === 'function' && el.getPlayerState() > 0) {
  361
+					// pause video if not autoplaying (if already initialized)
  362
+					el.pauseVideo();
  363
+				}
  364
+			});
  365
+		},
  366
+		isPlaying : function(base, vid){
  367
+			var $vid = $('#' + vid);
  368
+			return (typeof($vid[0].getPlayerState) === 'function' && ($vid[0].getPlayerState() === 1 || $vid[0].getPlayerState() > 2)) ? true : false;
  369
+		}
  370
+	}
  371
+
  372
+};
  373
+
  374
+})(jQuery);
  375
+
  376
+// Initialize video extension automatically
  377
+jQuery(window).load(function(){
  378
+ jQuery('.anythingBase').anythingSliderVideo();
  379
+});
8  ajax/libs/anythingslider/1.8.17/jquery.anythingslider.video.min.js
... ...
@@ -0,0 +1,8 @@
  1
+/*
  2
+ * AnythingSlider Video Controller 1.3.1 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(a){a.fn.anythingSliderVideo=function(b){var c={videoID:"asvideo"};return this.each(function(){var f,e,d,h,g=a(this).data("AnythingSlider");if(!g){return}f=g.video={};f.options=a.extend({},c,b);f.hasSwfo=(typeof(swfobject)!=="undefined"&&swfobject.hasOwnProperty("embedSWF")&&typeof(swfobject.embedSWF)==="function"&&swfobject.hasFlashPlayerVersion("1"));f.list={};f.hasVid=false;f.hasEmbed=false;f.services=a.fn.anythingSliderVideo.services;f.len=0;f.hasEmbedCount=0;f.hasiframeCount=0;f.$items=g.$items.filter(":not(.cloned)");for(d in f.services){if(typeof(d)==="string"){h=f.services[d].selector;f.$items.find(h).each(function(){e=a(this);e.attr("id",f.options.videoID+f.len);f.list[f.len]={id:f.options.videoID+f.len++,panel:e.closest(".panel")[0],service:d,selector:h,status:-1};f.hasVid=true;if(h.match("embed|object")){f.hasEmbed=true;f.hasEmbedCount++}else{if(h.match("iframe")){f.hasiframeCount++}}})}}a.each(f.list,function(m,q){var n,k,r,j,l=a(q.panel).find(q.selector),p=f.services[q.service],o=p.initAPI||"";if(f.hasEmbed&&f.hasSwfo&&q.selector.match("embed|object")){l.each(function(){k=(a(this).parent()[0].tagName==="OBJECT")?a(this).parent():a(this);r=(k[0].tagName==="EMBED")?k.attr("src"):k.find("embed").attr("src")||k.children().filter("[name=movie]").attr("value");j=a.extend(true,{},{flashvars:null,params:{allowScriptAccess:"always",wmode:g.options.addWmodeToObject,allowfullscreen:true},attr:{"class":k.attr("class"),style:k.attr("style"),"data-url":r}},p.embedOpts);k.wrap('<div id="'+q.id+'"></div>');swfobject.embedSWF(r+(o===""?"":o+q.id),q.id,k.attr("width"),k.attr("height"),"10",null,j.flashvars,j.params,j.attr,function(){if(p.hasOwnProperty("init")){f.list[m].player=p.init(g,q.id,m)}if(m>=f.hasEmbedCount){g.$el.trigger("swf_completed",g)}})})}else{if(q.selector.match("iframe")){l.each(function(t,s){r=a(this).attr("src");n=(r.match(/\?/g)?"":"?")+"&wmode="+g.options.addWmodeToObject;a(this).attr("src",function(u,v){return v+n+(o===""?"":o+q.id)})})}}});f.gup=function(k,i){k=k.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var j=(new RegExp("[\\?&]"+k+"=([^&#]*)")).exec(i||window.location.href);return(j===null)?"":j[1]};f.postMsg=function(k,i){var j=a("#"+i);if(j.length){j[0].contentWindow.postMessage(k,j.attr("src").split("?")[0])}};f.message=function(j){if(j.data){if(/infoDelivery/g.test(j.data)){return}var i=a.parseJSON(j.data);a.each(f.list,function(k,l){if(f.services[f.list[k].service].hasOwnProperty("message")){f.services[f.list[k].service].message(g,i)}})}};f.control=function(k){var l,m=f.list,j=(k==="pause")?g.$lastPage[0]:g.$currentPage[0],n=false;for(l=0;l<f.len;l++){if(m[l].panel===j&&f.services[m[l].service].hasOwnProperty(k)){n=f.services[m[l].service][k](g,m[l].id,l)}}return n};if(f.hasiframeCount){if(window.addEventListener){window.addEventListener("message",f.message,false)}else{window.attachEvent("onmessage",f.message,false)}}g.$el.bind("slide_init",function(){f.control("pause")}).bind("slide_complete",function(){f.control("cont")});g.options.isVideoPlaying=function(){return f.control("isPlaying")}})};a.fn.anythingSliderVideo.services={video:{selector:"video",cont:function(e,b,d){var c=a("#"+b);if(c.length&&c[0].paused&&c[0].currentTime>0&&!c[0].ended){c[0].play()}},pause:function(c,b){a("video").each(function(){if(typeof(this.pause)!=="undefined"){this.pause()}})},isPlaying:function(e,b,d){var c=a("#"+b);return(c.length&&typeof(c[0].pause)!=="undefined"&&!c[0].paused&&!c[0].ended)?true:false}},vimeo1:{selector:"iframe[src*=vimeo]",initAPI:"&api=1&player_id=",cont:function(d,b,c){if(d.options.resumeOnVisible&&d.video.list[c].status==="pause"){d.video.postMsg('{"method":"play"}',b)}},pause:function(c,b){a("iframe[src*=vimeo]").each(function(){c.video.postMsg('{"method":"pause"}',this.id)})},message:function(e,d){var c,b=d.player_id||"";if(b!==""){c=b.replace(e.video.options.videoID,"");if(d.event==="ready"){e.video.postMsg('{"method":"addEventListener","value":"play"}',b);e.video.postMsg('{"method":"addEventListener","value":"pause"}',b);e.video.postMsg('{"method":"addEventListener","value":"finish"}',b)}if(e.video.list[c]){e.video.list[c].status=d.event}}},isPlaying:function(d,b,c){return(d.video.list[c].status==="play")?true:false}},vimeo2:{selector:"object[data-url*=vimeo], embed[src*=vimeo]",embedOpts:{flashvars:{api:1}},cont:function(e,b,d){if(e.options.resumeOnVisible){var c=a("#"+b);if(typeof(c[0].api_play)==="function"&&c[0].api_paused()&&c[0].api_getCurrentTime()!==0&&(c[0].api_getDuration()-c[0].api_getCurrentTime())>2){c[0].api_play()}}},pause:function(c,b){a("object[data-url*=vimeo], embed[src*=vimeo]").each(function(){var d=(this.tagName==="EMBED")?a(this).parent()[0]:this;if(typeof(d.api_pause)==="function"){d.api_pause()}})},isPlaying:function(e,b,d){var c=a("#"+b);return(typeof(c[0].api_paused)==="function"&&!c[0].api_paused())?true:false}},youtube1:{selector:"iframe[src*=youtube]",initAPI:"&iv_load_policy=3&enablejsapi=1&playerapiid=",cont:function(d,b,c){if(d.options.resumeOnVisible&&d.video.list[c].status===2){d.video.postMsg('{"event":"command","func":"playVideo"}',b)}},pause:function(d,b,c){a("iframe[src*=youtube]").each(function(){d.video.postMsg('{"event":"command","func":"pauseVideo"}',b)})},message:function(g,f){if(f.event==="infoDelivery"){return}if(f.info&&f.info.videoUrl){var e=g.video.gup("v",f.info.videoUrl),c=a("iframe[src*="+e+"]"),b,d;if(c.length){b=c[0].id;d=b.replace(g.video.options.videoID,"");if(f.event==="onReady"){g.video.postMsg('{"event":"listening","func":"onStateChange"}',b)}if(f.event==="onStateChange"&&g.video.list[d]){g.video.list[d].status=f.info.playerState}}}},isPlaying:function(e,b,d){var c=e.video.list[d].status;return(c===1||c>2)?true:false}},youtube2:{selector:"object[data-url*=youtube], embed[src*=youtube]",initAPI:"&iv_load_policy=3&enablejsapi=1&version=3&playerapiid=",cont:function(e,b,d){if(e.options.resumeOnVisible){var c=a("#"+b);if(c.length&&typeof(c[0].getPlayerState)==="function"&&c[0].getPlayerState()>0){c[0].playVideo()}}},pause:function(c,b){a("object[data-url*=youtube], embed[src*=youtube]").each(function(){var d=(this.tagName==="EMBED")?a(this).parent()[0]:this;if(typeof(d.getPlayerState)==="function"&&d.getPlayerState()>0){d.pauseVideo()}})},isPlaying:function(d,b){var c=a("#"+b);return(typeof(c[0].getPlayerState)==="function"&&(c[0].getPlayerState()===1||c[0].getPlayerState()>2))?true:false}}}})(jQuery);jQuery(window).load(function(){jQuery(".anythingBase").anythingSliderVideo()});
4  ajax/libs/anythingslider/package.json 100644 → 100755
@@ -11,8 +11,8 @@
11 11
    ],
12 12
    "maintainers": [
13 13
        {
14  
-           "name": "Lorenzo Raffio",
15  
-           "url": "http://lorenzoraffio.com"
  14
+           "name": "Rob Garrison",
  15
+           "url": "https://github.com/Mottie"
16 16
        }
17 17
    ],
18 18
    "repositories": [

0 notes on commit cf9b5fc

Please sign in to comment.
Something went wrong with that request. Please try again.