Rotating Tweets (Twitter widget and shortcode) - Version 1.5.0

Version Description

  • Added Carousel rotation option and beta support for version 2 of JQuery Cycle

=

Download this release

Release Info

Developer mpntod
Plugin Icon wp plugin Rotating Tweets (Twitter widget and shortcode)
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.7 to 1.5.0

js/jquery.cycle2.carousel.renamed.js ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! carousel transition plugin for Cycle2; version: 20130528 */
2
+ (function($) {
3
+ "use strict";
4
+
5
+ $( document ).on('cycle-bootstrap', function( e, opts, API ) {
6
+ if ( opts.fx !== 'carousel' )
7
+ return;
8
+
9
+ API.getSlideIndex = function( el ) {
10
+ var slides = this.opts()._carouselWrap.children();
11
+ var i = slides.index( el );
12
+ return i % slides.length;
13
+ };
14
+
15
+ // override default 'next' function
16
+ API.next = function() {
17
+ var count = opts.reverse ? -1 : 1;
18
+ if ( opts.allowWrap === false && ( opts.currSlide + count ) > opts.slideCount - opts.carouselVisible )
19
+ return;
20
+ opts.API.advanceSlide( count );
21
+ opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
22
+ };
23
+
24
+ });
25
+
26
+
27
+ $.fn.cycle2.transitions.carousel = {
28
+ // transition API impl
29
+ preInit: function( opts ) {
30
+ opts.hideNonActive = false;
31
+
32
+ opts.container.on('cycle-destroyed', $.proxy(this.onDestroy, opts.API));
33
+ // override default API implementation
34
+ opts.API.stopTransition = this.stopTransition;
35
+
36
+ // issue #10
37
+ for (var i=0; i < opts.startingSlide; i++) {
38
+ opts.container.append( opts.slides[0] );
39
+ }
40
+ },
41
+
42
+ // transition API impl
43
+ postInit: function( opts ) {
44
+ var i, j, slide, pagerCutoffIndex, wrap;
45
+ var vert = opts.carouselVertical;
46
+ if (opts.carouselVisible && opts.carouselVisible > opts.slideCount)
47
+ opts.carouselVisible = opts.slideCount - 1;
48
+ var visCount = opts.carouselVisible || opts.slides.length;
49
+ var slideCSS = { display: vert ? 'block' : 'inline-block', position: 'static' };
50
+
51
+ // required styles
52
+ opts.container.css({ position: 'relative', overflow: 'hidden' });
53
+ opts.slides.css( slideCSS );
54
+
55
+ opts._currSlide = opts.currSlide;
56
+
57
+ // wrap slides in a div; this div is what is animated
58
+ wrap = $('<div class="cycle-carousel-wrap"></div>')
59
+ .prependTo( opts.container )
60
+ .css({ margin: 0, padding: 0, top: 0, left: 0, position: 'absolute' })
61
+ .append( opts.slides );
62
+
63
+ opts._carouselWrap = wrap;
64
+
65
+ if ( !vert )
66
+ wrap.css('white-space', 'nowrap');
67
+
68
+ if ( opts.allowWrap !== false ) {
69
+ // prepend and append extra slides so we don't see any empty space when we
70
+ // near the end of the carousel. for fluid containers, add even more clones
71
+ // so there is plenty to fill the screen
72
+ // @todo: optimzie this based on slide sizes
73
+
74
+ for ( j=0; j < (opts.carouselVisible === undefined ? 2 : 1); j++ ) {
75
+ for ( i=0; i < opts.slideCount; i++ ) {
76
+ wrap.append( opts.slides[i].cloneNode(true) );
77
+ }
78
+ i = opts.slideCount;
79
+ while ( i-- ) { // #160, #209
80
+ wrap.prepend( opts.slides[i].cloneNode(true) );
81
+ }
82
+ }
83
+
84
+ wrap.find('.cycle2-slide-active').removeClass('cycle-slide-active');
85
+ opts.slides.eq(opts.startingSlide).addClass('cycle-slide-active');
86
+ }
87
+
88
+ if ( opts.pager && opts.allowWrap === false ) {
89
+ // hide "extra" pagers
90
+ pagerCutoffIndex = opts.slideCount - visCount;
91
+ $( opts.pager ).children().filter( ':gt('+pagerCutoffIndex+')' ).hide();
92
+ }
93
+
94
+ opts._nextBoundry = opts.slideCount - opts.carouselVisible;
95
+
96
+ this.prepareDimensions( opts );
97
+ },
98
+
99
+ prepareDimensions: function( opts ) {
100
+ var dim, offset, pagerCutoffIndex, tmp;
101
+ var vert = opts.carouselVertical;
102
+ var visCount = opts.carouselVisible || opts.slides.length;
103
+
104
+ if ( opts.carouselFluid && opts.carouselVisible ) {
105
+ if ( ! opts._carouselResizeThrottle ) {
106
+ // fluid container AND fluid slides; slides need to be resized to fit container
107
+ this.fluidSlides( opts );
108
+ }
109
+ }
110
+ else if ( opts.carouselVisible && opts.carouselSlideDimension ) {
111
+ dim = visCount * opts.carouselSlideDimension;
112
+ opts.container[ vert ? 'height' : 'width' ]( dim );
113
+ }
114
+ else if ( opts.carouselVisible ) {
115
+ dim = visCount * $(opts.slides[0])[vert ? 'outerHeight' : 'outerWidth'](true);
116
+ opts.container[ vert ? 'height' : 'width' ]( dim );
117
+ }
118
+ // else {
119
+ // // fluid; don't size the container
120
+ // }
121
+
122
+ offset = ( opts.carouselOffset || 0 );
123
+ if ( opts.allowWrap !== false ) {
124
+ if ( opts.carouselSlideDimension ) {
125
+ offset -= ( (opts.slideCount + opts.currSlide) * opts.carouselSlideDimension );
126
+ }
127
+ else {
128
+ // calculate offset based on actual slide dimensions
129
+ tmp = opts._carouselWrap.children();
130
+ for (var j=0; j < (opts.slideCount + opts.currSlide); j++) {
131
+ offset -= $(tmp[j])[vert?'outerHeight':'outerWidth'](true);
132
+ }
133
+ }
134
+ }
135
+
136
+ opts._carouselWrap.css( vert ? 'top' : 'left', offset );
137
+ },
138
+
139
+ fluidSlides: function( opts ) {
140
+ var timeout;
141
+ var slide = opts.slides.eq(0);
142
+ var adjustment = slide.outerWidth() - slide.width();
143
+ var prepareDimensions = this.prepareDimensions;
144
+
145
+ // throttle resize event
146
+ $(window).on( 'resize', resizeThrottle);
147
+
148
+ opts._carouselResizeThrottle = resizeThrottle;
149
+ onResize();
150
+
151
+ function resizeThrottle() {
152
+ clearTimeout( timeout );
153
+ timeout = setTimeout( onResize, 20 );
154
+ }
155
+
156
+ function onResize() {
157
+ opts._carouselWrap.stop( false, true );
158
+ var slideWidth = opts.container.width() / opts.carouselVisible;
159
+ slideWidth = Math.ceil( slideWidth - adjustment );
160
+ opts._carouselWrap.children().width( slideWidth );
161
+ if ( opts._sentinel )
162
+ opts._sentinel.width( slideWidth );
163
+ prepareDimensions( opts );
164
+ }
165
+ },
166
+
167
+ // transition API impl
168
+ transition: function( opts, curr, next, fwd, callback ) {
169
+ var moveBy, props = {};
170
+ var hops = opts.nextSlide - opts.currSlide;
171
+ var vert = opts.carouselVertical;
172
+ var speed = opts.speed;
173
+
174
+ // handle all the edge cases for wrapping & non-wrapping
175
+ if ( opts.allowWrap === false ) {
176
+ fwd = hops > 0;
177
+ var currSlide = opts._currSlide;
178
+ var maxCurr = opts.slideCount - opts.carouselVisible;
179
+ if ( hops > 0 && opts.nextSlide > maxCurr && currSlide == maxCurr ) {
180
+ hops = 0;
181
+ }
182
+ else if ( hops > 0 && opts.nextSlide > maxCurr ) {
183
+ hops = opts.nextSlide - currSlide - (opts.nextSlide - maxCurr);
184
+ }
185
+ else if ( hops < 0 && opts.currSlide > maxCurr && opts.nextSlide > maxCurr ) {
186
+ hops = 0;
187
+ }
188
+ else if ( hops < 0 && opts.currSlide > maxCurr ) {
189
+ hops += opts.currSlide - maxCurr;
190
+ }
191
+ else
192
+ currSlide = opts.currSlide;
193
+
194
+ moveBy = this.getScroll( opts, vert, currSlide, hops );
195
+ opts.API.opts()._currSlide = opts.nextSlide > maxCurr ? maxCurr : opts.nextSlide;
196
+ }
197
+ else {
198
+ if ( fwd && opts.nextSlide === 0 ) {
199
+ // moving from last slide to first
200
+ moveBy = this.getDim( opts, opts.currSlide, vert );
201
+ callback = this.genCallback( opts, fwd, vert, callback );
202
+ }
203
+ else if ( !fwd && opts.nextSlide == opts.slideCount - 1 ) {
204
+ // moving from first slide to last
205
+ moveBy = this.getDim( opts, opts.currSlide, vert );
206
+ callback = this.genCallback( opts, fwd, vert, callback );
207
+ }
208
+ else {
209
+ moveBy = this.getScroll( opts, vert, opts.currSlide, hops );
210
+ }
211
+ }
212
+
213
+ props[ vert ? 'top' : 'left' ] = fwd ? ( "-=" + moveBy ) : ( "+=" + moveBy );
214
+
215
+ // throttleSpeed means to scroll slides at a constant rate, rather than
216
+ // a constant speed
217
+ if ( opts.throttleSpeed )
218
+ speed = (moveBy / $(opts.slides[0])[vert ? 'height' : 'width']() ) * opts.speed;
219
+
220
+ opts._carouselWrap.animate( props, speed, opts.easing, callback );
221
+ },
222
+
223
+ getDim: function( opts, index, vert ) {
224
+ var slide = $( opts.slides[index] );
225
+ return slide[ vert ? 'outerHeight' : 'outerWidth'](true);
226
+ },
227
+
228
+ getScroll: function( opts, vert, currSlide, hops ) {
229
+ var i, moveBy = 0;
230
+
231
+ if (hops > 0) {
232
+ for (i=currSlide; i < currSlide+hops; i++)
233
+ moveBy += this.getDim( opts, i, vert);
234
+ }
235
+ else {
236
+ for (i=currSlide; i > currSlide+hops; i--)
237
+ moveBy += this.getDim( opts, i, vert);
238
+ }
239
+ return moveBy;
240
+ },
241
+
242
+ genCallback: function( opts, fwd, vert, callback ) {
243
+ // returns callback fn that resets the left/top wrap position to the "real" slides
244
+ return function() {
245
+ var pos = $(opts.slides[opts.nextSlide]).position();
246
+ var offset = 0 - pos[vert?'top':'left'] + (opts.carouselOffset || 0);
247
+ opts._carouselWrap.css( opts.carouselVertical ? 'top' : 'left', offset );
248
+ callback();
249
+ };
250
+ },
251
+
252
+ // core API override
253
+ stopTransition: function() {
254
+ var opts = this.opts();
255
+ opts.slides.stop( false, true );
256
+ opts._carouselWrap.stop( false, true );
257
+ },
258
+
259
+ // core API supplement
260
+ onDestroy: function( e ) {
261
+ var opts = this.opts();
262
+ if ( opts._carouselResizeThrottle )
263
+ $( window ).off( 'resize', opts._carouselResizeThrottle );
264
+ opts.slides.prependTo( opts.container );
265
+ opts._carouselWrap.remove();
266
+ }
267
+ };
268
+
269
+ })(jQuery);
js/jquery.cycle2.renamed.js ADDED
@@ -0,0 +1,1500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Cycle2 - Version: 20130502
3
+ * http://malsup.com/jquery/cycle2/
4
+ * Copyright (c) 2012 M. Alsup; Dual licensed: MIT/GPL
5
+ * Requires: jQuery v1.7 or later
6
+ */
7
+ ;(function($) {
8
+ "use strict";
9
+
10
+ var version = '20130409';
11
+
12
+ $.fn.cycle2 = function( options ) {
13
+ // fix mistakes with the ready state
14
+ var o;
15
+ if ( this.length === 0 && !$.isReady ) {
16
+ o = { s: this.selector, c: this.context };
17
+ $.fn.cycle2.log('requeuing slideshow (dom not ready)');
18
+ $(function() {
19
+ $( o.s, o.c ).cycle2(options);
20
+ });
21
+ return this;
22
+ }
23
+
24
+ return this.each(function() {
25
+ var data, opts, shortName, val;
26
+ var container = $(this);
27
+ var log = $.fn.cycle2.log;
28
+
29
+ if ( container.data('cycle.opts') )
30
+ return; // already initialized
31
+
32
+ if ( container.data('cycle-log') === false ||
33
+ ( options && options.log === false ) ||
34
+ ( opts && opts.log === false) ) {
35
+ log = $.noop;
36
+ }
37
+
38
+ log('--c2 init--');
39
+ data = container.data();
40
+ for (var p in data) {
41
+ // allow props to be accessed sans 'cycle' prefix and log the overrides
42
+ if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
43
+ val = data[p];
44
+ shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
45
+ log(shortName+':', val, '('+typeof val +')');
46
+ data[shortName] = val;
47
+ }
48
+ }
49
+
50
+ opts = $.extend( {}, $.fn.cycle2.defaults, data, options || {});
51
+
52
+ opts.timeoutId = 0;
53
+ opts.paused = opts.paused || false; // #57
54
+ opts.container = container;
55
+ opts._maxZ = opts.maxZ;
56
+
57
+ opts.API = $.extend ( { _container: container }, $.fn.cycle2.API );
58
+ opts.API.log = log;
59
+ opts.API.trigger = function( eventName, args ) {
60
+ opts.container.trigger( eventName, args );
61
+ return opts.API;
62
+ };
63
+
64
+ container.data( 'cycle.opts', opts );
65
+ container.data( 'cycle.API', opts.API );
66
+
67
+ // opportunity for plugins to modify opts and API
68
+ opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]);
69
+
70
+ opts.API.addInitialSlides();
71
+ opts.API.preInitSlideshow();
72
+
73
+ if ( opts.slides.length )
74
+ opts.API.initSlideshow();
75
+ });
76
+ };
77
+
78
+ $.fn.cycle2.API = {
79
+ opts: function() {
80
+ return this._container.data( 'cycle.opts' );
81
+ },
82
+ addInitialSlides: function() {
83
+ var opts = this.opts();
84
+ var slides = opts.slides;
85
+ opts.slideCount = 0;
86
+ opts.slides = $(); // empty set
87
+
88
+ // add slides that already exist
89
+ slides = slides.jquery ? slides : opts.container.find( slides );
90
+
91
+ if ( opts.random ) {
92
+ slides.sort(function() {return Math.random() - 0.5;});
93
+ }
94
+
95
+ opts.API.add( slides );
96
+ },
97
+
98
+ preInitSlideshow: function() {
99
+ var opts = this.opts();
100
+ opts.API.trigger('cycle-pre-initialize', [ opts ]);
101
+ var tx = $.fn.cycle2.transitions[opts.fx];
102
+ if (tx && $.isFunction(tx.preInit))
103
+ tx.preInit( opts );
104
+ opts._preInitialized = true;
105
+ },
106
+
107
+ postInitSlideshow: function() {
108
+ var opts = this.opts();
109
+ opts.API.trigger('cycle-post-initialize', [ opts ]);
110
+ var tx = $.fn.cycle2.transitions[opts.fx];
111
+ if (tx && $.isFunction(tx.postInit))
112
+ tx.postInit( opts );
113
+ },
114
+
115
+ initSlideshow: function() {
116
+ var opts = this.opts();
117
+ var pauseObj = opts.container;
118
+ var slideOpts;
119
+ opts.API.calcFirstSlide();
120
+
121
+ if ( opts.container.css('position') == 'static' )
122
+ opts.container.css('position', 'relative');
123
+
124
+ $(opts.slides[opts.currSlide]).css('opacity',1).show();
125
+ opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse );
126
+
127
+ if ( opts.pauseOnHover ) {
128
+ // allow pauseOnHover to specify an element
129
+ if ( opts.pauseOnHover !== true )
130
+ pauseObj = $( opts.pauseOnHover );
131
+
132
+ pauseObj.hover(
133
+ function(){ opts.API.pause( true ); },
134
+ function(){ opts.API.resume( true ); }
135
+ );
136
+ }
137
+
138
+ // stage initial transition
139
+ if ( opts.timeout ) {
140
+ slideOpts = opts.API.getSlideOpts( opts.nextSlide );
141
+ opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay );
142
+ }
143
+
144
+ opts._initialized = true;
145
+ opts.API.updateView( true );
146
+ opts.API.trigger('cycle-initialized', [ opts ]);
147
+ opts.API.postInitSlideshow();
148
+ },
149
+
150
+ pause: function( hover ) {
151
+ var opts = this.opts(),
152
+ slideOpts = opts.API.getSlideOpts(),
153
+ alreadyPaused = opts.hoverPaused || opts.paused;
154
+
155
+ if ( hover )
156
+ opts.hoverPaused = true;
157
+ else
158
+ opts.paused = true;
159
+
160
+ if ( ! alreadyPaused ) {
161
+ opts.container.addClass('cycle-paused');
162
+ opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused');
163
+
164
+ if ( slideOpts.timeout ) {
165
+ clearTimeout( opts.timeoutId );
166
+ opts.timeoutId = 0;
167
+
168
+ // determine how much time is left for the current slide
169
+ opts._remainingTimeout -= ( $.now() - opts._lastQueue );
170
+ if ( opts._remainingTimeout < 0 || isNaN(opts._remainingTimeout) )
171
+ opts._remainingTimeout = undefined;
172
+ }
173
+ }
174
+ },
175
+
176
+ resume: function( hover ) {
177
+ var opts = this.opts(),
178
+ alreadyResumed = !opts.hoverPaused && !opts.paused,
179
+ remaining;
180
+
181
+ if ( hover )
182
+ opts.hoverPaused = false;
183
+ else
184
+ opts.paused = false;
185
+
186
+ if ( ! alreadyResumed ) {
187
+ opts.container.removeClass('cycle-paused');
188
+ opts.API.queueTransition( opts.API.getSlideOpts(), opts._remainingTimeout );
189
+ opts.API.trigger('cycle-resumed', [ opts, opts._remainingTimeout ] ).log('cycle-resumed');
190
+ }
191
+ },
192
+
193
+ add: function( slides, prepend ) {
194
+ var opts = this.opts();
195
+ var oldSlideCount = opts.slideCount;
196
+ var startSlideshow = false;
197
+ var len;
198
+
199
+ if ( $.type(slides) == 'string')
200
+ slides = $.trim( slides );
201
+
202
+ $( slides ).each(function(i) {
203
+ var slideOpts;
204
+ var slide = $(this);
205
+
206
+ if ( prepend )
207
+ opts.container.prepend( slide );
208
+ else
209
+ opts.container.append( slide );
210
+
211
+ opts.slideCount++;
212
+ slideOpts = opts.API.buildSlideOpts( slide );
213
+
214
+ if ( prepend )
215
+ opts.slides = $( slide ).add( opts.slides );
216
+ else
217
+ opts.slides = opts.slides.add( slide );
218
+
219
+ opts.API.initSlide( slideOpts, slide, --opts._maxZ );
220
+
221
+ slide.data('cycle.opts', slideOpts);
222
+ opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]);
223
+ });
224
+
225
+ opts.API.updateView( true );
226
+
227
+ startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1);
228
+ if ( startSlideshow ) {
229
+ if ( !opts._initialized )
230
+ opts.API.initSlideshow();
231
+ else if ( opts.timeout ) {
232
+ len = opts.slides.length;
233
+ opts.nextSlide = opts.reverse ? len - 1 : 1;
234
+ if ( !opts.timeoutId ) {
235
+ opts.API.queueTransition( opts );
236
+ }
237
+ }
238
+ }
239
+ },
240
+
241
+ calcFirstSlide: function() {
242
+ var opts = this.opts();
243
+ var firstSlideIndex;
244
+ firstSlideIndex = parseInt( opts.startingSlide || 0, 10 );
245
+ if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0)
246
+ firstSlideIndex = 0;
247
+
248
+ opts.currSlide = firstSlideIndex;
249
+ if ( opts.reverse ) {
250
+ opts.nextSlide = firstSlideIndex - 1;
251
+ if (opts.nextSlide < 0)
252
+ opts.nextSlide = opts.slides.length - 1;
253
+ }
254
+ else {
255
+ opts.nextSlide = firstSlideIndex + 1;
256
+ if (opts.nextSlide == opts.slides.length)
257
+ opts.nextSlide = 0;
258
+ }
259
+ },
260
+
261
+ calcNextSlide: function() {
262
+ var opts = this.opts();
263
+ var roll;
264
+ if ( opts.reverse ) {
265
+ roll = (opts.nextSlide - 1) < 0;
266
+ opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1;
267
+ opts.currSlide = roll ? 0 : opts.nextSlide+1;
268
+ }
269
+ else {
270
+ roll = (opts.nextSlide + 1) == opts.slides.length;
271
+ opts.nextSlide = roll ? 0 : opts.nextSlide+1;
272
+ opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1;
273
+ }
274
+ },
275
+
276
+ calcTx: function( slideOpts, manual ) {
277
+ var opts = slideOpts;
278
+ var tx;
279
+ if ( manual && opts.manualFx )
280
+ tx = $.fn.cycle2.transitions[opts.manualFx];
281
+ if ( !tx )
282
+ tx = $.fn.cycle2.transitions[opts.fx];
283
+
284
+ if (!tx) {
285
+ tx = $.fn.cycle2.transitions.fade;
286
+ opts.API.log('Transition "' + opts.fx + '" not found. Using fade.');
287
+ }
288
+ return tx;
289
+ },
290
+
291
+ prepareTx: function( manual, fwd ) {
292
+ var opts = this.opts();
293
+ var after, curr, next, slideOpts, tx;
294
+
295
+ if ( opts.slideCount < 2 ) {
296
+ opts.timeoutId = 0;
297
+ return;
298
+ }
299
+ if ( manual && ( !opts.busy || opts.manualTrump ) ) {
300
+ opts.API.stopTransition();
301
+ opts.busy = false;
302
+ clearTimeout(opts.timeoutId);
303
+ opts.timeoutId = 0;
304
+ }
305
+ if ( opts.busy )
306
+ return;
307
+ if ( opts.timeoutId === 0 && !manual )
308
+ return;
309
+
310
+ curr = opts.slides[opts.currSlide];
311
+ next = opts.slides[opts.nextSlide];
312
+ slideOpts = opts.API.getSlideOpts( opts.nextSlide );
313
+ tx = opts.API.calcTx( slideOpts, manual );
314
+
315
+ opts._tx = tx;
316
+
317
+ if ( manual && slideOpts.manualSpeed !== undefined )
318
+ slideOpts.speed = slideOpts.manualSpeed;
319
+
320
+ // if ( opts.nextSlide === opts.currSlide )
321
+ // opts.API.calcNextSlide();
322
+
323
+ // ensure that:
324
+ // 1. advancing to a different slide
325
+ // 2. this is either a manual event (prev/next, pager, cmd) or
326
+ // a timer event and slideshow is not paused
327
+ if ( opts.nextSlide != opts.currSlide &&
328
+ (manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62
329
+
330
+ opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]);
331
+ if ( tx.before )
332
+ tx.before( slideOpts, curr, next, fwd );
333
+
334
+ after = function() {
335
+ opts.busy = false;
336
+ // #76; bail if slideshow has been destroyed
337
+ if (! opts.container.data( 'cycle.opts' ) )
338
+ return;
339
+
340
+ if (tx.after)
341
+ tx.after( slideOpts, curr, next, fwd );
342
+ opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]);
343
+ opts.API.queueTransition( slideOpts);
344
+ opts.API.updateView( true );
345
+ };
346
+
347
+ opts.busy = true;
348
+ if (tx.transition)
349
+ tx.transition(slideOpts, curr, next, fwd, after);
350
+ else
351
+ opts.API.doTransition( slideOpts, curr, next, fwd, after);
352
+
353
+ opts.API.calcNextSlide();
354
+ opts.API.updateView();
355
+ } else {
356
+ opts.API.queueTransition( slideOpts );
357
+ }
358
+ },
359
+
360
+ // perform the actual animation
361
+ doTransition: function( slideOpts, currEl, nextEl, fwd, callback) {
362
+ var opts = slideOpts;
363
+ var curr = $(currEl), next = $(nextEl);
364
+ var fn = function() {
365
+ // make sure animIn has something so that callback doesn't trigger immediately
366
+ next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback);
367
+ };
368
+
369
+ next.css(opts.cssBefore || {});
370
+ curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() {
371
+ curr.css(opts.cssAfter || {});
372
+ if (!opts.sync) {
373
+ fn();
374
+ }
375
+ });
376
+ if (opts.sync) {
377
+ fn();
378
+ }
379
+ },
380
+
381
+ queueTransition: function( slideOpts, specificTimeout ) {
382
+ var opts = this.opts();
383
+ var timeout = specificTimeout !== undefined ? specificTimeout : slideOpts.timeout;
384
+ if (opts.nextSlide === 0 && --opts.loop === 0) {
385
+ opts.API.log('terminating; loop=0');
386
+ opts.timeout = 0;
387
+ if ( timeout ) {
388
+ setTimeout(function() {
389
+ opts.API.trigger('cycle-finished', [ opts ]);
390
+ }, timeout);
391
+ }
392
+ else {
393
+ opts.API.trigger('cycle-finished', [ opts ]);
394
+ }
395
+ // reset nextSlide
396
+ opts.nextSlide = opts.currSlide;
397
+ return;
398
+ }
399
+ if ( timeout ) {
400
+ opts._lastQueue = $.now();
401
+ if ( specificTimeout === undefined )
402
+ opts._remainingTimeout = slideOpts.timeout;
403
+
404
+ if ( !opts.paused && ! opts.hoverPaused ) {
405
+ opts.timeoutId = setTimeout(function() {
406
+ opts.API.prepareTx( false, !opts.reverse );
407
+ }, timeout );
408
+ }
409
+ }
410
+ },
411
+
412
+ stopTransition: function() {
413
+ var opts = this.opts();
414
+ if ( opts.slides.filter(':animated').length ) {
415
+ opts.slides.stop(false, true);
416
+ opts.API.trigger('cycle-transition-stopped', [ opts ]);
417
+ }
418
+
419
+ if ( opts._tx && opts._tx.stopTransition )
420
+ opts._tx.stopTransition( opts );
421
+ },
422
+
423
+ // advance slide forward or back
424
+ advanceSlide: function( val ) {
425
+ var opts = this.opts();
426
+ clearTimeout(opts.timeoutId);
427
+ opts.timeoutId = 0;
428
+ opts.nextSlide = opts.currSlide + val;
429
+
430
+ if (opts.nextSlide < 0)
431
+ opts.nextSlide = opts.slides.length - 1;
432
+ else if (opts.nextSlide >= opts.slides.length)
433
+ opts.nextSlide = 0;
434
+
435
+ opts.API.prepareTx( true, val >= 0 );
436
+ return false;
437
+ },
438
+
439
+ buildSlideOpts: function( slide ) {
440
+ var opts = this.opts();
441
+ var val, shortName;
442
+ var slideOpts = slide.data() || {};
443
+ for (var p in slideOpts) {
444
+ // allow props to be accessed sans 'cycle' prefix and log the overrides
445
+ if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
446
+ val = slideOpts[p];
447
+ shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
448
+ opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')');
449
+ slideOpts[shortName] = val;
450
+ }
451
+ }
452
+
453
+ slideOpts = $.extend( {}, $.fn.cycle2.defaults, opts, slideOpts );
454
+ slideOpts.slideNum = opts.slideCount;
455
+
456
+ try {
457
+ // these props should always be read from the master state object
458
+ delete slideOpts.API;
459
+ delete slideOpts.slideCount;
460
+ delete slideOpts.currSlide;
461
+ delete slideOpts.nextSlide;
462
+ delete slideOpts.slides;
463
+ } catch(e) {
464
+ // no op
465
+ }
466
+ return slideOpts;
467
+ },
468
+
469
+ getSlideOpts: function( index ) {
470
+ var opts = this.opts();
471
+ if ( index === undefined )
472
+ index = opts.currSlide;
473
+
474
+ var slide = opts.slides[index];
475
+ var slideOpts = $(slide).data('cycle.opts');
476
+ return $.extend( {}, opts, slideOpts );
477
+ },
478
+
479
+ initSlide: function( slideOpts, slide, suggestedZindex ) {
480
+ var opts = this.opts();
481
+ slide.css( slideOpts.slideCss || {} );
482
+ if ( suggestedZindex > 0 )
483
+ slide.css( 'zIndex', suggestedZindex );
484
+
485
+ // ensure that speed settings are sane
486
+ if ( isNaN( slideOpts.speed ) )
487
+ slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default;
488
+ if ( !slideOpts.sync )
489
+ slideOpts.speed = slideOpts.speed / 2;
490
+
491
+ slide.addClass( opts.slideClass );
492
+ },
493
+
494
+ updateView: function( isAfter ) {
495
+ var opts = this.opts();
496
+ if ( !opts._initialized )
497
+ return;
498
+ var slideOpts = opts.API.getSlideOpts();
499
+ var currSlide = opts.slides[ opts.currSlide ];
500
+
501
+ if ( ! isAfter ) {
502
+ opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]);
503
+ if ( opts.updateView < 0 )
504
+ return;
505
+ }
506
+
507
+ if ( opts.slideActiveClass ) {
508
+ opts.slides.removeClass( opts.slideActiveClass )
509
+ .eq( opts.currSlide ).addClass( opts.slideActiveClass );
510
+ }
511
+
512
+ if ( isAfter && opts.hideNonActive )
513
+ opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).hide();
514
+
515
+ opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]);
516
+ opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]);
517
+ },
518
+
519
+ getComponent: function( name ) {
520
+ var opts = this.opts();
521
+ var selector = opts[name];
522
+ if (typeof selector === 'string') {
523
+ // if selector is a child, sibling combinator, adjancent selector then use find, otherwise query full dom
524
+ return (/^\s*[\>|\+|~]/).test( selector ) ? opts.container.find( selector ) : $( selector );
525
+ }
526
+ if (selector.jquery)
527
+ return selector;
528
+
529
+ return $(selector);
530
+ },
531
+
532
+ stackSlides: function( curr, next, fwd ) {
533
+ var opts = this.opts();
534
+ if ( !curr ) {
535
+ curr = opts.slides[opts.currSlide];
536
+ next = opts.slides[opts.nextSlide];
537
+ fwd = !opts.reverse;
538
+ }
539
+
540
+ // reset the zIndex for the common case:
541
+ // curr slide on top, next slide beneath, and the rest in order to be shown
542
+ $(curr).css('zIndex', opts.maxZ);
543
+
544
+ var i;
545
+ var z = opts.maxZ - 2;
546
+ var len = opts.slideCount;
547
+ if (fwd) {
548
+ for ( i = opts.currSlide + 1; i < len; i++ )
549
+ $( opts.slides[i] ).css( 'zIndex', z-- );
550
+ for ( i = 0; i < opts.currSlide; i++ )
551
+ $( opts.slides[i] ).css( 'zIndex', z-- );
552
+ }
553
+ else {
554
+ for ( i = opts.currSlide - 1; i >= 0; i-- )
555
+ $( opts.slides[i] ).css( 'zIndex', z-- );
556
+ for ( i = len - 1; i > opts.currSlide; i-- )
557
+ $( opts.slides[i] ).css( 'zIndex', z-- );
558
+ }
559
+
560
+ $(next).css('zIndex', opts.maxZ - 1);
561
+ },
562
+
563
+ getSlideIndex: function( el ) {
564
+ return this.opts().slides.index( el );
565
+ }
566
+
567
+ }; // API
568
+
569
+ // default logger
570
+ $.fn.cycle2.log = function log() {
571
+ /*global console:true */
572
+ if (window.console && console.log)
573
+ console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') );
574
+ };
575
+
576
+ $.fn.cycle2.version = function() { return 'Cycle2: ' + version; };
577
+
578
+ // helper functions
579
+
580
+ function lowerCase(s) {
581
+ return (s || '').toLowerCase();
582
+ }
583
+
584
+ // expose transition object
585
+ $.fn.cycle2.transitions = {
586
+ custom: {
587
+ },
588
+ none: {
589
+ before: function( opts, curr, next, fwd ) {
590
+ opts.API.stackSlides( next, curr, fwd );
591
+ opts.cssBefore = { opacity: 1, display: 'block' };
592
+ }
593
+ },
594
+ fade: {
595
+ before: function( opts, curr, next, fwd ) {
596
+ var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
597
+ opts.API.stackSlides( curr, next, fwd );
598
+ opts.cssBefore = $.extend(css, { opacity: 0, display: 'block' });
599
+ opts.animIn = { opacity: 1 };
600
+ opts.animOut = { opacity: 0 };
601
+ }
602
+ },
603
+ fadeout: {
604
+ before: function( opts , curr, next, fwd ) {
605
+ var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
606
+ opts.API.stackSlides( curr, next, fwd );
607
+ opts.cssBefore = $.extend(css, { opacity: 1, display: 'block' });
608
+ opts.animOut = { opacity: 0 };
609
+ }
610
+ },
611
+ scrollHorz: {
612
+ before: function( opts, curr, next, fwd ) {
613
+ opts.API.stackSlides( curr, next, fwd );
614
+ var w = opts.container.css('overflow','hidden').width();
615
+ opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, display: 'block' };
616
+ opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 };
617
+ opts.animIn = { left: 0 };
618
+ opts.animOut = { left: fwd ? -w : w };
619
+ }
620
+ }
621
+ };
622
+
623
+ // @see: http://jquery.malsup.com/cycle2/api
624
+ $.fn.cycle2.defaults = {
625
+ allowWrap: true,
626
+ autoSelector: '.cycle2-slideshow[data-cycle-auto-init!=false]',
627
+ delay: 0,
628
+ easing: null,
629
+ fx: 'fade',
630
+ hideNonActive: true,
631
+ loop: 0,
632
+ manualFx: undefined,
633
+ manualSpeed: undefined,
634
+ manualTrump: true,
635
+ maxZ: 100,
636
+ pauseOnHover: false,
637
+ reverse: false,
638
+ slideActiveClass: 'cycle-slide-active',
639
+ slideClass: 'cycle-slide',
640
+ slideCss: { position: 'absolute', top: 0, left: 0 },
641
+ slides: '> img',
642
+ speed: 500,
643
+ startingSlide: 0,
644
+ sync: true,
645
+ timeout: 4000,
646
+ updateView: -1
647
+ };
648
+
649
+ // automatically find and run slideshows
650
+ $(document).ready(function() {
651
+ $( $.fn.cycle2.defaults.autoSelector ).cycle2();
652
+ });
653
+
654
+ })(jQuery);
655
+
656
+ /*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130304 */
657
+ (function($) {
658
+ "use strict";
659
+
660
+ $.extend($.fn.cycle2.defaults, {
661
+ autoHeight: 0 // setting this option to false disables autoHeight logic
662
+ });
663
+
664
+ $(document).on( 'cycle-initialized', function( e, opts ) {
665
+ var autoHeight = opts.autoHeight;
666
+ var t = $.type( autoHeight );
667
+ var resizeThrottle = null;
668
+ var ratio;
669
+
670
+ if ( t !== 'string' && t !== 'number' )
671
+ return;
672
+
673
+ // bind events
674
+ opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
675
+ opts.container.on( 'cycle-destroyed', onDestroy );
676
+
677
+ if ( autoHeight == 'container' ) {
678
+ opts.container.on( 'cycle-before', onBefore );
679
+ }
680
+ else if ( t === 'string' && /\d+\:\d+/.test( autoHeight ) ) {
681
+ // use ratio
682
+ ratio = autoHeight.match(/(\d+)\:(\d+)/);
683
+ ratio = ratio[1] / ratio[2];
684
+ opts._autoHeightRatio = ratio;
685
+ }
686
+
687
+ // if autoHeight is a number then we don't need to recalculate the sentinel
688
+ // index on resize
689
+ if ( t !== 'number' ) {
690
+ // bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy)
691
+ opts._autoHeightOnResize = function () {
692
+ clearTimeout( resizeThrottle );
693
+ resizeThrottle = setTimeout( onResize, 50 );
694
+ };
695
+
696
+ $(window).on( 'resize orientationchange', opts._autoHeightOnResize );
697
+ }
698
+
699
+ setTimeout( onResize, 30 );
700
+
701
+ function onResize() {
702
+ initAutoHeight( e, opts );
703
+ }
704
+ });
705
+
706
+ function initAutoHeight( e, opts ) {
707
+ var clone, height, sentinelIndex;
708
+ var autoHeight = opts.autoHeight;
709
+
710
+ if ( autoHeight == 'container' ) {
711
+ height = $( opts.slides[ opts.currSlide ] ).outerHeight();
712
+ opts.container.height( height );
713
+ }
714
+ else if ( opts._autoHeightRatio ) {
715
+ opts.container.height( opts.container.width() / opts._autoHeightRatio );
716
+ }
717
+ else if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) {
718
+ if ( autoHeight === 'calc' )
719
+ sentinelIndex = calcSentinelIndex( e, opts );
720
+ else if ( autoHeight >= opts.slides.length )
721
+ sentinelIndex = 0;
722
+ else
723
+ sentinelIndex = autoHeight;
724
+
725
+ // only recreate sentinel if index is different
726
+ if ( sentinelIndex == opts._sentinelIndex )
727
+ return;
728
+
729
+ opts._sentinelIndex = sentinelIndex;
730
+ if ( opts._sentinel )
731
+ opts._sentinel.remove();
732
+
733
+ // clone existing slide as sentinel
734
+ clone = $( opts.slides[ sentinelIndex ].cloneNode(true) );
735
+
736
+ // #50; remove special attributes from cloned content
737
+ clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' );
738
+
739
+ clone.css({
740
+ position: 'static',
741
+ visibility: 'hidden',
742
+ display: 'block'
743
+ }).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide').removeClass('cycle-slide-active');
744
+ clone.find( '*' ).css( 'visibility', 'hidden' );
745
+
746
+ opts._sentinel = clone;
747
+ }
748
+ }
749
+
750
+ function calcSentinelIndex( e, opts ) {
751
+ var index = 0, max = -1;
752
+
753
+ // calculate tallest slide index
754
+ opts.slides.each(function(i) {
755
+ var h = $(this).height();
756
+ if ( h > max ) {
757
+ max = h;
758
+ index = i;
759
+ }
760
+ });
761
+ return index;
762
+ }
763
+
764
+ function onBefore( e, opts, outgoing, incoming, forward ) {
765
+ var h = $(incoming).outerHeight();
766
+ var duration = opts.sync ? opts.speed / 2 : opts.speed;
767
+ opts.container.animate( { height: h }, duration );
768
+ }
769
+
770
+ function onDestroy( e, opts ) {
771
+ if ( opts._autoHeightOnResize ) {
772
+ $(window).off( 'resize orientationchange', opts._autoHeightOnResize );
773
+ opts._autoHeightOnResize = null;
774
+ }
775
+ opts.container.off( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
776
+ opts.container.off( 'cycle-destroyed', onDestroy );
777
+ opts.container.off( 'cycle-before', onBefore );
778
+
779
+ if ( opts._sentinel ) {
780
+ opts._sentinel.remove();
781
+ opts._sentinel = null;
782
+ }
783
+ }
784
+
785
+ })(jQuery);
786
+
787
+ /*! caption plugin for Cycle2; version: 20130306 */
788
+ (function($) {
789
+ "use strict";
790
+
791
+ $.extend($.fn.cycle2.defaults, {
792
+ caption: '> .cycle2-caption',
793
+ captionTemplate: '{{slideNum}} / {{slideCount}}',
794
+ overlay: '> .cycle2-overlay',
795
+ overlayTemplate: '<div>{{title}}</div><div>{{desc}}</div>',
796
+ captionModule: 'caption'
797
+ });
798
+
799
+ $(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
800
+ if ( opts.captionModule !== 'caption' )
801
+ return;
802
+ var el;
803
+ $.each(['caption','overlay'], function() {
804
+ var name = this;
805
+ var template = slideOpts[name+'Template'];
806
+ var el = opts.API.getComponent( name );
807
+ if( el.length && template ) {
808
+ el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
809
+ el.show();
810
+ }
811
+ else {
812
+ el.hide();
813
+ }
814
+ });
815
+ });
816
+
817
+ $(document).on( 'cycle-destroyed', function( e, opts ) {
818
+ var el;
819
+ $.each(['caption','overlay'], function() {
820
+ var name = this, template = opts[name+'Template'];
821
+ if ( opts[name] && template ) {
822
+ el = opts.API.getComponent( 'caption' );
823
+ el.empty();
824
+ }
825
+ });
826
+ });
827
+
828
+ })(jQuery);
829
+
830
+ /*! command plugin for Cycle2; version: 20130525.1 */
831
+ (function($) {
832
+ "use strict";
833
+
834
+ var c2 = $.fn.cycle2;
835
+
836
+ $.fn.cycle2 = function( options ) {
837
+ var cmd, cmdFn, opts;
838
+ var args = $.makeArray( arguments );
839
+
840
+ if ( $.type( options ) == 'number' ) {
841
+ return this.cycle2( 'goto', options );
842
+ }
843
+
844
+ if ( $.type( options ) == 'string' ) {
845
+ return this.each(function() {
846
+ var cmdArgs;
847
+ cmd = options;
848
+ opts = $(this).data('cycle.opts');
849
+
850
+ if ( opts === undefined ) {
851
+ c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored');
852
+ return;
853
+ }
854
+ else {
855
+ cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally
856
+ cmdFn = opts.API[ cmd ];
857
+ if ( $.isFunction( cmdFn )) {
858
+ cmdArgs = $.makeArray( args );
859
+ cmdArgs.shift();
860
+ return cmdFn.apply( opts.API, cmdArgs );
861
+ }
862
+ else {
863
+ c2.log( 'unknown command: ', cmd );
864
+ }
865
+ }
866
+ });
867
+ }
868
+ else {
869
+ return c2.apply( this, arguments );
870
+ }
871
+ };
872
+
873
+ // copy props
874
+ $.extend( $.fn.cycle2, c2 );
875
+
876
+ $.extend( c2.API, {
877
+ next: function() {
878
+ var opts = this.opts();
879
+ if ( opts.busy && ! opts.manualTrump )
880
+ return;
881
+
882
+ var count = opts.reverse ? -1 : 1;
883
+ if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount )
884
+ return;
885
+
886
+ opts.API.advanceSlide( count );
887
+ opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
888
+ },
889
+
890
+ prev: function() {
891
+ var opts = this.opts();
892
+ if ( opts.busy && ! opts.manualTrump )
893
+ return;
894
+ var count = opts.reverse ? 1 : -1;
895
+ if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 )
896
+ return;
897
+
898
+ opts.API.advanceSlide( count );
899
+ opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev');
900
+ },
901
+
902
+ destroy: function() {
903
+ this.stop(); //#204
904
+
905
+ var opts = this.opts();
906
+ var clean = $.isFunction( $._data ) ? $._data : $.noop; // hack for #184 and #201
907
+ clearTimeout(opts.timeoutId);
908
+ opts.timeoutId = 0;
909
+ opts.API.stop();
910
+ opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed');
911
+ opts.container.removeData();
912
+ clean( opts.container[0], 'parsedAttrs', false );
913
+
914
+ // #75; remove inline styles
915
+ if ( ! opts.retainStylesOnDestroy ) {
916
+ opts.container.removeAttr( 'style' );
917
+ opts.slides.removeAttr( 'style' );
918
+ opts.slides.removeClass( 'cycle-slide-active' );
919
+ }
920
+ opts.slides.each(function() {
921
+ $(this).removeData();
922
+ clean( this, 'parsedAttrs', false );
923
+ });
924
+ },
925
+
926
+ jump: function( index ) {
927
+ // go to the requested slide
928
+ var fwd;
929
+ var opts = this.opts();
930
+ if ( opts.busy && ! opts.manualTrump )
931
+ return;
932
+ var num = parseInt( index, 10 );
933
+ if (isNaN(num) || num < 0 || num >= opts.slides.length) {
934
+ opts.API.log('goto: invalid slide index: ' + num);
935
+ return;
936
+ }
937
+ if (num == opts.currSlide) {
938
+ opts.API.log('goto: skipping, already on slide', num);
939
+ return;
940
+ }
941
+ opts.nextSlide = num;
942
+ clearTimeout(opts.timeoutId);
943
+ opts.timeoutId = 0;
944
+ opts.API.log('goto: ', num, ' (zero-index)');
945
+ fwd = opts.currSlide < opts.nextSlide;
946
+ opts.API.prepareTx( true, fwd );
947
+ },
948
+
949
+ stop: function() {
950
+ var opts = this.opts();
951
+ var pauseObj = opts.container;
952
+ clearTimeout(opts.timeoutId);
953
+ opts.timeoutId = 0;
954
+ opts.API.stopTransition();
955
+ if ( opts.pauseOnHover ) {
956
+ if ( opts.pauseOnHover !== true )
957
+ pauseObj = $( opts.pauseOnHover );
958
+ pauseObj.off('mouseenter mouseleave');
959
+ }
960
+ opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped');
961
+ },
962
+
963
+ reinit: function() {
964
+ var opts = this.opts();
965
+ opts.API.destroy();
966
+ opts.container.cycle2();
967
+ },
968
+
969
+ remove: function( index ) {
970
+ var opts = this.opts();
971
+ var slide, slideToRemove, slides = [], slideNum = 1;
972
+ for ( var i=0; i < opts.slides.length; i++ ) {
973
+ slide = opts.slides[i];
974
+ if ( i == index ) {
975
+ slideToRemove = slide;
976
+ }
977
+ else {
978
+ slides.push( slide );
979
+ $( slide ).data('cycle.opts').slideNum = slideNum;
980
+ slideNum++;
981
+ }
982
+ }
983
+ if ( slideToRemove ) {
984
+ opts.slides = $( slides );
985
+ opts.slideCount--;
986
+ $( slideToRemove ).remove();
987
+ if (index == opts.currSlide) {
988
+ opts.API.advanceSlide( 1 );
989
+ }
990
+
991
+ opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed');
992
+ opts.API.updateView();
993
+ }
994
+ }
995
+
996
+ });
997
+
998
+ // listen for clicks on elements with data-cycle-cmd attribute
999
+ $(document).on('click.cycle2', '[data-cycle-cmd]', function(e) {
1000
+ // issue cycle command
1001
+ e.preventDefault();
1002
+ var el = $(this);
1003
+ var command = el.data('cycle-cmd');
1004
+ var context = el.data('cycle-context') || '.cycle2-slideshow';
1005
+ $(context).cycle2(command, el.data('cycle-arg'));
1006
+ });
1007
+
1008
+
1009
+ })(jQuery);
1010
+
1011
+ /*! hash plugin for Cycle2; version: 20121120 */
1012
+ (function($) {
1013
+ "use strict";
1014
+
1015
+ $(document).on( 'cycle-pre-initialize', function( e, opts ) {
1016
+ onHashChange( opts, true );
1017
+
1018
+ opts._onHashChange = function() {
1019
+ onHashChange( opts, false );
1020
+ };
1021
+
1022
+ $( window ).on( 'hashchange', opts._onHashChange);
1023
+ });
1024
+
1025
+ $(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
1026
+ if ( slideOpts.hash ) {
1027
+ opts._hashFence = true;
1028
+ window.location.hash = slideOpts.hash;
1029
+ }
1030
+ });
1031
+
1032
+ $(document).on( 'cycle-destroyed', function( e, opts) {
1033
+ if ( opts._onHashChange ) {
1034
+ $( window ).off( 'hashchange', opts._onHashChange );
1035
+ }
1036
+ });
1037
+
1038
+ function onHashChange( opts, setStartingSlide ) {
1039
+ var hash;
1040
+ if ( opts._hashFence ) {
1041
+ opts._hashFence = false;
1042
+ return;
1043
+ }
1044
+
1045
+ hash = window.location.hash.substring(1);
1046
+
1047
+ opts.slides.each(function(i) {
1048
+ if ( $(this).data( 'cycle-hash' ) == hash ) {
1049
+ if ( setStartingSlide === true ) {
1050
+ opts.startingSlide = i;
1051
+ }
1052
+ else {
1053
+ opts.nextSlide = i;
1054
+ opts.API.prepareTx( true, false );
1055
+ }
1056
+ return false;
1057
+ }
1058
+ });
1059
+ }
1060
+
1061
+ })(jQuery);
1062
+
1063
+ /*! loader plugin for Cycle2; version: 20130307 */
1064
+ (function($) {
1065
+ "use strict";
1066
+
1067
+ $.extend($.fn.cycle2.defaults, {
1068
+ loader: false
1069
+ });
1070
+
1071
+ $(document).on( 'cycle-bootstrap', function( e, opts ) {
1072
+ var addFn;
1073
+
1074
+ if ( !opts.loader )
1075
+ return;
1076
+
1077
+ // override API.add for this slideshow
1078
+ addFn = opts.API.add;
1079
+ opts.API.add = add;
1080
+
1081
+ function add( slides, prepend ) {
1082
+ var slideArr = [];
1083
+ if ( $.type( slides ) == 'string' )
1084
+ slides = $.trim( slides );
1085
+ else if ( $.type( slides) === 'array' ) {
1086
+ for (var i=0; i < slides.length; i++ )
1087
+ slides[i] = $(slides[i])[0];
1088
+ }
1089
+
1090
+ slides = $( slides );
1091
+ var slideCount = slides.length;
1092
+
1093
+ if ( ! slideCount )
1094
+ return;
1095
+
1096
+ slides.hide().appendTo('body').each(function(i) { // appendTo fixes #56
1097
+ var count = 0;
1098
+ var slide = $(this);
1099
+ var images = slide.is('img') ? slide : slide.find('img');
1100
+ slide.data('index', i);
1101
+ // allow some images to be marked as unimportant (and filter out images w/o src value)
1102
+ images = images.filter(':not(.cycle2-loader-ignore)').filter(':not([src=""])');
1103
+ if ( ! images.length ) {
1104
+ --slideCount;
1105
+ slideArr.push( slide );
1106
+ return;
1107
+ }
1108
+
1109
+ count = images.length;
1110
+ images.each(function() {
1111
+ // add images that are already loaded
1112
+ if ( this.complete ) {
1113
+ imageLoaded();
1114
+ }
1115
+ else {
1116
+ $(this).load(function() {
1117
+ imageLoaded();
1118
+ }).error(function() {
1119
+ if ( --count === 0 ) {
1120
+ // ignore this slide
1121
+ opts.API.log('slide skipped; img not loaded:', this.src);
1122
+ if ( --slideCount === 0 && opts.loader == 'wait') {
1123
+ addFn.apply( opts.API, [ slideArr, prepend ] );
1124
+ }
1125
+ }
1126
+ });
1127
+ }
1128
+ });
1129
+
1130
+ function imageLoaded() {
1131
+ if ( --count === 0 ) {
1132
+ --slideCount;
1133
+ addSlide( slide );
1134
+ }
1135
+ }
1136
+ });
1137
+
1138
+ if ( slideCount )
1139
+ opts.container.addClass('cycle-loading');
1140
+
1141
+
1142
+ function addSlide( slide ) {
1143
+ var curr;
1144
+ if ( opts.loader == 'wait' ) {
1145
+ slideArr.push( slide );
1146
+ if ( slideCount === 0 ) {
1147
+ // #59; sort slides into original markup order
1148
+ slideArr.sort( sorter );
1149
+ addFn.apply( opts.API, [ slideArr, prepend ] );
1150
+ opts.container.removeClass('cycle-loading');
1151
+ }
1152
+ }
1153
+ else {
1154
+ curr = $(opts.slides[opts.currSlide]);
1155
+ addFn.apply( opts.API, [ slide, prepend ] );
1156
+ curr.show();
1157
+ opts.container.removeClass('cycle-loading');
1158
+ }
1159
+ }
1160
+
1161
+ function sorter(a, b) {
1162
+ return a.data('index') - b.data('index');
1163
+ }
1164
+ }
1165
+ });
1166
+
1167
+ })(jQuery);
1168
+
1169
+ /*! pager plugin for Cycle2; version: 20130525 */
1170
+ (function($) {
1171
+ "use strict";
1172
+
1173
+ $.extend($.fn.cycle2.defaults, {
1174
+ pager: '> .cycle2-pager',
1175
+ pagerActiveClass: 'cycle-pager-active',
1176
+ pagerEvent: 'click.cycle2',
1177
+ pagerTemplate: '<span>&bull;</span>'
1178
+ });
1179
+
1180
+ $(document).on( 'cycle-bootstrap', function( e, opts, API ) {
1181
+ // add method to API
1182
+ API.buildPagerLink = buildPagerLink;
1183
+ });
1184
+
1185
+ $(document).on( 'cycle-slide-added', function( e, opts, slideOpts, slideAdded ) {
1186
+ if ( opts.pager ) {
1187
+ opts.API.buildPagerLink ( opts, slideOpts, slideAdded );
1188
+ opts.API.page = page;
1189
+ }
1190
+ });
1191
+
1192
+ $(document).on( 'cycle-slide-removed', function( e, opts, index, slideRemoved ) {
1193
+ if ( opts.pager ) {
1194
+ var pagers = opts.API.getComponent( 'pager' );
1195
+ pagers.each(function() {
1196
+ var pager = $(this);
1197
+ $( pager.children()[index] ).remove();
1198
+ });
1199
+ }
1200
+ });
1201
+
1202
+ $(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
1203
+ var pagers;
1204
+
1205
+ if ( opts.pager ) {
1206
+ pagers = opts.API.getComponent( 'pager' );
1207
+ pagers.each(function() {
1208
+ $(this).children().removeClass( opts.pagerActiveClass )
1209
+ .eq( opts.currSlide ).addClass( opts.pagerActiveClass );
1210
+ });
1211
+ }
1212
+ });
1213
+
1214
+ $(document).on( 'cycle-destroyed', function( e, opts ) {
1215
+ var pager = opts.API.getComponent( 'pager' );
1216
+
1217
+ if ( pager ) {
1218
+ pager.children().off( opts.pagerEvent ); // #202
1219
+ if ( opts.pagerTemplate )
1220
+ pager.empty();
1221
+ }
1222
+ });
1223
+
1224
+ function buildPagerLink( opts, slideOpts, slide ) {
1225
+ var pagerLink;
1226
+ var pagers = opts.API.getComponent( 'pager' );
1227
+ pagers.each(function() {
1228
+ var pager = $(this);
1229
+ if ( slideOpts.pagerTemplate ) {
1230
+ var markup = opts.API.tmpl( slideOpts.pagerTemplate, slideOpts, opts, slide[0] );
1231
+ pagerLink = $( markup ).appendTo( pager );
1232
+ }
1233
+ else {
1234
+ pagerLink = pager.children().eq( opts.slideCount - 1 );
1235
+ }
1236
+ pagerLink.on( opts.pagerEvent, function(e) {
1237
+ e.preventDefault();
1238
+ opts.API.page( pager, e.currentTarget);
1239
+ });
1240
+ });
1241
+ }
1242
+
1243
+ function page( pager, target ) {
1244
+ /*jshint validthis:true */
1245
+ var opts = this.opts();
1246
+ if ( opts.busy && ! opts.manualTrump )
1247
+ return;
1248
+
1249
+ var index = pager.children().index( target );
1250
+ var nextSlide = index;
1251
+ var fwd = opts.currSlide < nextSlide;
1252
+ if (opts.currSlide == nextSlide) {
1253
+ return; // no op, clicked pager for the currently displayed slide
1254
+ }
1255
+ opts.nextSlide = nextSlide;
1256
+ opts.API.prepareTx( true, fwd );
1257
+ opts.API.trigger('cycle-pager-activated', [opts, pager, target ]);
1258
+ }
1259
+
1260
+ })(jQuery);
1261
+
1262
+
1263
+ /*! prevnext plugin for Cycle2; version: 20130307 */
1264
+ (function($) {
1265
+ "use strict";
1266
+
1267
+ $.extend($.fn.cycle2.defaults, {
1268
+ next: '> .cycle2-next',
1269
+ nextEvent: 'click.cycle2',
1270
+ disabledClass: 'disabled',
1271
+ prev: '> .cycle2-prev',
1272
+ prevEvent: 'click.cycle2',
1273
+ swipe: false
1274
+ });
1275
+
1276
+ $(document).on( 'cycle-initialized', function( e, opts ) {
1277
+ opts.API.getComponent( 'next' ).on( opts.nextEvent, function(e) {
1278
+ e.preventDefault();
1279
+ opts.API.next();
1280
+ });
1281
+
1282
+ opts.API.getComponent( 'prev' ).on( opts.prevEvent, function(e) {
1283
+ e.preventDefault();
1284
+ opts.API.prev();
1285
+ });
1286
+
1287
+ if ( opts.swipe ) {
1288
+ var nextEvent = opts.swipeVert ? 'swipeUp.cycle2' : 'swipeLeft.cycle2 swipeleft.cycle2';
1289
+ var prevEvent = opts.swipeVert ? 'swipeDown.cycle2' : 'swipeRight.cycle2 swiperight.cycle2';
1290
+ opts.container.on( nextEvent, function(e) {
1291
+ opts.API.next();
1292
+ });
1293
+ opts.container.on( prevEvent, function() {
1294
+ opts.API.prev();
1295
+ });
1296
+ }
1297
+ });
1298
+
1299
+ $(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
1300
+ if ( opts.allowWrap )
1301
+ return;
1302
+
1303
+ var cls = opts.disabledClass;
1304
+ var next = opts.API.getComponent( 'next' );
1305
+ var prev = opts.API.getComponent( 'prev' );
1306
+ var prevBoundry = opts._prevBoundry || 0;
1307
+ var nextBoundry = opts._nextBoundry || opts.slideCount - 1;
1308
+
1309
+ if ( opts.currSlide == nextBoundry )
1310
+ next.addClass( cls ).prop( 'disabled', true );
1311
+ else
1312
+ next.removeClass( cls ).prop( 'disabled', false );
1313
+
1314
+ if ( opts.currSlide === prevBoundry )
1315
+ prev.addClass( cls ).prop( 'disabled', true );
1316
+ else
1317
+ prev.removeClass( cls ).prop( 'disabled', false );
1318
+ });
1319
+
1320
+
1321
+ $(document).on( 'cycle-destroyed', function( e, opts ) {
1322
+ opts.API.getComponent( 'prev' ).off( opts.nextEvent );
1323
+ opts.API.getComponent( 'next' ).off( opts.prevEvent );
1324
+ opts.container.off( 'swipeleft.cycle2 swiperight.cycle2 swipeLeft.cycle2 swipeRight.cycle2 swipeUp.cycle2 swipeDown.cycle2' );
1325
+ });
1326
+
1327
+ })(jQuery);
1328
+
1329
+ /*! progressive loader plugin for Cycle2; version: 20130315 */
1330
+ (function($) {
1331
+ "use strict";
1332
+
1333
+ $.extend($.fn.cycle2.defaults, {
1334
+ progressive: false
1335
+ });
1336
+
1337
+ $(document).on( 'cycle-pre-initialize', function( e, opts ) {
1338
+ if ( !opts.progressive )
1339
+ return;
1340
+
1341
+ var API = opts.API;
1342
+ var nextFn = API.next;
1343
+ var prevFn = API.prev;
1344
+ var prepareTxFn = API.prepareTx;
1345
+ var type = $.type( opts.progressive );
1346
+ var slides, scriptEl;
1347
+
1348
+ if ( type == 'array' ) {
1349
+ slides = opts.progressive;
1350
+ }
1351
+ else if ($.isFunction( opts.progressive ) ) {
1352
+ slides = opts.progressive( opts );
1353
+ }
1354
+ else if ( type == 'string' ) {
1355
+ scriptEl = $( opts.progressive );
1356
+ slides = $.trim( scriptEl.html() );
1357
+ if ( !slides )
1358
+ return;
1359
+ // is it json array?
1360
+ if ( /^(\[)/.test( slides ) ) {
1361
+ try {
1362
+ slides = $.parseJSON( slides );
1363
+ }
1364
+ catch(err) {
1365
+ API.log( 'error parsing progressive slides', err );
1366
+ return;
1367
+ }
1368
+ }
1369
+ else {
1370
+ // plain text, split on delimeter
1371
+ slides = slides.split( new RegExp( scriptEl.data('cycle-split') || '\n') );
1372
+
1373
+ // #95; look for empty slide
1374
+ if ( ! slides[ slides.length - 1 ] )
1375
+ slides.pop();
1376
+ }
1377
+ }
1378
+
1379
+
1380
+
1381
+ if ( prepareTxFn ) {
1382
+ API.prepareTx = function( manual, fwd ) {
1383
+ var index, slide;
1384
+
1385
+ if ( manual || slides.length === 0 ) {
1386
+ prepareTxFn.apply( opts.API, [ manual, fwd ] );
1387
+ return;
1388
+ }
1389
+
1390
+ if ( fwd && opts.currSlide == ( opts.slideCount-1) ) {
1391
+ slide = slides[ 0 ];
1392
+ slides = slides.slice( 1 );
1393
+ opts.container.one('cycle-slide-added', function(e, opts ) {
1394
+ setTimeout(function() {
1395
+ opts.API.advanceSlide( 1 );
1396
+ },50);
1397
+ });
1398
+ opts.API.add( slide );
1399
+ }
1400
+ else if ( !fwd && opts.currSlide === 0 ) {
1401
+ index = slides.length-1;
1402
+ slide = slides[ index ];
1403
+ slides = slides.slice( 0, index );
1404
+ opts.container.one('cycle-slide-added', function(e, opts ) {
1405
+ setTimeout(function() {
1406
+ opts.currSlide = 1;
1407
+ opts.API.advanceSlide( -1 );
1408
+ },50);
1409
+ });
1410
+ opts.API.add( slide, true );
1411
+ }
1412
+ else {
1413
+ prepareTxFn.apply( opts.API, [ manual, fwd ] );
1414
+ }
1415
+ };
1416
+ }
1417
+
1418
+ if ( nextFn ) {
1419
+ API.next = function() {
1420
+ var opts = this.opts();
1421
+ if ( slides.length && opts.currSlide == ( opts.slideCount - 1 ) ) {
1422
+ var slide = slides[ 0 ];
1423
+ slides = slides.slice( 1 );
1424
+ opts.container.one('cycle-slide-added', function(e, opts ) {
1425
+ nextFn.apply( opts.API );
1426
+ opts.container.removeClass('cycle-loading');
1427
+ });
1428
+ opts.container.addClass('cycle-loading');
1429
+ opts.API.add( slide );
1430
+ }
1431
+ else {
1432
+ nextFn.apply( opts.API );
1433
+ }
1434
+ };
1435
+ }
1436
+
1437
+ if ( prevFn ) {
1438
+ API.prev = function() {
1439
+ var opts = this.opts();
1440
+ if ( slides.length && opts.currSlide === 0 ) {
1441
+ var index = slides.length-1;
1442
+ var slide = slides[ index ];
1443
+ slides = slides.slice( 0, index );
1444
+ opts.container.one('cycle-slide-added', function(e, opts ) {
1445
+ opts.currSlide = 1;
1446
+ opts.API.advanceSlide( -1 );
1447
+ opts.container.removeClass('cycle-loading');
1448
+ });
1449
+ opts.container.addClass('cycle-loading');
1450
+ opts.API.add( slide, true );
1451
+ }
1452
+ else {
1453
+ prevFn.apply( opts.API );
1454
+ }
1455
+ };
1456
+ }
1457
+ });
1458
+
1459
+ })(jQuery);
1460
+
1461
+ /*! tmpl plugin for Cycle2; version: 20121227 */
1462
+ (function($) {
1463
+ "use strict";
1464
+
1465
+ $.extend($.fn.cycle2.defaults, {
1466
+ tmplRegex: '{{((.)?.*?)}}'
1467
+ });
1468
+
1469
+ $.extend($.fn.cycle2.API, {
1470
+ tmpl: function( str, opts /*, ... */) {
1471
+ var regex = new RegExp( opts.tmplRegex || $.fn.cycle2.defaults.tmplRegex, 'g' );
1472
+ var args = $.makeArray( arguments );
1473
+ args.shift();
1474
+ return str.replace(regex, function(_, str) {
1475
+ var i, j, obj, prop, names = str.split('.');
1476
+ for (i=0; i < args.length; i++) {
1477
+ obj = args[i];
1478
+ if ( ! obj )
1479
+ continue;
1480
+ if (names.length > 1) {
1481
+ prop = obj;
1482
+ for (j=0; j < names.length; j++) {
1483
+ obj = prop;
1484
+ prop = prop[ names[j] ] || str;
1485
+ }
1486
+ } else {
1487
+ prop = obj[str];
1488
+ }
1489
+
1490
+ if ($.isFunction(prop))
1491
+ return prop.apply(obj, args);
1492
+ if (prop !== undefined && prop !== null && prop != str)
1493
+ return prop;
1494
+ }
1495
+ return str;
1496
+ });
1497
+ }
1498
+ });
1499
+
1500
+ })(jQuery);
js/jquery.cycle2.scrollVert.renamed.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! scrollVert transition plugin for Cycle2; version: 20121120 */
2
+ (function($) {
3
+ "use strict";
4
+
5
+ $.fn.cycle2.transitions.scrollVert = {
6
+ before: function( opts, curr, next, fwd ) {
7
+ opts.API.stackSlides( opts, curr, next, fwd );
8
+ var height = opts.container.css('overflow','hidden').height();
9
+ opts.cssBefore = { top: fwd ? -height : height, left: 0, opacity: 1, display: 'block' };
10
+ opts.animIn = { top: 0 };
11
+ opts.animOut = { top: fwd ? height : -height };
12
+ }
13
+ };
14
+
15
+
16
+
17
+ })(jQuery);
js/rotatingtweets_v2.js ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Add some transitions
3
+ */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ $.fn.cycle2.transitions.scrollDown = {
8
+ before: function( opts, curr, next, fwd ) {
9
+ opts.API.stackSlides( opts, curr, next, fwd );
10
+ var width = opts.container.css('overflow','visible').width();
11
+ var height = opts.container.css('overflow','hidden').height();
12
+ opts.cssBefore = { top: fwd ? -height : height, left: 0, opacity: 1, display: 'block' ,width:width };
13
+ opts.animIn = { top: 0 };
14
+ opts.animOut = { top: fwd ? height : -height };
15
+ }
16
+ };
17
+ $.fn.cycle2.transitions.scrollUp = {
18
+ before: function( opts, curr, next, fwd ) {
19
+ opts.API.stackSlides( opts, curr, next, fwd );
20
+ var width = opts.container.css('overflow','visible').width();
21
+ var height = opts.container.css('overflow','hidden').height();
22
+ opts.cssBefore = { top: fwd ? height : -height, left: 0, opacity: 1, display: 'block' ,width:width };
23
+ opts.animIn = { top: 0 };
24
+ opts.animOut = { top: fwd ? -height : height };
25
+ }
26
+ };
27
+ $.fn.cycle2.transitions.scrollLeft = {
28
+ before: function( opts, curr, next, fwd ) {
29
+ opts.API.stackSlides( opts, curr, next, fwd );
30
+ var width = opts.container.css('overflow','hidden').width();
31
+ opts.cssBefore = { width: width, left : width+20, top: 0, opacity: 1, display: 'block' };
32
+ opts.animIn = { left: 0 };
33
+ opts.animOut = { left : -width-20,width:width };
34
+ }
35
+ };
36
+
37
+ $.fn.cycle2.transitions.scrollRight = {
38
+ before: function( opts, curr, next, fwd ) {
39
+ opts.API.stackSlides( opts, curr, next, fwd );
40
+ var width = opts.container.css('overflow','hidden').width();
41
+ opts.cssBefore = { width: width, left : -width-20, top: 0, opacity: 1, display: 'block' };
42
+ opts.animIn = { left: 0 };
43
+ opts.animOut = { left : width+20 };
44
+ }
45
+ };
46
+
47
+ $.fn.cycle2.transitions.toss = {
48
+ before: function( opts, curr, next, fwd ) {
49
+ opts.API.stackSlides( opts, curr, next, fwd );
50
+ var width = opts.container.css('overflow','visible').width();
51
+ var height = opts.container.css('overflow','visible').height();
52
+ opts.cssBefore = { left: 0, top: 0, opacity: 1, display: 'block',width:width };
53
+ opts.animIn = { left: 0 };
54
+ opts.animOut = { left : width*2, top:-height/2 , opacity:0, width:width, display:'block' };
55
+ }
56
+ };
57
+
58
+ })(jQuery);
59
+ /*
60
+ Script to cycle the rotating tweets
61
+ */
62
+ jQuery(document).ready(function() {
63
+ // Not at all sure we need this
64
+ jQuery('.rotatingtweets').cycle2();
65
+ // Script to show mouseover effects when going over the Twitter intents
66
+ jQuery('.rtw_intents a').hover(function() {
67
+ var rtw_src = jQuery(this).find('img').attr('src');
68
+ var clearOutHovers = /_hover.png$/;
69
+ jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
70
+ var rtw_src = jQuery(this).find('img').attr('src');
71
+ var srcReplacePattern = /.png$/;
72
+ jQuery(this).find('img').attr('src',rtw_src.replace(srcReplacePattern,"_hover.png"));
73
+ },function() {
74
+ var rtw_src = jQuery(this).find('img').attr('src');
75
+ var clearOutHovers = /_hover.png/;
76
+ jQuery(this).find('img').attr('src',rtw_src.replace(clearOutHovers,".png"));
77
+ });
78
+ jQuery('.rtw_wide .rtw_intents').hide();
79
+ jQuery('.rtw_expand').show();
80
+ jQuery('.rotatingtweets').has('.rtw_wide').hover(function() {
81
+ jQuery(this).find('.rtw_intents').show();
82
+ },function() {
83
+ jQuery(this).find('.rtw_intents').hide();
84
+ });
85
+ });
86
+ /* And call the Twitter script while we're at it! */
87
+ /* Standard script to call Twitter */
88
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
languages/rotatingtweets-nl_NL.mo CHANGED
Binary file
languages/rotatingtweets-nl_NL.po CHANGED
@@ -8,7 +8,7 @@ msgstr ""
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-03-15 12:25-0000\n"
12
  "Last-Translator: Martin Tod <martin@martintod.org.uk>\n"
13
  "Language-Team: \n"
14
  "X-Generator: Poedit 1.5.5\n"
@@ -159,63 +159,63 @@ msgstr ""
159
 
160
  #: rotatingtweets.php:242
161
  msgid "less than a second ago"
162
- msgstr ""
163
 
164
  #: rotatingtweets.php:243
165
  msgid "%d seconds ago"
166
- msgstr ""
167
 
168
  #: rotatingtweets.php:244
169
  msgid "about a minute ago"
170
  msgid_plural "about %d minutes ago"
171
- msgstr[0] ""
172
- msgstr[1] ""
173
 
174
  #: rotatingtweets.php:245 rotatingtweets.php:247
175
  msgid "about an hour ago"
176
  msgid_plural "about %d hours ago"
177
- msgstr[0] ""
178
- msgstr[1] ""
179
 
180
  #: rotatingtweets.php:246
181
  msgid "yesterday"
182
- msgstr ""
183
 
184
  #: rotatingtweets.php:248
185
  msgid "about a day ago"
186
  msgid_plural "about %d days ago"
187
- msgstr[0] ""
188
- msgstr[1] ""
189
 
190
  #: rotatingtweets.php:249
191
  msgid "last week"
192
- msgstr ""
193
 
194
  #: rotatingtweets.php:250
195
  msgid "about a week ago"
196
  msgid_plural "about %d weeks ago"
197
- msgstr[0] ""
198
- msgstr[1] ""
199
 
200
  #: rotatingtweets.php:251
201
  msgid "last month"
202
- msgstr ""
203
 
204
  #: rotatingtweets.php:252
205
  msgid "about a month ago"
206
  msgid_plural "about %d months ago"
207
- msgstr[0] ""
208
- msgstr[1] ""
209
 
210
  #: rotatingtweets.php:253
211
  msgid "last year"
212
- msgstr ""
213
 
214
  #: rotatingtweets.php:254
215
  msgid "about a year ago"
216
  msgid_plural "about %d years ago"
217
- msgstr[0] ""
218
- msgstr[1] ""
219
 
220
  #: rotatingtweets.php:261
221
  msgctxt "abbreviated timestamp in seconds"
@@ -416,7 +416,7 @@ msgstr ""
416
 
417
  #: rotatingtweets.php:910
418
  msgid "from <a href='%1$s' title='%2$s'>%2$s's Twitter</a>"
419
- msgstr ""
420
 
421
  #: rotatingtweets.php:914
422
  msgid "via %s"
@@ -444,7 +444,7 @@ msgstr ""
444
 
445
  #: rotatingtweets.php:986
446
  msgid "Follow @%s"
447
- msgstr "@%s folgen"
448
 
449
  #. Plugin Name of the plugin/theme
450
  msgid "Rotating Tweets (Twitter widget & shortcode)"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-06-17 22:44-0000\n"
12
  "Last-Translator: Martin Tod <martin@martintod.org.uk>\n"
13
  "Language-Team: \n"
14
  "X-Generator: Poedit 1.5.5\n"
159
 
160
  #: rotatingtweets.php:242
161
  msgid "less than a second ago"
162
+ msgstr "Minder dan een seconde geleden"
163
 
164
  #: rotatingtweets.php:243
165
  msgid "%d seconds ago"
166
+ msgstr "%d seconden geleden"
167
 
168
  #: rotatingtweets.php:244
169
  msgid "about a minute ago"
170
  msgid_plural "about %d minutes ago"
171
+ msgstr[0] "Ongeveer een minuut geleden"
172
+ msgstr[1] "Ongeveer %d minuten geleden"
173
 
174
  #: rotatingtweets.php:245 rotatingtweets.php:247
175
  msgid "about an hour ago"
176
  msgid_plural "about %d hours ago"
177
+ msgstr[0] "Ongeveer een uur geleden"
178
+ msgstr[1] "Ongeveer %d uur geleden"
179
 
180
  #: rotatingtweets.php:246
181
  msgid "yesterday"
182
+ msgstr "Gisteren"
183
 
184
  #: rotatingtweets.php:248
185
  msgid "about a day ago"
186
  msgid_plural "about %d days ago"
187
+ msgstr[0] "Ongeveer een dag geleden"
188
+ msgstr[1] "Ongeveer %d dagen geleden"
189
 
190
  #: rotatingtweets.php:249
191
  msgid "last week"
192
+ msgstr "Vorige week"
193
 
194
  #: rotatingtweets.php:250
195
  msgid "about a week ago"
196
  msgid_plural "about %d weeks ago"
197
+ msgstr[0] "Ongeveer een week geleden"
198
+ msgstr[1] "Ongeveer %d weken geleden"
199
 
200
  #: rotatingtweets.php:251
201
  msgid "last month"
202
+ msgstr "Vorige maand"
203
 
204
  #: rotatingtweets.php:252
205
  msgid "about a month ago"
206
  msgid_plural "about %d months ago"
207
+ msgstr[0] "Ongeveer een maand geleden"
208
+ msgstr[1] "Ongeveer %d maanden geleden"
209
 
210
  #: rotatingtweets.php:253
211
  msgid "last year"
212
+ msgstr "Vorig jaar"
213
 
214
  #: rotatingtweets.php:254
215
  msgid "about a year ago"
216
  msgid_plural "about %d years ago"
217
+ msgstr[0] "Ongeveer een jaar geleden"
218
+ msgstr[1] "Ongeveer %d jaar geleden"
219
 
220
  #: rotatingtweets.php:261
221
  msgctxt "abbreviated timestamp in seconds"
416
 
417
  #: rotatingtweets.php:910
418
  msgid "from <a href='%1$s' title='%2$s'>%2$s's Twitter</a>"
419
+ msgstr "op <a href='%1$s' title='%2$s'>%2$s's Twitter</a>"
420
 
421
  #: rotatingtweets.php:914
422
  msgid "via %s"
444
 
445
  #: rotatingtweets.php:986
446
  msgid "Follow @%s"
447
+ msgstr "@%s volgen"
448
 
449
  #. Plugin Name of the plugin/theme
450
  msgid "Rotating Tweets (Twitter widget & shortcode)"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mpntod
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
4
  Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual,responsive
5
  Requires at least: 2.6
6
- Tested up to: 3.5.1
7
- Stable tag: 1.4.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -31,7 +31,7 @@ Currently the following languages are available:
31
  * German *(basic tweet display only)*
32
  * Spanish *(basic tweet display only)*
33
  * Italian *(basic tweet display only)*
34
- * Dutch *(basic tweet display only)*
35
  * French *(almost complete - many thanks to [Alexandre Trudel](http://wordpress.org/support/profile/alexandretrudel) for his help on this)*
36
 
37
  If you have made the plug-in work in your language, please send the translations you'd like to see or, even better, the relevant [gettext PO and MO files](http://codex.wordpress.org/I18n_for_WordPress_Developers) to [me](http://www.martintod.org.uk/contact-martin/) and I will then share them with everyone else. You can download [the latest POT file](http://plugins.svn.wordpress.org/rotatingtweets/trunk/languages/rotatingtweets.pot), and [PO files in each language](http://plugins.svn.wordpress.org/rotatingtweets/trunk/languages/) from this site. You may find [Poedit](http://www.poedit.net/) rather useful for translation and creation of PO and MO files - although the PO files themselves are quite simple text files and can be edited in Notepad or [Notepad++](http://notepad-plus-plus.org/).
@@ -108,7 +108,7 @@ Try something like:
108
  `<?php echo do_shortcode( "[rotatingtweets screen_name='your_twitter']" ) ?>`
109
 
110
  = How can I pull information from two accounts into one widget =
111
- The easiest way is to use a search term like `'from:account1 OR from:account2'`.
112
 
113
  = How often does the plug-in call Twitter =
114
  In most cases, each use (or "instance") of this plug-in gets data from Twitter every 2 minutes. The exception is when two or more instances share the same settings (screen name etc.), in which case they share the same data rather than each calling it separately.
@@ -162,10 +162,20 @@ into your CSS - changing `123px;` to the width you're aiming at - either via put
162
  You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
163
 
164
  == Upgrade notice ==
165
- = 1.4.7 =
166
- * HTML5 compliance and improved rate-limiting. If you are using a version before 0.700, you will need to upgrade to a more recent version for Rotating Tweets to keep accessing Twitter after May 7, 2013.
167
 
168
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
169
  = 1.4.7 =
170
  * HTML5 compliance
171
  * Improved rate-limiting
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9XCNM4QSVHYT8
4
  Tags: shortcode,widget,twitter,rotating,rotate,rotator,tweet,tweets,animation,jquery,jquery cycle,cycle,multilingual,responsive
5
  Requires at least: 2.6
6
+ Tested up to: 3.6
7
+ Stable tag: 1.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
31
  * German *(basic tweet display only)*
32
  * Spanish *(basic tweet display only)*
33
  * Italian *(basic tweet display only)*
34
+ * Dutch *(public facing translation complete - many thanks to Natasja Weijer for her help on this)*
35
  * French *(almost complete - many thanks to [Alexandre Trudel](http://wordpress.org/support/profile/alexandretrudel) for his help on this)*
36
 
37
  If you have made the plug-in work in your language, please send the translations you'd like to see or, even better, the relevant [gettext PO and MO files](http://codex.wordpress.org/I18n_for_WordPress_Developers) to [me](http://www.martintod.org.uk/contact-martin/) and I will then share them with everyone else. You can download [the latest POT file](http://plugins.svn.wordpress.org/rotatingtweets/trunk/languages/rotatingtweets.pot), and [PO files in each language](http://plugins.svn.wordpress.org/rotatingtweets/trunk/languages/) from this site. You may find [Poedit](http://www.poedit.net/) rather useful for translation and creation of PO and MO files - although the PO files themselves are quite simple text files and can be edited in Notepad or [Notepad++](http://notepad-plus-plus.org/).
108
  `<?php echo do_shortcode( "[rotatingtweets screen_name='your_twitter']" ) ?>`
109
 
110
  = How can I pull information from two accounts into one widget =
111
+ The easiest way is to use a search term like `'from:account1 OR from:account2'`. There's a list of advanced Twitter search options at https://support.twitter.com/articles/71577-using-advanced-search
112
 
113
  = How often does the plug-in call Twitter =
114
  In most cases, each use (or "instance") of this plug-in gets data from Twitter every 2 minutes. The exception is when two or more instances share the same settings (screen name etc.), in which case they share the same data rather than each calling it separately.
162
  You can do this by going to the `rotatingtweets/css` directory and renaming `rotatingtweets-sample.css` to `rotatingtweets.css` and putting it in the `wp-content/uploads/` directory. This displays a Twitter bird to the left of your tweets. Any CSS you put into `rotatingtweets.css` won't be overwritten when the plug-in is upgraded to the latest version.
163
 
164
  == Upgrade notice ==
165
+ = 1.5.0 =
166
+ * Added `Carousel` rotation option and beta support for version 2 of JQuery Cycle
167
 
168
  == Changelog ==
169
+ = 1.5.0 =
170
+ * Added `Carousel` rotation option and beta support for [version 2 of JQuery Cycle](http://jquery.malsup.com/cycle2/)
171
+ * Added `link_all_text` shortcode tag and functionality
172
+ * Added richer debug information
173
+ * Corrected API expiry date
174
+ * Added missing `alt` tag
175
+ * Kept CSS permanently in the header to maintain HTML capability
176
+ * Public facing Dutch translation complete - many thanks to Natasja Weijer for her help on this
177
+ * Attempt to fix clash with [Avada](http://themeforest.net/item/avada-responsive-multipurpose-theme/2833226) and [Gleam](http://www.elegantthemes.com/gallery/gleam/) themes
178
+
179
  = 1.4.7 =
180
  * HTML5 compliance
181
  * Improved rate-limiting
rotatingtweets.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Rotating Tweets (Twitter widget & shortcode)
4
  Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
5
- Version: 1.4.7
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
@@ -247,13 +247,7 @@ class rotatingtweets_Widget extends WP_Widget {
247
  <?php
248
  # For reference, all the rotations that look good.
249
  # $goodRotations = array('blindX','blindY','blindZ','cover','curtainY','fade','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','toss','turnUp','turnDown','uncover');
250
- $rotationoptions = array (
251
- 'scrollUp' => __('Scroll Up','rotatingtweets'),
252
- 'scrollDown' => __('Scroll Down','rotatingtweets'),
253
- 'scrollLeft' => __('Scroll Left','rotatingtweets'),
254
- 'scrollRight' => __('Scroll Right','rotatingtweets'),
255
- 'fade' => __('Fade','rotatingtweets')
256
- );
257
  asort($rotationoptions);
258
  ?>
259
  <p><label for="<?php echo $this->get_field_id('tw_rotation_type'); ?>"><?php _e('Type of rotation','rotatingtweets'); ?> <select id="<?php echo $this->get_field_id('tw_rotation_type'); ?>" name="<?php echo $this->get_field_name('tw_rotation_type');?>">
@@ -391,7 +385,11 @@ function rotatingtweets_user_intent($person,$lang,$linkcontent,$targetvalue='')
391
  $return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr($person['name'])."' lang='{$lang}'{$targetvalue}>";
392
  switch($linkcontent){
393
  case 'icon':
394
- $return .= "<img src='{$person['profile_image_url']}' alt='".esc_attr($person['name'])."' /></a>";
 
 
 
 
395
  break;
396
  case 'name':
397
  $return .= $person['name']."</a>";
@@ -401,10 +399,10 @@ function rotatingtweets_user_intent($person,$lang,$linkcontent,$targetvalue='')
401
  break;
402
  case 'blue_bird':
403
  $return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr(sprintf(__('Follow @%s','rotatingtweets'),$person['name']))."' lang='{$lang}'{$targetvalue}>";
404
- $return .= '<img src="'.plugins_url('images/bird_blue_32.png', __FILE__).'" class="twitter_icon" /></a>';
405
  break;
406
  default:
407
- $return .= $linkcontent."</a>";
408
  break;
409
  }
410
  return ($return);
@@ -481,6 +479,7 @@ function rotatingtweets_display_shortcode( $atts, $content=null, $code="", $prin
481
  'prev' => __('prev','rotatingtweets'),
482
  'middot' => ' &middot; ',
483
  'np_pos' => 'top',
 
484
  'no_rotate' => FALSE
485
  ), $atts ) ;
486
  extract($args);
@@ -513,13 +512,9 @@ function rotatingtweets_settings_check() {
513
  endif;
514
  $optionslink = 'options-general.php?page=rotatingtweets';
515
  if(empty($apistring)):
516
- if(time() > strtotime('6-May-2013')):
517
- $msgString = __('Please update <a href="%2$s">your settings for Rotating Tweets</a>. The Twitter API <a href="%1$s">changed on May 7, 2013</a> and new settings are needed for Rotating Tweets to continue working.','rotatingtweets');
518
- else:
519
- $msgString = __('Please update <a href="%2$s">your settings for Rotating Tweets</a>. The Twitter API will <a href="%1$s">be changing on May 7, 2013</a> and new settings are needed for Rotating Tweets to continue working after the API changes.','rotatingtweets');
520
- endif;
521
  // add_settings_error( 'rotatingtweets_settings_needed', esc_attr('rotatingtweets_settings_needed'), sprintf($msgString,'https://dev.twitter.com/calendar',$optionslink), 'error');
522
- echo "<div class='error'><p><strong>".sprintf($msgString,'https://dev.twitter.com/calendar',$optionslink)."</strong></p></div>";
523
  elseif($error[0]['code'] == 32 ):
524
  // add_settings_error( 'rotatingtweets_settings_needed', esc_attr('rotatingtweets_settings_needed'), sprintf(__('Please update <a href="%1$s">your settings for Rotating Tweets</a>. Currently Twitter cannot authenticate you with the details you have given.','rotatingtweets'),$optionslink), 'error');
525
  echo "<div class='error'><p><strong>".sprintf(__('Please update <a href="%1$s">your settings for Rotating Tweets</a>. Currently Rotating Tweets cannot authenticate you with Twitter using the details you have given.','rotatingtweets'),$optionslink)."</strong></p></div>";
@@ -566,6 +561,10 @@ function rotatingtweets_admin_init(){
566
  add_settings_field('rotatingtweets_token', __('Twitter API Access Token','rotatingtweets'), 'rotatingtweets_option_show_token', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
567
  add_settings_field('rotatingtweets_token_secret', __('Twitter API Access Token Secret','rotatingtweets'), 'rotatingtweets_option_show_token_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
568
  add_settings_field('rotatingtweets_ssl_verify', __('Verify SSL connection to Twitter','rotatingtweets'), 'rotatingtweets_option_show_ssl_verify','rotatingtweets_api_settings','rotatingtweets_api_main');
 
 
 
 
569
  }
570
  function rotatingtweets_option_show_key() {
571
  $options = get_option('rotatingtweets-api-settings');
@@ -600,9 +599,31 @@ function rotatingtweets_option_show_ssl_verify() {
600
  }
601
  echo "\n</select>";
602
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  // Explanatory text
604
  function rotatingtweets_api_explanation() {
605
 
 
 
 
 
606
  };
607
  // validate our options
608
  function rotatingtweets_api_validate($input) {
@@ -642,6 +663,12 @@ function rotatingtweets_api_validate($input) {
642
  else:
643
  $options['ssl_verify_off']=false;
644
  endif;
 
 
 
 
 
 
645
  // Now a proper test
646
  if(empty($error)):
647
  $test = rotatingtweets_call_twitter_API('statuses/user_timeline',NULL,$options);
@@ -661,16 +688,16 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
661
  if(!empty($api)):
662
  $connection = new wp_TwitterOAuth($api['key'], $api['secret'], $api['token'], $api['token_secret'] );
663
  // $result = $connection->get('statuses/user_timeline', $options);
664
- if(WP_DEBUG):
665
  echo "\n<!-- Using OAuth - version 1.1 of API - ".esc_attr($command)." -->\n";
666
  endif;
667
  if(isset($api['ssl_verify_off']) && $api['ssl_verify_off']):
668
- if(WP_DEBUG):
669
  echo "\n<!-- NOT verifying SSL peer -->\n";
670
  endif;
671
  $connection->ssl_verifypeer = FALSE;
672
  else:
673
- if(WP_DEBUG):
674
  echo "\n<!-- Verifying SSL peer -->\n";
675
  endif;
676
  $connection->ssl_verifypeer = TRUE;
@@ -694,7 +721,7 @@ function rotatingtweets_call_twitter_API($command,$options = NULL,$api = NULL )
694
  $apicall = "http://search.twitter.com/search.json";
695
  endif;
696
  if(!empty($string)) $apicall .= "?".implode('&',$string);
697
- if(WP_DEBUG) echo "<!-- Using version 1 of API - calling string ".esc_attr($apicall)." -->";
698
  $result = wp_remote_request($apicall);
699
  endif;
700
  if(!is_wp_error($result)):
@@ -891,6 +918,7 @@ function rotatingtweets_get_tweets($tw_screen_name,$tw_include_rts,$tw_exclude_r
891
  function rotatingtweets_get_rate_data() {
892
  // $callstring = "http://api.twitter.com/1/account/rate_limit_status.json";
893
  // $command = 'account/rate_limit_status';
 
894
  $ratedata = rotatingtweets_call_twitter_API('application/rate_limit_status',array('resources'=>'statuses'));
895
  // $ratedata = wp_remote_request($callstring);
896
  if(!is_wp_error($ratedata)):
@@ -899,8 +927,16 @@ function rotatingtweets_get_rate_data() {
899
  $newrate['hourly_limit']=$rate['resources']['statuses']['/statuses/user_timeline']['limit'];
900
  $newrate['remaining_hits']=$rate['resources']['statuses']['/statuses/user_timeline']['remaining'];
901
  $newrate['reset_time_in_seconds']=$rate['resources']['statuses']['/statuses/user_timeline']['reset'];
 
 
 
 
902
  return($newrate);
903
  else:
 
 
 
 
904
  return($rate);
905
  endif;
906
  else:
@@ -930,6 +966,7 @@ function rotatingtweets_get_twitter_language() {
930
  if($timegap > $cache_delay):
931
  // $callstring = "https://api.twitter.com/1/help/languages.json";
932
  // $twitterdata = wp_remote_request($callstring);
 
933
  $twitterdata = rotatingtweets_call_twitter_API('help/languages');
934
  if(!is_wp_error($twitterdata)):
935
  $twitterjson = json_decode($twitterdata['body'],TRUE);
@@ -949,6 +986,7 @@ function rotatingtweets_get_twitter_language() {
949
  $option['languages']=$latest_languages;
950
  $option['datetime']=time();
951
  update_option($optionname,$option);
 
952
  endif;
953
  endif;
954
  else:
@@ -998,8 +1036,9 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
998
  # Default
999
  $twitterlocale = 'en';
1000
  endif;
1001
- # All the valid rotations - if people to use one that looks weird, that's their business!
1002
- $possibleRotations = array('blindX','blindY','blindZ','cover','curtainX','curtainY','fade','fadeZoom','growX','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','slideX','slideY','toss','turnUp','turnDown','turnLeft','turnRight','uncover','wipe','zoom');
 
1003
  foreach($possibleRotations as $possibleRotation):
1004
  if(strtolower($args['rotation_type']) == strtolower($possibleRotation)) $rotation_type = $possibleRotation;
1005
  endforeach;
@@ -1018,10 +1057,34 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
1018
  else:
1019
  $rotclass = 'rotatingtweets';
1020
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1021
  if(WP_DEBUG):
1022
- $result .= "\n<div class='$rotclass wp_debug rotatingtweets_format_".+intval($args['official_format'])."' id='$id'>";
1023
  else:
1024
- $result .= "\n<div class='$rotclass rotatingtweets_format_".+intval($args['official_format'])."' id='$id'>";
1025
  endif;
1026
  $error = get_option('rotatingtweets_api_error');
1027
  if(!empty($error)):
@@ -1086,7 +1149,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
1086
  foreach($json as $twitter_object):
1087
  $tweet_counter++;
1088
  if($tweet_counter <= $tweet_count):
1089
- if($tweet_counter == 1 || ( isset($args['no_rotate']) && $args['no_rotate'] ) ):
1090
  $result .= "\n\t<div class = 'rotatingtweet'>";
1091
  else:
1092
  $result .= "\n\t<div class = 'rotatingtweet' style='display:none'>";
@@ -1178,7 +1241,9 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
1178
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
1179
  $after[]='<a href="http://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
1180
  $main_text = preg_replace($before,$after,$main_text);
1181
-
 
 
1182
  # Now for the meta text
1183
  switch ($args['official_format']) {
1184
  case 0:
@@ -1324,7 +1389,7 @@ function rotating_tweets_display($json,$args,$print=TRUE) {
1324
  $result .= "<!-- rotatingtweets plugin was unable to parse this data: ".print_r($json,TRUE)." -->";
1325
  $result .= "\n\t\t<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".__("Please check the comments on this page's HTML to understand more.",'rotatingtweets')."</p>";
1326
  endif;
1327
- $result .= "\n\t</div>";
1328
  endif;
1329
  endforeach;
1330
  endif;
@@ -1358,8 +1423,43 @@ function rotatingtweets_init() {
1358
  }
1359
  add_action('plugins_loaded', 'rotatingtweets_init');
1360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1361
  function rotatingtweets_enqueue_scripts() {
1362
  wp_enqueue_script( 'jquery' );
 
 
 
1363
  # Check for evil plug-ins
1364
  if ( ! function_exists( 'is_plugin_active' ) )
1365
  require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
@@ -1370,29 +1470,57 @@ function rotatingtweets_enqueue_scripts() {
1370
  } else {
1371
  $dependence = array('jquery');
1372
  }
1373
- # Get Stylesheet
1374
- $style = get_stylesheet();
1375
- switch ($style):
1376
- case 'bremen_theme':
1377
- case 'zeebizzcard':
1378
- // case 'zeeStyle':
1379
- wp_dequeue_script( 'zee_jquery-cycle');
1380
- wp_enqueue_script( 'zee_jquery-cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
1381
- $dependence[]='zee_jquery-cycle';
1382
- wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
1383
- break;
1384
- case 'oxygen':
1385
- wp_dequeue_script( 'oxygen_cycle');
1386
- wp_enqueue_script( 'oxygen_cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
1387
- $dependence[]='oxygen_cycle';
1388
- wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
1389
- break;
1390
- default:
1391
- wp_enqueue_script( 'jquery-cycle', plugins_url('js/jquery.cycle.all.min.js', __FILE__),$dependence,FALSE,FALSE );
1392
- $dependence[]='jquery-cycle';
1393
- wp_enqueue_script( 'rotating_tweet', plugins_url('js/rotating_tweet.js', __FILE__),$dependence,FALSE,FALSE );
1394
- break;
1395
- endswitch;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1396
  wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
1397
  $uploads = wp_upload_dir();
1398
  $personalstyle = array(
@@ -1409,11 +1537,20 @@ function rotatingtweets_enqueue_scripts() {
1409
  endif;
1410
  endforeach;
1411
  }
1412
-
1413
  function rotatingtweets_enqueue_admin_scripts($hook) {
1414
  if( 'widgets.php' != $hook ) return;
1415
  wp_enqueue_script( 'jquery' );
1416
  wp_enqueue_script( 'rotating_tweet_admin', plugins_url('js/rotating_tweet_admin.js', __FILE__),array('jquery'),FALSE,FALSE );
1417
  }
1418
  add_action( 'admin_enqueue_scripts', 'rotatingtweets_enqueue_admin_scripts' );
 
 
 
 
 
 
 
 
 
 
1419
  ?>
2
  /*
3
  Plugin Name: Rotating Tweets (Twitter widget & shortcode)
4
  Description: Replaces a shortcode such as [rotatingtweets screen_name='your_twitter_name'], or a widget, with a rotating tweets display
5
+ Version: 1.5.0
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
247
  <?php
248
  # For reference, all the rotations that look good.
249
  # $goodRotations = array('blindX','blindY','blindZ','cover','curtainY','fade','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','toss','turnUp','turnDown','uncover');
250
+ $rotationoptions = rotatingtweets_possible_rotations(true);
 
 
 
 
 
 
251
  asort($rotationoptions);
252
  ?>
253
  <p><label for="<?php echo $this->get_field_id('tw_rotation_type'); ?>"><?php _e('Type of rotation','rotatingtweets'); ?> <select id="<?php echo $this->get_field_id('tw_rotation_type'); ?>" name="<?php echo $this->get_field_name('tw_rotation_type');?>">
385
  $return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr($person['name'])."' lang='{$lang}'{$targetvalue}>";
386
  switch($linkcontent){
387
  case 'icon':
388
+ if(isset($_SERVER['HTTPS'])):
389
+ $return .= "<img src='{$person['profile_image_url_https']}' alt='".esc_attr($person['name'])."' /></a>";
390
+ else:
391
+ $return .= "<img src='{$person['profile_image_url']}' alt='".esc_attr($person['name'])."' /></a>";
392
+ endif;
393
  break;
394
  case 'name':
395
  $return .= $person['name']."</a>";
399
  break;
400
  case 'blue_bird':
401
  $return = "<a href='https://twitter.com/intent/user?user_id={$person['id']}' title='".esc_attr(sprintf(__('Follow @%s','rotatingtweets'),$person['name']))."' lang='{$lang}'{$targetvalue}>";
402
+ $return .= '<img src="'.plugins_url('images/bird_blue_32.png', __FILE__).'" class="twitter_icon" alt="'.__('Twitter','rotatingtweets').'" /></a>';
403
  break;
404
  default:
405
+ $return .= strip_tags($linkcontent,'<img>')."</a>";
406
  break;
407
  }
408
  return ($return);
479
  'prev' => __('prev','rotatingtweets'),
480
  'middot' => ' &middot; ',
481
  'np_pos' => 'top',
482
+ 'link_all_text' => FALSE,
483
  'no_rotate' => FALSE
484
  ), $atts ) ;
485
  extract($args);
512
  endif;
513
  $optionslink = 'options-general.php?page=rotatingtweets';
514
  if(empty($apistring)):
515
+ $msgString = __('Please update <a href="%2$s">your settings for Rotating Tweets</a>. The Twitter API <a href="%1$s">changed on June 11, 2013</a> and new settings are needed for Rotating Tweets to continue working.','rotatingtweets');
 
 
 
 
516
  // add_settings_error( 'rotatingtweets_settings_needed', esc_attr('rotatingtweets_settings_needed'), sprintf($msgString,'https://dev.twitter.com/calendar',$optionslink), 'error');
517
+ echo "<div class='error'><p><strong>".sprintf($msgString,'https://dev.twitter.com/blog/api-v1-is-retired',$optionslink)."</strong></p></div>";
518
  elseif($error[0]['code'] == 32 ):
519
  // add_settings_error( 'rotatingtweets_settings_needed', esc_attr('rotatingtweets_settings_needed'), sprintf(__('Please update <a href="%1$s">your settings for Rotating Tweets</a>. Currently Twitter cannot authenticate you with the details you have given.','rotatingtweets'),$optionslink), 'error');
520
  echo "<div class='error'><p><strong>".sprintf(__('Please update <a href="%1$s">your settings for Rotating Tweets</a>. Currently Rotating Tweets cannot authenticate you with Twitter using the details you have given.','rotatingtweets'),$optionslink)."</strong></p></div>";
561
  add_settings_field('rotatingtweets_token', __('Twitter API Access Token','rotatingtweets'), 'rotatingtweets_option_show_token', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
562
  add_settings_field('rotatingtweets_token_secret', __('Twitter API Access Token Secret','rotatingtweets'), 'rotatingtweets_option_show_token_secret', 'rotatingtweets_api_settings', 'rotatingtweets_api_main');
563
  add_settings_field('rotatingtweets_ssl_verify', __('Verify SSL connection to Twitter','rotatingtweets'), 'rotatingtweets_option_show_ssl_verify','rotatingtweets_api_settings','rotatingtweets_api_main');
564
+ // if(WP_DEBUG):
565
+ add_settings_section('rotatingtweets_jquery_main', __('JQuery Settings','rotatingtweets'), 'rotatingtweets_jquery_explanation', 'rotatingtweets_api_settings');
566
+ add_settings_field('rotatingtweets_jquery_cycle_version', __('Version of JQuery Cycle','rotatingtweets'), 'rotatingtweets_option_show_cycle_version','rotatingtweets_api_settings','rotatingtweets_jquery_main');
567
+ // endif;
568
  }
569
  function rotatingtweets_option_show_key() {
570
  $options = get_option('rotatingtweets-api-settings');
599
  }
600
  echo "\n</select>";
601
  }
602
+ function rotatingtweets_option_show_cycle_version() {
603
+ $options = get_option('rotatingtweets-api-settings');
604
+ $choice = array(
605
+ 1 => _x('Version 1 (default)','Version of JQuery Cycle','rotatingtweets'),
606
+ 2 => _x('Version 2 (beta)','Version of JQuery Cycle','rotatingtweets')
607
+ );
608
+ echo "\n<select id='rotatingtweets_api_jqery_cycle_version_input' name='rotatingtweets-api-settings[jquery_cycle_version]'>";
609
+ if(!isset($options['jquery_cycle_version'])) $options['jquery_cycle_version'] = 1;
610
+ foreach($choice as $value => $text) {
611
+ if($options['jquery_cycle_version'] == $value ) {
612
+ $selected = 'selected = "selected"';
613
+ } else {
614
+ $selected = '';
615
+ }
616
+ echo "\n\t<option value='".$value."'".$selected.">".$text."</option>";
617
+ }
618
+ echo "\n</select>";
619
+ }
620
  // Explanatory text
621
  function rotatingtweets_api_explanation() {
622
 
623
+ };
624
+ // Explanatory text
625
+ function rotatingtweets_jquery_explanation() {
626
+ _e('This section is experimental and currently only displays if WP_DEBUG is set','rotatingtweets');
627
  };
628
  // validate our options
629
  function rotatingtweets_api_validate($input) {
663
  else:
664
  $options['ssl_verify_off']=false;
665
  endif;
666
+ // Check 'jquery_cycle_version'
667
+ if(isset($input['jquery_cycle_version'])):
668
+ $options['jquery_cycle_version']=max(min(absint($input['jquery_cycle_version']),2),1);
669
+ else:
670
+ $options['jquery_cycle_version']=1;
671
+ endif;
672
  // Now a proper test
673
  if(empty($error)):
674
  $test = rotatingtweets_call_twitter_API('statuses/user_timeline',NULL,$options);
688
  if(!empty($api)):
689
  $connection = new wp_TwitterOAuth($api['key'], $api['secret'], $api['token'], $api['token_secret'] );
690
  // $result = $connection->get('statuses/user_timeline', $options);
691
+ if(WP_DEBUG && ! is_admin()):
692
  echo "\n<!-- Using OAuth - version 1.1 of API - ".esc_attr($command)." -->\n";
693
  endif;
694
  if(isset($api['ssl_verify_off']) && $api['ssl_verify_off']):
695
+ if(WP_DEBUG && ! is_admin() ):
696
  echo "\n<!-- NOT verifying SSL peer -->\n";
697
  endif;
698
  $connection->ssl_verifypeer = FALSE;
699
  else:
700
+ if(WP_DEBUG && ! is_admin() ):
701
  echo "\n<!-- Verifying SSL peer -->\n";
702
  endif;
703
  $connection->ssl_verifypeer = TRUE;
721
  $apicall = "http://search.twitter.com/search.json";
722
  endif;
723
  if(!empty($string)) $apicall .= "?".implode('&',$string);
724
+ if(WP_DEBUG && ! is_admin() ) echo "<!-- Using version 1 of API - calling string ".esc_attr($apicall)." -->";
725
  $result = wp_remote_request($apicall);
726
  endif;
727
  if(!is_wp_error($result)):
918
  function rotatingtweets_get_rate_data() {
919
  // $callstring = "http://api.twitter.com/1/account/rate_limit_status.json";
920
  // $command = 'account/rate_limit_status';
921
+ if(WP_DEBUG) echo "<!-- Retrieving Rate Data \n";
922
  $ratedata = rotatingtweets_call_twitter_API('application/rate_limit_status',array('resources'=>'statuses'));
923
  // $ratedata = wp_remote_request($callstring);
924
  if(!is_wp_error($ratedata)):
927
  $newrate['hourly_limit']=$rate['resources']['statuses']['/statuses/user_timeline']['limit'];
928
  $newrate['remaining_hits']=$rate['resources']['statuses']['/statuses/user_timeline']['remaining'];
929
  $newrate['reset_time_in_seconds']=$rate['resources']['statuses']['/statuses/user_timeline']['reset'];
930
+ if(WP_DEBUG):
931
+ print_r($newrate);
932
+ echo "\n -->";
933
+ endif;
934
  return($newrate);
935
  else:
936
+ if(WP_DEBUG):
937
+ print_r($rate);
938
+ echo "\n -->";
939
+ endif;
940
  return($rate);
941
  endif;
942
  else:
966
  if($timegap > $cache_delay):
967
  // $callstring = "https://api.twitter.com/1/help/languages.json";
968
  // $twitterdata = wp_remote_request($callstring);
969
+ if(WP_DEBUG) echo "<!-- Retrieving Twitter Language Options -->";
970
  $twitterdata = rotatingtweets_call_twitter_API('help/languages');
971
  if(!is_wp_error($twitterdata)):
972
  $twitterjson = json_decode($twitterdata['body'],TRUE);
986
  $option['languages']=$latest_languages;
987
  $option['datetime']=time();
988
  update_option($optionname,$option);
989
+ if(WP_DEBUG) echo "<!-- ".count($option['languages'])." language options successfully retrieved -->";
990
  endif;
991
  endif;
992
  else:
1036
  # Default
1037
  $twitterlocale = 'en';
1038
  endif;
1039
+ # Now get the possible rotationgs that are permitted
1040
+ $api = get_option('rotatingtweets-api-settings');
1041
+ $possibleRotations = rotatingtweets_possible_rotations();
1042
  foreach($possibleRotations as $possibleRotation):
1043
  if(strtolower($args['rotation_type']) == strtolower($possibleRotation)) $rotation_type = $possibleRotation;
1044
  endforeach;
1057
  else:
1058
  $rotclass = 'rotatingtweets';
1059
  endif;
1060
+ # Now set all the version 2 options
1061
+ $v2string = '';
1062
+ if(isset($api['jquery_cycle_version']) && $api['jquery_cycle_version'] == 2):
1063
+ $v2options = array(
1064
+ 'auto-height' => 'calc',
1065
+ 'fx' => $rotation_type,
1066
+ 'pause-on-hover' => 'true',
1067
+ 'timeout' => $timeout,
1068
+ 'speed' => 1000,
1069
+ 'easing' => 'swing',
1070
+ 'slides'=> 'div.rotatingtweet'
1071
+ );
1072
+ if(! WP_DEBUG) $v2options['log'] = 'false';
1073
+ if($rotation_type == 'carousel'):
1074
+ $v2options['carousel-vertical'] = 'true';
1075
+ $v2options['carousel-visible'] = 3;
1076
+ endif;
1077
+ $v2stringelements = array();
1078
+ foreach ($v2options as $name => $value) {
1079
+ $v2stringelements[] = ' data-cycle-'.$name.'="'.$value.'"';
1080
+ }
1081
+ $v2string = implode(' ',$v2stringelements);
1082
+ endif;
1083
+ # Now finalise things
1084
  if(WP_DEBUG):
1085
+ $result .= "\n<div class='$rotclass wp_debug rotatingtweets_format_".+intval($args['official_format'])."' id='$id'$v2string>";
1086
  else:
1087
+ $result .= "\n<div class='$rotclass rotatingtweets_format_".+intval($args['official_format'])."' id='$id'$v2string>";
1088
  endif;
1089
  $error = get_option('rotatingtweets_api_error');
1090
  if(!empty($error)):
1149
  foreach($json as $twitter_object):
1150
  $tweet_counter++;
1151
  if($tweet_counter <= $tweet_count):
1152
+ if($tweet_counter == 1 || ( isset($args['no_rotate']) && $args['no_rotate'] ) || $rotation_type == 'carousel' ):
1153
  $result .= "\n\t<div class = 'rotatingtweet'>";
1154
  else:
1155
  $result .= "\n\t<div class = 'rotatingtweet' style='display:none'>";
1241
  $before[]="%#\b(\d*[^\d\s[:punct:]]+[^\s[:punct:]]*)%";
1242
  $after[]='<a href="http://twitter.com/search?q=%23$1&amp;src=hash" title="#$1"'.$targetvalue.'>#$1</a>';
1243
  $main_text = preg_replace($before,$after,$main_text);
1244
+ if(isset($args['link_all_text']) && $args['link_all_text']):
1245
+ $main_text = rotatingtweets_user_intent($tweetuser,$twitterlocale,$main_text,$targetvalue);
1246
+ endif;
1247
  # Now for the meta text
1248
  switch ($args['official_format']) {
1249
  case 0:
1389
  $result .= "<!-- rotatingtweets plugin was unable to parse this data: ".print_r($json,TRUE)." -->";
1390
  $result .= "\n\t\t<div class = 'rotatingtweet' style='display:none'><p class='rtw_main'>".__("Please check the comments on this page's HTML to understand more.",'rotatingtweets')."</p>";
1391
  endif;
1392
+ $result .= "</div>";
1393
  endif;
1394
  endforeach;
1395
  endif;
1423
  }
1424
  add_action('plugins_loaded', 'rotatingtweets_init');
1425
 
1426
+ function rotatingtweets_possible_rotations($dropbox = FALSE) {
1427
+ # Check if we're using jQuery Cycle 1 or 2 - sends back response for validity checking or raw data for a drop down box
1428
+ $api = get_option('rotatingtweets-api-settings');
1429
+ if(isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2):
1430
+ if($dropbox):
1431
+ $possibleRotations = array (
1432
+ 'scrollUp' => __('Scroll Up','rotatingtweets'),
1433
+ 'scrollDown' => __('Scroll Down','rotatingtweets'),
1434
+ 'scrollLeft' => __('Scroll Left','rotatingtweets'),
1435
+ 'scrollRight' => __('Scroll Right','rotatingtweets'),
1436
+ 'fade' => __('Fade','rotatingtweets'),
1437
+ 'carousel' => __('Carousel','rotatingtweets')
1438
+ );
1439
+ else:
1440
+ $possibleRotations = array('scrollUp','scrollDown','scrollHorz','scrollLeft','scrollRight','toss','scrollVert','fade','carousel');
1441
+ endif;
1442
+ else:
1443
+ if($dropbox):
1444
+ $possibleRotations = array (
1445
+ 'scrollUp' => __('Scroll Up','rotatingtweets'),
1446
+ 'scrollDown' => __('Scroll Down','rotatingtweets'),
1447
+ 'scrollLeft' => __('Scroll Left','rotatingtweets'),
1448
+ 'scrollRight' => __('Scroll Right','rotatingtweets'),
1449
+ 'fade' => __('Fade','rotatingtweets')
1450
+ );
1451
+ else:
1452
+ $possibleRotations = array('blindX','blindY','blindZ','cover','curtainX','curtainY','fade','fadeZoom','growX','growY','none','scrollUp','scrollDown','scrollLeft','scrollRight','scrollHorz','scrollVert','shuffle','slideX','slideY','toss','turnUp','turnDown','turnLeft','turnRight','uncover','wipe','zoom');
1453
+ endif;
1454
+ endif;
1455
+ return($possibleRotations);
1456
+ }
1457
+
1458
  function rotatingtweets_enqueue_scripts() {
1459
  wp_enqueue_script( 'jquery' );
1460
+ # Set the base versions of the strings
1461
+ $cyclejsfile = 'js/jquery.cycle.all.min.js';
1462
+ $rotatingtweetsjsfile = 'js/rotating_tweet.js';
1463
  # Check for evil plug-ins
1464
  if ( ! function_exists( 'is_plugin_active' ) )
1465
  require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
1470
  } else {
1471
  $dependence = array('jquery');
1472
  }
1473
+ # Check if we're using jQuery Cycle 1 or 2
1474
+ $api = get_option('rotatingtweets-api-settings');
1475
+ if(isset($api['jquery_cycle_version']) && $api['jquery_cycle_version']==2):
1476
+ /*
1477
+ 'jquery-easing' => 'http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js',
1478
+ */
1479
+ $rt_enqueue_script_list = array(
1480
+ 'jquery-cycle2' => plugins_url('js/jquery.cycle2.renamed.js', __FILE__),
1481
+ 'jquery-cycle2-scrollvert' => plugins_url('js/jquery.cycle2.scrollVert.renamed.js', __FILE__),
1482
+ 'jquery-cycle2-carousel' => plugins_url('js/jquery.cycle2.carousel.renamed.js', __FILE__),
1483
+ 'rotating_tweet' => plugins_url('js/rotatingtweets_v2.js', __FILE__)
1484
+ );
1485
+ // $dependence[]='jquery-effects-core';
1486
+ foreach($rt_enqueue_script_list as $scriptname => $scriptlocation):
1487
+ wp_enqueue_script($scriptname,$scriptlocation,$dependence,FALSE,FALSE);
1488
+ $dependence[] = $scriptname;
1489
+ endforeach;
1490
+ else:
1491
+ # Get Stylesheet
1492
+ $style = strtolower(get_stylesheet());
1493
+ switch ($style):
1494
+ case 'bremen_theme':
1495
+ case 'zeebizzcard':
1496
+ // case 'zeeStyle':
1497
+ wp_dequeue_script( 'zee_jquery-cycle');
1498
+ wp_enqueue_script( 'zee_jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,FALSE );
1499
+ $dependence[]='zee_jquery-cycle';
1500
+ break;
1501
+ case 'oxygen':
1502
+ wp_dequeue_script( 'oxygen_cycle');
1503
+ wp_enqueue_script( 'oxygen_cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,FALSE );
1504
+ $dependence[]='oxygen_cycle';
1505
+ break;
1506
+ case 'avada':
1507
+ case 'avada child':
1508
+ case 'avada-child-theme':
1509
+ case 'avada child theme':
1510
+ case 'a52cars':
1511
+ wp_dequeue_script( 'jquery.cycle');
1512
+ wp_enqueue_script( 'jquery.cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,FALSE );
1513
+ $dependence[]='jquery.cycle';
1514
+ break;
1515
+ default:
1516
+ wp_enqueue_script( 'jquery-cycle', plugins_url($cyclejsfile, __FILE__),$dependence,FALSE,FALSE );
1517
+ $dependence[]='jquery-cycle';
1518
+ break;
1519
+ endswitch;
1520
+ wp_enqueue_script( 'rotating_tweet', plugins_url($rotatingtweetsjsfile, __FILE__),$dependence,FALSE,FALSE );
1521
+ endif;
1522
+ }
1523
+ function rotatingtweets_enqueue_style() {
1524
  wp_enqueue_style( 'rotatingtweets', plugins_url('css/style.css', __FILE__));
1525
  $uploads = wp_upload_dir();
1526
  $personalstyle = array(
1537
  endif;
1538
  endforeach;
1539
  }
 
1540
  function rotatingtweets_enqueue_admin_scripts($hook) {
1541
  if( 'widgets.php' != $hook ) return;
1542
  wp_enqueue_script( 'jquery' );
1543
  wp_enqueue_script( 'rotating_tweet_admin', plugins_url('js/rotating_tweet_admin.js', __FILE__),array('jquery'),FALSE,FALSE );
1544
  }
1545
  add_action( 'admin_enqueue_scripts', 'rotatingtweets_enqueue_admin_scripts' );
1546
+
1547
+ /*
1548
+ Forces the inclusion of Rotating Tweets CSS in the header - irrespective of whether the widget or shortcode is in use. I wouldn't normally do this, but CSS needs to be in the header for HTML5 compliance (at least if the intention is not to break other browsers) - and short-code only pages won't do that without some really time-consuming and complicated code up front to check for this
1549
+ */
1550
+ add_action('wp_enqueue_scripts','rotatingtweets_enqueue_style');
1551
+ // add_action('wp_enqueue_scripts','rotatingtweets_enqueue_scripts'); // Use this if you are loading the tweet page via ajax
1552
+ $style = strtolower(get_stylesheet());
1553
+ if($style == 'gleam'):
1554
+ add_action('wp_enqueue_scripts','rotatingtweets_enqueue_scripts');
1555
+ endif;
1556
  ?>