'use strict';
- var shortcodeDropdown, shortcodeCategory, blankStart, listBox, detailBox, target, boxTarget, shortcodeString,
+ var shortcodeDropdown, shortcodeCategory, blankStart, memberView, amenityGroups, listBox, detailBox, target, boxTarget, shortcodeString,
editor_shortcodes, category_id, shortcodeValues = {}, editor_content, debug = false;
debug = true;
}
}
if ( editor_shortcodes.match( /glm-members-list .* blank-start="(.*?)"/ ) !== null ) {
+ blankStart = editor_shortcodes.match(/glm-members-list .* blank-start="(.*?)"/)[1];
if ( debug ) {
- console.info('DEBUG INFO: editor_shortcodes.match blank-start ', editor_shortcodes.match(/glm-members-list .* blank-start="(.*?)"/)[1] );
+ console.info('DEBUG INFO: editor_shortcodes.match blank-start ', blankStart );
}
}
if ( editor_shortcodes.match( /glm-members-list .* view="(.*?)"/ ) !== null ) {
+ memberView = editor_shortcodes.match(/glm-members-list .* view="(.*?)"/)[1];
if ( debug ) {
- console.info('DEBUG INFO: editor_shortcodes.match view ', editor_shortcodes.match(/glm-members-list .* view="(.*?)"/)[1] );
+ console.info('DEBUG INFO: editor_shortcodes.match view ', memberView );
}
}
if(editor_shortcodes.match(/glm-members-list category="(.*?)"/) !== null){
$('#category-scDropdown').change( function() {
editor_shortcodes = get_tinymce_content();
- if(editor_shortcodes){
- if(editor_shortcodes.match(/category="(.*?)"/) !== null){
- category_id = editor_shortcodes.match(/glm-members-list category="(.*?)"/)[1];
+ if ( editor_shortcodes ) {
+ if ( editor_shortcodes.match( /category="(.*?)"/ ) !== null ){
+ category_id = editor_shortcodes.match( /glm-members-list category="(.*?)"/ )[1];
- if(category_id !== ""){
+ if ( category_id !== "" ) {
category_id = category_id.split(',');
ids = category_id.join(',');
});
// if more than one category id in the array, join together with ',' otherwise set the id string to a single value
- if ( new_ids.length > 1){
+ if ( new_ids.length > 1 ){
id_string = new_ids.join(',');
- } else if ( new_ids.length === 1) {
+ } else if ( new_ids.length === 1 ) {
id_string = new_ids[0];
}
// replace the current content in either the visual or text editor and replace it with a filtered version of the categories
- if($("#content").css("display") !== "none"){
+ if ( $("#content").css("display") !== "none" ) {
editor_content = content.val();
- if(empty_space){
- editor_content = editor_content.replace(ids, 'category="' + id_string + '"');
- content.val(editor_content);
+ if ( empty_space ) {
+ editor_content = editor_content.replace( ids, 'category="' + id_string + '"' );
+ content.val( editor_content );
} else {
- editor_content = editor_content.replace('category="' + ids, 'category="' + id_string);
- content.val(editor_content);
+ editor_content = editor_content.replace( 'category="' + ids, 'category="' + id_string );
+ content.val( editor_content );
}
- } else if(tinyMCE.activeEditor !== null){
- if(empty_space){
+ } else if ( tinyMCE.activeEditor !== null ) {
+ if ( empty_space ) {
editor_content = tinyMCE.get('content').getContent({format: 'raw'});
editor_content = editor_content.replace(ids, 'category="' + id_string + '"' );
tinyMCE.activeEditor.setContent(editor_content);
} else {
-
editor_content = tinyMCE.get('content').getContent({format: 'raw'});
editor_content = editor_content.replace('category="' + ids, 'category="' + id_string);
tinyMCE.activeEditor.setContent(editor_content);
});
$('#blank-start-scDropdown').change(function(){
-
+ editor_shortcodes = get_tinymce_content();
+ editor_content = content.val();
+ if ( editor_shortcodes ) {
+ if ( $("#content").css("display") !== "none" ) {
+ editor_content = editor_content.replace( ids, 'blank-start="' + $(this).val() + '"' );
+ } else if ( tinyMCE.activeEditor !== null ) {
+ }
+ }
});
-
-
- function insert_tag(text){
- if(tinyMCE && tinyMCE.activeEditor)
- {
+
+
+ function insert_tag( text ) {
+ if ( tinyMCE && tinyMCE.activeEditor ) {
tinyMCE.activeEditor.selection.setContent(text);
}
- return false;
+ return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
var members = document.getElementById('member-scDropdown');
var view = document.getElementById('view-scDropdown');
- if(scd){
+ if ( editor_shortcodes ) {
+ $('#shortcodeDropdown').val('glm-members-list');
+ $('#shortcodeDropdown').change();
+ $('#generate').hide();
+ }
+ if( scd ){
window.onload = document.getElementById('shortcodeDropdown').options[0].selected = 'selected';
}
- if(catscd){
+ if( catscd ){
window.onload = document.getElementById('category-scDropdown').options[0].selected = 'selected';
}
- if(blank){
- window.onload = document.getElementById('blank-start-scDropdown').options[0].selected = 'selected';
+ if( blank ){
+ if ( blankStart ) {
+ $('#blank-start-scDropdown').val( blankStart );
+ console.log( blankStart );
+ } else {
+ window.onload = document.getElementById('blank-start-scDropdown').options[0].selected = 'selected';
+ }
}
- if(list){
+ if( list ){
window.onload = document.getElementById('type-scList').options[0].selected = 'selected';
}
- if(members){
+ if( members ){
window.onload = document.getElementById('member-scDropdown').options[0].selected = 'selected';
}
- if(view){
- window.onload = document.getElementById('view-scDropdown').options[0].selected = 'selected';
- }
- if ( editor_shortcodes ) {
- $('#shortcodeDropdown').val('glm-members-list');
- $('#shortcodeDropdown').change();
- $('#generate').hide();
+ if( view ){
+ if ( memberView ) {
+ $('#view-scDropdown').val( memberView );
+ } else {
+ window.onload = document.getElementById('view-scDropdown').options[0].selected = 'selected';
+ }
}
-// window.onload = uncheckAll();
});