Adding in console output for javascript
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 24 Jun 2016 17:29:49 +0000 (13:29 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 24 Jun 2016 17:29:49 +0000 (13:29 -0400)
Just adding console log and info statements to see what is going on.
These should be removed before go live.

classes/glmPluginSupport.php
js/shortcodeBuilder.js

index 020bdd9..02c7246 100644 (file)
@@ -527,7 +527,7 @@ return; // Off for now ** Need to make this switchable in management
         
         // This button will add another shortcode editor
 
-        echo '<button id="additionalShortcode" class="button" type="button"> Configure Additional Shortcode </button>';
+        //echo '<button id="additionalShortcode" class="button" type="button"> Configure Additional Shortcode </button>';
     }
 }
 
index c37a8da..ae99b50 100644 (file)
@@ -11,15 +11,17 @@ jQuery(document).ready(function ($) {
     'use strict';
     
     var shortcodeDropdown, shortcodeCategory, blankStart, listBox, detailBox, target, boxTarget, shortcodeString,
-    editor_shortcodes, category_id, shortcodeValues = {}, editor_content;
+    editor_shortcodes, category_id, shortcodeValues = {}, editor_content, debug = false;
     
+    debug = true;
+
     $("#showDetail").hide();
     $("#categoryBox").hide();
     $("#showCategory").hide();
     $("#detailBtn").hide();
     $("[id$=-scDropdown]").hide();
     $("#packageListAttr").hide();
-    $(".scCategories").hide();
+    //$(".scCategories").hide();
 
     
     /////////////////////////////////////////////////////////////////////////////////////////
@@ -27,6 +29,9 @@ jQuery(document).ready(function ($) {
     /////////////////////////////////////////////////////////////////////////////////////////
    // fire events and reset settings when switching between shortcodes
     $("[id$=shortcodeDropdown]").on("change", function () {
+        if ( debug ) {
+            console.info( 'DEBUG INFO: [id$=shortcodeDropdown] change binding run' );
+        }
         
         // reset the dropdowns and checkbox if when switching shortcodes
         document.getElementById('category-scDropdown').options[0].selected = 'selected';
@@ -49,6 +54,9 @@ jQuery(document).ready(function ($) {
         
         // many of these are not necessary as much of the shortcode has been stripped
         if(shortcodeDropdown === "glm-members-list"){
+            if ( debug ) {
+                console.info( 'DEBUG INFO: shortcodeDropdown == glm-member-list' );
+            }
             $("#showCategory").show();
             $("#detailBtn").hide();
             $("#blank-start-scDropdown").show();
@@ -99,6 +107,9 @@ jQuery(document).ready(function ($) {
 
     // function used to get everything out of the visual and text editors
     function get_tinymce_content(){
+        if ( debug ) {
+            console.info('DEBUG INFO: get_tinymce_content run');
+        }
         if (jQuery("#wp-content-wrap").hasClass("tmce-active")){
             
             tinyMCE.triggerSave();
@@ -125,20 +136,33 @@ jQuery(document).ready(function ($) {
 
     // returned shortcode string after the editor content is filtered by the regex
     editor_shortcodes = get_tinymce_content();
-    
+    if ( debug ) {
+        console.info('DEBUG INFO: ' + editor_shortcodes);
+    }
+
     if(editor_shortcodes){
         // get the number of instances of shortcodes with the category option
         var number_of_categories = (editor_shortcodes.match(/glm-members-list category="(.*?)"/g) || []).length;
+        if ( debug ) {
+            console.info('DEBUG INFO: number_of_categories instances ' + number_of_categories );
+        }
+        //$('#shortcodeBuilder').hide();
     }
 
     if(editor_shortcodes){
         if(editor_shortcodes.match(/glm-members-list category="(.*?)"/) !== null){
+            if ( debug ) {
+                console.info('DEBUG INFO: editor_shortcodes.match true ' );
+            }
             
             // return the category option from the shortcode
             category_id = editor_shortcodes.match(/glm-members-list category="(.*?)"/)[1];
             
             // pull the ID numbers from the returned category string
             category_id = category_id.split(',');
+            if ( debug ) {
+                console.log('DEBUG INFO: category_id ', category_id );
+            }
 
         } else if (editor_shortcodes.match(/glm-members-list category=""/) !== null){
             category_id = editor_shortcodes.match(/glm-members-list category="(.*?)"/)[1];