'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();
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// 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';
// 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();
// 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();
// 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];