From: Steve Sutton Date: Fri, 24 Jun 2016 17:29:49 +0000 (-0400) Subject: Adding in console output for javascript X-Git-Tag: v2.1.16^2~5^2~5 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=717b0910bb991466417ea84d7c31ac6751d2b928;p=WP-Plugins%2Fglm-member-db.git Adding in console output for javascript Just adding console log and info statements to see what is going on. These should be removed before go live. --- diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index 020bdd97..02c72464 100644 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -527,7 +527,7 @@ return; // Off for now ** Need to make this switchable in management // This button will add another shortcode editor - echo ''; + //echo ''; } } diff --git a/js/shortcodeBuilder.js b/js/shortcodeBuilder.js index c37a8dae..ae99b50f 100644 --- a/js/shortcodeBuilder.js +++ b/js/shortcodeBuilder.js @@ -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];