1 line
1.5 KiB
JavaScript
1 line
1.5 KiB
JavaScript
var jQuery,mla_shortcodes_tab_vars,mlaShortcodes={settings:{},utility:{getId:function(b){var c=jQuery(b).closest("tr").attr("id"),a=c.split("-");return a[a.length-1]}},addTemplate:null};(function(a){mlaShortcodes.settings=typeof mla_shortcodes_tab_vars==="undefined"?{}:mla_shortcodes_tab_vars;mla_shortcodes_tab_vars=void 0;mlaShortcodes.settings.sectionText=[];mlaShortcodes.addTemplate={init:function(){var c=this,b=a("#mla-edit-template");a("#mla-template-type, #mla-template-shortcode",b).change(function(g){var d=a("#mla-template-type",b).val(),f=a("#mla-template-shortcode",b).val();g.preventDefault();c.fillSections(d,f,b)})},fillSections:function(e,f,d){var g=a("#mla-template-item-type",d).val(),b=a("#mla-template-item-shortcode",d).val(),c=".mla_section.mla_"+g+".mla_"+b;newClass=".mla_section.mla_"+e+".mla_"+f;a("#mla-template-item-type",d).val(e),a("#mla-template-item-shortcode",d).val(f),a(c,d).each(function(i){var l=a("textarea",this).attr("id"),k=a("textarea",this).val(),j="mla-template-"+g+"-"+b+"-",h=l.substring(j.length);mlaShortcodes.settings.sectionText[h]=k});a(".mla_section",d).hide();if(e=="any"||f=="any"){return}a(newClass,d).each(function(i){var k=a("textarea",this).attr("id"),j="mla-template-"+e+"-"+f+"-",h=k.substring(j.length);if(typeof mlaShortcodes.settings.sectionText[h]!=="undefined"){a("textarea",this).val(mlaShortcodes.settings.sectionText[h])}});a(newClass,d).show()}};a(document).ready(function(){mlaShortcodes.addTemplate.init()})})(jQuery); |