Version Description
- June 8th, 2017 =
- WordPress 4.8 support - using the new JavaScript Editor API functions to instantiate the editor and removed requiring WordPress' wpembed plugin
Download this release
Release Info
Developer | yikesitskevin |
Plugin | Custom Product Tabs for WooCommerce |
Version | 1.5.15 |
Comparing to | |
See all releases |
Code changes from version 1.5.14 to 1.5.15
js/repeatable-custom-tabs-shared.js
CHANGED
@@ -41,13 +41,15 @@
|
|
41 |
jQuery( '.' + textarea_id + '_field' ).html( response ).addClass( '_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic' );
|
42 |
|
43 |
// Initialize quicktags (for working in 'Text tab' mode)
|
44 |
-
if ( typeof(
|
45 |
-
quicktags(
|
|
|
46 |
}
|
47 |
|
48 |
// These are WordPress default editor settings, retrieved from wp-includes\class-wp-editor.php
|
49 |
// The `setup:` function is not part of the WordPress core, but the default styles were not being applied
|
50 |
tinymce.init({
|
|
|
51 |
selector: '#' + textarea_id,
|
52 |
theme: 'modern',
|
53 |
skin: 'lightgray',
|
@@ -80,7 +82,7 @@
|
|
80 |
end_container_on_empty_block: true,
|
81 |
wpeditimage_disable_captions: false,
|
82 |
wpeditimage_html5_captions: true,
|
83 |
-
plugins: 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview
|
84 |
resize: 'vertical',
|
85 |
menubar: false,
|
86 |
wpautop: true,
|
@@ -116,6 +118,96 @@
|
|
116 |
});
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* @summary Get the numerical ID from a string ID
|
121 |
*
|
@@ -275,4 +367,9 @@
|
|
275 |
// Else we need to set the value using the textarea's val
|
276 |
jQuery( '#' + editor_id ).val( content );
|
277 |
}
|
278 |
-
}
|
|
|
|
|
|
|
|
|
|
41 |
jQuery( '.' + textarea_id + '_field' ).html( response ).addClass( '_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic' );
|
42 |
|
43 |
// Initialize quicktags (for working in 'Text tab' mode)
|
44 |
+
if ( typeof( QTags ) !== 'undefined' ) {
|
45 |
+
quicktags( textarea_id );
|
46 |
+
QTags._buttonsInit();
|
47 |
}
|
48 |
|
49 |
// These are WordPress default editor settings, retrieved from wp-includes\class-wp-editor.php
|
50 |
// The `setup:` function is not part of the WordPress core, but the default styles were not being applied
|
51 |
tinymce.init({
|
52 |
+
branding: false,
|
53 |
selector: '#' + textarea_id,
|
54 |
theme: 'modern',
|
55 |
skin: 'lightgray',
|
82 |
end_container_on_empty_block: true,
|
83 |
wpeditimage_disable_captions: false,
|
84 |
wpeditimage_html5_captions: true,
|
85 |
+
plugins: 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview',
|
86 |
resize: 'vertical',
|
87 |
menubar: false,
|
88 |
wpautop: true,
|
118 |
});
|
119 |
}
|
120 |
|
121 |
+
function yikes_woo_get_wp_editor_foureight( textarea_id, product_page, tab_content ) {
|
122 |
+
|
123 |
+
if ( ! wp && ! wp.editor && ! wp.editor.initialize ) {
|
124 |
+
yikes_woo_get_wp_editor_ajax( textarea_id, product_page, tab_content );
|
125 |
+
}
|
126 |
+
|
127 |
+
// Re-enable buttons / arrows
|
128 |
+
yikes_woo_toggle_controls( 'enable' );
|
129 |
+
|
130 |
+
var settings = {
|
131 |
+
tinymce: {
|
132 |
+
branding: false,
|
133 |
+
theme: 'modern',
|
134 |
+
skin: 'lightgray',
|
135 |
+
language: 'en',
|
136 |
+
formats: {
|
137 |
+
alignleft: [
|
138 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'left' } },
|
139 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'alignleft' }
|
140 |
+
],
|
141 |
+
aligncenter: [
|
142 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'center' } },
|
143 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'aligncenter' }
|
144 |
+
],
|
145 |
+
alignright: [
|
146 |
+
{ selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: { textAlign:'right' } },
|
147 |
+
{ selector: 'img,table,dl.wp-caption', classes: 'alignright' }
|
148 |
+
],
|
149 |
+
strikethrough: { inline: 'del' }
|
150 |
+
},
|
151 |
+
relative_urls: false,
|
152 |
+
remove_script_host: false,
|
153 |
+
convert_urls: false,
|
154 |
+
browser_spellcheck: true,
|
155 |
+
fix_list_elements: true,
|
156 |
+
entities: '38,amp,60,lt,62,gt',
|
157 |
+
entity_encoding: 'raw',
|
158 |
+
keep_styles: false,
|
159 |
+
paste_webkit_styles: 'font-weight font-style color',
|
160 |
+
preview_styles: 'font-family font-size font-weight font-style text-decoration text-transform',
|
161 |
+
end_container_on_empty_block: true,
|
162 |
+
wpeditimage_disable_captions: false,
|
163 |
+
wpeditimage_html5_captions: true,
|
164 |
+
plugins: 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview',
|
165 |
+
menubar: false,
|
166 |
+
wpautop: true,
|
167 |
+
indent: false,
|
168 |
+
resize: 'both',
|
169 |
+
toolbar1: 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_adv',
|
170 |
+
toolbar2: 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
|
171 |
+
toolbar3: '',
|
172 |
+
toolbar4: '',
|
173 |
+
tabfocus_elements: ':prev,:next',
|
174 |
+
// body_class: 'id post-type-post post-status-publish post-format-standard',
|
175 |
+
setup: function( editor ) {
|
176 |
+
editor.on( 'init', function() {
|
177 |
+
this.getBody().style.fontFamily = 'Georgia, "Times New Roman", "Bitstream Charter", Times, serif';
|
178 |
+
this.getBody().style.fontSize = '16px';
|
179 |
+
this.getBody().style.color = '#333';
|
180 |
+
});
|
181 |
+
},
|
182 |
+
// width: jQuery( '#yikes_woocommerce_custom_product_tabs' ).width() * .85
|
183 |
+
},
|
184 |
+
quicktags: {
|
185 |
+
buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,more,close"
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
wp.editor.initialize( textarea_id, settings );
|
190 |
+
|
191 |
+
// If we have content, add it
|
192 |
+
if ( tab_content.length > 0 ) {
|
193 |
+
yikes_woo_set_content_for_wysiwyg( textarea_id, tab_content );
|
194 |
+
}
|
195 |
+
|
196 |
+
// If we're on the button page, show the button holder (we temporarily hide it for UI/UX purposes)
|
197 |
+
if ( product_page === true ) {
|
198 |
+
jQuery( '.button-holder' ).show();
|
199 |
+
}
|
200 |
+
|
201 |
+
// After tinymce is initialized, let's check if we need to disable the box (because it's a saved tab)
|
202 |
+
var tab_number = yikes_woo_get_tab_number_from_id( textarea_id );
|
203 |
+
if ( jQuery( '#_yikes_wc_custom_repeatable_product_tabs_tab_title_' + tab_number ).hasClass( 'yikes_woo_disable_this_tab' ) ) {
|
204 |
+
jQuery( '#_yikes_wc_custom_repeatable_product_tabs_tab_title_' + tab_number ).removeClass( 'yikes_woo_disable_this_tab' );
|
205 |
+
yikes_woo_toggle_reusable_override_overlay( 'disable', tab_number );
|
206 |
+
}
|
207 |
+
|
208 |
+
return true;
|
209 |
+
}
|
210 |
+
|
211 |
/**
|
212 |
* @summary Get the numerical ID from a string ID
|
213 |
*
|
367 |
// Else we need to set the value using the textarea's val
|
368 |
jQuery( '#' + editor_id ).val( content );
|
369 |
}
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
|
374 |
+
|
375 |
+
|
js/repeatable-custom-tabs-shared.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yikes_woo_get_wp_editor_ajax(a,b,c){var d={action:"yikes_woo_get_wp_editor",textarea_id:a,tab_content:c,security_nonce:repeatable_custom_tabs_shared.get_wp_editor_security_nonce};jQuery.post(repeatable_custom_tabs_shared.ajaxurl,d,function(c){if(yikes_woo_toggle_controls("enable"),"undefined"!=typeof c.success&&c.success===!1)return jQuery("."+a+"_field").html("<p>"+repeatable_custom_tabs_shared.get_wp_editor_failure_message+"</p>"),!1;b===!0&&jQuery(".button-holder").show(),jQuery("."+a+"_field").html(c).addClass("_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic"),"undefined"!=typeof
|
1 |
+
function yikes_woo_get_wp_editor_ajax(a,b,c){var d={action:"yikes_woo_get_wp_editor",textarea_id:a,tab_content:c,security_nonce:repeatable_custom_tabs_shared.get_wp_editor_security_nonce};jQuery.post(repeatable_custom_tabs_shared.ajaxurl,d,function(c){if(yikes_woo_toggle_controls("enable"),"undefined"!=typeof c.success&&c.success===!1)return jQuery("."+a+"_field").html("<p>"+repeatable_custom_tabs_shared.get_wp_editor_failure_message+"</p>"),!1;b===!0&&jQuery(".button-holder").show(),jQuery("."+a+"_field").html(c).addClass("_yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_field_dynamic"),"undefined"!=typeof QTags&&(quicktags(a),QTags._buttonsInit()),tinymce.init({branding:!1,selector:"#"+a,theme:"modern",skin:"lightgray",language:"en",formats:{alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table,dl.wp-caption",classes:"alignleft"}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img,table,dl.wp-caption",classes:"aligncenter"}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table,dl.wp-caption",classes:"alignright"}],strikethrough:{inline:"del"}},relative_urls:!1,remove_script_host:!1,convert_urls:!1,browser_spellcheck:!0,fix_list_elements:!0,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:!1,paste_webkit_styles:"font-weight font-style color",preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:!0,wpeditimage_disable_captions:!1,wpeditimage_html5_captions:!0,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview",resize:"vertical",menubar:!1,wpautop:!0,indent:!1,toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_adv",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",toolbar3:"",toolbar4:"",tabfocus_elements:":prev,:next",body_class:"id post-type-post post-status-publish post-format-standard",setup:function(a){a.on("init",function(){this.getBody().style.fontFamily='Georgia, "Times New Roman", "Bitstream Charter", Times, serif',this.getBody().style.fontSize="16px",this.getBody().style.color="#333"})}}),"undefined"!=typeof tinymce&&tinymce.execCommand("mceAddEditor",!1,a);var d=yikes_woo_get_tab_number_from_id(a);return jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+d).hasClass("yikes_woo_disable_this_tab")&&(jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+d).removeClass("yikes_woo_disable_this_tab"),yikes_woo_toggle_reusable_override_overlay("disable",d)),!0})}function yikes_woo_get_wp_editor_foureight(a,b,c){wp||wp.editor||wp.editor.initialize||yikes_woo_get_wp_editor_ajax(a,b,c),yikes_woo_toggle_controls("enable");var d={tinymce:{branding:!1,theme:"modern",skin:"lightgray",language:"en",formats:{alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table,dl.wp-caption",classes:"alignleft"}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img,table,dl.wp-caption",classes:"aligncenter"}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table,dl.wp-caption",classes:"alignright"}],strikethrough:{inline:"del"}},relative_urls:!1,remove_script_host:!1,convert_urls:!1,browser_spellcheck:!0,fix_list_elements:!0,entities:"38,amp,60,lt,62,gt",entity_encoding:"raw",keep_styles:!1,paste_webkit_styles:"font-weight font-style color",preview_styles:"font-family font-size font-weight font-style text-decoration text-transform",end_container_on_empty_block:!0,wpeditimage_disable_captions:!1,wpeditimage_html5_captions:!0,plugins:"charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wpview",menubar:!1,wpautop:!0,indent:!1,resize:"both",toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_adv",toolbar2:"strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",toolbar3:"",toolbar4:"",tabfocus_elements:":prev,:next",setup:function(a){a.on("init",function(){this.getBody().style.fontFamily='Georgia, "Times New Roman", "Bitstream Charter", Times, serif',this.getBody().style.fontSize="16px",this.getBody().style.color="#333"})}},quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,more,close"}};wp.editor.initialize(a,d),c.length>0&&yikes_woo_set_content_for_wysiwyg(a,c),b===!0&&jQuery(".button-holder").show();var e=yikes_woo_get_tab_number_from_id(a);return jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+e).hasClass("yikes_woo_disable_this_tab")&&(jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+e).removeClass("yikes_woo_disable_this_tab"),yikes_woo_toggle_reusable_override_overlay("disable",e)),!0}function yikes_woo_get_tab_number_from_id(a){return a.slice(a.lastIndexOf("_")+1)}function yikes_woo_toggle_controls(a){"disable"===a?(jQuery(".remove_this_tab").attr("disabled","disabled"),jQuery("#add_another_tab").attr("disabled","disabled"),jQuery("._yikes_wc_apply_a_saved_tab").attr("disabled","disabled"),jQuery(".move-tab-data-up").hide(),jQuery(".move-tab-data-down").hide()):(jQuery(".remove_this_tab").removeAttr("disabled"),jQuery("#add_another_tab").removeAttr("disabled"),jQuery("._yikes_wc_apply_a_saved_tab").removeAttr("disabled"),jQuery(".move-tab-data-up").show(),jQuery(".move-tab-data-down").show())}function yikes_woo_display_feedback_messages(a,b,c,d){var e={inline:!1,classes:[],css_string:"",time:3e3},f=jQuery.extend(e,d);jQuery("._yikes_wc_feedback_message").remove();var g="";f.css_string.length>0&&(g=f.css_string);var h=e.classes;f.classes.length>0&&f.classes.each(function(a,b){h+=b});var i="";i=f.inline===!0?'<span id="'+b+'" class="_yikes_wc_feedback_message '+h+'" style="'+g+'">'+c+"</span>":'<p id="'+b+'" class="_yikes_wc_feedback_message '+h+'" style="'+g+'">'+c+"</p>",jQuery(a).after(i),jQuery("#"+b).fadeIn(500).delay(f.time).fadeOut(500)}function yikes_woo_toggle_how_to(){jQuery(".yikes-woo-tabs-hidden-how-to-info").slideToggle("fast",function(){jQuery("#yikes-woo-help-me-icon").hasClass("dashicons-editor-help")?jQuery("#yikes-woo-help-me-icon").removeClass("dashicons-editor-help").addClass("dashicons-dismiss"):jQuery("#yikes-woo-help-me-icon").removeClass("dashicons-dismiss").addClass("dashicons-editor-help")})}function yikes_woo_get_content_from_wysiwyg(a){var b="";return"undefined"!==tinymce&&null!==tinymce.get(a)?(b=tinymce.get(a).getContent(),0===b.length&&jQuery("#"+a).val().length>0&&(b=jQuery("#"+a).val())):b=jQuery("#"+a).val(),b}function yikes_woo_set_content_for_wysiwyg(a,b){"undefined"!==tinymce&&null!==tinymce.get(a)?(tinymce.get(a).setContent(b),jQuery("#"+a).val(b)):jQuery("#"+a).val(b)}
|
js/repeatable-custom-tabs.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
/*
|
2 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
|
|
3 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
|
|
1 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
2 |
+
/*
|
3 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
js/repeatable-custom-tabs.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yikes_woo_apply_resuable_tab(a){var b=a.data,c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d=b.tab_title,e=b.tab_id,f=b.tab_content;yikes_woo_add_another_tab(f);var g=jQuery("#number_of_tabs").val();jQuery("#"+c+g).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(e),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+g+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",g):jQuery("#"+c+g).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show()}function yikes_woo_fetch_reusable_tab(a,b){var c={action:"yikes_woo_fetch_reusable_tab",tab_id:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){global_lity.close(),b(a)})}function yikes_woo_fetch_reusable_tabs(a,b){var c={action:"yikes_woo_fetch_reusable_tabs",fetch_tab_content:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tabs_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){b(a)})}function yikes_woo_handle_reusable_tabs(a){if("undefined"!=typeof a.success&&a.success===!0)if("undefined"!=typeof a.data&&"undefined"!=typeof a.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(a.data.message).fadeIn().delay("2000").fadeOut();else{var b=JSON.parse(a.data);lity_html=create_lity_manage_reusable_tabs_html(b),global_lity=lity(lity_html,{handler:"inline"})}else"undefined"!=typeof a.success&&a.success===!1&&console.log(response);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}function create_lity_manage_reusable_tabs_html(a){var b=1,c="";return c+='<div class="display_saved_tabs_lity">',c+='<div class="yikes_wc_lity_header">',c+="<span> Choose a Tab </span>",c+="</div>",jQuery.each(a,function(a,d){c+='<div id="saved_tab_container_'+b+'" data-tab-id="'+d.tab_id+'">',c+='<div class="yikes_wc_lity_col_title">',c+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+b+'">',c+=d.tab_title,c+="</span>",c+="</div>",c+='<div class="yikes_wc_lity_col_select">',c+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+b+'"></span>',c+="</div>",c+="</div>",b++}),c+="</div>"}function yikes_woo_toggle_reusable_override_overlay(a,b){"disable"===a?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").addClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").removeClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").removeClass("yikes_woo_using_reusable_tab"))}function yikes_woo_check_for_reusable_tabs_and_disable(){jQuery(".yikes_wc_override_reusable_tab_container").each(function(){if(1==jQuery(this).data("reusable-tab")){var a=jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number");yikes_woo_toggle_reusable_override_overlay("disable",a)}})}function yikes_woo_add_another_tab(a){yikes_woo_toggle_controls("disable"),jQuery("._yikes_wc_add_tab_center_new").removeClass("_yikes_wc_add_tab_center_new"),jQuery("#add_another_tab").parent(".add_tabs_container").removeClass("_yikes_wc_add_tab_center");var b=jQuery("#duplicate_this_row"),c=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),d=jQuery("#duplicate_this_row .button-holder"),e="_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c,f="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c;b.children("p").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+c).attr("data-tab-number",c),jQuery(".new_duplicate_row").children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+c).attr("id","_yikes_wc_override_reusable_tab_label_"+c).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c),jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",f).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",f).parents("p").addClass(f+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",f+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&jQuery(this).attr("name",e).attr("id",e).parents("p").addClass(e+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",e+"_field")}),jQuery("#number_of_tabs").val(c),c>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')}),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+c),d.clone().insertAfter(jQuery("."+e+"_field")).addClass("last-button-holder"),jQuery(".last-button-holder").removeAttr("alt").attr("alt",c).hide(),jQuery("."+e+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(e,!0,a),jQuery(".last-button-holder").removeClass("last-button-holder"),jQuery(".new_duplicate_row").removeClass("new_duplicate_row")}function yikes_woo_set_editor_specific_styles(){jQuery('textarea[name^="_yikes_wc_custom_repeatable_product_tabs_tab_content_"]').each(function(){jQuery(this).addClass("yikes_woo_custom_editor_styles")})}jQuery(document).ready(function(){setTimeout(function(){yikes_woo_check_for_reusable_tabs_and_disable(),yikes_woo_set_editor_specific_styles()},4e3),jQuery(".yikes-tabs-how-to-toggle").on("click",function(a){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(a){yikes_woo_add_another_tab(""),a.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(a){var b=jQuery(this),c=b.parents(".button-holder").attr("alt"),d=jQuery("#number_of_tabs").val(),e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(c!==d)for(var g=parseInt(c);g<d;){var h="",i="",j=g+1;h=jQuery("#"+e+j).val(),jQuery("#"+e+g).val(h),i=yikes_woo_get_content_from_wysiwyg(f+j),yikes_woo_set_content_for_wysiwyg(f+g,i);var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(l);var m=jQuery("#_yikes_wc_override_reusable_tab_"+j).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",m),jQuery("#_yikes_wc_override_reusable_tab_container_"+j).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+j+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",g):yikes_woo_toggle_reusable_override_overlay("enable",g),g++}var e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_",n=f+d,o=jQuery("#_yikes_wc_override_reusable_tab_container_"+d),p=jQuery("."+e+d+"_field"),q=jQuery("."+f+d+"_field"),r=jQuery(".yikes-woo-custom-tab-divider").last(),s=jQuery("."+f+d+"_field").next(".button-holder"),t=parseInt(d)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,n),o.remove(),p.remove(),q.remove(),r.remove(),s.remove(),jQuery("#number_of_tabs").val(t),0===parseInt(t)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),a.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt");if(1==b)return!1;var c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d="_yikes_wc_custom_repeatable_product_tabs_tab_content_",e=jQuery("#"+c+b).val(),f=yikes_woo_get_content_from_wysiwyg(d+b),g=parseInt(b)-parseInt(1),h=jQuery("#"+c+g).val(),i=yikes_woo_get_content_from_wysiwyg(d+g);jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",g)):jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",g));var j=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(j),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(k),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+c+b).val(h),jQuery("#"+c+g).val(e),yikes_woo_set_content_for_wysiwyg(d+b,i),yikes_woo_set_content_for_wysiwyg(d+g,f)}),jQuery("body").on("click",".move-tab-data-down",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt"),c=jQuery("#number_of_tabs").val();if(b==c)return!1;var d="_yikes_wc_custom_repeatable_product_tabs_tab_title_",e="_yikes_wc_custom_repeatable_product_tabs_tab_content_",f=jQuery("#"+d+b).val(),g=yikes_woo_get_content_from_wysiwyg(e+b),h=parseInt(b)+parseInt(1),i=jQuery("#"+d+h).val(),j=yikes_woo_get_content_from_wysiwyg(e+h);jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",h)):jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",h));var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(),n=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(n),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val(l),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+d+b).val(i),jQuery("#"+d+h).val(f),yikes_woo_set_content_for_wysiwyg(e+b,j),yikes_woo_set_content_for_wysiwyg(e+h,g)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){return!jQuery(this).hasClass("disabled")&&(jQuery(this).addClass("disabled"),void yikes_woo_fetch_reusable_tabs(!1,yikes_woo_handle_reusable_tabs))}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var a=jQuery(this).data("saved-tab-number"),b=jQuery("#saved_tab_container_"+a).data("tab-id");jQuery(".lity-content").html(repeatable_custom_tabs.loading_gif).css("width","50px").children("img").css("margin-left","37%"),yikes_woo_fetch_reusable_tab(b,yikes_woo_apply_resuable_tab)}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var a=jQuery(this).data("tab-number");jQuery(this).is(":checked")===!0?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+a,"_yikes_wc_override_reusable_tab_message","If you override this tab it will no longer recognize global tab changes.",!1),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",a)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",a))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var a=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return a.removeClass("_yikes_wc_title_red_overlay"),void a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var b=jQuery(this).attr("id"),c=jQuery(this).val(),d=!1;jQuery(".yikes_woo_tabs_title_field").each(function(e,f){jQuery(f).attr("id")!=b&&""!=jQuery(f).val()&&jQuery(f).val()===c&&(a.addClass("_yikes_wc_title_red_overlay"),a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),a.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),d=!0)}),d===!1&&(jQuery("._yikes_wc_title_red_overlay").removeClass("_yikes_wc_title_red_overlay"),jQuery("._yikes_wc_duplicate_title_message").remove())}),jQuery("body").on("lity:close",function(){jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}),jQuery("#yikes_woo_save_custom_tabs").click(function(){if(jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")!==!0){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();for(var a=jQuery("#number_of_tabs").val(),b={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:a,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce},c=1;c<=a;c++)b["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,b,function(a){"undefined"!=typeof a.success&&(a.success===!0?feedback_message_class="yikes_woo_save_success":a.success===!1&&(feedback_message_class="yikes_woo_save_failure")),"undefined"!=typeof a.data&&"undefined"!=typeof a.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(a.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
1 |
+
function yikes_woo_apply_resuable_tab(a){var b=a.data,c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d=b.tab_title,e=b.tab_id,f=b.tab_content;yikes_woo_add_another_tab(f);var g=jQuery("#number_of_tabs").val();jQuery("#"+c+g).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(e),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+g+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",g):jQuery("#"+c+g).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show()}function yikes_woo_fetch_reusable_tab(a,b){var c={action:"yikes_woo_fetch_reusable_tab",tab_id:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){global_lity.close(),b(a)})}function yikes_woo_fetch_reusable_tabs(a,b){var c={action:"yikes_woo_fetch_reusable_tabs",fetch_tab_content:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tabs_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){b(a)})}function yikes_woo_handle_reusable_tabs(a){if("undefined"!=typeof a.success&&a.success===!0)if("undefined"!=typeof a.data&&"undefined"!=typeof a.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(a.data.message).fadeIn().delay("2000").fadeOut();else{var b=JSON.parse(a.data);lity_html=create_lity_manage_reusable_tabs_html(b),global_lity=lity(lity_html,{handler:"inline"})}else"undefined"!=typeof a.success&&a.success===!1&&console.log(response);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}function create_lity_manage_reusable_tabs_html(a){var b=1,c="";return c+='<div class="display_saved_tabs_lity">',c+='<div class="yikes_wc_lity_header">',c+="<span> Choose a Tab </span>",c+="</div>",jQuery.each(a,function(a,d){c+='<div id="saved_tab_container_'+b+'" data-tab-id="'+d.tab_id+'">',c+='<div class="yikes_wc_lity_col_title">',c+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+b+'">',c+=d.tab_title,c+="</span>",c+="</div>",c+='<div class="yikes_wc_lity_col_select">',c+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+b+'"></span>',c+="</div>",c+="</div>",b++}),c+="</div>"}function yikes_woo_toggle_reusable_override_overlay(a,b){"disable"===a?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").addClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").removeClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").removeClass("yikes_woo_using_reusable_tab"))}function yikes_woo_check_for_reusable_tabs_and_disable(){jQuery(".yikes_wc_override_reusable_tab_container").each(function(){if(1==jQuery(this).data("reusable-tab")){var a=jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number");yikes_woo_toggle_reusable_override_overlay("disable",a)}})}function yikes_woo_add_another_tab(a){yikes_woo_toggle_controls("disable"),jQuery("._yikes_wc_add_tab_center_new").removeClass("_yikes_wc_add_tab_center_new"),jQuery("#add_another_tab").parent(".add_tabs_container").removeClass("_yikes_wc_add_tab_center");var b=jQuery("#duplicate_this_row"),c=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),d=jQuery("#duplicate_this_row .button-holder"),e="_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c,f="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c;b.children("p").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+c).attr("data-tab-number",c),jQuery(".new_duplicate_row").children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+c).attr("id","_yikes_wc_override_reusable_tab_label_"+c).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c),jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",f).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",f).parents("p").addClass(f+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",f+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&jQuery(this).attr("name",e).attr("id",e).parents("p").addClass(e+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",e+"_field")}),jQuery("#number_of_tabs").val(c),c>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')}),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+c),d.clone().insertAfter(jQuery("."+e+"_field")).addClass("last-button-holder"),jQuery(".last-button-holder").removeAttr("alt").attr("alt",c).hide(),1===parseInt(repeatable_custom_tabs.wp_version_four_eight)?yikes_woo_get_wp_editor_foureight(e,!0,a):(jQuery("."+e+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(e,!0,a)),jQuery(".last-button-holder").removeClass("last-button-holder"),jQuery(".new_duplicate_row").removeClass("new_duplicate_row")}function yikes_woo_set_editor_specific_styles(){jQuery('textarea[name^="_yikes_wc_custom_repeatable_product_tabs_tab_content_"]').each(function(){jQuery(this).addClass("yikes_woo_custom_editor_styles")})}jQuery(document).ready(function(){setTimeout(function(){yikes_woo_check_for_reusable_tabs_and_disable(),yikes_woo_set_editor_specific_styles()},4e3),jQuery(".yikes-tabs-how-to-toggle").on("click",function(a){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(a){yikes_woo_add_another_tab(""),a.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(a){var b=jQuery(this),c=b.parents(".button-holder").attr("alt"),d=jQuery("#number_of_tabs").val(),e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(c!==d)for(var g=parseInt(c);g<d;){var h="",i="",j=g+1;h=jQuery("#"+e+j).val(),jQuery("#"+e+g).val(h),i=yikes_woo_get_content_from_wysiwyg(f+j),yikes_woo_set_content_for_wysiwyg(f+g,i);var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(l);var m=jQuery("#_yikes_wc_override_reusable_tab_"+j).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",m),jQuery("#_yikes_wc_override_reusable_tab_container_"+j).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+j+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",g):yikes_woo_toggle_reusable_override_overlay("enable",g),g++}var e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_",n=f+d,o=jQuery("#_yikes_wc_override_reusable_tab_container_"+d),p=jQuery("."+e+d+"_field"),q=jQuery("."+f+d+"_field"),r=jQuery(".yikes-woo-custom-tab-divider").last(),s=jQuery("."+f+d+"_field").next(".button-holder"),t=parseInt(d)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,n),o.remove(),p.remove(),q.remove(),r.remove(),s.remove(),jQuery("#number_of_tabs").val(t),0===parseInt(t)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),a.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt");if(1==b)return!1;var c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d="_yikes_wc_custom_repeatable_product_tabs_tab_content_",e=jQuery("#"+c+b).val(),f=yikes_woo_get_content_from_wysiwyg(d+b),g=parseInt(b)-parseInt(1),h=jQuery("#"+c+g).val(),i=yikes_woo_get_content_from_wysiwyg(d+g);jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",g)):jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",g));var j=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(j),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(k),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+c+b).val(h),jQuery("#"+c+g).val(e),yikes_woo_set_content_for_wysiwyg(d+b,i),yikes_woo_set_content_for_wysiwyg(d+g,f)}),jQuery("body").on("click",".move-tab-data-down",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt"),c=jQuery("#number_of_tabs").val();if(b==c)return!1;var d="_yikes_wc_custom_repeatable_product_tabs_tab_title_",e="_yikes_wc_custom_repeatable_product_tabs_tab_content_",f=jQuery("#"+d+b).val(),g=yikes_woo_get_content_from_wysiwyg(e+b),h=parseInt(b)+parseInt(1),i=jQuery("#"+d+h).val(),j=yikes_woo_get_content_from_wysiwyg(e+h);jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",h)):jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",h));var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(),n=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(n),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val(l),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+d+b).val(i),jQuery("#"+d+h).val(f),yikes_woo_set_content_for_wysiwyg(e+b,j),yikes_woo_set_content_for_wysiwyg(e+h,g)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){return!jQuery(this).hasClass("disabled")&&(jQuery(this).addClass("disabled"),void yikes_woo_fetch_reusable_tabs(!1,yikes_woo_handle_reusable_tabs))}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var a=jQuery(this).data("saved-tab-number"),b=jQuery("#saved_tab_container_"+a).data("tab-id");jQuery(".lity-content").html(repeatable_custom_tabs.loading_gif).css("width","50px").children("img").css("margin-left","37%"),yikes_woo_fetch_reusable_tab(b,yikes_woo_apply_resuable_tab)}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var a=jQuery(this).data("tab-number");jQuery(this).is(":checked")===!0?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+a,"_yikes_wc_override_reusable_tab_message","If you override this tab it will no longer recognize global tab changes.",!1),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",a)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",a))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var a=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return a.removeClass("_yikes_wc_title_red_overlay"),void a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var b=jQuery(this).attr("id"),c=jQuery(this).val(),d=!1;jQuery(".yikes_woo_tabs_title_field").each(function(e,f){jQuery(f).attr("id")!=b&&""!=jQuery(f).val()&&jQuery(f).val()===c&&(a.addClass("_yikes_wc_title_red_overlay"),a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),a.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),d=!0)}),d===!1&&(jQuery("._yikes_wc_title_red_overlay").removeClass("_yikes_wc_title_red_overlay"),jQuery("._yikes_wc_duplicate_title_message").remove())}),jQuery("body").on("lity:close",function(){jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}),jQuery("#yikes_woo_save_custom_tabs").click(function(){if(jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")!==!0){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();for(var a=jQuery("#number_of_tabs").val(),b={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:a,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce},c=1;c<=a;c++)b["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,b,function(a){"undefined"!=typeof a.success&&(a.success===!0?feedback_message_class="yikes_woo_save_success":a.success===!1&&(feedback_message_class="yikes_woo_save_failure")),"undefined"!=typeof a.data&&"undefined"!=typeof a.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(a.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
readme.txt
CHANGED
@@ -3,10 +3,10 @@ Contributors: yikesinc, eherman24, liljimmi, yikesitskevin
|
|
3 |
Donate link: http://yikesinc.com
|
4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
Requires WooCommerce at least: 3.0.0
|
8 |
-
Tested WooCommerce up to: 3.0
|
9 |
-
Stable tag: 1.5.
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
@@ -21,6 +21,8 @@ Tab content areas use the standard WordPress text editor and may contain text, i
|
|
21 |
|
22 |
If you experience any problems, please submit a New Issue on our [Github Issue Tracker](https://github.com/yikesinc/yikes-inc-easy-custom-woocommerce-product-tabs/issues) and we'll look in to it as soon as possible.
|
23 |
|
|
|
|
|
24 |
<i>This plugin is a fork of <a href="https://wordpress.org/plugins/woocommerce-custom-product-tabs-lite/" target="_blank">SkyVerge WooCommerce Custom Product Tabs Lite</a></i>
|
25 |
|
26 |
== Installation ==
|
@@ -74,6 +76,9 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
77 |
= 1.5.14 - May 8th, 2017 =
|
78 |
* Updating some CSS for the admin tabs table - the table should now render correctly regardless of "Visual" or "Text" tab and the saved tabs list should include a scrollbar if necessary
|
79 |
|
3 |
Donate link: http://yikesinc.com
|
4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.8
|
7 |
Requires WooCommerce at least: 3.0.0
|
8 |
+
Tested WooCommerce up to: 3.1.0
|
9 |
+
Stable tag: 1.5.15
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
21 |
|
22 |
If you experience any problems, please submit a New Issue on our [Github Issue Tracker](https://github.com/yikesinc/yikes-inc-easy-custom-woocommerce-product-tabs/issues) and we'll look in to it as soon as possible.
|
23 |
|
24 |
+
This plugin is compatible with WPML.
|
25 |
+
|
26 |
<i>This plugin is a fork of <a href="https://wordpress.org/plugins/woocommerce-custom-product-tabs-lite/" target="_blank">SkyVerge WooCommerce Custom Product Tabs Lite</a></i>
|
27 |
|
28 |
== Installation ==
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 1.5.15 - June 8th, 2017 =
|
80 |
+
* WordPress 4.8 support - using the new JavaScript Editor API functions to instantiate the editor and removed requiring WordPress' wpembed plugin
|
81 |
+
|
82 |
= 1.5.14 - May 8th, 2017 =
|
83 |
* Updating some CSS for the admin tabs table - the table should now render correctly regardless of "Visual" or "Text" tab and the saved tabs list should include a scrollbar if necessary
|
84 |
|
yikes-inc-easy-custom-woocommerce-product-tabs.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
-
* Version: 1.5.
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
@@ -62,7 +62,7 @@
|
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
-
const VERSION = '1.5.
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
@@ -194,9 +194,15 @@
|
|
194 |
*/
|
195 |
public function enqueue_tab_scripts( $hook ) {
|
196 |
global $post;
|
|
|
197 |
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
|
198 |
if ( $post->post_type == 'product' ) {
|
199 |
|
|
|
|
|
|
|
|
|
|
|
200 |
// script
|
201 |
wp_enqueue_script ( 'repeatable-custom-tabs', plugin_dir_url(__FILE__) . 'js/repeatable-custom-tabs.min.js' , array( 'jquery' ) , 'all' );
|
202 |
wp_localize_script( 'repeatable-custom-tabs', 'repeatable_custom_tabs', array(
|
@@ -209,7 +215,8 @@
|
|
209 |
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
210 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
211 |
'global_post_id' => $post->ID,
|
212 |
-
'get_wp_editor_failure_message' => __('Sorry! An error has occurred while trying to retrieve the editor. Please refresh the page and try again.', 'yikes-inc-easy-custom-woocommerce-product-tabs')
|
|
|
213 |
) );
|
214 |
|
215 |
wp_enqueue_script ( 'repeatable-custom-tabs-shared', plugin_dir_url(__FILE__) . 'js/repeatable-custom-tabs-shared.min.js' );
|
@@ -862,7 +869,7 @@
|
|
862 |
$fetch_tab_content = isset( $_POST['fetch_tab_content'] ) ? filter_var( $_POST['fetch_tab_content'], FILTER_VALIDATE_BOOLEAN ) : false;
|
863 |
|
864 |
// We don't need to pass the content back, and it could be a LOT, so let's just remove it
|
865 |
-
if ( $fetch_tab_content === false ) {
|
866 |
foreach( $saved_tabs as $key => $tab ) {
|
867 |
unset( $saved_tabs[$key]['tab_content'] );
|
868 |
}
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
+
* Version: 1.5.15
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
+
const VERSION = '1.5.15';
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
194 |
*/
|
195 |
public function enqueue_tab_scripts( $hook ) {
|
196 |
global $post;
|
197 |
+
global $wp_version;
|
198 |
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
|
199 |
if ( $post->post_type == 'product' ) {
|
200 |
|
201 |
+
// Enqueue WordPress' built-in editor functions - added in WPv4.8
|
202 |
+
if ( function_exists( 'wp_enqueue_editor' ) ) {
|
203 |
+
wp_enqueue_editor();
|
204 |
+
}
|
205 |
+
|
206 |
// script
|
207 |
wp_enqueue_script ( 'repeatable-custom-tabs', plugin_dir_url(__FILE__) . 'js/repeatable-custom-tabs.min.js' , array( 'jquery' ) , 'all' );
|
208 |
wp_localize_script( 'repeatable-custom-tabs', 'repeatable_custom_tabs', array(
|
215 |
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
216 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
217 |
'global_post_id' => $post->ID,
|
218 |
+
'get_wp_editor_failure_message' => __('Sorry! An error has occurred while trying to retrieve the editor. Please refresh the page and try again.', 'yikes-inc-easy-custom-woocommerce-product-tabs'),
|
219 |
+
'wp_version_four_eight' => $wp_version >= '4.8' ? true : false
|
220 |
) );
|
221 |
|
222 |
wp_enqueue_script ( 'repeatable-custom-tabs-shared', plugin_dir_url(__FILE__) . 'js/repeatable-custom-tabs-shared.min.js' );
|
869 |
$fetch_tab_content = isset( $_POST['fetch_tab_content'] ) ? filter_var( $_POST['fetch_tab_content'], FILTER_VALIDATE_BOOLEAN ) : false;
|
870 |
|
871 |
// We don't need to pass the content back, and it could be a LOT, so let's just remove it
|
872 |
+
if ( $fetch_tab_content === false && ! empty( $saved_tabs ) ) {
|
873 |
foreach( $saved_tabs as $key => $tab ) {
|
874 |
unset( $saved_tabs[$key]['tab_content'] );
|
875 |
}
|