Rotating Tweets (Twitter widget and shortcode) - Version 1.4.3

Version Description

  • Works with responsive templates. Fixes some styling problems.
Download this release

Release Info

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

Code changes from version 1.4.2 to 1.4.3

Files changed (4) hide show
  1. css/style.css +4 -0
  2. js/rotating_tweet.js +44 -39
  3. readme.txt +7 -3
  4. rotatingtweets.php +1 -1
css/style.css CHANGED
@@ -1,14 +1,18 @@
1
  /* First - sort out the fonts */
 
2
  .widget_rotatingtweets_widget {
3
  width: 100%;
4
  }
 
5
  div.rotatingtweet {
6
  font-size: 100%;
7
  word-wrap: break-word;
8
  }
 
9
  div.rotatingtweets {
10
  clear:both;
11
  }
 
12
  p.rtw_meta,div.rtw_meta,div.rtw_meta_wide,div.rtw_name,div.rtw_id,div.rtw_time_short,div.rtw_rt_meta {
13
  font-size: 0.8em;
14
  line-height: normal;
1
  /* First - sort out the fonts */
2
+ /*
3
  .widget_rotatingtweets_widget {
4
  width: 100%;
5
  }
6
+ */
7
  div.rotatingtweet {
8
  font-size: 100%;
9
  word-wrap: break-word;
10
  }
11
+ /*
12
  div.rotatingtweets {
13
  clear:both;
14
  }
15
+ */
16
  p.rtw_meta,div.rtw_meta,div.rtw_meta_wide,div.rtw_name,div.rtw_id,div.rtw_time_short,div.rtw_rt_meta {
17
  font-size: 0.8em;
18
  line-height: normal;
js/rotating_tweet.js CHANGED
@@ -18,20 +18,22 @@ jQuery(document).ready(function() {
18
  var rt_height_px = 'auto';
19
  /* Now find the widget container width */
20
  // Take the smaller of the parent and grandparent
21
- rt_parent = jQuery(this).parent();
22
- rt_grandparent = rt_parent.parent();
23
  var rt_target_container_width = Math.min (
24
  rt_parent.innerWidth() - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')),
25
  rt_grandparent.innerWidth() - parseFloat(rt_grandparent.css('padding-left')) - parseFloat(rt_grandparent.css('padding-right')) - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')) - parseFloat(rt_parent.css('margin-left')) - parseFloat(rt_parent.css('margin-right'))
26
  );
27
 
28
  // Get the size of the parent box and subtract any padding
29
- var rt_target_width = rt_target_container_width - parseFloat(jQuery(this).css('padding-left')) - parseFloat(jQuery(this).css('padding-right')) - parseFloat(jQuery(this).css('margin-left')) - parseFloat(jQuery(this).css('margin-right')) - parseFloat(jQuery(this).css('border-left')) - parseFloat(jQuery(this).css('border-right'));
30
  var rt_fit = 1;
31
  if( rt_target_width == null ) {
32
  rt_fit = 0;
33
  }
34
  if(rotate_wp_debug) {
 
 
35
  console.log('parent_width = '+rt_parent.innerWidth());
36
  console.log('grandparent_width = '+rt_grandparent.innerWidth());
37
  console.log('rt_target_container_width = '+rt_target_container_width);
@@ -141,25 +143,19 @@ jQuery(document).ready(function() {
141
  console.log('- rt_max_width: ' + rt_max_width);
142
  };
143
  /* Go through the tweets - and set the minimum width */
144
- /*
145
- jQuery(rt_children_id).each(function() {
146
- jQuery(this).width(rt_max_width);
147
- });
148
- */
149
  jQuery(rt_children_id).width(rt_max_width);
150
  /* Go through the tweets - and set the minimum width */
151
- /*
152
- jQuery(rt_children_meta_id).each(function() {
153
- jQuery(this).width(rt_max_width);
154
- });
155
- */
156
  jQuery(rt_children_meta_id).width(rt_max_width);
157
  };
158
- // Now the resizing
159
- var rt_resize_width_old = Math.min (
160
- rt_parent.innerWidth(),
161
- rt_grandparent.innerWidth()
162
- );
 
 
 
 
163
  var rt_resize_target_width = jQuery(rotate_id).width();
164
  var rt_resize_target_main = jQuery(rotate_id + ' .rtw_main').width();
165
  var rt_resize_target_tweet = jQuery(rotate_id + ' .rotatingtweet').width();
@@ -167,21 +163,29 @@ jQuery(document).ready(function() {
167
  jQuery(window).resize(function() {
168
  rt_parent = jQuery(rotate_id).parent();
169
  rt_grandparent = rt_parent.parent();
170
- var rt_resize_width_new = Math.min (
171
- rt_parent.innerWidth(),
172
- rt_grandparent.innerWidth()
173
- );
 
 
 
 
 
 
 
 
174
  if(rotate_wp_debug) {
175
- console.log('Old width: '+rt_resize_width_old);
176
- console.log('New width: '+rt_resize_width_new);
177
  console.log('Old box width: '+rt_resize_target_width);
178
- console.log('New target width: '+ (rt_resize_target_width + rt_resize_width_new - rt_resize_width_old));
179
- console.log('rt_max_width: '+ (rt_resize_target_width + rt_resize_width_new - rt_resize_width_old));
180
  }
181
  if(rt_max_width == null) {
182
  rt_max_width = rt_resize_target_tweet;
183
  }
184
- if(rt_resize_width_new != null && rt_resize_width_old != null && rt_resize_width_new != rt_resize_width_old) {
185
  var rt_oldheight = 0;
186
  var rt_oldcontainerheight = jQuery(rotate_id).height();
187
  jQuery(rotate_id + ' .rotatingtweet').height('auto');
@@ -202,19 +206,20 @@ jQuery(document).ready(function() {
202
  if(rotate_wp_debug) {
203
  console.log('Old container height' + rt_old_box_height )
204
  }
205
- jQuery(rt_children_id).width(rt_max_width + rt_resize_width_new - rt_resize_width_old );
206
- jQuery(rt_children_meta_id).width(rt_max_width + rt_resize_width_new - rt_resize_width_old );
207
- jQuery(rotate_id + ' .rtw_main').width(rt_resize_target_main + rt_resize_width_new - rt_resize_width_old );
208
- jQuery(rotate_id + ' .rotatingtweet').width(rt_resize_target_tweet + rt_resize_width_new - rt_resize_width_old );
209
- jQuery(rotate_id + ' .rtw_meta').width(rt_resize_target_meta + rt_resize_width_new - rt_resize_width_old );
210
- jQuery(rotate_id).width(rt_resize_target_width + rt_resize_width_new - rt_resize_width_old );
211
  // Now update the variables
212
- rt_resize_target_width = rt_resize_target_width + rt_resize_width_new - rt_resize_width_old;
213
- rt_resize_target_main = rt_resize_target_main + rt_resize_width_new - rt_resize_width_old;
214
- rt_resize_target_tweet = rt_resize_target_tweet + rt_resize_width_new - rt_resize_width_old;
215
- rt_max_width = rt_max_width + rt_resize_width_new - rt_resize_width_old;
216
- rt_resize_target_meta = rt_resize_target_meta + rt_resize_width_new - rt_resize_width_old;
217
- rt_resize_width_old = rt_resize_width_new;
 
218
  // Now we need to fix the heights
219
  var rt_newheight = 0;
220
  jQuery(rotate_id + ' .rotatingtweet').height('auto');
18
  var rt_height_px = 'auto';
19
  /* Now find the widget container width */
20
  // Take the smaller of the parent and grandparent
21
+ var rt_parent = jQuery(rotate_id).parent();
22
+ var rt_grandparent = jQuery(rotate_id).parent().parent();
23
  var rt_target_container_width = Math.min (
24
  rt_parent.innerWidth() - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')),
25
  rt_grandparent.innerWidth() - parseFloat(rt_grandparent.css('padding-left')) - parseFloat(rt_grandparent.css('padding-right')) - parseFloat(rt_parent.css('padding-left')) - parseFloat(rt_parent.css('padding-right')) - parseFloat(rt_parent.css('margin-left')) - parseFloat(rt_parent.css('margin-right'))
26
  );
27
 
28
  // Get the size of the parent box and subtract any padding
29
+ var rt_target_width = rt_target_container_width - parseFloat(jQuery(this).css('padding-left')) - parseFloat(jQuery(this).css('padding-right')) - parseFloat(jQuery(this).css('margin-left')) - parseFloat(jQuery(this).css('margin-right')) - parseFloat(jQuery(this).css('border-left')) - parseFloat(jQuery(this).css('border-right') ) ;
30
  var rt_fit = 1;
31
  if( rt_target_width == null ) {
32
  rt_fit = 0;
33
  }
34
  if(rotate_wp_debug) {
35
+ console.log('============================');
36
+ console.log('self_width = '+jQuery(rotate_id).innerWidth());
37
  console.log('parent_width = '+rt_parent.innerWidth());
38
  console.log('grandparent_width = '+rt_grandparent.innerWidth());
39
  console.log('rt_target_container_width = '+rt_target_container_width);
143
  console.log('- rt_max_width: ' + rt_max_width);
144
  };
145
  /* Go through the tweets - and set the minimum width */
 
 
 
 
 
146
  jQuery(rt_children_id).width(rt_max_width);
147
  /* Go through the tweets - and set the minimum width */
 
 
 
 
 
148
  jQuery(rt_children_meta_id).width(rt_max_width);
149
  };
150
+ // Now the responsiveness code
151
+ // First get the measures we will use to track change
152
+ var rt_resize_width_old_parent = rt_parent.innerWidth();
153
+ var rt_resize_width_old_grandparent = rt_grandparent.innerWidth();
154
+ var rt_resize_width_new_parent = rt_resize_width_old_parent;
155
+ var rt_resize_width_new_grandparent = rt_resize_width_old_grandparent;
156
+ var rt_resize_parent_change = 0;
157
+ var rt_resize_grandparent_change = 0;
158
+ // Now get the starting measures
159
  var rt_resize_target_width = jQuery(rotate_id).width();
160
  var rt_resize_target_main = jQuery(rotate_id + ' .rtw_main').width();
161
  var rt_resize_target_tweet = jQuery(rotate_id + ' .rotatingtweet').width();
163
  jQuery(window).resize(function() {
164
  rt_parent = jQuery(rotate_id).parent();
165
  rt_grandparent = rt_parent.parent();
166
+ rt_resize_width_new_parent = rt_parent.innerWidth();
167
+ rt_resize_width_new_grandparent = rt_grandparent.innerWidth();
168
+
169
+ // Now calculate the largest and smallest change in size
170
+ rt_resize_parent_change = rt_resize_width_new_parent - rt_resize_width_old_parent;
171
+ rt_resize_grandparent_change = rt_resize_width_new_grandparent - rt_resize_width_old_grandparent;
172
+
173
+ // Now decide how much to change things
174
+ rt_resize_change = rt_resize_parent_change;
175
+ if(rt_resize_change == 0) {
176
+ rt_resize_change = rt_resize_grandparent_change;
177
+ }
178
  if(rotate_wp_debug) {
179
+ console.log('Parent change: '+rt_resize_parent_change);
180
+ console.log('Grandparent change: '+rt_resize_grandparent_change);
181
  console.log('Old box width: '+rt_resize_target_width);
182
+ console.log('New target width: '+ (rt_resize_target_width + rt_resize_change));
183
+ console.log('rt_max_width: '+ (rt_resize_target_width + rt_resize_change));
184
  }
185
  if(rt_max_width == null) {
186
  rt_max_width = rt_resize_target_tweet;
187
  }
188
+ if(rt_resize_change != 0) {
189
  var rt_oldheight = 0;
190
  var rt_oldcontainerheight = jQuery(rotate_id).height();
191
  jQuery(rotate_id + ' .rotatingtweet').height('auto');
206
  if(rotate_wp_debug) {
207
  console.log('Old container height' + rt_old_box_height )
208
  }
209
+ jQuery(rt_children_id).width(rt_max_width + rt_resize_change );
210
+ jQuery(rt_children_meta_id).width(rt_max_width + rt_resize_change );
211
+ jQuery(rotate_id + ' .rtw_main').width(rt_resize_target_main + rt_resize_change );
212
+ jQuery(rotate_id + ' .rotatingtweet').width(rt_resize_target_tweet + rt_resize_change );
213
+ jQuery(rotate_id + ' .rtw_meta').width(rt_resize_target_meta + rt_resize_change );
214
+ jQuery(rotate_id).width(rt_resize_target_width + rt_resize_change );
215
  // Now update the variables
216
+ rt_resize_target_width = rt_resize_target_width + rt_resize_change;
217
+ rt_resize_target_main = rt_resize_target_main + rt_resize_change;
218
+ rt_resize_target_tweet = rt_resize_target_tweet + rt_resize_change;
219
+ rt_max_width = rt_max_width + rt_resize_change;
220
+ rt_resize_target_meta = rt_resize_target_meta + rt_resize_change;
221
+ rt_resize_width_old_parent = rt_parent.innerWidth();
222
+ rt_resize_width_old_grandparent = rt_grandparent.innerWidth();
223
  // Now we need to fix the heights
224
  var rt_newheight = 0;
225
  jQuery(rotate_id + ' .rotatingtweet').height('auto');
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -141,13 +141,17 @@ If there is only one copy of `jquery` and of `jquery.cycle` on your page, the be
141
  1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
142
 
143
  == Upgrade notice ==
144
- = 1.4.2 =
145
- Works with responsive templates.
146
 
147
  = 0.700 (1.3.0) =
148
  * Upgrade needed for Rotating Tweets to keep working after May 2013. Supports version 1.1 of the Twitter API.
149
 
150
  == Changelog ==
 
 
 
 
151
  = 1.4.2 =
152
  * Corrected minor error with resizing of `.rtw_meta` div
153
 
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.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
141
  1. Read the diagnostics and look for any problems that relate to JavaScript. This will normally tell you which JavaScript (if any) is having problems.
142
 
143
  == Upgrade notice ==
144
+ = 1.4.3 =
145
+ * Works with responsive templates. Fixes some styling problems.
146
 
147
  = 0.700 (1.3.0) =
148
  * Upgrade needed for Rotating Tweets to keep working after May 2013. Supports version 1.1 of the Twitter API.
149
 
150
  == Changelog ==
151
+ = 1.4.3 =
152
+ * Removes two lines of CSS causing formatting problems
153
+ * Improves responsiveness going from narrow to wider layouts
154
+
155
  = 1.4.2 =
156
  * Corrected minor error with resizing of `.rtw_meta` div
157
 
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.2
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk
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.3
6
  Text Domain: rotatingtweets
7
  Author: Martin Tod
8
  Author URI: http://www.martintod.org.uk