Shortcodes by Angie Makes - Version 1.67

Version Description

Download this release

Release Info

Developer cbaldelomar
Plugin Icon wp plugin Shortcodes by Angie Makes
Version 1.67
Comparing to
See all releases

Code changes from version 1.66 to 1.67

Files changed (5) hide show
  1. README.md +4 -0
  2. includes/css/style.css +0 -1
  3. includes/js/posts.js +42 -23
  4. readme.txt +4 -0
  5. wc-shortcodes.php +2 -2
README.md CHANGED
@@ -66,6 +66,10 @@ Use the shortcode manager in the TinyMCE text editor
66
 
67
  ## Changelog ##
68
 
 
 
 
 
69
  ### Version 1.66
70
 
71
  * Updated images loaded library to 3.1.8
66
 
67
  ## Changelog ##
68
 
69
+ ### Version 1.67
70
+
71
+ * Masonry post items now load in series when each image is loaded
72
+
73
  ### Version 1.66
74
 
75
  * Updated images loaded library to 3.1.8
includes/css/style.css CHANGED
@@ -1419,7 +1419,6 @@ pre.pre-wrap {
1419
  }
1420
  .wc-shortcodes-posts {
1421
  position: relative;
1422
- visibility: hidden;
1423
  overflow: hidden;
1424
  }
1425
  .wc-shortcodes-post-box {
1419
  }
1420
  .wc-shortcodes-posts {
1421
  position: relative;
 
1422
  overflow: hidden;
1423
  }
1424
  .wc-shortcodes-post-box {
includes/js/posts.js CHANGED
@@ -1,10 +1,36 @@
1
  ( function( $ ) {
2
  "use strict";
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  var calculateGrid = function($container) {
5
  var columns = parseInt( $container.data('columns') );
6
  var gutterWidth = $container.data('gutterSpace');
7
- var containerWidth = $container.width();
 
8
 
9
  if ( isNaN( gutterWidth ) ) {
10
  gutterWidth = 20;
@@ -43,19 +69,12 @@
43
  return {columnWidth: columnWidth, gutterWidth: gutterWidth, columns: columns};
44
  }
45
 
46
- var runMasonry = function( duration, $container) {
47
- var $postBox = $container.children('.wc-shortcodes-post-box');
48
-
49
  var o = calculateGrid($container);
50
 
51
- var marginBottom = o.gutterWidth;
52
- /* if ( 1 == o.columns ) {
53
- marginBottom = 20;
54
- } */
55
-
56
- $postBox.css({'width':o.columnWidth+'px', 'margin-bottom':marginBottom+'px', 'padding':'0'});
57
 
58
- $container.masonry( {
59
  itemSelector: '.wc-shortcodes-post-box',
60
  columnWidth: o.columnWidth,
61
  gutter: o.gutterWidth,
@@ -66,21 +85,20 @@
66
  $(document).ready(function(){
67
  $('.wc-shortcodes-posts').each( function() {
68
  var $container = $(this);
69
- var $postBox = $container.children('.wc-shortcodes-post-box');
70
 
 
 
71
 
72
  // keeps the media elements from calculating for the full width of the post
73
- runMasonry(0, $container);
74
 
75
- imagesLoaded( $container, function() {
76
- runMasonry(0, $container);
77
-
78
- $container.css('visibility', 'visible');
79
- });
80
 
81
  $(window).resize(function() {
82
- runMasonry(0, $container);
83
- });
84
 
85
  $container.find(".wc-shortcodes-post-box .rslides").responsiveSlides({
86
  auto: false, // Boolean: Animate automatically, true or false
@@ -99,7 +117,7 @@
99
  namespace: "rslides", // String: Change the default namespace used
100
  before: function(){}, // Function: Before callback
101
  after: function(){
102
- runMasonry(0, $container);
103
  }// Function: After callback
104
  });
105
  });
@@ -116,11 +134,12 @@
116
  var target = $filterNav.data('target');
117
  var $target = $(target);
118
  $target.animate({opacity: 0}, 300, function() {
 
119
  if ( '*' == selector ) {
120
- $target.find('.wc-shortcodes-post-box').show();
121
  }
122
  else {
123
- $target.find('.wc-shortcodes-post-box').hide();
124
  $target.find(selector).show();
125
  }
126
 
1
  ( function( $ ) {
2
  "use strict";
3
 
4
+ $.fn.wcShortcodesMasonryImagesReveal = function( $items ) {
5
+ var msnry = this.data('masonry');
6
+ var itemSelector = msnry.options.itemSelector;
7
+
8
+ // hide by default
9
+ $items.hide();
10
+
11
+ // append to container
12
+ this.append( $items );
13
+
14
+ $.each( $items, function( key, item ) {
15
+ var $item = $(this);
16
+
17
+ // un-hide item
18
+ $item.show();
19
+
20
+ $item.imagesLoaded().always( function( instance ) {
21
+ // masonry does its thing
22
+ msnry.appended( $item );
23
+ });
24
+ });
25
+
26
+ return this;
27
+ };
28
+
29
  var calculateGrid = function($container) {
30
  var columns = parseInt( $container.data('columns') );
31
  var gutterWidth = $container.data('gutterSpace');
32
+ // need to return exact decimal width
33
+ var containerWidth = Math.floor($container[0].getBoundingClientRect().width);
34
 
35
  if ( isNaN( gutterWidth ) ) {
36
  gutterWidth = 20;
69
  return {columnWidth: columnWidth, gutterWidth: gutterWidth, columns: columns};
70
  }
71
 
72
+ var runMasonry = function( duration, $container, $posts ) {
 
 
73
  var o = calculateGrid($container);
74
 
75
+ $posts.css({'width':o.columnWidth+'px', 'margin-bottom':o.gutterWidth+'px', 'padding':'0'});
 
 
 
 
 
76
 
77
+ $container = $container.masonry( {
78
  itemSelector: '.wc-shortcodes-post-box',
79
  columnWidth: o.columnWidth,
80
  gutter: o.gutterWidth,
85
  $(document).ready(function(){
86
  $('.wc-shortcodes-posts').each( function() {
87
  var $container = $(this);
88
+ var $posts = $container.children('.wc-shortcodes-post-box');
89
 
90
+ // remove posts from element
91
+ $container.empty();
92
 
93
  // keeps the media elements from calculating for the full width of the post
94
+ runMasonry(0, $container, $posts);
95
 
96
+ // we are going to append masonry items as the images load
97
+ $container.wcShortcodesMasonryImagesReveal( $posts );
 
 
 
98
 
99
  $(window).resize(function() {
100
+ runMasonry(0, $container, $posts);
101
+ });
102
 
103
  $container.find(".wc-shortcodes-post-box .rslides").responsiveSlides({
104
  auto: false, // Boolean: Animate automatically, true or false
117
  namespace: "rslides", // String: Change the default namespace used
118
  before: function(){}, // Function: Before callback
119
  after: function(){
120
+ runMasonry(0, $container, $posts);
121
  }// Function: After callback
122
  });
123
  });
134
  var target = $filterNav.data('target');
135
  var $target = $(target);
136
  $target.animate({opacity: 0}, 300, function() {
137
+ var $targetPosts = $container.children('.wc-shortcodes-post-box');
138
  if ( '*' == selector ) {
139
+ $targetPosts.show();
140
  }
141
  else {
142
+ $targetPosts.hide();
143
  $target.find(selector).show();
144
  }
145
 
readme.txt CHANGED
@@ -88,6 +88,10 @@ Use the shortcode manager in the TinyMCE text editor
88
 
89
  == Changelog ==
90
 
 
 
 
 
91
  = Version 1.66 =
92
 
93
  * Updated images loaded library to 3.1.8
88
 
89
  == Changelog ==
90
 
91
+ = Version 1.67 =
92
+
93
+ * Masonry post items now load in series when each image is loaded
94
+
95
  = Version 1.66 =
96
 
97
  * Updated images loaded library to 3.1.8
wc-shortcodes.php CHANGED
@@ -5,11 +5,11 @@ Plugin URI: http://webplantmedia.com/starter-themes/wordpresscanvas/features/sho
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 1.66
9
  License: GPLv2 or later
10
  */
11
 
12
- define( 'WC_SHORTCODES_VERSION', '1.66' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.67
9
  License: GPLv2 or later
10
  */
11
 
12
+ define( 'WC_SHORTCODES_VERSION', '1.67' );
13
  define( 'WC_SHORTCODES_PREFIX', 'wc_shortcodes_' );
14
  define( '_WC_SHORTCODES_PREFIX', '_wc_shortcodes_' );
15
  define( 'WC_SHORTCODES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );