/*
* This file taken from "Cherry Plugin": http://www.cherryframework.com/update/meet-the-cherry-plugin-bare-functionalities-no-strings-attached/
* Makes small changes 2015-08
* */
var animate_shortcode_generator_url = animate_plugin_data.url + 'admin/shortcodes/',
animateSelectedShortcodeType,
animate_tb_dialog_helper = {
animateSelectedShortcodeType: '',
needsPreview: false,
setUpButtons: function(){
var a = this;
jQuery("#animatedialog-cancel-button").click(function(){
a.closeDialog()
});
jQuery("#animatedialog-insert-button").click(function(){
a.insertAction()
});
},
setupShortcodeType: function ( shortcode ) {
animateSelectedShortcodeType = shortcode;
this.animateSelectedShortcodeType = shortcode;
},
loadShortcodeDetails: function() {
if (animateSelectedShortcodeType) {
var a = this;
// Clean out the table rows before applying the new ones.
jQuery( '#animatedialog-options-table' ).html( '' );
jQuery.getScript(animate_shortcode_generator_url + "shortcodes/my_" + animateSelectedShortcodeType + ".js", function () {
a.initializeDialog();
// Set the default content to the highlighted text, for certain shortcode types.
switch ( animateSelectedShortcodeType ) {
case 'box':
case 'ilink':
case 'quote':
case 'button':
case 'abbr':
case 'unordered_list':
case 'ordered_list':
case 'typography':
jQuery('input#value-content').val( selectedText );
case 'toggle':
jQuery('textarea#value-content').val( selectedText );
break;
}
})
}
},
initializeDialog: function (){
if (typeof frameworkShortcodeAtts == "undefined") {
jQuery("#animatedialog-shortcode-options").append("
");
} else {
var a = frameworkShortcodeAtts.attributes,
b = jQuery("#animatedialog-options-table");
// Clean out the table rows before applying the new ones.
b.html( '' );
for (var c in a) {
var f = "mytheme-value-" + a[c].id,
d = a[c].isRequired ? "mytheme-required" : "",
g = jQuery('
');
var requiredSpan = '';
if (a[c].isRequired) {
requiredSpan = '*';
} // End IF Statement
jQuery("").attr("for", f).attr("class", a[c].id).html(a[c].label).append(requiredSpan).appendTo(g);
f = jQuery("
");
d = (d = a[c].controlType) ? d : "text-control";
switch (d) {
case "tab-control":
this.createTabControl(a[c], f, c == 0);
break;
case "icon-control":
case "link-control":
case "text-control":
this.createTextControl(a[c], f, c == 0);
break;
case "textarea-control":
this.createTextAreaControl(a[c], f, c == 0);
break;
case "optgroup-select-control":
this.createOptgroupSelectControl(a[c], f, c == 0);
break;
case "select-control":
this.createSelectControl(a[c], f, c == 0);
break;
}
jQuery("
").append(g).append(f).appendTo(b)
}
jQuery(".mytheme-focus-here:first").focus()
// Add additional wrappers, etc, to each select box.
jQuery( '#woo-options select' ).each( function ( i ) {
if ( ! jQuery( this ).parent().hasClass( 'select_wrapper' ) ) {
jQuery( this ).wrap( '' ).before( '' );
}
});
jQuery('#animatedialog-shortcode-options select option:selected').each( function () {
jQuery(this).parents('.select_wrapper').find('span').text( jQuery(this).text() );
});
} // End IF Statement
},
/* Tab Generator Element */
createTabControl: function (a, b, c) {
new myThemeTabMaker(b, 10, c ? "mytheme-focus-here" : null);
b.addClass("mytheme-marker-tab-control")
},
/* Generic Text Element */
createTextControl: function (a, b, c) {
var f = a.validateLink ? "mytheme-validation-marker" : "",
d = a.isRequired ? "mytheme-required" : "",
g = "framework-" + a.id,
defaultValue = a.defaultValue ? a.defaultValue : "";
jQuery('').attr("id", g).attr("name", g).attr( 'value', defaultValue ).addClass(f).addClass(d).addClass('txt input-text').addClass(c ? "mytheme-focus-here" : "").appendTo(b);
if (a = a.help) {
jQuery(" ").appendTo(b);
jQuery("").addClass("input-help").html(a).appendTo(b)
}
var h = this;
b.find("#" + g).bind("keydown focusout", function (e) {
})
},
/* Generic TextArea Element */
createTextAreaControl: function (a, b, c) {
var f = a.validateLink ? "mytheme-validation-marker" : "",
d = a.isRequired ? "mytheme-required" : "",
g = "framework-" + a.id;
jQuery('