Shortcodes by Angie Makes - Version 1.4

Version Description

Download this release

Release Info

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

Code changes from version 1.3 to 1.4

README.md CHANGED
@@ -44,6 +44,12 @@ Use the shortcode manager in the TinyMCE text editor
44
 
45
  ## Changelog ##
46
 
 
 
 
 
 
 
47
  ### Version 1.3
48
 
49
  * Fixed style bug with columns not changing width on mobile devices
44
 
45
  ## Changelog ##
46
 
47
+ ### Version 1.4
48
+
49
+ * Fixed minor JS bugs
50
+ * Ran Javascript through jshint
51
+ * Fixed minor shortcode button bug in TinyMCE editor
52
+
53
  ### Version 1.3
54
 
55
  * Fixed style bug with columns not changing width on mobile devices
includes/js/accordion.js CHANGED
@@ -1 +1 @@
1
- ( function( $ ) {
1
+ ( function( $ ) {
includes/js/admin.js CHANGED
@@ -2,36 +2,39 @@
2
  * WC Shortcodes Gallery Settings
3
  */
4
  (function($) {
5
- var $body = $("body"), file_frame = [], media = wp.media, custom_uploader;
 
 
6
 
7
  //fetch preExisting selection of galleries. change the gallery state based on wheter we got a selection or not to "Edit gallery" or "AAdd gallery"
8
- fetchSelection = function(ids, options) {
9
- if(typeof ids == 'undefined') return; //<--happens on multi_image insert for modal group
 
 
10
 
11
  var id_array = ids.split(','),
12
  args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in:id_array},
13
  attachments = wp.media.query( args ),
14
- selection = new wp.media.model.Selection( attachments.models,
15
- {
16
  props: attachments.props.toJSON(),
17
  multiple: true
18
  });
19
 
20
 
21
- if(options.state == 'gallery-library' && id_array.length && !isNaN(parseInt(id_array[0],10)))
22
  {
23
  options.state = 'gallery-edit';
24
  }
25
  return selection;
26
  };
27
 
28
- $body.on('click', '.wc-shortcodes-image-upload', function( event ) {
29
  event.preventDefault();
30
 
31
- var clicked = $(this),
32
  options = clicked.data(),
33
- parent = clicked.parent(),
34
- target = parent.find(options.target),
35
  preview = parent.find(options.preview), // will not find <div> tag inside of <p>
36
  prefill = fetchSelection(target.val(), options),
37
  frame_key = _.random(0, 999999999999999999);
@@ -45,15 +48,15 @@
45
 
46
  // Create the media frame.
47
  file_frame[frame_key] = wp.media({
48
- frame: options.frame,
49
- state: options.state,
50
  library: { type: 'image' },
51
- button: { text: options.button },
52
  className: options['class'],
53
  selection: prefill
54
  });
55
 
56
- if ( 'wordpresscanvas_insert_single' == options.state ) {
57
  // add the single insert state
58
  file_frame[frame_key].states.add([
59
  // Main states.
@@ -66,14 +69,14 @@
66
  library: media.query( file_frame[frame_key].options.library ),
67
  multiple: false,
68
  editable: true,
69
- displayUserSettings: false,
70
  displaySettings: true,
71
  allowLocalEdits: true
72
  // AttachmentView: media.view.Attachment.Library
73
  })
74
  ]);
75
  }
76
- else if ( 'wordpresscanvas_insert_multi' == options.state ) {
77
  // add the single insert state
78
  file_frame[frame_key].states.add([
79
  new media.controller.Library({
@@ -85,7 +88,7 @@
85
  library: media.query( file_frame[frame_key].options.library ),
86
  multiple: 'add',
87
  editable: true,
88
- displayUserSettings: false,
89
  displaySettings: false,
90
  allowLocalEdits: true
91
  // AttachmentView: media.view.Attachment.Library
@@ -112,14 +115,14 @@
112
  values = selection.map( function( attachment ) {
113
  element = attachment.toJSON();
114
 
115
- if ( 'url' == options.fetch ) {
116
  display = state.display( attachment ).toJSON();
117
 
118
- if ( 'undefined' == typeof element.sizes ) {
119
  preview_img = element.url;
120
  preview_html = "";
121
  }
122
- else if ( ( 'string' == typeof options.imgsize ) && ( 'object' == typeof element.sizes[ options.imgsize ] ) ) {
123
  preview_img = element.sizes[ options.imgsize ].url;
124
  preview_html += "<img src='"+preview_img+"' />";
125
  }
@@ -130,8 +133,8 @@
130
 
131
  return preview_img;
132
  }
133
- else if(options.fetch == 'id') {
134
- preview_img = typeof element.sizes['thumbnail'] != 'undefined' ? element.sizes['thumbnail'].url : element.url ;
135
  preview_html += "<img src='"+preview_img+"' />";
136
 
137
  return element[options.fetch];
@@ -142,42 +145,45 @@
142
  });
143
 
144
  if ( target.length ) {
145
- target.val( values.join(',') ).trigger('change');
146
  }
147
 
148
- if ( preview.length )
149
  preview.html( preview_html ).show();
 
150
  });
151
 
152
  // Finally, open the modal
153
  file_frame[frame_key].open();
154
  })
155
- .on('click', '.wc-shortcodes-restore-image', function( e ) {
156
  e.preventDefault();
157
 
158
- var clicked = $(this),
159
  options = clicked.data(),
160
- parent = clicked.parent(),
161
- target = parent.find(options.target),
162
  preview = parent.find(options.preview);
163
 
164
  $(target).val(options.restore);
165
 
166
- if ( preview.length && options.restore.length )
167
  $(preview).html('<img src="'+options.restore+'" />').show();
 
168
  })
169
- .on('click', '.wc-shortcodes-delete-image', function( e ) {
170
  e.preventDefault();
171
 
172
- var clicked = $(this),
173
  options = clicked.data(),
174
- parent = clicked.parent(),
175
- target = parent.find(options.target),
176
  preview = parent.find(options.preview);
177
 
178
  $(target).val('');
179
 
180
- if ( preview.length )
181
  $(preview).html("").hide();
182
- })
 
183
  })(jQuery);
2
  * WC Shortcodes Gallery Settings
3
  */
4
  (function($) {
5
+ "use strict";
6
+
7
+ var $body = $("body"), file_frame = [], media = wp.media;
8
 
9
  //fetch preExisting selection of galleries. change the gallery state based on wheter we got a selection or not to "Edit gallery" or "AAdd gallery"
10
+ var fetchSelection = function(ids, options) {
11
+ if(typeof ids === 'undefined') {
12
+ return; //<--happens on multi_image insert for modal group
13
+ }
14
 
15
  var id_array = ids.split(','),
16
  args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in:id_array},
17
  attachments = wp.media.query( args ),
18
+ selection = new wp.media.model.Selection( attachments.models, {
 
19
  props: attachments.props.toJSON(),
20
  multiple: true
21
  });
22
 
23
 
24
+ if(options.state === 'gallery-library' && id_array.length && !isNaN(parseInt(id_array[0],10)))
25
  {
26
  options.state = 'gallery-edit';
27
  }
28
  return selection;
29
  };
30
 
31
+ $body.on('click', '.wc-shortcodes-image-upload', function( event ) {
32
  event.preventDefault();
33
 
34
+ var clicked = $(this),
35
  options = clicked.data(),
36
+ parent = clicked.parent(),
37
+ target = parent.find(options.target),
38
  preview = parent.find(options.preview), // will not find <div> tag inside of <p>
39
  prefill = fetchSelection(target.val(), options),
40
  frame_key = _.random(0, 999999999999999999);
48
 
49
  // Create the media frame.
50
  file_frame[frame_key] = wp.media({
51
+ frame: options.frame,
52
+ state: options.state,
53
  library: { type: 'image' },
54
+ button: { text: options.button },
55
  className: options['class'],
56
  selection: prefill
57
  });
58
 
59
+ if ( 'wordpresscanvas_insert_single' === options.state ) {
60
  // add the single insert state
61
  file_frame[frame_key].states.add([
62
  // Main states.
69
  library: media.query( file_frame[frame_key].options.library ),
70
  multiple: false,
71
  editable: true,
72
+ displayUserSettings: false,
73
  displaySettings: true,
74
  allowLocalEdits: true
75
  // AttachmentView: media.view.Attachment.Library
76
  })
77
  ]);
78
  }
79
+ else if ( 'wordpresscanvas_insert_multi' === options.state ) {
80
  // add the single insert state
81
  file_frame[frame_key].states.add([
82
  new media.controller.Library({
88
  library: media.query( file_frame[frame_key].options.library ),
89
  multiple: 'add',
90
  editable: true,
91
+ displayUserSettings: false,
92
  displaySettings: false,
93
  allowLocalEdits: true
94
  // AttachmentView: media.view.Attachment.Library
115
  values = selection.map( function( attachment ) {
116
  element = attachment.toJSON();
117
 
118
+ if ( 'url' === options.fetch ) {
119
  display = state.display( attachment ).toJSON();
120
 
121
+ if ( 'undefined' === typeof element.sizes ) {
122
  preview_img = element.url;
123
  preview_html = "";
124
  }
125
+ else if ( ( 'string' === typeof options.imgsize ) && ( 'object' === typeof element.sizes[ options.imgsize ] ) ) {
126
  preview_img = element.sizes[ options.imgsize ].url;
127
  preview_html += "<img src='"+preview_img+"' />";
128
  }
133
 
134
  return preview_img;
135
  }
136
+ else if(options.fetch === 'id') {
137
+ preview_img = typeof element.sizes.thumbnail !== 'undefined' ? element.sizes.thumbnail.url : element.url ;
138
  preview_html += "<img src='"+preview_img+"' />";
139
 
140
  return element[options.fetch];
145
  });
146
 
147
  if ( target.length ) {
148
+ target.val( values.join(',') ).trigger('change');
149
  }
150
 
151
+ if ( preview.length ) {
152
  preview.html( preview_html ).show();
153
+ }
154
  });
155
 
156
  // Finally, open the modal
157
  file_frame[frame_key].open();
158
  })
159
+ .on('click', '.wc-shortcodes-restore-image', function( e ) {
160
  e.preventDefault();
161
 
162
+ var clicked = $(this),
163
  options = clicked.data(),
164
+ parent = clicked.parent(),
165
+ target = parent.find(options.target),
166
  preview = parent.find(options.preview);
167
 
168
  $(target).val(options.restore);
169
 
170
+ if ( preview.length && options.restore.length ) {
171
  $(preview).html('<img src="'+options.restore+'" />').show();
172
+ }
173
  })
174
+ .on('click', '.wc-shortcodes-delete-image', function( e ) {
175
  e.preventDefault();
176
 
177
+ var clicked = $(this),
178
  options = clicked.data(),
179
+ parent = clicked.parent(),
180
+ target = parent.find(options.target),
181
  preview = parent.find(options.preview);
182
 
183
  $(target).val('');
184
 
185
+ if ( preview.length ) {
186
  $(preview).html("").hide();
187
+ }
188
+ });
189
  })(jQuery);
includes/js/fullwidth.js CHANGED
@@ -1,12 +1,18 @@
1
  ( function( $ ) {
 
 
2
  var fullWidthSite = function() {
3
  $('.wc-shortcodes-full-width').each( function() {
4
  var $this,
5
- siteWidthId, contentWidthId,
6
- $siteWidth, $contentWidth,
7
- siteWidth, contentWidth,
8
- sitePos, contentPos,
9
- marginLeft, marginRight;
 
 
 
 
10
 
11
  $this = $(this);
12
 
@@ -36,7 +42,7 @@
36
  $this.css( {'margin-left': marginLeft+'px', 'margin-right': marginRight+'px'} );
37
  }
38
  });
39
- }
40
  fullWidthSite();
41
 
42
  $(window).resize( fullWidthSite );
1
  ( function( $ ) {
2
+ "use strict";
3
+
4
  var fullWidthSite = function() {
5
  $('.wc-shortcodes-full-width').each( function() {
6
  var $this,
7
+ siteWidthId,
8
+ $siteWidth,
9
+ $contentWidth,
10
+ siteWidth,
11
+ contentWidth,
12
+ // sitePos,
13
+ // contentPos,
14
+ marginLeft,
15
+ marginRight;
16
 
17
  $this = $(this);
18
 
42
  $this.css( {'margin-left': marginLeft+'px', 'margin-right': marginRight+'px'} );
43
  }
44
  });
45
+ };
46
  fullWidthSite();
47
 
48
  $(window).resize( fullWidthSite );
includes/js/googlemap.js CHANGED
@@ -2,6 +2,8 @@
2
  /* Googlemap - code from http://aquagraphite.com/
3
  /*===================================================================================*/
4
  jQuery(function($){
 
 
5
  $(document).ready(function(){
6
  $('.googlemap').each( function() {
7
 
@@ -11,16 +13,11 @@ jQuery(function($){
11
  $zoom = parseInt( $(this).find('.zoom').val() ),
12
  geocoder, map;
13
 
14
- var mapOptions = {
15
- zoom: $zoom,
16
- mapTypeId: google.maps.MapTypeId.ROADMAP
17
- };
18
-
19
  geocoder = new google.maps.Geocoder();
20
 
21
  geocoder.geocode( { 'address': $location}, function(results, status) {
22
 
23
- if (status == google.maps.GeocoderStatus.OK) {
24
 
25
  var mapOptions = {
26
  scrollwheel: false,
@@ -33,19 +30,19 @@ jQuery(function($){
33
  map.setCenter(results[0].geometry.location);
34
 
35
  var marker = new google.maps.Marker({
36
- map: map,
37
- position: results[0].geometry.location,
38
- title : $location
39
  });
40
 
41
  var contentString = '<div class="map-infowindow">'+
42
- ( ($title) ? '<h3>' + $title + '</h3>' : '' ) +
43
  $location + '<br/>' +
44
  '<a href="https://maps.google.com/?q='+ $location +'" target="_blank">View on Google Map</a>' +
45
  '</div>';
46
 
47
  var infowindow = new google.maps.InfoWindow({
48
- content: contentString
49
  });
50
 
51
  google.maps.event.addListener(marker, 'click', function() {
2
  /* Googlemap - code from http://aquagraphite.com/
3
  /*===================================================================================*/
4
  jQuery(function($){
5
+ "use strict";
6
+
7
  $(document).ready(function(){
8
  $('.googlemap').each( function() {
9
 
13
  $zoom = parseInt( $(this).find('.zoom').val() ),
14
  geocoder, map;
15
 
 
 
 
 
 
16
  geocoder = new google.maps.Geocoder();
17
 
18
  geocoder.geocode( { 'address': $location}, function(results, status) {
19
 
20
+ if (status === google.maps.GeocoderStatus.OK) {
21
 
22
  var mapOptions = {
23
  scrollwheel: false,
30
  map.setCenter(results[0].geometry.location);
31
 
32
  var marker = new google.maps.Marker({
33
+ map: map,
34
+ position: results[0].geometry.location,
35
+ title : $location
36
  });
37
 
38
  var contentString = '<div class="map-infowindow">'+
39
+ ( ($title) ? '<h3>' + $title + '</h3>' : '' ) +
40
  $location + '<br/>' +
41
  '<a href="https://maps.google.com/?q='+ $location +'" target="_blank">View on Google Map</a>' +
42
  '</div>';
43
 
44
  var infowindow = new google.maps.InfoWindow({
45
+ content: contentString
46
  });
47
 
48
  google.maps.event.addListener(marker, 'click', function() {
includes/js/pre.js CHANGED
@@ -1,4 +1,6 @@
1
  ( function( $ ) {
 
 
2
  $(document).ready(function(){
3
  prettyPrint();
4
  });
1
  ( function( $ ) {
2
+ "use strict";
3
+
4
  $(document).ready(function(){
5
  prettyPrint();
6
  });
includes/js/skillbar.js CHANGED
@@ -1,4 +1,6 @@
1
  jQuery(function($){
 
 
2
  $(document).ready(function(){
3
  $('.wc-shortcodes-skillbar').each(function(){
4
  $(this).find('.wc-shortcodes-skillbar-bar').animate({ width: $(this).attr('data-percent') }, 1500 );
1
  jQuery(function($){
2
+ "use strict";
3
+
4
  $(document).ready(function(){
5
  $('.wc-shortcodes-skillbar').each(function(){
6
  $(this).find('.wc-shortcodes-skillbar-bar').animate({ width: $(this).attr('data-percent') }, 1500 );
includes/js/tabs.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){
1
+ jQuery(function($){
includes/js/toggle.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){
1
+ jQuery(function($){
includes/mce/js/shortcodes_tinymce.js CHANGED
@@ -1,17 +1,23 @@
1
- (function() {
 
 
2
  tinymce.create('tinymce.plugins.wcShortcodeMce', {
3
  init : function(ed, url){
4
  tinymce.plugins.wcShortcodeMce.theurl = url;
5
  },
6
  createControl : function(btn, e) {
7
- if ( btn == "wc_shortcodes_button" ) {
8
- var a = this;
9
- var btn = e.createSplitButton('wc_shortcodes_button', {
10
- title: "Insert Shortcode",
 
 
 
 
11
  image: tinymce.plugins.wcShortcodeMce.theurl +"/images/shortcodes.png",
12
  icons: false,
13
- });
14
- btn.onRenderMenu.add(function (c, b) {
15
 
16
  b.add({title : 'WC Shortcodes', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
17
 
@@ -41,7 +47,7 @@
41
  a.render( c, "Heading", "heading" );
42
  a.render( c, "Pricing Table", "pricing" );
43
  a.render( c, "Skillbar", "skillbar" );
44
- a.render( c, "Social Icon", "social" );
45
  a.render( c, "Testimonial", "testimonial" );
46
  a.render( c, "HTML", "html" );
47
 
@@ -108,10 +114,10 @@
108
 
109
 
110
  });
111
-
112
- return btn;
113
  }
114
- return null;
115
  },
116
  render : function(ed, title, id) {
117
  ed.add({
@@ -122,15 +128,16 @@
122
  var mceSelected = tinyMCE.activeEditor.selection.getContent();
123
 
124
  // Add highlighted content inside the shortcode when possible - yay!
 
125
  if ( mceSelected ) {
126
- var wcDummyContent = mceSelected;
127
  } else {
128
- var wcDummyContent = 'Sample Content';
129
  }
130
  var wcParagraphContent = '<p>Sample Content</p>';
131
 
132
  // Accordion
133
- if(id == "accordion") {
134
  tinyMCE.activeEditor.selection.setContent('<p>[wc_accordion collapse="0"][wc_accordion_section title="Section 1"]</p>' + wcParagraphContent + '<p>[/wc_accordion_section][wc_accordion_section title="Section 2"]</p>' + wcParagraphContent + '<p>[/wc_accordion_section][/wc_accordion]</p>');
135
  }
136
 
@@ -138,25 +145,25 @@
138
 
139
 
140
  // Boxes
141
- if(id == "primaryBox") {
142
  tinyMCE.activeEditor.selection.setContent('[wc_box color="primary" text_align="left"]' + wcDummyContent + '[/wc_box]');
143
  }
144
- if(id == "secondaryBox") {
145
  tinyMCE.activeEditor.selection.setContent('[wc_box color="secondary" text_align="left"]' + wcDummyContent + '[/wc_box]');
146
  }
147
- if(id == "inverseBox") {
148
  tinyMCE.activeEditor.selection.setContent('[wc_box color="inverse" text_align="left"]' + wcDummyContent + '[/wc_box]');
149
  }
150
- if(id == "successBox") {
151
  tinyMCE.activeEditor.selection.setContent('[wc_box color="success" text_align="left"]' + wcDummyContent + '[/wc_box]');
152
  }
153
- if(id == "warningBox") {
154
  tinyMCE.activeEditor.selection.setContent('[wc_box color="warning" text_align="left"]' + wcDummyContent + '[/wc_box]');
155
  }
156
- if(id == "dangerBox") {
157
  tinyMCE.activeEditor.selection.setContent('[wc_box color="danger" text_align="left"]' + wcDummyContent + '[/wc_box]');
158
  }
159
- if(id == "infoBox") {
160
  tinyMCE.activeEditor.selection.setContent('[wc_box color="info" text_align="left"]' + wcDummyContent + '[/wc_box]');
161
  }
162
 
@@ -164,7 +171,7 @@
164
 
165
 
166
  // Button
167
- if(id == "button") {
168
  tinyMCE.activeEditor.selection.setContent('[wc_button type="primary" url="http://www.wordpresscanvas.com" title="Visit Site" target="self"]' + wcDummyContent + '[/wc_button]');
169
  }
170
 
@@ -172,7 +179,7 @@
172
 
173
 
174
  // Clear Floats
175
- if(id == "clear") {
176
  tinyMCE.activeEditor.selection.setContent('[wc_clear_floats]');
177
  }
178
 
@@ -180,56 +187,56 @@
180
 
181
 
182
  // Columns
183
- if(id == "half-half") {
184
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-half" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
185
  }
186
- if(id == "third-third-third") {
187
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
188
  }
189
- if(id == "third-twothird") {
190
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="two-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
191
  }
192
- if(id == "twothird-third") {
193
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="two-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
194
  }
195
- if(id == "fourth-fourth-fourth-fourth") {
196
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
197
  }
198
- if(id == "fourth-half-fourth") {
199
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
200
  }
201
- if(id == "half-fourth-fourth") {
202
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-half" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
203
  }
204
- if(id == "fourth-fourth-half") {
205
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
206
  }
207
- if(id == "fourth-three-fourth") {
208
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="three-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
209
  }
210
- if(id == "three-fourth-fourth") {
211
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="three-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
212
  }
213
 
214
 
215
 
216
  // Divider
217
- if(id == "solidDivider") {
218
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="single" margin_top="" margin_bottom=""]');
219
  }
220
- if(id == "dashedDivider") {
221
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="dashed" line="single" margin_top="" margin_bottom=""]');
222
  }
223
- if(id == "dottedDivider") {
224
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="dotted" line="single" margin_top="" margin_bottom=""]');
225
  }
226
- if(id == "doubleDivider") {
227
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="double" margin_top="" margin_bottom=""]');
228
  }
229
- if(id == "tripleDivider") {
230
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="triple" margin_top="" margin_bottom=""]');
231
  }
232
- if(id == "imageDivider") {
233
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="image" margin_top="" margin_bottom=""]');
234
  }
235
 
@@ -237,7 +244,7 @@
237
 
238
 
239
  // Google Map
240
- if(id == "googlemap") {
241
  tinyMCE.activeEditor.selection.setContent('[wc_googlemap title="St. Paul\'s Chapel" location="209 Broadway, New York, NY 10007" zoom="10" height="250"]');
242
  }
243
 
@@ -245,7 +252,7 @@
245
 
246
 
247
  // Heading
248
- if(id == "heading") {
249
  tinyMCE.activeEditor.selection.setContent('[wc_heading type="h1" title="' + wcDummyContent + '" text_align="left"]');
250
  }
251
 
@@ -253,26 +260,26 @@
253
 
254
 
255
  // Highlight
256
- if(id == "blueHighlight") {
257
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="blue"]' + wcDummyContent + '[/wc_highlight]');
258
  }
259
- if(id == "grayHighlight") {
260
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="gray"]' + wcDummyContent + '[/wc_highlight]');
261
  }
262
- if(id == "greenHighlight") {
263
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="green"]' + wcDummyContent + '[/wc_highlight]');
264
  }
265
- if(id == "redHighlight") {
266
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="red"]' + wcDummyContent + '[/wc_highlight]');
267
  }
268
- if(id == "yellowHighlight") {
269
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="yellow"]' + wcDummyContent + '[/wc_highlight]');
270
- }
271
 
272
 
273
 
274
  // Pricing
275
- if(id == "pricing") {
276
  tinyMCE.activeEditor.selection.setContent('[wc_pricing featured="yes" plan="Basic" cost="$19.99" per="per month" button_url="#" button_text="Sign Up" button_target="self" button_rel="nofollow"]<ul><li>30GB Storage</li><li>512MB Ram</li><li>10 databases</li><li>1,000 Emails</li><li>25GB Bandwidth</li></ul>[/wc_pricing]');
277
  }
278
 
@@ -280,7 +287,7 @@
280
 
281
 
282
  //Spacing
283
- if(id == "spacing") {
284
  tinyMCE.activeEditor.selection.setContent('[wc_spacing size="40px"]');
285
  }
286
 
@@ -288,7 +295,7 @@
288
 
289
 
290
  //Social
291
- if(id == "social") {
292
  tinyMCE.activeEditor.selection.setContent('[wc_social_icons align="left" size="large" display="facebook,google,twitter,pinterest,instagram,bloglovin,flickr,rss,email,custom1,custom2,custom3,custom4,custom5"]');
293
  }
294
 
@@ -296,7 +303,7 @@
296
 
297
 
298
  //Skillbar
299
- if(id == "skillbar") {
300
  tinyMCE.activeEditor.selection.setContent('[wc_skillbar title="' + wcDummyContent + '" percentage="100" color="#6adcfa"]');
301
  }
302
 
@@ -304,52 +311,52 @@
304
 
305
 
306
  //Tabs
307
- if(id == "tabs") {
308
  tinyMCE.activeEditor.selection.setContent('<p>[wc_tabgroup][wc_tab title="First Tab"]</p>'+wcParagraphContent+'<p>[/wc_tab][wc_tab title="Second Tab"]</p>'+wcParagraphContent+'<p>[/wc_tab][/wc_tabgroup]</p>');
309
  }
310
 
311
 
312
 
313
  //Testimonial
314
- if(id == "testimonial") {
315
  tinyMCE.activeEditor.selection.setContent('[wc_testimonial by="Wordpress Canvas" position="left"]' + wcDummyContent + '[/wc_testimonial]');
316
  }
317
 
318
 
319
 
320
  //Toggle
321
- if(id == "toggle") {
322
  tinyMCE.activeEditor.selection.setContent('<p>[wc_toggle title="This Is Your Toggle Title" padding="" border_width=""]</p>' + wcParagraphContent + '<p>[/wc_toggle]</p>');
323
  }
324
 
325
- if(id == "center") {
326
  tinyMCE.activeEditor.selection.setContent('<p>[wc_center max_width="500px" text_align="left"]</p>' + wcParagraphContent + '<p>[/wc_center]</p>');
327
  }
328
 
329
 
330
- if(id == "fullwidth") {
331
  tinyMCE.activeEditor.selection.setContent('[wc_fullwidth selector="#main"]' + wcDummyContent + '[/wc_fullwidth]');
332
  }
333
 
334
 
335
- if(id == "html") {
336
  tinyMCE.activeEditor.selection.setContent('[wc_html name="Custom Field Name"]');
337
  }
338
 
339
 
340
- if(id == "code") {
341
  tinyMCE.activeEditor.selection.setContent('[wc_code]' + wcDummyContent + '[/wc_code]');
342
  }
343
 
344
 
345
- if(id == "pre") {
346
  tinyMCE.activeEditor.selection.setContent('[wc_pre color="1" wrap="0" scrollable="1" linenums="0" name="Custom Field Name"]');
347
  }
348
 
349
 
350
  return false;
351
  }
352
- })
353
  }
354
 
355
  });
1
+ (function () {
2
+ "use strict";
3
+
4
  tinymce.create('tinymce.plugins.wcShortcodeMce', {
5
  init : function(ed, url){
6
  tinymce.plugins.wcShortcodeMce.theurl = url;
7
  },
8
  createControl : function(btn, e) {
9
+ if ( btn === "wc_shortcodes_button" ) {
10
+ var a = this;
11
+
12
+ // out puts an js error when clicking on button
13
+ // btn = e.createSplitButton('wc_shortcodes_button', {
14
+
15
+ btn = e.createMenuButton('wc_shortcodes_button', {
16
+ title: "Insert Shortcode",
17
  image: tinymce.plugins.wcShortcodeMce.theurl +"/images/shortcodes.png",
18
  icons: false,
19
+ });
20
+ btn.onRenderMenu.add(function (c, b) {
21
 
22
  b.add({title : 'WC Shortcodes', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
23
 
47
  a.render( c, "Heading", "heading" );
48
  a.render( c, "Pricing Table", "pricing" );
49
  a.render( c, "Skillbar", "skillbar" );
50
+ a.render( c, "Social Icon", "social" );
51
  a.render( c, "Testimonial", "testimonial" );
52
  a.render( c, "HTML", "html" );
53
 
114
 
115
 
116
  });
117
+
118
+ return btn;
119
  }
120
+ return null;
121
  },
122
  render : function(ed, title, id) {
123
  ed.add({
128
  var mceSelected = tinyMCE.activeEditor.selection.getContent();
129
 
130
  // Add highlighted content inside the shortcode when possible - yay!
131
+ var wcDummyContent;
132
  if ( mceSelected ) {
133
+ wcDummyContent = mceSelected;
134
  } else {
135
+ wcDummyContent = 'Sample Content';
136
  }
137
  var wcParagraphContent = '<p>Sample Content</p>';
138
 
139
  // Accordion
140
+ if(id === "accordion") {
141
  tinyMCE.activeEditor.selection.setContent('<p>[wc_accordion collapse="0"][wc_accordion_section title="Section 1"]</p>' + wcParagraphContent + '<p>[/wc_accordion_section][wc_accordion_section title="Section 2"]</p>' + wcParagraphContent + '<p>[/wc_accordion_section][/wc_accordion]</p>');
142
  }
143
 
145
 
146
 
147
  // Boxes
148
+ if(id === "primaryBox") {
149
  tinyMCE.activeEditor.selection.setContent('[wc_box color="primary" text_align="left"]' + wcDummyContent + '[/wc_box]');
150
  }
151
+ if(id === "secondaryBox") {
152
  tinyMCE.activeEditor.selection.setContent('[wc_box color="secondary" text_align="left"]' + wcDummyContent + '[/wc_box]');
153
  }
154
+ if(id === "inverseBox") {
155
  tinyMCE.activeEditor.selection.setContent('[wc_box color="inverse" text_align="left"]' + wcDummyContent + '[/wc_box]');
156
  }
157
+ if(id === "successBox") {
158
  tinyMCE.activeEditor.selection.setContent('[wc_box color="success" text_align="left"]' + wcDummyContent + '[/wc_box]');
159
  }
160
+ if(id === "warningBox") {
161
  tinyMCE.activeEditor.selection.setContent('[wc_box color="warning" text_align="left"]' + wcDummyContent + '[/wc_box]');
162
  }
163
+ if(id === "dangerBox") {
164
  tinyMCE.activeEditor.selection.setContent('[wc_box color="danger" text_align="left"]' + wcDummyContent + '[/wc_box]');
165
  }
166
+ if(id === "infoBox") {
167
  tinyMCE.activeEditor.selection.setContent('[wc_box color="info" text_align="left"]' + wcDummyContent + '[/wc_box]');
168
  }
169
 
171
 
172
 
173
  // Button
174
+ if(id === "button") {
175
  tinyMCE.activeEditor.selection.setContent('[wc_button type="primary" url="http://www.wordpresscanvas.com" title="Visit Site" target="self"]' + wcDummyContent + '[/wc_button]');
176
  }
177
 
179
 
180
 
181
  // Clear Floats
182
+ if(id === "clear") {
183
  tinyMCE.activeEditor.selection.setContent('[wc_clear_floats]');
184
  }
185
 
187
 
188
 
189
  // Columns
190
+ if(id === "half-half") {
191
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-half" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
192
  }
193
+ if(id === "third-third-third") {
194
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
195
  }
196
+ if(id === "third-twothird") {
197
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="two-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
198
  }
199
+ if(id === "twothird-third") {
200
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="two-third" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-third" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
201
  }
202
+ if(id === "fourth-fourth-fourth-fourth") {
203
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
204
  }
205
+ if(id === "fourth-half-fourth") {
206
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
207
  }
208
+ if(id === "half-fourth-fourth") {
209
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-half" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
210
  }
211
+ if(id === "fourth-fourth-half") {
212
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-half" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
213
  }
214
+ if(id === "fourth-three-fourth") {
215
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="one-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="three-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
216
  }
217
+ if(id === "three-fourth-fourth") {
218
  tinyMCE.activeEditor.selection.setContent('<p>[wc_row][wc_column size="three-fourth" position="first"]</p>' + wcParagraphContent + '<p>[/wc_column][wc_column size="one-fourth" position="last"]</p>' + wcParagraphContent + '<p>[/wc_column][/wc_row]</p>');
219
  }
220
 
221
 
222
 
223
  // Divider
224
+ if(id === "solidDivider") {
225
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="single" margin_top="" margin_bottom=""]');
226
  }
227
+ if(id === "dashedDivider") {
228
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="dashed" line="single" margin_top="" margin_bottom=""]');
229
  }
230
+ if(id === "dottedDivider") {
231
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="dotted" line="single" margin_top="" margin_bottom=""]');
232
  }
233
+ if(id === "doubleDivider") {
234
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="double" margin_top="" margin_bottom=""]');
235
  }
236
+ if(id === "tripleDivider") {
237
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="solid" line="triple" margin_top="" margin_bottom=""]');
238
  }
239
+ if(id === "imageDivider") {
240
  tinyMCE.activeEditor.selection.setContent('[wc_divider style="image" margin_top="" margin_bottom=""]');
241
  }
242
 
244
 
245
 
246
  // Google Map
247
+ if(id === "googlemap") {
248
  tinyMCE.activeEditor.selection.setContent('[wc_googlemap title="St. Paul\'s Chapel" location="209 Broadway, New York, NY 10007" zoom="10" height="250"]');
249
  }
250
 
252
 
253
 
254
  // Heading
255
+ if(id === "heading") {
256
  tinyMCE.activeEditor.selection.setContent('[wc_heading type="h1" title="' + wcDummyContent + '" text_align="left"]');
257
  }
258
 
260
 
261
 
262
  // Highlight
263
+ if(id === "blueHighlight") {
264
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="blue"]' + wcDummyContent + '[/wc_highlight]');
265
  }
266
+ if(id === "grayHighlight") {
267
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="gray"]' + wcDummyContent + '[/wc_highlight]');
268
  }
269
+ if(id === "greenHighlight") {
270
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="green"]' + wcDummyContent + '[/wc_highlight]');
271
  }
272
+ if(id === "redHighlight") {
273
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="red"]' + wcDummyContent + '[/wc_highlight]');
274
  }
275
+ if(id === "yellowHighlight") {
276
  tinyMCE.activeEditor.selection.setContent('[wc_highlight color="yellow"]' + wcDummyContent + '[/wc_highlight]');
277
+ }
278
 
279
 
280
 
281
  // Pricing
282
+ if(id === "pricing") {
283
  tinyMCE.activeEditor.selection.setContent('[wc_pricing featured="yes" plan="Basic" cost="$19.99" per="per month" button_url="#" button_text="Sign Up" button_target="self" button_rel="nofollow"]<ul><li>30GB Storage</li><li>512MB Ram</li><li>10 databases</li><li>1,000 Emails</li><li>25GB Bandwidth</li></ul>[/wc_pricing]');
284
  }
285
 
287
 
288
 
289
  //Spacing
290
+ if(id === "spacing") {
291
  tinyMCE.activeEditor.selection.setContent('[wc_spacing size="40px"]');
292
  }
293
 
295
 
296
 
297
  //Social
298
+ if(id === "social") {
299
  tinyMCE.activeEditor.selection.setContent('[wc_social_icons align="left" size="large" display="facebook,google,twitter,pinterest,instagram,bloglovin,flickr,rss,email,custom1,custom2,custom3,custom4,custom5"]');
300
  }
301
 
303
 
304
 
305
  //Skillbar
306
+ if(id === "skillbar") {
307
  tinyMCE.activeEditor.selection.setContent('[wc_skillbar title="' + wcDummyContent + '" percentage="100" color="#6adcfa"]');
308
  }
309
 
311
 
312
 
313
  //Tabs
314
+ if(id === "tabs") {
315
  tinyMCE.activeEditor.selection.setContent('<p>[wc_tabgroup][wc_tab title="First Tab"]</p>'+wcParagraphContent+'<p>[/wc_tab][wc_tab title="Second Tab"]</p>'+wcParagraphContent+'<p>[/wc_tab][/wc_tabgroup]</p>');
316
  }
317
 
318
 
319
 
320
  //Testimonial
321
+ if(id === "testimonial") {
322
  tinyMCE.activeEditor.selection.setContent('[wc_testimonial by="Wordpress Canvas" position="left"]' + wcDummyContent + '[/wc_testimonial]');
323
  }
324
 
325
 
326
 
327
  //Toggle
328
+ if(id === "toggle") {
329
  tinyMCE.activeEditor.selection.setContent('<p>[wc_toggle title="This Is Your Toggle Title" padding="" border_width=""]</p>' + wcParagraphContent + '<p>[/wc_toggle]</p>');
330
  }
331
 
332
+ if(id === "center") {
333
  tinyMCE.activeEditor.selection.setContent('<p>[wc_center max_width="500px" text_align="left"]</p>' + wcParagraphContent + '<p>[/wc_center]</p>');
334
  }
335
 
336
 
337
+ if(id === "fullwidth") {
338
  tinyMCE.activeEditor.selection.setContent('[wc_fullwidth selector="#main"]' + wcDummyContent + '[/wc_fullwidth]');
339
  }
340
 
341
 
342
+ if(id === "html") {
343
  tinyMCE.activeEditor.selection.setContent('[wc_html name="Custom Field Name"]');
344
  }
345
 
346
 
347
+ if(id === "code") {
348
  tinyMCE.activeEditor.selection.setContent('[wc_code]' + wcDummyContent + '[/wc_code]');
349
  }
350
 
351
 
352
+ if(id === "pre") {
353
  tinyMCE.activeEditor.selection.setContent('[wc_pre color="1" wrap="0" scrollable="1" linenums="0" name="Custom Field Name"]');
354
  }
355
 
356
 
357
  return false;
358
  }
359
+ });
360
  }
361
 
362
  });
readme.txt CHANGED
@@ -44,6 +44,12 @@ Use the shortcode manager in the TinyMCE text editor
44
 
45
  == Changelog ==
46
 
 
 
 
 
 
 
47
  ### Version 1.3
48
 
49
  * Fixed style bug with columns not changing width on mobile devices
44
 
45
  == Changelog ==
46
 
47
+ ### Version 1.4
48
+
49
+ * Fixed minor JS bugs
50
+ * Ran Javascript through jshint
51
+ * Fixed minor shortcode button bug in TinyMCE editor
52
+
53
  ### Version 1.3
54
 
55
  * Fixed style bug with columns not changing width on mobile devices
wc-shortcodes.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpresscanvas.com/features/shortcodes/
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
- Version: 1.3
9
  License: GPLv2 or later
10
  */
11
 
5
  Description: A family of shortcodes to enhance site functionality.
6
  Author: Chris Baldelomar
7
  Author URI: http://webplantmedia.com/
8
+ Version: 1.4
9
  License: GPLv2 or later
10
  */
11