first import
This commit is contained in:
7
sites/all/libraries/wmu-slider/LICENSE
Normal file
7
sites/all/libraries/wmu-slider/LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2011 Brice Lechatellier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
sites/all/libraries/wmu-slider/README
Normal file
19
sites/all/libraries/wmu-slider/README
Normal file
@@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* jQuery wmuSlider v2.1
|
||||
*
|
||||
* Copyright (c) 2011 Brice Lechatellier
|
||||
* http://brice.lechatellier.com/
|
||||
*
|
||||
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
Changelog:
|
||||
v1.0 2011-09-05
|
||||
- Release
|
||||
v2.0 2011-10-26
|
||||
- Code refactoring
|
||||
- Gallery
|
||||
- Lighter modernizr
|
||||
v2.1 2011-10-29
|
||||
- Bug fixes
|
||||
- Demo
|
9
sites/all/libraries/wmu-slider/jquery.wmu-slider.min.js
vendored
Normal file
9
sites/all/libraries/wmu-slider/jquery.wmu-slider.min.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* jQuery wmuSlider v2.1
|
||||
*
|
||||
* Copyright (c) 2011 Brice Lechatellier
|
||||
* http://brice.lechatellier.com/
|
||||
*
|
||||
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function(a){a.fn.wmuSlider=function(b){var c={animation:"fade",animationDuration:600,slideshow:true,slideshowSpeed:7000,slideToStart:0,navigationControl:true,paginationControl:true,previousText:"Previous",nextText:"Next",touch:false,slide:"article",items:1};var b=a.extend(c,b);return this.each(function(){var p=a(this);var o=b.slideToStart;var f=p.find(".wmuSliderWrapper");var g=p.find(b.slide);var d=g.length;var k;var l;var e;var j=function(t,u,v){if(e){return false}e=true;o=t;var s=a(g[t]);p.animate({height:s.innerHeight()});if(b.animation=="fade"){g.css({position:"absolute",opacity:0});s.css("position","relative");s.animate({opacity:1},b.animationDuration,function(){e=false})}else{if(b.animation=="slide"){if(!u){f.animate({marginLeft:-p.width()/b.items*t},b.animationDuration,function(){e=false})}else{if(t==0){f.animate({marginLeft:-p.width()/b.items*d},b.animationDuration,function(){f.css("marginLeft",0);e=false})}else{if(!v){f.css("marginLeft",-p.width()/b.items*d)}f.animate({marginLeft:-p.width()/b.items*t},b.animationDuration,function(){e=false})}}}}if(l){l.find("a").each(function(w){if(w==t){a(this).addClass("wmuActive")}else{a(this).removeClass("wmuActive")}})}p.trigger("slideLoaded",t)};if(b.navigationControl){var i=a('<a class="wmuSliderPrev">'+b.previousText+"</a>");i.click(function(s){s.preventDefault();clearTimeout(k);if(o==0){j(d-1,true)}else{j(o-1)}});p.append(i);var m=a('<a class="wmuSliderNext">'+b.nextText+"</a>");m.click(function(s){s.preventDefault();clearTimeout(k);if(o+1==d){j(0,true)}else{j(o+1)}});p.append(m)}if(b.paginationControl){l=a('<ul class="wmuSliderPagination"></ul>');a.each(g,function(s){l.append('<li><a href="#">'+s+"</a></li>");l.find("a:eq("+s+")").click(function(t){t.preventDefault();clearTimeout(k);j(s)})});p.append(l)}if(b.slideshow){var r=function(){if(o+1<d){j(o+1)}else{j(0,true)}k=setTimeout(r,b.slideshowSpeed)};k=setTimeout(r,b.slideshowSpeed)}var h=function(){var s=a(g[o]);p.animate({height:s.innerHeight()});if(b.animation=="slide"){g.css({width:p.width()/b.items});f.css({marginLeft:-p.width()/b.items*o,width:p.width()*g.length})}};var n=function(t,s,u,v){clearTimeout(k);if(s=="move"&&(u=="left"||u=="right")){if(u=="right"){if(o==0){f.css("marginLeft",(-d*p.width()/b.items)+v)}else{f.css("marginLeft",(-o*p.width()/b.items)+v)}}else{if(u=="left"){f.css("marginLeft",(-o*p.width()/b.items)-v)}}}else{if(s=="cancel"){if(u=="right"&&o==0){f.animate({marginLeft:-d*p.width()/b.items},b.animationDuration)}else{f.animate({marginLeft:-o*p.width()/b.items},b.animationDuration)}}else{if(s=="end"){if(u=="right"){if(o==0){j(d-1,true,true)}else{j(o-1)}}else{if(u=="left"){if(o+1==d){j(0,true)}else{j(o+1)}}else{f.animate({marginLeft:-o*p.width()/b.items},b.animationDuration)}}}}}};if(b.touch&&b.animation=="slide"){if(!a.isFunction(a.fn.swipe)){a.ajax({url:"jquery.touchSwipe.min.js",async:false})}if(a.isFunction(a.fn.swipe)){p.swipe({triggerOnTouchEnd:false,swipeStatus:n,allowPageScroll:"vertical"})}}var q=function(){var s=a(g[o]);var t=s.find("img");t.load(function(){f.show();p.animate({height:s.innerHeight()})});if(b.animation=="fade"){g.css({position:"absolute",width:"100%",opacity:0});a(g[o]).css("position","relative")}else{if(b.animation=="slide"){if(b.items>d){b.items=d}g.css("float","left");g.each(function(w){var v=a(this);v.attr("data-index",w)});for(var u=0;u<b.items;u++){f.append(a(g[u]).clone())}g=p.find(b.slide)}}h();p.trigger("hasLoaded");j(o)};q();a(window).resize(h);p.bind("loadSlide",function(t,s){clearTimeout(k);j(s)})})}})(jQuery);
|
96
sites/all/libraries/wmu-slider/jquery.wmuGallery.js
Normal file
96
sites/all/libraries/wmu-slider/jquery.wmuGallery.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/*!
|
||||
* jQuery wmuGallery v2.1
|
||||
*
|
||||
* Copyright (c) 2011 Brice Lechatellier
|
||||
* http://brice.lechatellier.com/
|
||||
*
|
||||
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
$.fn.wmuGallery = function(options) {
|
||||
|
||||
/* Default Options
|
||||
================================================== */
|
||||
var defaults = {
|
||||
position: 'before',
|
||||
animationDuration: 600,
|
||||
touch: false,
|
||||
slide: 'article',
|
||||
items: 5
|
||||
};
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
/* Variables
|
||||
================================================== */
|
||||
var $this = $(this);
|
||||
var slides = $this.find(options.slide);
|
||||
var gallery;
|
||||
var image;
|
||||
var slider;
|
||||
|
||||
/* Slider
|
||||
================================================== */
|
||||
var loadImage = function(i) {
|
||||
var imageURI = $(slides[i]).find('img').attr('data-src-full');
|
||||
if (!image) {
|
||||
image = $('<img src="' + imageURI + '" />');
|
||||
gallery.append(image);
|
||||
} else {
|
||||
image.attr('src', imageURI);
|
||||
}
|
||||
};
|
||||
|
||||
/* Init
|
||||
================================================== */
|
||||
var init = function() {
|
||||
gallery = $('<div class="wmuGalleryImage"></div>');
|
||||
if (options.position == 'before') {
|
||||
$this.prepend(gallery);
|
||||
} else if (options.position == 'after') {
|
||||
$this.append(gallery);
|
||||
}
|
||||
|
||||
if (!$.isFunction($.fn.wmuSlider)) {
|
||||
$.ajax({
|
||||
url: 'jquery.wmuSlider.min.js',
|
||||
async: false
|
||||
});
|
||||
}
|
||||
if ($.isFunction($.fn.wmuSlider)) {
|
||||
slider = $this.find('.wmuSlider');
|
||||
slider.bind('hasLoaded', function(e) {
|
||||
var prev = slider.find('.wmuSliderPrev');
|
||||
var next = slider.find('.wmuSliderNext');
|
||||
var pagination = slider.find('.wmuSliderPagination');
|
||||
gallery.append(prev);
|
||||
gallery.append(next);
|
||||
gallery.append(pagination);
|
||||
slides = $this.find(options.slide);
|
||||
slides.each(function(i) {
|
||||
var slide = $(this);
|
||||
slide.click(function(e) {
|
||||
e.preventDefault();
|
||||
slider.trigger('loadSlide', parseInt(slide.attr('data-index')));
|
||||
});
|
||||
});
|
||||
}).bind('slideLoaded', function(e, i) {
|
||||
loadImage(i);
|
||||
}).wmuSlider({
|
||||
touch: options.touch,
|
||||
animation: 'slide',
|
||||
animationDuration: options.animationDuration,
|
||||
slide: options.slide,
|
||||
items: options.items
|
||||
});
|
||||
}
|
||||
};
|
||||
init();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
9
sites/all/libraries/wmu-slider/jquery.wmuGallery.min.js
vendored
Normal file
9
sites/all/libraries/wmu-slider/jquery.wmuGallery.min.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* jQuery wmuGallery v2.1
|
||||
*
|
||||
* Copyright (c) 2011 Brice Lechatellier
|
||||
* http://brice.lechatellier.com/
|
||||
*
|
||||
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function(a){a.fn.wmuGallery=function(b){var c={position:"before",animationDuration:600,touch:false,slide:"article",items:5};var b=a.extend(c,b);return this.each(function(){var i=a(this);var e=i.find(b.slide);var d;var h;var f;var g=function(k){var l=a(e[k]).find("img").attr("data-src-full");if(!h){h=a('<img src="'+l+'" />');d.append(h)}else{h.attr("src",l)}};var j=function(){d=a('<div class="wmuGalleryImage"></div>');if(b.position=="before"){i.prepend(d)}else{if(b.position=="after"){i.append(d)}}if(!a.isFunction(a.fn.wmuSlider)){a.ajax({url:"jquery.wmuSlider.min.js",async:false})}if(a.isFunction(a.fn.wmuSlider)){f=i.find(".wmuSlider");f.bind("hasLoaded",function(n){var m=f.find(".wmuSliderPrev");var l=f.find(".wmuSliderNext");var k=f.find(".wmuSliderPagination");d.append(m);d.append(l);d.append(k);e=i.find(b.slide);e.each(function(p){var o=a(this);o.click(function(q){q.preventDefault();f.trigger("loadSlide",parseInt(o.attr("data-index")))})})}).bind("slideLoaded",function(l,k){g(k)}).wmuSlider({touch:b.touch,animation:"slide",animationDuration:b.animationDuration,slide:b.slide,items:b.items})}};j()})}})(jQuery);
|
285
sites/all/libraries/wmu-slider/jquery.wmuslider.js
Normal file
285
sites/all/libraries/wmu-slider/jquery.wmuslider.js
Normal file
@@ -0,0 +1,285 @@
|
||||
/*!
|
||||
* jQuery wmuSlider v2.1
|
||||
*
|
||||
* Copyright (c) 2011 Brice Lechatellier
|
||||
* http://brice.lechatellier.com/
|
||||
*
|
||||
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
$.fn.wmuSlider = function(options) {
|
||||
|
||||
/* Default Options
|
||||
================================================== */
|
||||
var defaults = {
|
||||
animation: 'fade',
|
||||
animationDuration: 600,
|
||||
slideshow: true,
|
||||
slideshowSpeed: 7000,
|
||||
slideToStart: 0,
|
||||
navigationControl: true,
|
||||
paginationControl: true,
|
||||
previousText: 'Previous',
|
||||
nextText: 'Next',
|
||||
touch: false,
|
||||
slide: 'article',
|
||||
items: 1
|
||||
};
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
/* Variables
|
||||
================================================== */
|
||||
var $this = $(this);
|
||||
var currentIndex = options.slideToStart;
|
||||
var wrapper = $this.find('.wmuSliderWrapper');
|
||||
var slides = $this.find(options.slide);
|
||||
var slidesCount = slides.length;
|
||||
var slideshowTimeout;
|
||||
var paginationControl;
|
||||
var isAnimating;
|
||||
|
||||
|
||||
/* Load Slide
|
||||
================================================== */
|
||||
var loadSlide = function(index, infinite, touch) {
|
||||
if (isAnimating) {
|
||||
return false;
|
||||
}
|
||||
isAnimating = true;
|
||||
currentIndex = index;
|
||||
var slide = $(slides[index]);
|
||||
$this.animate({ height: slide.innerHeight() });
|
||||
if (options.animation == 'fade') {
|
||||
slides.css({
|
||||
position: 'absolute',
|
||||
opacity: 0
|
||||
});
|
||||
|
||||
slide.css({'position' : 'relative', 'z-index' : '2'});
|
||||
slide.siblings(options.slide).css('z-index' , '1');
|
||||
slide.animate({ opacity:1 }, options.animationDuration, function() {
|
||||
isAnimating = false;
|
||||
});
|
||||
} else if (options.animation == 'slide') {
|
||||
if (!infinite) {
|
||||
wrapper.animate({ marginLeft: -$this.width() / options.items * index }, options.animationDuration, function() {
|
||||
isAnimating = false;
|
||||
});
|
||||
} else {
|
||||
if (index == 0) {
|
||||
wrapper.animate({ marginLeft: -$this.width() / options.items * slidesCount }, options.animationDuration, function() {
|
||||
wrapper.css('marginLeft', 0);
|
||||
isAnimating = false;
|
||||
});
|
||||
} else {
|
||||
if (!touch) {
|
||||
wrapper.css('marginLeft', -$this.width() / options.items * slidesCount);
|
||||
}
|
||||
wrapper.animate({ marginLeft: -$this.width() / options.items * index }, options.animationDuration, function() {
|
||||
isAnimating = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (paginationControl) {
|
||||
paginationControl.find('a').each(function(i) {
|
||||
if(i == index) {
|
||||
$(this).addClass('wmuActive');
|
||||
} else {
|
||||
$(this).removeClass('wmuActive');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Trigger Event
|
||||
$this.trigger('slideLoaded', index);
|
||||
};
|
||||
|
||||
|
||||
/* Navigation Control
|
||||
================================================== */
|
||||
if (options.navigationControl) {
|
||||
var prev = $('<a class="wmuSliderPrev">' + options.previousText + '</a>');
|
||||
prev.click(function(e) {
|
||||
e.preventDefault();
|
||||
clearTimeout(slideshowTimeout);
|
||||
if (currentIndex == 0) {
|
||||
loadSlide(slidesCount - 1, true);
|
||||
} else {
|
||||
loadSlide(currentIndex - 1);
|
||||
}
|
||||
});
|
||||
$this.append(prev);
|
||||
|
||||
var next = $('<a class="wmuSliderNext">' + options.nextText + '</a>');
|
||||
next.click(function(e) {
|
||||
e.preventDefault();
|
||||
clearTimeout(slideshowTimeout);
|
||||
if (currentIndex + 1 == slidesCount) {
|
||||
loadSlide(0, true);
|
||||
} else {
|
||||
loadSlide(currentIndex + 1);
|
||||
}
|
||||
});
|
||||
$this.append(next);
|
||||
}
|
||||
|
||||
|
||||
/* Pagination Control
|
||||
================================================== */
|
||||
if (options.paginationControl) {
|
||||
paginationControl = $('<ul class="wmuSliderPagination"></ul>');
|
||||
$.each(slides, function(i) {
|
||||
paginationControl.append('<li><a href="#">' + i + '</a></li>');
|
||||
paginationControl.find('a:eq(' + i + ')').click(function(e) {
|
||||
e.preventDefault();
|
||||
clearTimeout(slideshowTimeout);
|
||||
loadSlide(i);
|
||||
});
|
||||
});
|
||||
$this.append(paginationControl);
|
||||
}
|
||||
|
||||
|
||||
/* Slideshow
|
||||
================================================== */
|
||||
if (options.slideshow) {
|
||||
var slideshow = function() {
|
||||
if (currentIndex + 1 < slidesCount) {
|
||||
loadSlide(currentIndex + 1);
|
||||
} else {
|
||||
loadSlide(0, true);
|
||||
}
|
||||
slideshowTimeout = setTimeout(slideshow, options.slideshowSpeed);
|
||||
}
|
||||
slideshowTimeout = setTimeout(slideshow, options.slideshowSpeed);
|
||||
}
|
||||
|
||||
|
||||
/* Resize Slider
|
||||
================================================== */
|
||||
var resize = function() {
|
||||
var slide = $(slides[currentIndex]);
|
||||
$this.animate({ height: slide.innerHeight() });
|
||||
if (options.animation == 'slide') {
|
||||
slides.css({
|
||||
width: $this.width() / options.items
|
||||
});
|
||||
wrapper.css({
|
||||
marginLeft: -$this.width() / options.items * currentIndex,
|
||||
width: $this.width() * slides.length
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* Touch
|
||||
================================================== */
|
||||
var touchSwipe = function(event, phase, direction, distance) {
|
||||
clearTimeout(slideshowTimeout);
|
||||
if(phase == 'move' && (direction == 'left' || direction == 'right')) {
|
||||
if (direction == 'right') {
|
||||
if (currentIndex == 0) {
|
||||
wrapper.css('marginLeft', (-slidesCount * $this.width() / options.items) + distance);
|
||||
} else {
|
||||
wrapper.css('marginLeft', (-currentIndex * $this.width() / options.items) + distance);
|
||||
}
|
||||
} else if (direction == 'left') {
|
||||
wrapper.css('marginLeft', (-currentIndex * $this.width() / options.items) - distance);
|
||||
}
|
||||
} else if (phase == 'cancel' ) {
|
||||
if (direction == 'right' && currentIndex == 0) {
|
||||
wrapper.animate({ marginLeft: -slidesCount * $this.width() / options.items }, options.animationDuration);
|
||||
} else {
|
||||
wrapper.animate({ marginLeft: -currentIndex * $this.width() / options.items }, options.animationDuration);
|
||||
}
|
||||
} else if (phase == 'end' ) {
|
||||
if (direction == 'right') {
|
||||
if (currentIndex == 0) {
|
||||
loadSlide(slidesCount - 1, true, true);
|
||||
} else {
|
||||
loadSlide(currentIndex - 1);
|
||||
}
|
||||
} else if (direction == 'left') {
|
||||
if (currentIndex + 1 == slidesCount) {
|
||||
loadSlide(0, true);
|
||||
} else {
|
||||
loadSlide(currentIndex + 1);
|
||||
}
|
||||
} else {
|
||||
wrapper.animate({ marginLeft: -currentIndex * $this.width() / options.items }, options.animationDuration);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (options.touch && options.animation == 'slide') {
|
||||
if (!$.isFunction($.fn.swipe)) {
|
||||
$.ajax({
|
||||
url: 'jquery.touchSwipe.min.js',
|
||||
async: false
|
||||
});
|
||||
}
|
||||
if ($.isFunction($.fn.swipe)) {
|
||||
$this.swipe({ triggerOnTouchEnd:false, swipeStatus:touchSwipe, allowPageScroll:'vertical' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Init Slider
|
||||
================================================== */
|
||||
var init = function() {
|
||||
var slide = $(slides[currentIndex]);
|
||||
var img = slide.find('img');
|
||||
img.load(function() {
|
||||
wrapper.show();
|
||||
$this.animate({ height: slide.innerHeight() });
|
||||
});
|
||||
if (options.animation == 'fade') {
|
||||
slides.css({
|
||||
position: 'absolute',
|
||||
width: '100%',
|
||||
opacity: 0
|
||||
});
|
||||
$(slides[currentIndex]).css('position', 'relative');
|
||||
} else if (options.animation == 'slide') {
|
||||
if (options.items > slidesCount) {
|
||||
options.items = slidesCount;
|
||||
}
|
||||
slides.css('float', 'left');
|
||||
slides.each(function(i){
|
||||
var slide = $(this);
|
||||
slide.attr('data-index', i);
|
||||
});
|
||||
for(var i = 0; i < options.items; i++) {
|
||||
wrapper.append($(slides[i]).clone());
|
||||
}
|
||||
slides = $this.find(options.slide);
|
||||
}
|
||||
resize();
|
||||
|
||||
$this.trigger('hasLoaded');
|
||||
|
||||
loadSlide(currentIndex);
|
||||
}
|
||||
init();
|
||||
|
||||
|
||||
/* Bind Events
|
||||
================================================== */
|
||||
// Resize
|
||||
$(window).resize(resize);
|
||||
|
||||
// Load Slide
|
||||
$this.bind('loadSlide', function(e, i) {
|
||||
clearTimeout(slideshowTimeout);
|
||||
loadSlide(i);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user