Version Description
Download this release
Release Info
Developer | eherman24 |
Plugin | Custom Product Tabs for WooCommerce |
Version | 1.8.2 |
Comparing to | |
See all releases |
Code changes from version 1.8.1 to 1.8.2
- admin/class.yikes-woo-generate-html.php +68 -65
- admin/class.yikes-woo-saved-tabs.php +22 -22
- admin/class.yikes-woo-tabs.php +25 -22
- changelog.txt +12 -7
- css/repeatable-custom-tabs.css +22 -6
- css/repeatable-custom-tabs.min.css +1 -1
- js/repeatable-custom-tabs.js +50 -41
- js/repeatable-custom-tabs.min.js +1 -1
- languages/yikes-inc-easy-custom-woocommerce-product-tabs.pot +25 -45
- readme.txt +5 -5
- yikes-inc-easy-custom-woocommerce-product-tabs.php +8 -7
admin/class.yikes-woo-generate-html.php
CHANGED
@@ -27,11 +27,11 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
27 |
|
28 |
// Pull the saved array of reusable tabs
|
29 |
$reusable_tab_options_array = get_option( 'yikes_woo_reusable_products_tabs_applied', array() );
|
30 |
-
|
31 |
// Display the custom tab panel
|
32 |
echo '<div id="yikes_woocommerce_custom_product_tabs" class="panel wc-metaboxes-wrapper woocommerce_options_panel">';
|
33 |
echo '<div class="options_group">';
|
34 |
-
|
35 |
echo $this->display_yikes_how_to();
|
36 |
|
37 |
if ( $product_has_tabs === true ) {
|
@@ -49,9 +49,9 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
49 |
// Hidden input field holding # of tabs
|
50 |
echo $this->display_yikes_number_of_tabs( count( $tab_data ) );
|
51 |
|
52 |
-
echo '</div>';
|
53 |
echo '</div>';
|
54 |
-
|
|
|
55 |
}
|
56 |
|
57 |
/* Generate HTML Functions */
|
@@ -66,12 +66,16 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
66 |
|
67 |
// duplicate_this_row content
|
68 |
echo '<div id="duplicate_this_row">';
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
echo '</div>';
|
76 |
}
|
77 |
|
@@ -129,7 +133,7 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
129 |
*/
|
130 |
protected function display_yikes_how_to() {
|
131 |
$return_html = '';
|
132 |
-
$return_html .= '<div class="yikes-woo-tabs-hidden-how-to-info">';
|
133 |
$return_html .= '<p class="yikes_woo_how_to_info">' . __( "For help using Custom Tabs please visit our <a href='https://yikesplugins.com/support/knowledge-base/product/easy-custom-product-tabs-for-woocommerce/' target='_blank'>Knowledge Base</a>" , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '</p>';
|
134 |
$return_html .= '</div>';
|
135 |
$return_html .= '<div id="yikes-woo-help-me-icon" class="dashicons dashicons-editor-help yikes-tabs-how-to-toggle" title="' . __( "Help Me!" , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '"></div>';
|
@@ -157,9 +161,9 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
157 |
$return_html .= ' style="display: none;">';
|
158 |
}
|
159 |
$return_html .= '<input type="checkbox" class="_yikes_wc_override_reusable_tab" id="_yikes_wc_override_reusable_tab_' . $i . '" data-tab-number="'. $i .'"';
|
160 |
-
$return_html .= 'title="' .
|
161 |
$return_html .= '<label id="_yikes_wc_override_reusable_tab_label_' . $i . '" for="_yikes_wc_override_reusable_tab_' . $i . '" class="_yikes_wc_override_reusable_tab_label">';
|
162 |
-
$return_html .=
|
163 |
$return_html .= '</label>';
|
164 |
$return_html .= '<input type="hidden" name="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action" class="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action"';
|
165 |
$return_html .= 'id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action" value="none">';
|
@@ -167,20 +171,14 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
167 |
$return_html .= 'id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '" value="' . $reusable_tab_id . '">';
|
168 |
$return_html .= '</p>';
|
169 |
|
170 |
-
$return_html .= '<
|
171 |
-
|
172 |
-
$return_html .=
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
<button type="button" class="move-tab-data-down" aria-disabled="false" aria-describedby="custom-product-tabs-pro-handle-order-lower-description">
|
179 |
-
<span class="screen-reader-text">' . esc_html__( 'Move down', 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '</span>
|
180 |
-
</button>
|
181 |
-
<span class="hidden" id="custom-product-tabs-pro-handle-order-lower-description">' . esc_html__( 'Move tab down', 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '</span>
|
182 |
-
</div>';
|
183 |
-
|
184 |
$return_html .= '</section>';
|
185 |
|
186 |
return $return_html;
|
@@ -197,7 +195,7 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
197 |
*/
|
198 |
protected function display_yikes_tab_divider( $i, $tab_count ) {
|
199 |
$return_html = '';
|
200 |
-
if ( $i != $tab_count ) {
|
201 |
$return_html .= '<div class="yikes-woo-custom-tab-divider"></div>';
|
202 |
}
|
203 |
|
@@ -227,18 +225,19 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
227 |
*/
|
228 |
protected function display_woocommerce_wp_wysiwyg_input( $i, $tab ) {
|
229 |
echo '<div class="form-field-tinymce _yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i . '_field">';
|
230 |
-
$this->woocommerce_wp_wysiwyg_input( array(
|
231 |
-
'id' => '_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i ,
|
232 |
-
'label' => __( 'Content', 'yikes-inc-easy-custom-woocommerce-product-tabs' ),
|
233 |
-
'placeholder' => __( 'HTML and text to display.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ),
|
234 |
-
'value' => $tab['content'],
|
|
|
235 |
'class' => 'yikes_woo_tabs_content_field',
|
236 |
'number' => $i
|
237 |
) );
|
238 |
echo '</div>';
|
239 |
}
|
240 |
|
241 |
-
/* Hidden Duplicate HTML Section */
|
242 |
|
243 |
/**
|
244 |
* Add duplicate remove tab button HTML to page
|
@@ -266,7 +265,8 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
266 |
* @param array $tab Array of tab data
|
267 |
*/
|
268 |
protected function display_woocommerce_wp_wysiwyg_input_duplicate() {
|
269 |
-
|
|
|
270 |
}
|
271 |
|
272 |
/**
|
@@ -277,32 +277,27 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
277 |
* @return string HTML
|
278 |
*/
|
279 |
protected function display_yikes_button_holder_container_duplicate() {
|
|
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
<
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
</section>
|
301 |
-
</div>
|
302 |
-
|
303 |
-
<?php
|
304 |
-
|
305 |
-
return ob_get_clean();
|
306 |
}
|
307 |
|
308 |
/**
|
@@ -333,7 +328,7 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
333 |
|
334 |
// If we don't have any tabs, then add some classes
|
335 |
$classes_to_add = ( $product_has_tabs === false ) ? '_yikes_wc_add_tab_center_new _yikes_wc_add_tab_center' : '';
|
336 |
-
|
337 |
$return_html .= '<div class="add_tabs_container ' . $classes_to_add . '">';
|
338 |
$return_html .= '<span id="yikes_woo_ajax_save_feedback"></span>';
|
339 |
$return_html .= '<a href="#" class="button-secondary _yikes_wc_add_tabs" id="add_another_tab">';
|
@@ -363,9 +358,15 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
363 |
if ( ! isset( $field['class'] ) ) $field['class'] = '';
|
364 |
if ( ! isset( $field['value'] ) ) $field['value'] = '';
|
365 |
|
366 |
-
echo '<
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
368 |
-
|
369 |
/**
|
370 |
* Wrapper function for wp_editor
|
371 |
*
|
@@ -380,9 +381,9 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
380 |
$editor_settings = array(
|
381 |
'textarea_name' => $field['id']
|
382 |
);
|
383 |
-
|
384 |
wp_editor( $field['value'], $field['id'], $editor_settings );
|
385 |
-
|
386 |
if ( isset( $field['description'] ) && $field['description'] ) {
|
387 |
echo '<span class="description">' . $field['description'] . '</span>';
|
388 |
}
|
@@ -391,3 +392,5 @@ if ( ! class_exists( 'Yikes_Woo_Custom_Product_Tabs_HTML' ) ) {
|
|
391 |
/* END HTML Functions */
|
392 |
}
|
393 |
}
|
|
|
|
27 |
|
28 |
// Pull the saved array of reusable tabs
|
29 |
$reusable_tab_options_array = get_option( 'yikes_woo_reusable_products_tabs_applied', array() );
|
30 |
+
|
31 |
// Display the custom tab panel
|
32 |
echo '<div id="yikes_woocommerce_custom_product_tabs" class="panel wc-metaboxes-wrapper woocommerce_options_panel">';
|
33 |
echo '<div class="options_group">';
|
34 |
+
|
35 |
echo $this->display_yikes_how_to();
|
36 |
|
37 |
if ( $product_has_tabs === true ) {
|
49 |
// Hidden input field holding # of tabs
|
50 |
echo $this->display_yikes_number_of_tabs( count( $tab_data ) );
|
51 |
|
|
|
52 |
echo '</div>';
|
53 |
+
echo '</div>';
|
54 |
+
|
55 |
}
|
56 |
|
57 |
/* Generate HTML Functions */
|
66 |
|
67 |
// duplicate_this_row content
|
68 |
echo '<div id="duplicate_this_row">';
|
69 |
+
|
70 |
+
// Tab title input field
|
71 |
+
woocommerce_wp_text_input( array( 'id' => 'hidden_duplicator_row_title' , 'label' => __( 'Tab Title', 'yikes-inc-easy-custom-woocommerce-product-tabs' ), 'description' => '', 'placeholder' => __( 'Custom Tab Title' , 'yikes-inc-easy-custom-woocommerce-product-tabs' ), 'class' => 'yikes_woo_tabs_title_field yikes_woo_tabs_title_field_duplicate' ) );
|
72 |
+
|
73 |
+
// WYSIWYG Content field
|
74 |
+
$this->display_woocommerce_wp_wysiwyg_input_duplicate();
|
75 |
+
|
76 |
+
// Override Saved Tab checkbox & hidden input fields - Up & Down arrows && Remove Tab button (Duplicate)
|
77 |
+
echo $this->display_yikes_button_holder_container_duplicate();
|
78 |
+
|
79 |
echo '</div>';
|
80 |
}
|
81 |
|
133 |
*/
|
134 |
protected function display_yikes_how_to() {
|
135 |
$return_html = '';
|
136 |
+
$return_html .= '<div class="yikes-woo-tabs-hidden-how-to-info">';
|
137 |
$return_html .= '<p class="yikes_woo_how_to_info">' . __( "For help using Custom Tabs please visit our <a href='https://yikesplugins.com/support/knowledge-base/product/easy-custom-product-tabs-for-woocommerce/' target='_blank'>Knowledge Base</a>" , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '</p>';
|
138 |
$return_html .= '</div>';
|
139 |
$return_html .= '<div id="yikes-woo-help-me-icon" class="dashicons dashicons-editor-help yikes-tabs-how-to-toggle" title="' . __( "Help Me!" , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '"></div>';
|
161 |
$return_html .= ' style="display: none;">';
|
162 |
}
|
163 |
$return_html .= '<input type="checkbox" class="_yikes_wc_override_reusable_tab" id="_yikes_wc_override_reusable_tab_' . $i . '" data-tab-number="'. $i .'"';
|
164 |
+
$return_html .= 'title="' . __( 'Check this box to override the saved tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '">';
|
165 |
$return_html .= '<label id="_yikes_wc_override_reusable_tab_label_' . $i . '" for="_yikes_wc_override_reusable_tab_' . $i . '" class="_yikes_wc_override_reusable_tab_label">';
|
166 |
+
$return_html .= __( ' Override Saved Tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' );
|
167 |
$return_html .= '</label>';
|
168 |
$return_html .= '<input type="hidden" name="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action" class="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action"';
|
169 |
$return_html .= 'id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action" value="none">';
|
171 |
$return_html .= 'id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '" value="' . $reusable_tab_id . '">';
|
172 |
$return_html .= '</p>';
|
173 |
|
174 |
+
$return_html .= '<div class="yikes_wc_move_tab_container">';
|
175 |
+
$return_html .= '<p class="yikes_wc_move_tab">Move tab order</p>';
|
176 |
+
$return_html .= '<span class="dashicons dashicons-arrow-up move-tab-data-up"></span>';
|
177 |
+
$return_html .= '<span class="dashicons dashicons-arrow-down move-tab-data-down"></span>';
|
178 |
+
$return_html .= '</div>';
|
179 |
+
$return_html .= '<a href="#" onclick="return false;" class="button-secondary remove_this_tab"><span class="dashicons dashicons-no-alt"></span>';
|
180 |
+
$return_html .= __( 'Remove Tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' );
|
181 |
+
$return_html .= '</a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$return_html .= '</section>';
|
183 |
|
184 |
return $return_html;
|
195 |
*/
|
196 |
protected function display_yikes_tab_divider( $i, $tab_count ) {
|
197 |
$return_html = '';
|
198 |
+
if ( $i != $tab_count ) {
|
199 |
$return_html .= '<div class="yikes-woo-custom-tab-divider"></div>';
|
200 |
}
|
201 |
|
225 |
*/
|
226 |
protected function display_woocommerce_wp_wysiwyg_input( $i, $tab ) {
|
227 |
echo '<div class="form-field-tinymce _yikes_wc_custom_repeatable_product_tabs_tab_content_field _yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i . '_field">';
|
228 |
+
$this->woocommerce_wp_wysiwyg_input( array(
|
229 |
+
'id' => '_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i ,
|
230 |
+
'label' => __( 'Content', 'yikes-inc-easy-custom-woocommerce-product-tabs' ),
|
231 |
+
'placeholder' => __( 'HTML and text to display.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ),
|
232 |
+
'value' => $tab['content'],
|
233 |
+
'style' => 'width:100%;min-height:10rem;',
|
234 |
'class' => 'yikes_woo_tabs_content_field',
|
235 |
'number' => $i
|
236 |
) );
|
237 |
echo '</div>';
|
238 |
}
|
239 |
|
240 |
+
/* Hidden Duplicate HTML Section */
|
241 |
|
242 |
/**
|
243 |
* Add duplicate remove tab button HTML to page
|
265 |
* @param array $tab Array of tab data
|
266 |
*/
|
267 |
protected function display_woocommerce_wp_wysiwyg_input_duplicate() {
|
268 |
+
|
269 |
+
$this->woocommerce_wp_textarea_input( array( 'id' => 'hidden_duplicator_row_content' , 'label' => __( 'Content', 'yikes-inc-easy-custom-woocommerce-product-tabs' ), 'placeholder' => __( 'HTML and text to display.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ), 'style' => 'width:100%; min-height:10rem;' , 'class' => 'yikes_woo_tabs_content_field' ) );
|
270 |
}
|
271 |
|
272 |
/**
|
277 |
* @return string HTML
|
278 |
*/
|
279 |
protected function display_yikes_button_holder_container_duplicate() {
|
280 |
+
$return_html = '';
|
281 |
|
282 |
+
$return_html .= '<section class="button-holder hidden_duplicator_row_button_holder last-button-holder" alt="">';
|
283 |
+
$return_html .= '<p class="yikes_wc_override_reusable_tab_container _yikes_wc_override_reusable_tab_container_duplicate" id="_yikes_wc_override_reusable_tab_container_duplicate" style="display: none;">';
|
284 |
+
$return_html .= '<input type="checkbox" class="_yikes_wc_override_reusable_tab" id="_yikes_wc_override_reusable_tab_duplicate" title="' . __( 'Check this box to override the saved tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '" />';
|
285 |
+
$return_html .= '<label class="_yikes_wc_override_reusable_tab_label_duplicate">' . __( 'Override Saved Tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' ) . '</label>';
|
286 |
+
$return_html .= '<input type="hidden" class="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action" id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate" value="none">';
|
287 |
+
$return_html .= '<input type="hidden" class="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id" id="_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate" value="">';
|
288 |
+
$return_html .= '</p>';
|
289 |
+
$return_html .= '<div class="yikes_wc_move_tab_container">';
|
290 |
+
$return_html .= '<p class="yikes_wc_move_tab">Move tab order</p>';
|
291 |
+
$return_html .= '<span class="dashicons dashicons-arrow-up move-tab-data-up"></span>';
|
292 |
+
$return_html .= '<span class="dashicons dashicons-arrow-down move-tab-data-down"></span>';
|
293 |
+
$return_html .= '</div>';
|
294 |
+
$return_html .= '<a href="#" onclick="return false;" class="button-secondary remove_this_tab">';
|
295 |
+
$return_html .= '<span class="dashicons dashicons-no-alt"></span>';
|
296 |
+
$return_html .= __( 'Remove Tab' , 'yikes-inc-easy-custom-woocommerce-product-tabs' );
|
297 |
+
$return_html .= '</a>';
|
298 |
+
$return_html .= '</section>';
|
299 |
+
|
300 |
+
return $return_html;
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
|
303 |
/**
|
328 |
|
329 |
// If we don't have any tabs, then add some classes
|
330 |
$classes_to_add = ( $product_has_tabs === false ) ? '_yikes_wc_add_tab_center_new _yikes_wc_add_tab_center' : '';
|
331 |
+
|
332 |
$return_html .= '<div class="add_tabs_container ' . $classes_to_add . '">';
|
333 |
$return_html .= '<span id="yikes_woo_ajax_save_feedback"></span>';
|
334 |
$return_html .= '<a href="#" class="button-secondary _yikes_wc_add_tabs" id="add_another_tab">';
|
358 |
if ( ! isset( $field['class'] ) ) $field['class'] = '';
|
359 |
if ( ! isset( $field['value'] ) ) $field['value'] = '';
|
360 |
|
361 |
+
echo '<p class="form-field-tinymce ' . $field['id'] . '_field"> <textarea class="' . $field['class'] . '" name="' . $field['id'] . '" id="' . $field['id'] . '" placeholder="' . $field['placeholder'] . '" rows="2" cols="20"' . (isset( $field['style'] ) ? ' style="' . $field['style'] . '"' : '') . '>' . $field['value'] . '</textarea> ';
|
362 |
+
|
363 |
+
if ( isset( $field['description'] ) && $field['description'] ) {
|
364 |
+
echo '<span class="description">' . $field['description'] . '</span>';
|
365 |
+
}
|
366 |
+
|
367 |
+
echo '</p>';
|
368 |
}
|
369 |
+
|
370 |
/**
|
371 |
* Wrapper function for wp_editor
|
372 |
*
|
381 |
$editor_settings = array(
|
382 |
'textarea_name' => $field['id']
|
383 |
);
|
384 |
+
|
385 |
wp_editor( $field['value'], $field['id'], $editor_settings );
|
386 |
+
|
387 |
if ( isset( $field['description'] ) && $field['description'] ) {
|
388 |
echo '<span class="description">' . $field['description'] . '</span>';
|
389 |
}
|
392 |
/* END HTML Functions */
|
393 |
}
|
394 |
}
|
395 |
+
|
396 |
+
?>
|
admin/class.yikes-woo-saved-tabs.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
4 |
|
@@ -90,13 +90,13 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
90 |
* @param string | $_POST['tab_name'] | Tab name to save
|
91 |
* @param array | $_POST['taxonomies'] | Optional. Array of taxonomies.
|
92 |
*
|
93 |
-
* @return string | JSON response
|
94 |
*/
|
95 |
public function yikes_woo_save_tab_as_reusable() {
|
96 |
|
97 |
// Verify the nonce
|
98 |
if ( ! check_ajax_referer( 'yikes_woo_save_tab_as_reusable_nonce', 'security_nonce', false ) ) {
|
99 |
-
|
100 |
}
|
101 |
|
102 |
// Define it now, because we may use this later...
|
@@ -114,7 +114,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
114 |
$tab_id = isset( $_POST['tab_id'] ) && ! empty( $_POST['tab_id'] ) ? $_POST['tab_id'] : '';
|
115 |
$tab_name = isset( $_POST['tab_name'] ) ? $_POST['tab_name'] : '';
|
116 |
$global_tab = isset( $_POST['global_tab'] ) && $_POST['global_tab'] === 'true' ? true : false;
|
117 |
-
|
118 |
// Remove taxonomies if we're using a global tab
|
119 |
$taxonomies = isset( $_POST['taxonomies'] ) && ! empty( $_POST['taxonomies'] ) && $global_tab === false ? $_POST['taxonomies'] : array();
|
120 |
|
@@ -173,7 +173,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
173 |
'tab_slug' => $tab_string_id,
|
174 |
'global_tab' => $global_tab,
|
175 |
);
|
176 |
-
|
177 |
$yikes_custom_tab_data[$new_tab_id] = $new_tab;
|
178 |
|
179 |
do_action( 'yikes-woo-handle-tab-save', $new_tab, 'new' );
|
@@ -210,7 +210,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
210 |
// Get the array of applied product tabs
|
211 |
$reusable_tab_options_array = get_option( 'yikes_woo_reusable_products_tabs_applied', array() );
|
212 |
|
213 |
-
// Flag so we know we found a post and we should update it
|
214 |
$update_post_meta_flag = false;
|
215 |
|
216 |
// Flag so we know we have to update the yikes_woo_reusable_products_tabs_applied
|
@@ -264,7 +264,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
264 |
*
|
265 |
* @since 1.5
|
266 |
*
|
267 |
-
* @return object success w/ tab data || failure w/ message
|
268 |
*/
|
269 |
public function yikes_woo_fetch_reusable_tab() {
|
270 |
|
@@ -284,7 +284,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
284 |
|
285 |
$tab['tab_content'] = stripslashes( $tab['tab_content'] );
|
286 |
|
287 |
-
wp_send_json_success( $tab );
|
288 |
} else {
|
289 |
wp_send_json_success( array( 'message' => __( 'Could not find the tab. Please try again.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ) ) );
|
290 |
}
|
@@ -298,7 +298,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
298 |
*
|
299 |
* @since 1.5
|
300 |
*
|
301 |
-
* @return object success w/ saved_tabs || failure w/ message
|
302 |
*/
|
303 |
public function yikes_woo_fetch_reusable_tabs() {
|
304 |
|
@@ -320,7 +320,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
320 |
}
|
321 |
|
322 |
if ( ! empty( $saved_tabs ) ) {
|
323 |
-
wp_send_json_success( json_encode( $saved_tabs ) );
|
324 |
} else {
|
325 |
wp_send_json_success( array( 'message' => 'No saved tabs were found.' ) );
|
326 |
}
|
@@ -334,8 +334,8 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
334 |
*
|
335 |
* @since 1.5
|
336 |
*
|
337 |
-
* @param string $_POST['tab_id']
|
338 |
-
* @return object success w/ saved_tabs || failure w/ message
|
339 |
*/
|
340 |
public function yikes_woo_delete_reusable_tab_handler() {
|
341 |
|
@@ -348,7 +348,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
348 |
if ( isset( $_POST['tab_id'] ) && ! empty( $_POST['tab_id'] ) ) {
|
349 |
|
350 |
$tab_ids = $_POST['tab_id'];
|
351 |
-
|
352 |
// if $tab_ids isn't an array, turn it into one
|
353 |
if ( ! is_array( $tab_ids ) ) {
|
354 |
$tab_ids = array( $tab_ids );
|
@@ -360,12 +360,12 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
360 |
foreach( $tab_ids as $tab_id ) {
|
361 |
|
362 |
// Delete the tab, store the return values in $return_vars
|
363 |
-
$return_vars = $this->yikes_woo_delete_reusable_tab( $tab_id );
|
364 |
|
365 |
// Make sure $return_vars is what we think it is, and check if our delete failed
|
366 |
if ( is_array( $return_vars ) && isset( $return_vars['success'] ) && $return_vars['success'] === false ) {
|
367 |
|
368 |
-
// If something failed, let's return
|
369 |
wp_send_json_error( $return_vars );
|
370 |
}
|
371 |
}
|
@@ -378,7 +378,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
378 |
// Make sure $return_vars is what we think it is, and check if our delete was successful
|
379 |
if ( is_array( $return_vars ) && isset( $return_vars['success'] ) && $return_vars['success'] === true ) {
|
380 |
|
381 |
-
// If nothing failed, let's return
|
382 |
wp_send_json_success( $return_vars );
|
383 |
}
|
384 |
|
@@ -394,7 +394,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
394 |
* Delete a saved tab from the options array and delete the tab from the product's tabs array
|
395 |
*
|
396 |
* @since 1.5
|
397 |
-
*
|
398 |
* @param int | $tab_id | unique identifier of a tab
|
399 |
* @return array | $response | array of data signifying success, message, reason, and other needed data
|
400 |
*/
|
@@ -414,7 +414,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
414 |
$response = array(
|
415 |
'success' => false,
|
416 |
'tab_id' => $tab_id,
|
417 |
-
'message' => 'No saved tab with id ' . $tab_id . ' found!',
|
418 |
'reason' => 'no saved tab found'
|
419 |
);
|
420 |
return $response;
|
@@ -423,7 +423,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
423 |
$response = array(
|
424 |
'success' => false,
|
425 |
'tab_id' => $tab_id,
|
426 |
-
'message' => 'No saved tabs found!',
|
427 |
'reason' => 'no saved tabs found'
|
428 |
);
|
429 |
return $response;
|
@@ -481,7 +481,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
481 |
$response = array(
|
482 |
'success' => true,
|
483 |
'tab_id' => $tab_id,
|
484 |
-
'message' => 'Tab successfully deleted!',
|
485 |
'reason' => 'tab successfully deleted',
|
486 |
'redirect_url' => $return_redirect_url
|
487 |
);
|
@@ -576,7 +576,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
576 |
// Grab the old post's ID
|
577 |
$old_post_id = method_exists( $original_product, 'get_id' ) === true ? $original_product->get_id() : $original_product->ID;
|
578 |
|
579 |
-
// (1) Make sure we have a non-empty array of saved tabs,
|
580 |
// (2) Makre sure we have the ID of the old post, and then
|
581 |
// (3) Check for the old post's saved tabs. (If we don't find any, do nothing)
|
582 |
if ( ! empty( $saved_tabs_array ) && is_array( $saved_tabs_array ) && ! empty( $old_post_id ) && isset( $saved_tabs_array[$old_post_id] ) ) {
|
@@ -629,4 +629,4 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
|
629 |
}
|
630 |
|
631 |
new YIKES_Custom_Product_Tabs_Saved_Tabs();
|
632 |
-
}
|
1 |
+
<?php
|
2 |
|
3 |
if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Saved_Tabs' ) ) {
|
4 |
|
90 |
* @param string | $_POST['tab_name'] | Tab name to save
|
91 |
* @param array | $_POST['taxonomies'] | Optional. Array of taxonomies.
|
92 |
*
|
93 |
+
* @return string | JSON response
|
94 |
*/
|
95 |
public function yikes_woo_save_tab_as_reusable() {
|
96 |
|
97 |
// Verify the nonce
|
98 |
if ( ! check_ajax_referer( 'yikes_woo_save_tab_as_reusable_nonce', 'security_nonce', false ) ) {
|
99 |
+
wp_send_json_error();
|
100 |
}
|
101 |
|
102 |
// Define it now, because we may use this later...
|
114 |
$tab_id = isset( $_POST['tab_id'] ) && ! empty( $_POST['tab_id'] ) ? $_POST['tab_id'] : '';
|
115 |
$tab_name = isset( $_POST['tab_name'] ) ? $_POST['tab_name'] : '';
|
116 |
$global_tab = isset( $_POST['global_tab'] ) && $_POST['global_tab'] === 'true' ? true : false;
|
117 |
+
|
118 |
// Remove taxonomies if we're using a global tab
|
119 |
$taxonomies = isset( $_POST['taxonomies'] ) && ! empty( $_POST['taxonomies'] ) && $global_tab === false ? $_POST['taxonomies'] : array();
|
120 |
|
173 |
'tab_slug' => $tab_string_id,
|
174 |
'global_tab' => $global_tab,
|
175 |
);
|
176 |
+
|
177 |
$yikes_custom_tab_data[$new_tab_id] = $new_tab;
|
178 |
|
179 |
do_action( 'yikes-woo-handle-tab-save', $new_tab, 'new' );
|
210 |
// Get the array of applied product tabs
|
211 |
$reusable_tab_options_array = get_option( 'yikes_woo_reusable_products_tabs_applied', array() );
|
212 |
|
213 |
+
// Flag so we know we found a post and we should update it
|
214 |
$update_post_meta_flag = false;
|
215 |
|
216 |
// Flag so we know we have to update the yikes_woo_reusable_products_tabs_applied
|
264 |
*
|
265 |
* @since 1.5
|
266 |
*
|
267 |
+
* @return object success w/ tab data || failure w/ message
|
268 |
*/
|
269 |
public function yikes_woo_fetch_reusable_tab() {
|
270 |
|
284 |
|
285 |
$tab['tab_content'] = stripslashes( $tab['tab_content'] );
|
286 |
|
287 |
+
wp_send_json_success( $tab );
|
288 |
} else {
|
289 |
wp_send_json_success( array( 'message' => __( 'Could not find the tab. Please try again.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ) ) );
|
290 |
}
|
298 |
*
|
299 |
* @since 1.5
|
300 |
*
|
301 |
+
* @return object success w/ saved_tabs || failure w/ message
|
302 |
*/
|
303 |
public function yikes_woo_fetch_reusable_tabs() {
|
304 |
|
320 |
}
|
321 |
|
322 |
if ( ! empty( $saved_tabs ) ) {
|
323 |
+
wp_send_json_success( json_encode( $saved_tabs ) );
|
324 |
} else {
|
325 |
wp_send_json_success( array( 'message' => 'No saved tabs were found.' ) );
|
326 |
}
|
334 |
*
|
335 |
* @since 1.5
|
336 |
*
|
337 |
+
* @param string $_POST['tab_id']
|
338 |
+
* @return object success w/ saved_tabs || failure w/ message
|
339 |
*/
|
340 |
public function yikes_woo_delete_reusable_tab_handler() {
|
341 |
|
348 |
if ( isset( $_POST['tab_id'] ) && ! empty( $_POST['tab_id'] ) ) {
|
349 |
|
350 |
$tab_ids = $_POST['tab_id'];
|
351 |
+
|
352 |
// if $tab_ids isn't an array, turn it into one
|
353 |
if ( ! is_array( $tab_ids ) ) {
|
354 |
$tab_ids = array( $tab_ids );
|
360 |
foreach( $tab_ids as $tab_id ) {
|
361 |
|
362 |
// Delete the tab, store the return values in $return_vars
|
363 |
+
$return_vars = $this->yikes_woo_delete_reusable_tab( $tab_id );
|
364 |
|
365 |
// Make sure $return_vars is what we think it is, and check if our delete failed
|
366 |
if ( is_array( $return_vars ) && isset( $return_vars['success'] ) && $return_vars['success'] === false ) {
|
367 |
|
368 |
+
// If something failed, let's return
|
369 |
wp_send_json_error( $return_vars );
|
370 |
}
|
371 |
}
|
378 |
// Make sure $return_vars is what we think it is, and check if our delete was successful
|
379 |
if ( is_array( $return_vars ) && isset( $return_vars['success'] ) && $return_vars['success'] === true ) {
|
380 |
|
381 |
+
// If nothing failed, let's return
|
382 |
wp_send_json_success( $return_vars );
|
383 |
}
|
384 |
|
394 |
* Delete a saved tab from the options array and delete the tab from the product's tabs array
|
395 |
*
|
396 |
* @since 1.5
|
397 |
+
*
|
398 |
* @param int | $tab_id | unique identifier of a tab
|
399 |
* @return array | $response | array of data signifying success, message, reason, and other needed data
|
400 |
*/
|
414 |
$response = array(
|
415 |
'success' => false,
|
416 |
'tab_id' => $tab_id,
|
417 |
+
'message' => 'No saved tab with id ' . $tab_id . ' found!',
|
418 |
'reason' => 'no saved tab found'
|
419 |
);
|
420 |
return $response;
|
423 |
$response = array(
|
424 |
'success' => false,
|
425 |
'tab_id' => $tab_id,
|
426 |
+
'message' => 'No saved tabs found!',
|
427 |
'reason' => 'no saved tabs found'
|
428 |
);
|
429 |
return $response;
|
481 |
$response = array(
|
482 |
'success' => true,
|
483 |
'tab_id' => $tab_id,
|
484 |
+
'message' => 'Tab successfully deleted!',
|
485 |
'reason' => 'tab successfully deleted',
|
486 |
'redirect_url' => $return_redirect_url
|
487 |
);
|
576 |
// Grab the old post's ID
|
577 |
$old_post_id = method_exists( $original_product, 'get_id' ) === true ? $original_product->get_id() : $original_product->ID;
|
578 |
|
579 |
+
// (1) Make sure we have a non-empty array of saved tabs,
|
580 |
// (2) Makre sure we have the ID of the old post, and then
|
581 |
// (3) Check for the old post's saved tabs. (If we don't find any, do nothing)
|
582 |
if ( ! empty( $saved_tabs_array ) && is_array( $saved_tabs_array ) && ! empty( $old_post_id ) && isset( $saved_tabs_array[$old_post_id] ) ) {
|
629 |
}
|
630 |
|
631 |
new YIKES_Custom_Product_Tabs_Saved_Tabs();
|
632 |
+
}
|
admin/class.yikes-woo-tabs.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
4 |
|
@@ -18,7 +18,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
18 |
|
19 |
// Save custom tab data
|
20 |
add_action( 'woocommerce_process_product_meta', array( $this, 'product_save_data' ), 10, 2 );
|
21 |
-
|
22 |
// Enqueue our JS / CSS files
|
23 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_and_styles' ), 10, 1 );
|
24 |
|
@@ -52,13 +52,13 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
52 |
// script
|
53 |
wp_enqueue_script ( 'repeatable-custom-tabs', YIKES_Custom_Product_Tabs_URI . "js/repeatable-custom-tabs{$suffix}.js" , array( 'jquery' ) , YIKES_Custom_Product_Tabs_Version );
|
54 |
wp_localize_script( 'repeatable-custom-tabs', 'repeatable_custom_tabs', array(
|
55 |
-
'loading_gif' => '<img src="' . admin_url( 'images/loading.gif' ) . '" alt="preloader" class="loading-wp-editor-gif" />',
|
56 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
57 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
58 |
'save_tab_as_reusable_nonce' => wp_create_nonce( 'yikes_woo_save_tab_as_reusable_nonce' ),
|
59 |
'fetch_reusable_tabs_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tabs_nonce' ),
|
60 |
'fetch_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tab_nonce' ),
|
61 |
-
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
62 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
63 |
'global_post_id' => $post->ID,
|
64 |
'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' ),
|
@@ -67,7 +67,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
67 |
|
68 |
wp_enqueue_script ( 'repeatable-custom-tabs-shared', YIKES_Custom_Product_Tabs_URI . "js/repeatable-custom-tabs-shared{$suffix}.js", array( 'jquery' ), YIKES_Custom_Product_Tabs_Version );
|
69 |
wp_localize_script( 'repeatable-custom-tabs-shared', 'repeatable_custom_tabs_shared', array(
|
70 |
-
'loading_gif' => '<img src="' . admin_url( 'images/loading.gif' ) . '" alt="preloader" class="loading-wp-editor-gif" />',
|
71 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
72 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
73 |
'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' ),
|
@@ -117,6 +117,10 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
117 |
return;
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
120 |
// Save our tabs!
|
121 |
$this->save_tabs( $post_id, $is_ajax = false );
|
122 |
}
|
@@ -131,7 +135,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
131 |
*/
|
132 |
protected function save_tabs( $post_id, $is_ajax_flag ) {
|
133 |
$tab_data = array();
|
134 |
-
|
135 |
$number_of_tabs = $_POST['number_of_tabs'];
|
136 |
|
137 |
// Create an array for tab_ids that we will use later
|
@@ -146,24 +150,24 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
146 |
if ( isset ( $reusable_tab_options_array[$post_id] ) ) {
|
147 |
$post_has_reusable_tabs = true;
|
148 |
}
|
149 |
-
|
150 |
$i = 1;
|
151 |
while( $i <= $number_of_tabs ) {
|
152 |
|
153 |
// Deal with saving the tab content
|
154 |
-
|
155 |
$tab_title = isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_title_' . $i] ) ? stripslashes( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_title_' . $i] ) : '';
|
156 |
$tab_content = isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i] ) ? stripslashes( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i] ) : '';
|
157 |
-
|
158 |
if ( empty( $tab_title ) && empty( $tab_content ) ) {
|
159 |
-
|
160 |
// clean up if the custom tabs are removed
|
161 |
unset( $tab_data[$i] );
|
162 |
-
|
163 |
} else {
|
164 |
-
|
165 |
$tab_id = '';
|
166 |
-
|
167 |
if ( $tab_title ) {
|
168 |
$tab_id = urldecode( sanitize_title( $tab_title ) );
|
169 |
}
|
@@ -176,10 +180,10 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
176 |
|
177 |
if ( isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i] ) && isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'] )
|
178 |
&& ! empty( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i] ) && ! empty( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'] ) ) {
|
179 |
-
|
180 |
// Store the tab_id and action
|
181 |
$reusable_tab_id = $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i];
|
182 |
-
$reusable_tab_action = $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'];
|
183 |
|
184 |
// If $reusable_tab_options_array is not empty, we've done this before
|
185 |
if ( ! empty( $reusable_tab_options_array ) ) {
|
@@ -232,7 +236,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
232 |
// If we have tabs...
|
233 |
if ( ! empty( $current_saved_tab_id_array ) ) {
|
234 |
|
235 |
-
// Loop through our reusable tab array
|
236 |
foreach( $reusable_tab_options_array[ $post_id ] as $id => $reusable_tab_array ) {
|
237 |
|
238 |
// If we find one of our reusable tabs is no longer part of this post, remove it
|
@@ -241,7 +245,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
241 |
unset( $reusable_tab_options_array[ $post_id ][ $id ] );
|
242 |
$remove_a_tab_from_reusable = true;
|
243 |
}
|
244 |
-
}
|
245 |
} else {
|
246 |
|
247 |
// If we don't have any current tabs then we need to delete this post's option
|
@@ -254,7 +258,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
254 |
update_option( 'yikes_woo_reusable_products_tabs_applied', $reusable_tab_options_array );
|
255 |
}
|
256 |
}
|
257 |
-
|
258 |
// Reset the array count, when items are removed
|
259 |
$tab_data = array_values( $tab_data );
|
260 |
|
@@ -296,7 +300,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
296 |
$tab_content = isset( $_POST['tab_content'] ) ? $_POST['tab_content'] : '';
|
297 |
|
298 |
// Set up options
|
299 |
-
$wp_editor_options = array(
|
300 |
'textarea_name' => $textarea_id,
|
301 |
'textarea_rows' => 8,
|
302 |
);
|
@@ -313,7 +317,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
313 |
*
|
314 |
* @param string $_POST['post_id'] | ID of the current product (post)
|
315 |
* @param array $_POST['product_tabs'] | array of all the tab data
|
316 |
-
* @return object success w/ message || failure w/ message
|
317 |
*/
|
318 |
public function yikes_woo_save_product_tabs() {
|
319 |
|
@@ -353,7 +357,7 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
353 |
|
354 |
$current_products_tabs = get_post_meta( $old_post_id, 'yikes_woo_products_tabs', true );
|
355 |
|
356 |
-
if ( ! empty( $current_products_tabs ) ) {
|
357 |
update_post_meta( $new_post_id, 'yikes_woo_products_tabs', $current_products_tabs );
|
358 |
}
|
359 |
}
|
@@ -364,4 +368,3 @@ if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
|
364 |
|
365 |
new YIKES_Custom_Product_Tabs_Custom_Tabs();
|
366 |
}
|
367 |
-
|
1 |
+
<?php
|
2 |
|
3 |
if ( ! class_exists( 'YIKES_Custom_Product_Tabs_Custom_Tabs' ) ) {
|
4 |
|
18 |
|
19 |
// Save custom tab data
|
20 |
add_action( 'woocommerce_process_product_meta', array( $this, 'product_save_data' ), 10, 2 );
|
21 |
+
|
22 |
// Enqueue our JS / CSS files
|
23 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_and_styles' ), 10, 1 );
|
24 |
|
52 |
// script
|
53 |
wp_enqueue_script ( 'repeatable-custom-tabs', YIKES_Custom_Product_Tabs_URI . "js/repeatable-custom-tabs{$suffix}.js" , array( 'jquery' ) , YIKES_Custom_Product_Tabs_Version );
|
54 |
wp_localize_script( 'repeatable-custom-tabs', 'repeatable_custom_tabs', array(
|
55 |
+
'loading_gif' => '<img src="' . admin_url( 'images/loading.gif' ) . '" alt="preloader" class="loading-wp-editor-gif custom-tabs-preloader" />',
|
56 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
57 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
58 |
'save_tab_as_reusable_nonce' => wp_create_nonce( 'yikes_woo_save_tab_as_reusable_nonce' ),
|
59 |
'fetch_reusable_tabs_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tabs_nonce' ),
|
60 |
'fetch_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tab_nonce' ),
|
61 |
+
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
62 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
63 |
'global_post_id' => $post->ID,
|
64 |
'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' ),
|
67 |
|
68 |
wp_enqueue_script ( 'repeatable-custom-tabs-shared', YIKES_Custom_Product_Tabs_URI . "js/repeatable-custom-tabs-shared{$suffix}.js", array( 'jquery' ), YIKES_Custom_Product_Tabs_Version );
|
69 |
wp_localize_script( 'repeatable-custom-tabs-shared', 'repeatable_custom_tabs_shared', array(
|
70 |
+
'loading_gif' => '<img src="' . admin_url( 'images/loading.gif' ) . '" alt="preloader" class="loading-wp-editor-gif custom-tabs-preloader" />',
|
71 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
72 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
73 |
'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' ),
|
117 |
return;
|
118 |
}
|
119 |
|
120 |
+
update_option( 'what', $_POST );
|
121 |
+
update_option( 'etesting_action', $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_1_action'] );
|
122 |
+
update_option( 'etesting_id', $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_1'] );
|
123 |
+
|
124 |
// Save our tabs!
|
125 |
$this->save_tabs( $post_id, $is_ajax = false );
|
126 |
}
|
135 |
*/
|
136 |
protected function save_tabs( $post_id, $is_ajax_flag ) {
|
137 |
$tab_data = array();
|
138 |
+
|
139 |
$number_of_tabs = $_POST['number_of_tabs'];
|
140 |
|
141 |
// Create an array for tab_ids that we will use later
|
150 |
if ( isset ( $reusable_tab_options_array[$post_id] ) ) {
|
151 |
$post_has_reusable_tabs = true;
|
152 |
}
|
153 |
+
|
154 |
$i = 1;
|
155 |
while( $i <= $number_of_tabs ) {
|
156 |
|
157 |
// Deal with saving the tab content
|
158 |
+
|
159 |
$tab_title = isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_title_' . $i] ) ? stripslashes( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_title_' . $i] ) : '';
|
160 |
$tab_content = isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i] ) ? stripslashes( $_POST['_yikes_wc_custom_repeatable_product_tabs_tab_content_' . $i] ) : '';
|
161 |
+
|
162 |
if ( empty( $tab_title ) && empty( $tab_content ) ) {
|
163 |
+
|
164 |
// clean up if the custom tabs are removed
|
165 |
unset( $tab_data[$i] );
|
166 |
+
|
167 |
} else {
|
168 |
+
|
169 |
$tab_id = '';
|
170 |
+
|
171 |
if ( $tab_title ) {
|
172 |
$tab_id = urldecode( sanitize_title( $tab_title ) );
|
173 |
}
|
180 |
|
181 |
if ( isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i] ) && isset( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'] )
|
182 |
&& ! empty( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i] ) && ! empty( $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'] ) ) {
|
183 |
+
|
184 |
// Store the tab_id and action
|
185 |
$reusable_tab_id = $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i];
|
186 |
+
$reusable_tab_action = $_POST['_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' . $i . '_action'];
|
187 |
|
188 |
// If $reusable_tab_options_array is not empty, we've done this before
|
189 |
if ( ! empty( $reusable_tab_options_array ) ) {
|
236 |
// If we have tabs...
|
237 |
if ( ! empty( $current_saved_tab_id_array ) ) {
|
238 |
|
239 |
+
// Loop through our reusable tab array
|
240 |
foreach( $reusable_tab_options_array[ $post_id ] as $id => $reusable_tab_array ) {
|
241 |
|
242 |
// If we find one of our reusable tabs is no longer part of this post, remove it
|
245 |
unset( $reusable_tab_options_array[ $post_id ][ $id ] );
|
246 |
$remove_a_tab_from_reusable = true;
|
247 |
}
|
248 |
+
}
|
249 |
} else {
|
250 |
|
251 |
// If we don't have any current tabs then we need to delete this post's option
|
258 |
update_option( 'yikes_woo_reusable_products_tabs_applied', $reusable_tab_options_array );
|
259 |
}
|
260 |
}
|
261 |
+
|
262 |
// Reset the array count, when items are removed
|
263 |
$tab_data = array_values( $tab_data );
|
264 |
|
300 |
$tab_content = isset( $_POST['tab_content'] ) ? $_POST['tab_content'] : '';
|
301 |
|
302 |
// Set up options
|
303 |
+
$wp_editor_options = array(
|
304 |
'textarea_name' => $textarea_id,
|
305 |
'textarea_rows' => 8,
|
306 |
);
|
317 |
*
|
318 |
* @param string $_POST['post_id'] | ID of the current product (post)
|
319 |
* @param array $_POST['product_tabs'] | array of all the tab data
|
320 |
+
* @return object success w/ message || failure w/ message
|
321 |
*/
|
322 |
public function yikes_woo_save_product_tabs() {
|
323 |
|
357 |
|
358 |
$current_products_tabs = get_post_meta( $old_post_id, 'yikes_woo_products_tabs', true );
|
359 |
|
360 |
+
if ( ! empty( $current_products_tabs ) ) {
|
361 |
update_post_meta( $new_post_id, 'yikes_woo_products_tabs', $current_products_tabs );
|
362 |
}
|
363 |
}
|
368 |
|
369 |
new YIKES_Custom_Product_Tabs_Custom_Tabs();
|
370 |
}
|
|
changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 1.8.1 - October 17th, 2022 =
|
2 |
* Remove extra comma causing PHP 7.2 issues.
|
3 |
|
@@ -78,7 +83,7 @@
|
|
78 |
* Bumping WooCo Compatibility.
|
79 |
|
80 |
= 1.6.4 - January 9th, 2018 =
|
81 |
-
* Happy new year!
|
82 |
* The editor is now vertically resizeable.
|
83 |
* The default capability for interacting with saved tabs is now Publish Products (publish_products)
|
84 |
|
@@ -96,24 +101,24 @@
|
|
96 |
* Added a new "Support" page
|
97 |
* Added a new "Go Pro" page - check out [Custom Product Tabs Pro](https://yikesplugins.com/plugin/custom-product-tabs-pro/)
|
98 |
|
99 |
-
= 1.6.0 - October 9th, 2017 =
|
100 |
* Complete re-organization of all plugin files and removal of legacy code
|
101 |
* Added a "name" field for saved tabs. This field is used only on the admin as a way of identifying tabs.
|
102 |
* Tab "slugs" are now created via the WP Core `sanitize_title()` function. This should allow meaningful tab slugs when foreign characters are used in a title.
|
103 |
* Re-added the "Add Media" button to the editor when it's first initialized. This had disappeared when WP4.8 was released.
|
104 |
* Fixed some issues with loading saved tab content into the editor. This should fix the issue that some users were experiencing where adding a saved tab would only work the second time.
|
105 |
-
* Setting the width of the editor to 100%.
|
106 |
* Custom Product Tabs is now a top-level menu item instead of a sub-menu item.
|
107 |
* Cleaning up the saved tab's array so we don't leave orphaned data (e.g. added a hook so we delete a product's tabs when the product is deleted)
|
108 |
* Added a data update script to update all existing tab slugs to use `sanitize_title()` function.
|
109 |
* Generated new POT file.
|
110 |
-
* Added support and hooks for our new Custom Product Tabs Pro plugin!
|
111 |
|
112 |
-
= 1.5.17 - August 23rd, 2017 =
|
113 |
* Cleaning up some PHP Notices being thrown - thanks to @ZombiEquinox on GitHub for reporting this
|
114 |
* Updating readme compatibility values
|
115 |
|
116 |
-
= 1.5.16 - August 1st, 2017 =
|
117 |
* Adding a proper deactivation hook. The plugin will leave no trace.
|
118 |
|
119 |
= 1.5.15 - June 8th, 2017 =
|
@@ -213,4 +218,4 @@
|
|
213 |
* Added class to the Woo tabs content title, for targeting via CSS ( `.yikes-custom-woo-tab-title` )
|
214 |
|
215 |
= 1.0.0 =
|
216 |
-
* Initial Release
|
1 |
+
= 1.8.1 - October 17th, 2022 =
|
2 |
+
- Fix repeatable tabs not working as intended.
|
3 |
+
- Add overflow to repeatable tabs modal to allow for scrolling.
|
4 |
+
|
5 |
+
|
6 |
= 1.8.1 - October 17th, 2022 =
|
7 |
* Remove extra comma causing PHP 7.2 issues.
|
8 |
|
83 |
* Bumping WooCo Compatibility.
|
84 |
|
85 |
= 1.6.4 - January 9th, 2018 =
|
86 |
+
* Happy new year!
|
87 |
* The editor is now vertically resizeable.
|
88 |
* The default capability for interacting with saved tabs is now Publish Products (publish_products)
|
89 |
|
101 |
* Added a new "Support" page
|
102 |
* Added a new "Go Pro" page - check out [Custom Product Tabs Pro](https://yikesplugins.com/plugin/custom-product-tabs-pro/)
|
103 |
|
104 |
+
= 1.6.0 - October 9th, 2017 =
|
105 |
* Complete re-organization of all plugin files and removal of legacy code
|
106 |
* Added a "name" field for saved tabs. This field is used only on the admin as a way of identifying tabs.
|
107 |
* Tab "slugs" are now created via the WP Core `sanitize_title()` function. This should allow meaningful tab slugs when foreign characters are used in a title.
|
108 |
* Re-added the "Add Media" button to the editor when it's first initialized. This had disappeared when WP4.8 was released.
|
109 |
* Fixed some issues with loading saved tab content into the editor. This should fix the issue that some users were experiencing where adding a saved tab would only work the second time.
|
110 |
+
* Setting the width of the editor to 100%.
|
111 |
* Custom Product Tabs is now a top-level menu item instead of a sub-menu item.
|
112 |
* Cleaning up the saved tab's array so we don't leave orphaned data (e.g. added a hook so we delete a product's tabs when the product is deleted)
|
113 |
* Added a data update script to update all existing tab slugs to use `sanitize_title()` function.
|
114 |
* Generated new POT file.
|
115 |
+
* Added support and hooks for our new Custom Product Tabs Pro plugin!
|
116 |
|
117 |
+
= 1.5.17 - August 23rd, 2017 =
|
118 |
* Cleaning up some PHP Notices being thrown - thanks to @ZombiEquinox on GitHub for reporting this
|
119 |
* Updating readme compatibility values
|
120 |
|
121 |
+
= 1.5.16 - August 1st, 2017 =
|
122 |
* Adding a proper deactivation hook. The plugin will leave no trace.
|
123 |
|
124 |
= 1.5.15 - June 8th, 2017 =
|
218 |
* Added class to the Woo tabs content title, for targeting via CSS ( `.yikes-custom-woo-tab-title` )
|
219 |
|
220 |
= 1.0.0 =
|
221 |
+
* Initial Release
|
css/repeatable-custom-tabs.css
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
}
|
13 |
|
14 |
.loading-wp-editor-gif-settings {
|
15 |
-
padding-left: 50px;
|
16 |
}
|
17 |
|
18 |
.dashicons.inline-button-dashicons {
|
@@ -57,12 +57,13 @@
|
|
57 |
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce {
|
58 |
display: inline-block;
|
59 |
padding-left: 0;
|
|
|
60 |
vertical-align: top;
|
61 |
width: 80%;
|
62 |
}
|
63 |
|
64 |
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce .mce-edit-area.mce-container,
|
65 |
-
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce div.form-field-tinymce,
|
66 |
._yikes_wc_custom_repeatable_product_tabs_tab_content_field .mce-edit-area.mce-container {
|
67 |
min-height: 10rem
|
68 |
}
|
@@ -262,6 +263,23 @@ iframe[id^=_yikes_wc_custom_repeatable_product_tabs_tab_content_] {
|
|
262 |
box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%), 0 1px 0 #a36597;
|
263 |
}
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
.yikes_woo_using_reusable_tab {
|
266 |
opacity: 0.6;
|
267 |
pointer-events: none;
|
@@ -457,7 +475,7 @@ iframe[id^=_yikes_wc_custom_repeatable_product_tabs_tab_content_] {
|
|
457 |
text-align: center;
|
458 |
}
|
459 |
|
460 |
-
.yikes-woo-all-about-us .yikes-woo-review-us-body,
|
461 |
.yikes-woo-all-about-us .yikes-woo-buy-us-body {
|
462 |
padding: 0 1rem 1rem;
|
463 |
}
|
@@ -495,8 +513,6 @@ iframe[id^=_yikes_wc_custom_repeatable_product_tabs_tab_content_] {
|
|
495 |
}
|
496 |
|
497 |
.cptpro-image {
|
498 |
-
max-width: 800px;
|
499 |
max-height: 600px;
|
500 |
}
|
501 |
-
|
502 |
-
|
12 |
}
|
13 |
|
14 |
.loading-wp-editor-gif-settings {
|
15 |
+
padding-left: 50px;
|
16 |
}
|
17 |
|
18 |
.dashicons.inline-button-dashicons {
|
57 |
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce {
|
58 |
display: inline-block;
|
59 |
padding-left: 0;
|
60 |
+
padding-right: 0;
|
61 |
vertical-align: top;
|
62 |
width: 80%;
|
63 |
}
|
64 |
|
65 |
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce .mce-edit-area.mce-container,
|
66 |
+
#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce div.form-field-tinymce,
|
67 |
._yikes_wc_custom_repeatable_product_tabs_tab_content_field .mce-edit-area.mce-container {
|
68 |
min-height: 10rem
|
69 |
}
|
263 |
box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%), 0 1px 0 #a36597;
|
264 |
}
|
265 |
|
266 |
+
.lity-container .custom-tabs-preloader {
|
267 |
+
display: block;
|
268 |
+
padding: 0.5em 1em;
|
269 |
+
margin: 1em auto;
|
270 |
+
}
|
271 |
+
|
272 |
+
.lity-opened.custom-product-tabs.select-tab .lity-container {
|
273 |
+
max-height: 90vh;
|
274 |
+
overflow-y: auto;
|
275 |
+
}
|
276 |
+
|
277 |
+
#_yikes_wc_apply_a_saved_tab.disabled {
|
278 |
+
background: #bb77ae !important;
|
279 |
+
color: #fff !important;
|
280 |
+
opacity: 0.75;
|
281 |
+
}
|
282 |
+
|
283 |
.yikes_woo_using_reusable_tab {
|
284 |
opacity: 0.6;
|
285 |
pointer-events: none;
|
475 |
text-align: center;
|
476 |
}
|
477 |
|
478 |
+
.yikes-woo-all-about-us .yikes-woo-review-us-body,
|
479 |
.yikes-woo-all-about-us .yikes-woo-buy-us-body {
|
480 |
padding: 0 1rem 1rem;
|
481 |
}
|
513 |
}
|
514 |
|
515 |
.cptpro-image {
|
516 |
+
max-width: 800px;
|
517 |
max-height: 600px;
|
518 |
}
|
|
|
|
css/repeatable-custom-tabs.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.loading-wp-editor-gif{margin-left:50%;margin-right:50%}.loading-wp-editor-gif-settings{padding-left:50px}.dashicons.inline-button-dashicons{font-size:15px;vertical-align:bottom}.yikes_woo_tabs_title_field{width:70%!important}#duplicate_this_row{display:none}#woocommerce-product-data ul.wc-tabs li.yikes_wc_product_tabs_tab a::before{font-family:Dashicons;content:'\f164'}#yikes_woocommerce_custom_product_tabs hr{margin:1.5em 0}#yikes_woocommerce_custom_product_tabs .options_group{padding:0 1em}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{max-width:100%;padding-left:0}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{display:inline-block;padding-left:0;vertical-align:top;width:80%}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce .mce-edit-area.mce-container,._yikes_wc_custom_repeatable_product_tabs_tab_content_field .mce-edit-area.mce-container{min-height:10rem}textarea.yikes_woo_custom_editor_styles{border:1px solid #ddd;min-height:10rem}.yikes_woo_custom_editor_styles{position:relative;z-index:9}iframe[id^=_yikes_wc_custom_repeatable_product_tabs_tab_content_]{min-height:150px}._yikes_wc_custom_repeatable_product_tabs_tab_content_field{display:inline-block}.button-holder{display:inline-block;text-align:center;width:20%}.yikes_wc_move_tab_container{margin-top:.5em;text-align:center}.woocommerce_options_panel p.yikes_wc_move_tab{line-height:1;padding:0}.button-holder .button-secondary.remove_this_tab{background:#e35b5b;border-color:#dc3232;box-shadow:0 1px 0 #dc3232;color:#fff;cursor:pointer;margin-bottom:1.5rem}.button-holder .button-secondary.remove_this_tab .dashicons{margin-top:-2px;vertical-align:middle}.move-tab-data-down,.move-tab-data-up{font-size:25px;transition:color .2s;width:36px;height:36px;margin:0;padding:0;border:0;background:0 0;cursor:pointer}.move-tab-data-down:focus,.move-tab-data-up:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgb(79 148 212 / 80%);outline:1px solid transparent}.move-tab-data-down:hover,.move-tab-data-up:hover{cursor:pointer;color:#4c9cce}.move-tab-data-up:before{content:"\f343";color:inherit;font:normal 20px/1 dashicons}.move-tab-data-down:before{content:"\f347";color:inherit;font:normal 20px/1 dashicons}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{padding:5px 0 5px!important}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel .form-field label{font-size:1.1em;font-weight:700;margin:2px 8px 0 0;width:auto}.yikes-woo-custom-tab-divider{display:block;height:2px;margin:2em 0 1.5em;border-bottom:1px solid #eee}.yikes-woo-tabs-hidden-how-to-info{display:none;font-family:"Open Sans",sans-serif!important;margin-right:30px}.woocommerce_options_panel p.yikes_woo_how_to_info{margin:9px 0 0 0;padding:0;text-align:right}.yikes-tabs-how-to-toggle{font-size:20px;position:absolute;right:1em;top:12px}.yikes-tabs-how-to-toggle:hover{cursor:pointer}.yikes_woo_how_to_info{padding-left:23px!important}.yikes_woo_save_success{color:#31843f;float:left;padding-top:1em}._yikes_wc_add_tab_center,.add_tabs_container{border-top:1px solid #eee;margin:2em 2px 0 0;text-align:right;width:100%}.add_tabs_container .button.button-primary{margin-top:10px}._yikes_wc_add_tab_center{border-top:none;text-align:center}.add_tabs_container._yikes_wc_add_tab_center_new .button.button-primary{display:none}#add_another_tab{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597;margin-bottom:10px;margin-top:10px}#_yikes_wc_apply_a_saved_tab{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597;margin:10px 0 0 8px}#_yikes_wc_apply_a_saved_tab:active,#_yikes_wc_apply_a_saved_tab:focus,#_yikes_wc_apply_a_saved_tab:hover,#add_another_tab:active,#add_another_tab:focus,#add_another_tab:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597}.yikes_woo_using_reusable_tab{opacity:.6;pointer-events:none}.lity-container{background:#fff;border-radius:6px;padding:.6em 1em 1em}.lity-container .lity-content::after{box-shadow:none}[class*=yikes_wc_lity_col]{float:left}.yikes_wc_lity_col_title{width:93%;padding:4px 20px 4px 2px;white-space:nowrap}.yikes_wc_lity_col_select{width:7%;padding-right:8px;padding-top:4px;cursor:pointer}.yikes_wc_lity_header{border-bottom:1px solid #555d66;margin-bottom:.4em;line-height:1;font-size:1.2em;font-weight:700;padding:0 0 8px 0;text-align:center;width:100%}.yikes_wc_lity_header>span{width:100px;text-align:center;white-space:nowrap}.display_saved_tabs_lity{min-width:300px}._yikes_wc_feedback_message{display:none;padding-left:3px}#yikes_woo_tab_error_message{color:red}#yikes_woo_tab_success_message{color:#31843f;margin-top:4px}.yikes_woo_settings_info{font-family:"Open Sans",sans-serif}.woo-ct-admin-page-wrap h1 .dashicons{font-size:30px;height:30px;width:30px}.yikes-star{color:#daa520}.cptpro-savedtabs-pro-container{display:inline-block;vertical-align:top}.yikes_woo_delete_this_tab{color:#0073aa;cursor:pointer}.yikes_woo_delete_this_tab:hover{color:#00a0d2}.yikes_woo_go_back_url{margin-top:.4rem}.yikes_woo_reusable_tab_content>label h3,.yikes_woo_reusable_tab_title>label h3{margin-bottom:6px}.yikes_woo_reusable_tab_content,.yikes_woo_reusable_tab_title{margin-bottom:1.5em}.wp-core-ui .button-primary.yikes_woo_delete_this_tab{background:#e35b5b;border-color:#e35b5b;color:#fff;cursor:pointer}.wp-core-ui .button-primary.yikes_woo_delete_this_tab:active,.wp-core-ui .button-primary.yikes_woo_delete_this_tab:hover{background:#c55353;border-color:#c55353}.yikes_woo_add_another_tab:hover>a{color:#fff}.yikes_woo_number_of_products{font-weight:700}.yikes_woo_save_and_delete_tab_buttons{border-top:1px solid #ccc;margin-top:2rem;padding-top:1rem}._yikes_wc_title_red_overlay{background-color:#e68989!important}.woocommerce_options_panel p.yikes_wc_override_reusable_tab_container{line-height:1.1;margin-top:0;font-weight:600;font-size:14px;margin-bottom:20px}.woocommerce_options_panel label._yikes_wc_override_reusable_tab_label{margin:0 0 0 4px;float:none}.yikes-woo-all-about-us{text-align:center}.yikes-woo-all-about-us .yikes-woo-buy-us-body,.yikes-woo-all-about-us .yikes-woo-review-us-body{padding:0 1rem 1rem}.yikes-woo-all-about-us h3{margin:0;padding:8px 12px;color:#fff;background-color:#00a0d2;font-weight:800;font-size:14px}.yikes-woo-review-us .star-container .dashicons.dashicons-star-filled{color:#e6b800}.yikes-woo-review-us .star-container a{text-decoration:none}.yikes-woo-review-us-footer .yikes-love{color:pink}.cptpro-settings-pro-container{max-width:800px}#lightslider{text-align:center}.cptpro-image{max-width:800px;max-height:600px}
|
1 |
+
.loading-wp-editor-gif{margin-left:50%;margin-right:50%}.loading-wp-editor-gif-settings{padding-left:50px}.dashicons.inline-button-dashicons{font-size:15px;vertical-align:bottom}.yikes_woo_tabs_title_field{width:70%!important}#duplicate_this_row{display:none}#woocommerce-product-data ul.wc-tabs li.yikes_wc_product_tabs_tab a::before{font-family:Dashicons;content:'\f164'}#yikes_woocommerce_custom_product_tabs hr{margin:1.5em 0}#yikes_woocommerce_custom_product_tabs .options_group{padding:0 1em}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{max-width:100%;padding-left:0}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{display:inline-block;padding-left:0;padding-right:0;vertical-align:top;width:80%}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce .mce-edit-area.mce-container,._yikes_wc_custom_repeatable_product_tabs_tab_content_field .mce-edit-area.mce-container{min-height:10rem}textarea.yikes_woo_custom_editor_styles{border:1px solid #ddd;min-height:10rem}.yikes_woo_custom_editor_styles{position:relative;z-index:9}iframe[id^=_yikes_wc_custom_repeatable_product_tabs_tab_content_]{min-height:150px}._yikes_wc_custom_repeatable_product_tabs_tab_content_field{display:inline-block}.button-holder{display:inline-block;text-align:center;width:20%}.yikes_wc_move_tab_container{margin-top:.5em;text-align:center}.woocommerce_options_panel p.yikes_wc_move_tab{line-height:1;padding:0}.button-holder .button-secondary.remove_this_tab{background:#e35b5b;border-color:#dc3232;box-shadow:0 1px 0 #dc3232;color:#fff;cursor:pointer;margin-bottom:1.5rem}.button-holder .button-secondary.remove_this_tab .dashicons{margin-top:-2px;vertical-align:middle}.move-tab-data-down,.move-tab-data-up{font-size:25px;transition:color .2s;width:36px;height:36px;margin:0;padding:0;border:0;background:0 0;cursor:pointer}.move-tab-data-down:focus,.move-tab-data-up:focus{box-shadow:0 0 0 1px #4f94d4,0 0 2px 1px rgb(79 148 212 / 80%);outline:1px solid transparent}.move-tab-data-down:hover,.move-tab-data-up:hover{cursor:pointer;color:#4c9cce}.move-tab-data-up:before{content:"\f343";color:inherit;font:normal 20px/1 dashicons}.move-tab-data-down:before{content:"\f347";color:inherit;font:normal 20px/1 dashicons}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{padding:5px 0 5px!important}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel .form-field label{font-size:1.1em;font-weight:700;margin:2px 8px 0 0;width:auto}.yikes-woo-custom-tab-divider{display:block;height:2px;margin:2em 0 1.5em;border-bottom:1px solid #eee}.yikes-woo-tabs-hidden-how-to-info{display:none;font-family:"Open Sans",sans-serif!important;margin-right:30px}.woocommerce_options_panel p.yikes_woo_how_to_info{margin:9px 0 0 0;padding:0;text-align:right}.yikes-tabs-how-to-toggle{font-size:20px;position:absolute;right:1em;top:12px}.yikes-tabs-how-to-toggle:hover{cursor:pointer}.yikes_woo_how_to_info{padding-left:23px!important}.yikes_woo_save_success{color:#31843f;float:left;padding-top:1em}._yikes_wc_add_tab_center,.add_tabs_container{border-top:1px solid #eee;margin:2em 2px 0 0;text-align:right;width:100%}.add_tabs_container .button.button-primary{margin-top:10px}._yikes_wc_add_tab_center{border-top:none;text-align:center}.add_tabs_container._yikes_wc_add_tab_center_new .button.button-primary{display:none}#add_another_tab{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597;margin-bottom:10px;margin-top:10px}#_yikes_wc_apply_a_saved_tab{background:#bb77ae;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597;color:#fff;text-shadow:0 -1px 1px #a36597,1px 0 1px #a36597,0 1px 1px #a36597,-1px 0 1px #a36597;margin:10px 0 0 8px}#_yikes_wc_apply_a_saved_tab:active,#_yikes_wc_apply_a_saved_tab:focus,#_yikes_wc_apply_a_saved_tab:hover,#add_another_tab:active,#add_another_tab:focus,#add_another_tab:hover{background:#a36597;border-color:#a36597;box-shadow:inset 0 1px 0 rgb(255 255 255 / 25%),0 1px 0 #a36597}.lity-container .custom-tabs-preloader{display:block;padding:.5em 1em;margin:1em auto}.lity-opened.custom-product-tabs.select-tab .lity-container{max-height:90vh;overflow-y:auto}#_yikes_wc_apply_a_saved_tab.disabled{background:#bb77ae!important;color:#fff!important;opacity:.75}.yikes_woo_using_reusable_tab{opacity:.6;pointer-events:none}.lity-container{background:#fff;border-radius:6px;padding:.6em 1em 1em}.lity-container .lity-content::after{box-shadow:none}[class*=yikes_wc_lity_col]{float:left}.yikes_wc_lity_col_title{width:93%;padding:4px 20px 4px 2px;white-space:nowrap}.yikes_wc_lity_col_select{width:7%;padding-right:8px;padding-top:4px;cursor:pointer}.yikes_wc_lity_header{border-bottom:1px solid #555d66;margin-bottom:.4em;line-height:1;font-size:1.2em;font-weight:700;padding:0 0 8px 0;text-align:center;width:100%}.yikes_wc_lity_header>span{width:100px;text-align:center;white-space:nowrap}.display_saved_tabs_lity{min-width:300px}._yikes_wc_feedback_message{display:none;padding-left:3px}#yikes_woo_tab_error_message{color:red}#yikes_woo_tab_success_message{color:#31843f;margin-top:4px}.yikes_woo_settings_info{font-family:"Open Sans",sans-serif}.woo-ct-admin-page-wrap h1 .dashicons{font-size:30px;height:30px;width:30px}.yikes-star{color:#daa520}.cptpro-savedtabs-pro-container{display:inline-block;vertical-align:top}.yikes_woo_delete_this_tab{color:#0073aa;cursor:pointer}.yikes_woo_delete_this_tab:hover{color:#00a0d2}.yikes_woo_go_back_url{margin-top:.4rem}.yikes_woo_reusable_tab_content>label h3,.yikes_woo_reusable_tab_title>label h3{margin-bottom:6px}.yikes_woo_reusable_tab_content,.yikes_woo_reusable_tab_title{margin-bottom:1.5em}.wp-core-ui .button-primary.yikes_woo_delete_this_tab{background:#e35b5b;border-color:#e35b5b;color:#fff;cursor:pointer}.wp-core-ui .button-primary.yikes_woo_delete_this_tab:active,.wp-core-ui .button-primary.yikes_woo_delete_this_tab:hover{background:#c55353;border-color:#c55353}.yikes_woo_add_another_tab:hover>a{color:#fff}.yikes_woo_number_of_products{font-weight:700}.yikes_woo_save_and_delete_tab_buttons{border-top:1px solid #ccc;margin-top:2rem;padding-top:1rem}._yikes_wc_title_red_overlay{background-color:#e68989!important}.woocommerce_options_panel p.yikes_wc_override_reusable_tab_container{line-height:1.1;margin-top:0;font-weight:600;font-size:14px;margin-bottom:20px}.woocommerce_options_panel label._yikes_wc_override_reusable_tab_label{margin:0 0 0 4px;float:none}.yikes-woo-all-about-us{text-align:center}.yikes-woo-all-about-us .yikes-woo-buy-us-body,.yikes-woo-all-about-us .yikes-woo-review-us-body{padding:0 1rem 1rem}.yikes-woo-all-about-us h3{margin:0;padding:8px 12px;color:#fff;background-color:#00a0d2;font-weight:800;font-size:14px}.yikes-woo-review-us .star-container .dashicons.dashicons-star-filled{color:#e6b800}.yikes-woo-review-us .star-container a{text-decoration:none}.yikes-woo-review-us-footer .yikes-love{color:pink}.cptpro-settings-pro-container{max-width:800px}#lightslider{text-align:center}.cptpro-image{max-width:800px;max-height:600px}
|
js/repeatable-custom-tabs.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
jQuery(document).ready(function() {
|
7 |
// Disable fields on-load if necessary (delay 4 seconds to allow wp_editor to initialize)
|
8 |
-
setTimeout( function() {
|
9 |
yikes_woo_check_for_reusable_tabs_and_disable();
|
10 |
yikes_woo_set_editor_specific_styles();
|
11 |
}, 4000 );
|
@@ -85,13 +85,13 @@
|
|
85 |
var tab_title_prefix = '_yikes_wc_custom_repeatable_product_tabs_tab_title_';
|
86 |
var tab_content_prefix = '_yikes_wc_custom_repeatable_product_tabs_tab_content_';
|
87 |
var removed_textarea_id = tab_content_prefix + last_post_position;
|
88 |
-
|
89 |
// Set up our DOM elements to be removed
|
90 |
var tab_reusable_container_to_remove = jQuery( '#_yikes_wc_override_reusable_tab_container_' + last_post_position );
|
91 |
var tab_title_to_remove = jQuery( '.' + tab_title_prefix + last_post_position + '_field' );
|
92 |
-
var tab_content_to_remove = jQuery( '.' + tab_content_prefix + last_post_position
|
93 |
var divider_to_remove = jQuery( '.yikes-woo-custom-tab-divider' ).last();
|
94 |
-
var button_holder_to_remove = jQuery( '.' +
|
95 |
var number_of_tabs = parseInt( last_post_position ) - parseInt( 1 );
|
96 |
|
97 |
// Destroy our tinymce instance (this enables us to re-add it later if we need to)
|
@@ -103,9 +103,10 @@
|
|
103 |
tab_reusable_container_to_remove.remove();
|
104 |
tab_title_to_remove.remove();
|
105 |
tab_content_to_remove.remove();
|
|
|
106 |
divider_to_remove.remove();
|
107 |
button_holder_to_remove.remove();
|
108 |
-
|
109 |
// Store the new number of tabs
|
110 |
jQuery( '#number_of_tabs' ).val( number_of_tabs );
|
111 |
|
@@ -113,7 +114,7 @@
|
|
113 |
if ( parseInt( number_of_tabs ) === 0 ) {
|
114 |
jQuery( '#add_another_tab' ).parent( '.add_tabs_container' ).addClass( '_yikes_wc_add_tab_center' );
|
115 |
}
|
116 |
-
|
117 |
e.preventDefault();
|
118 |
});
|
119 |
|
@@ -141,13 +142,13 @@
|
|
141 |
var previous_content = yikes_woo_get_content_from_wysiwyg( tab_content_prefix + previous_position );
|
142 |
|
143 |
// Deal with saved tab disabled overlay classes
|
144 |
-
if ( jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
145 |
&& ! jQuery( '.' + tab_title_prefix + previous_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
146 |
|
147 |
// Add overlay to the previous tab && remove it from the current one
|
148 |
yikes_woo_toggle_reusable_override_overlay( 'enable', clicked_position );
|
149 |
yikes_woo_toggle_reusable_override_overlay( 'disable', previous_position );
|
150 |
-
} else if ( jQuery( '.' + tab_title_prefix + previous_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
151 |
&& ! jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
152 |
|
153 |
// Add overlay to the current tab && remove it from the previous one
|
@@ -168,22 +169,22 @@
|
|
168 |
// Deal with saved tab checkbox
|
169 |
|
170 |
// Checked / Unchecked
|
171 |
-
if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === true
|
172 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).is( ':checked' ) === false ) {
|
173 |
jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).prop( 'checked', true );
|
174 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', false );
|
175 |
-
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === false
|
176 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).is( ':checked' ) === true ) {
|
177 |
jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).prop( 'checked', false );
|
178 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', true );
|
179 |
}
|
180 |
|
181 |
// Shown / Hidden
|
182 |
-
if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === true
|
183 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).is( ':visible' ) === false ) {
|
184 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).show();
|
185 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).hide();
|
186 |
-
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === false
|
187 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).is( ':visible' ) === true ) {
|
188 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).hide();
|
189 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).show();
|
@@ -197,13 +198,13 @@
|
|
197 |
yikes_woo_set_content_for_wysiwyg( tab_content_prefix + clicked_position, previous_content );
|
198 |
yikes_woo_set_content_for_wysiwyg( tab_content_prefix + previous_position, clicked_content );
|
199 |
});
|
200 |
-
|
201 |
-
// Move tab selected tab down, move below-tab above
|
202 |
jQuery( 'body' ).on( 'click' , '.move-tab-data-down' , function( ) {
|
203 |
var clicked_button = jQuery( this );
|
204 |
var clicked_position = clicked_button.parents( '.button-holder' ).attr( 'alt' );
|
205 |
var number_of_tabs = jQuery( '#number_of_tabs' ).val();
|
206 |
-
|
207 |
// If we're trying to move the bottom tab, bail
|
208 |
if ( clicked_position == number_of_tabs ) {
|
209 |
return false;
|
@@ -223,13 +224,13 @@
|
|
223 |
var next_content = yikes_woo_get_content_from_wysiwyg( tab_content_prefix + next_position );
|
224 |
|
225 |
// Deal with saved tab disabled overlay classes
|
226 |
-
if ( jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
227 |
&& ! jQuery( '.' + tab_title_prefix + next_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
228 |
|
229 |
// Add overlay to the next tab && remove it from the current one
|
230 |
yikes_woo_toggle_reusable_override_overlay( 'enable', clicked_position );
|
231 |
yikes_woo_toggle_reusable_override_overlay( 'disable', next_position );
|
232 |
-
} else if ( jQuery( '.' + tab_title_prefix + next_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
233 |
&& ! jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
234 |
|
235 |
// Add overlay to the current tab && remove it from the next one
|
@@ -250,22 +251,22 @@
|
|
250 |
// Deal with saved tab checkbox
|
251 |
|
252 |
// Checked / Unchecked
|
253 |
-
if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === true
|
254 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).is( ':checked' ) === false ) {
|
255 |
jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).prop( 'checked', true );
|
256 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', false );
|
257 |
-
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === false
|
258 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).is( ':checked' ) === true ) {
|
259 |
jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).prop( 'checked', false );
|
260 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', true );
|
261 |
}
|
262 |
|
263 |
// Shown / Hidden
|
264 |
-
if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === true
|
265 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).is( ':visible' ) === false ) {
|
266 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).show();
|
267 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).hide();
|
268 |
-
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === false
|
269 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).is( ':visible' ) === true ) {
|
270 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).hide();
|
271 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).show();
|
@@ -300,7 +301,7 @@
|
|
300 |
var tab_id = jQuery( '#saved_tab_container_' + saved_tab_number ).data( 'tab-id' );
|
301 |
|
302 |
// Replace the lity box with a spinner because some tabs take a while to load
|
303 |
-
jQuery( '.lity-content' ).html( repeatable_custom_tabs.loading_gif ).css( 'width', '50px' )
|
304 |
|
305 |
yikes_woo_fetch_reusable_tab( tab_id, yikes_woo_apply_resuable_tab );
|
306 |
});
|
@@ -331,7 +332,7 @@
|
|
331 |
yikes_woo_toggle_reusable_override_overlay( 'disable', tab_number );
|
332 |
}
|
333 |
});
|
334 |
-
|
335 |
// Handle two tabs with the same name by creating an overlay and showing an error message
|
336 |
// To-do: make this function more robust - it doesn't handle multiple duplicates well
|
337 |
jQuery( 'body' ).on( 'focusout', '.yikes_woo_tabs_title_field', function() {
|
@@ -383,7 +384,7 @@
|
|
383 |
});
|
384 |
|
385 |
// Handle saving all the tabs
|
386 |
-
jQuery( '#yikes_woo_save_custom_tabs' ).click( function() {
|
387 |
|
388 |
// If we've added the disabled class, do not go further
|
389 |
if ( jQuery( '#yikes_woo_save_custom_tabs' ).hasClass( 'disabled' ) === true ) {
|
@@ -407,10 +408,14 @@
|
|
407 |
'security_nonce': repeatable_custom_tabs.save_product_tabs_nonce
|
408 |
};
|
409 |
|
|
|
|
|
410 |
// We're going to collect all the data and send it to the server as if it were a form submission
|
411 |
// So data object should have all the relevant fields like: field_name => field_value
|
412 |
for ( var ii = 1; ii <= number_of_tabs; ii++ ) {
|
413 |
|
|
|
|
|
414 |
// Title
|
415 |
data['_yikes_wc_custom_repeatable_product_tabs_tab_title_' + ii] = jQuery( '#_yikes_wc_custom_repeatable_product_tabs_tab_title_' + ii ).val();
|
416 |
|
@@ -461,7 +466,7 @@
|
|
461 |
// Tab number of our created tab will be equal to the number of tabs
|
462 |
var tab_number = jQuery( '#number_of_tabs' ).val();
|
463 |
|
464 |
-
// Apply variables
|
465 |
|
466 |
// Title
|
467 |
jQuery( '#' + tab_title_prefix + tab_number ).val( saved_tab_title );
|
@@ -470,24 +475,24 @@
|
|
470 |
jQuery( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + tab_number + '_action' ).val( 'add' );
|
471 |
jQuery( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + tab_number ).val( saved_tab_id );
|
472 |
|
473 |
-
|
474 |
// Check if our tinymce instance has been initialized yet
|
475 |
if ( jQuery( '#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_' + tab_number + '_toolbar' ).length > 0 ) {
|
476 |
|
477 |
// Add a class to the items to indicate this is a reusable tab
|
478 |
-
yikes_woo_toggle_reusable_override_overlay( 'disable', tab_number )
|
479 |
} else {
|
480 |
|
481 |
// If our tinymce instance is not initialized, let's set a flag so we know to do it
|
482 |
jQuery( '#' + tab_title_prefix + tab_number ).addClass( 'yikes_woo_disable_this_tab' );
|
483 |
}
|
484 |
-
|
485 |
// Show checkbox to let the user override the reusable tab status
|
486 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + tab_number ).show();
|
487 |
}
|
488 |
|
489 |
function yikes_woo_fetch_reusable_tab( tab_id, callback_function ) {
|
490 |
-
|
491 |
// Create data object for AJAX call
|
492 |
var data = {
|
493 |
'action': 'yikes_woo_fetch_reusable_tab',
|
@@ -531,19 +536,21 @@
|
|
531 |
function yikes_woo_handle_reusable_tabs( fetch_tabs_response ) {
|
532 |
|
533 |
if ( typeof( fetch_tabs_response.success ) !== 'undefined' && fetch_tabs_response.success === true ) {
|
534 |
-
|
535 |
// If we have a message, no tabs were found
|
536 |
if ( typeof( fetch_tabs_response.data ) !== 'undefined' && typeof( fetch_tabs_response.data.message ) !== 'undefined' ) {
|
537 |
jQuery( '#yikes_woo_ajax_save_feedback' ).removeClass().addClass( 'yikes_woo_save_success' ).text( fetch_tabs_response.data.message ).fadeIn().delay( '2000' ).fadeOut();
|
538 |
} else {
|
539 |
// Save response data
|
540 |
var saved_tabs = JSON.parse( fetch_tabs_response.data );
|
541 |
-
|
542 |
// Create HTML from response data
|
543 |
lity_html = create_lity_manage_reusable_tabs_html( saved_tabs );
|
544 |
|
545 |
// Display lity box
|
546 |
global_lity = lity( lity_html, { handler: 'inline' } );
|
|
|
|
|
547 |
}
|
548 |
|
549 |
} else if ( typeof( fetch_tabs_response.success ) !== 'undefined' && fetch_tabs_response.success === false ) {
|
@@ -587,8 +594,8 @@
|
|
587 |
lity_html += '<div class="yikes_wc_lity_col_select">';
|
588 |
lity_html += '<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="' + ii + '"></span>';
|
589 |
lity_html += '</div>';
|
590 |
-
lity_html += '</div>';
|
591 |
-
|
592 |
ii++;
|
593 |
});
|
594 |
|
@@ -691,7 +698,6 @@
|
|
691 |
// Setup variables for use in generating a new tab
|
692 |
var clone_container = jQuery( '#duplicate_this_row' );
|
693 |
var new_count = parseInt( jQuery( '#number_of_tabs' ).val() ) + parseInt( 1 ); /* get new number of cloned element */
|
694 |
-
// var remove_tab_button = jQuery( '#duplicate_this_row .remove_this_tab' );
|
695 |
var move_tab_content_buttons = jQuery( '#duplicate_this_row .button-holder' );
|
696 |
var textarea_id = '_yikes_wc_custom_repeatable_product_tabs_tab_content_' + new_count;
|
697 |
var title_id = '_yikes_wc_custom_repeatable_product_tabs_tab_title_' + new_count;
|
@@ -708,26 +714,26 @@
|
|
708 |
.removeClass( 'hidden_duplicator_row_title_field' ).find( 'label' ).removeAttr( 'for' ).attr( 'for', title_id + '_field' );
|
709 |
}
|
710 |
});
|
711 |
-
|
712 |
// Change content classes
|
713 |
jQuery( '.new_duplicate_row' ).find( 'textarea' ).each( function() {
|
714 |
if ( jQuery( this ).is( 'textarea[name="hidden_duplicator_row_content"]' ) ) {
|
|
|
715 |
jQuery( this ).attr( 'name' , textarea_id ).attr( 'id' , textarea_id ).parent( 'div' ).addClass( textarea_id + '_field' ).removeClass( 'hidden_duplicator_row_content_field' )
|
716 |
.find( 'label' ).removeAttr( 'for' ).attr( 'for', textarea_id + '_field' );
|
717 |
}
|
718 |
});
|
719 |
|
720 |
// Change button holder classes
|
721 |
-
jQuery( '.new_duplicate_row
|
722 |
jQuery( '.new_duplicate_row' ).find( '.yikes_wc_override_reusable_tab_container' ).attr( 'id', '_yikes_wc_override_reusable_tab_container_' + new_count );
|
723 |
-
jQuery( '.new_duplicate_row' ).find( '.button-holder' ).css( 'width', '19.25%' ).unwrap(); // fix weird spacing issue on cloned button holder.
|
724 |
|
725 |
// Set the new number of tabs value
|
726 |
jQuery( '#number_of_tabs' ).val( new_count );
|
727 |
|
728 |
// Append the divider between tabs
|
729 |
if ( new_count > 1 ) {
|
730 |
-
jQuery( '.new_duplicate_row' ).first().before( '<div class="yikes-woo-custom-tab-divider"></div>' );
|
731 |
}
|
732 |
});
|
733 |
|
@@ -739,6 +745,7 @@
|
|
739 |
// Change override label
|
740 |
reusable_tab_container.children( '._yikes_wc_override_reusable_tab_label_duplicate' ).attr( 'for', '_yikes_wc_override_reusable_tab_' + new_count ).attr( 'id', '_yikes_wc_override_reusable_tab_label_' + new_count )
|
741 |
.removeClass( '_yikes_wc_override_reusable_tab_label_duplicate' ).addClass( '_yikes_wc_override_reusable_tab_label' );
|
|
|
742 |
// Change hidden input action field
|
743 |
reusable_tab_container.children( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate' )
|
744 |
.attr( 'name', '_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + new_count + '_action' )
|
@@ -758,10 +765,12 @@
|
|
758 |
|
759 |
// Add a loading gif until AJAX returns
|
760 |
jQuery( '.' + textarea_id + '_field' ).html( repeatable_custom_tabs.loading_gif );
|
761 |
-
|
762 |
yikes_woo_get_wp_editor_ajax( textarea_id, true, tab_content );
|
763 |
}
|
764 |
-
|
|
|
|
|
765 |
// Remove some classes
|
766 |
jQuery( '.last-button-holder' ).removeClass( 'last-button-holder' );
|
767 |
jQuery( '.new_duplicate_row' ).removeClass( 'new_duplicate_row' );
|
@@ -771,4 +780,4 @@
|
|
771 |
jQuery( 'textarea[name^="_yikes_wc_custom_repeatable_product_tabs_tab_content_"]' ).each( function() {
|
772 |
jQuery( this ).addClass( 'yikes_woo_custom_editor_styles' );
|
773 |
});
|
774 |
-
}
|
5 |
*/
|
6 |
jQuery(document).ready(function() {
|
7 |
// Disable fields on-load if necessary (delay 4 seconds to allow wp_editor to initialize)
|
8 |
+
setTimeout( function() {
|
9 |
yikes_woo_check_for_reusable_tabs_and_disable();
|
10 |
yikes_woo_set_editor_specific_styles();
|
11 |
}, 4000 );
|
85 |
var tab_title_prefix = '_yikes_wc_custom_repeatable_product_tabs_tab_title_';
|
86 |
var tab_content_prefix = '_yikes_wc_custom_repeatable_product_tabs_tab_content_';
|
87 |
var removed_textarea_id = tab_content_prefix + last_post_position;
|
88 |
+
|
89 |
// Set up our DOM elements to be removed
|
90 |
var tab_reusable_container_to_remove = jQuery( '#_yikes_wc_override_reusable_tab_container_' + last_post_position );
|
91 |
var tab_title_to_remove = jQuery( '.' + tab_title_prefix + last_post_position + '_field' );
|
92 |
+
var tab_content_to_remove = jQuery( '.' + tab_content_prefix + last_post_position );
|
93 |
var divider_to_remove = jQuery( '.yikes-woo-custom-tab-divider' ).last();
|
94 |
+
var button_holder_to_remove = jQuery( '.button-holder[alt="' + last_post_position + '"]' );
|
95 |
var number_of_tabs = parseInt( last_post_position ) - parseInt( 1 );
|
96 |
|
97 |
// Destroy our tinymce instance (this enables us to re-add it later if we need to)
|
103 |
tab_reusable_container_to_remove.remove();
|
104 |
tab_title_to_remove.remove();
|
105 |
tab_content_to_remove.remove();
|
106 |
+
jQuery( '.' + tab_content_prefix + last_post_position + '_field' ).remove();
|
107 |
divider_to_remove.remove();
|
108 |
button_holder_to_remove.remove();
|
109 |
+
|
110 |
// Store the new number of tabs
|
111 |
jQuery( '#number_of_tabs' ).val( number_of_tabs );
|
112 |
|
114 |
if ( parseInt( number_of_tabs ) === 0 ) {
|
115 |
jQuery( '#add_another_tab' ).parent( '.add_tabs_container' ).addClass( '_yikes_wc_add_tab_center' );
|
116 |
}
|
117 |
+
|
118 |
e.preventDefault();
|
119 |
});
|
120 |
|
142 |
var previous_content = yikes_woo_get_content_from_wysiwyg( tab_content_prefix + previous_position );
|
143 |
|
144 |
// Deal with saved tab disabled overlay classes
|
145 |
+
if ( jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
146 |
&& ! jQuery( '.' + tab_title_prefix + previous_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
147 |
|
148 |
// Add overlay to the previous tab && remove it from the current one
|
149 |
yikes_woo_toggle_reusable_override_overlay( 'enable', clicked_position );
|
150 |
yikes_woo_toggle_reusable_override_overlay( 'disable', previous_position );
|
151 |
+
} else if ( jQuery( '.' + tab_title_prefix + previous_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
152 |
&& ! jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
153 |
|
154 |
// Add overlay to the current tab && remove it from the previous one
|
169 |
// Deal with saved tab checkbox
|
170 |
|
171 |
// Checked / Unchecked
|
172 |
+
if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === true
|
173 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).is( ':checked' ) === false ) {
|
174 |
jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).prop( 'checked', true );
|
175 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', false );
|
176 |
+
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === false
|
177 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).is( ':checked' ) === true ) {
|
178 |
jQuery( '#_yikes_wc_override_reusable_tab_' + previous_position ).prop( 'checked', false );
|
179 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', true );
|
180 |
}
|
181 |
|
182 |
// Shown / Hidden
|
183 |
+
if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === true
|
184 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).is( ':visible' ) === false ) {
|
185 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).show();
|
186 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).hide();
|
187 |
+
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === false
|
188 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).is( ':visible' ) === true ) {
|
189 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + previous_position ).hide();
|
190 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).show();
|
198 |
yikes_woo_set_content_for_wysiwyg( tab_content_prefix + clicked_position, previous_content );
|
199 |
yikes_woo_set_content_for_wysiwyg( tab_content_prefix + previous_position, clicked_content );
|
200 |
});
|
201 |
+
|
202 |
+
// Move tab selected tab down, move below-tab above
|
203 |
jQuery( 'body' ).on( 'click' , '.move-tab-data-down' , function( ) {
|
204 |
var clicked_button = jQuery( this );
|
205 |
var clicked_position = clicked_button.parents( '.button-holder' ).attr( 'alt' );
|
206 |
var number_of_tabs = jQuery( '#number_of_tabs' ).val();
|
207 |
+
|
208 |
// If we're trying to move the bottom tab, bail
|
209 |
if ( clicked_position == number_of_tabs ) {
|
210 |
return false;
|
224 |
var next_content = yikes_woo_get_content_from_wysiwyg( tab_content_prefix + next_position );
|
225 |
|
226 |
// Deal with saved tab disabled overlay classes
|
227 |
+
if ( jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
228 |
&& ! jQuery( '.' + tab_title_prefix + next_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
229 |
|
230 |
// Add overlay to the next tab && remove it from the current one
|
231 |
yikes_woo_toggle_reusable_override_overlay( 'enable', clicked_position );
|
232 |
yikes_woo_toggle_reusable_override_overlay( 'disable', next_position );
|
233 |
+
} else if ( jQuery( '.' + tab_title_prefix + next_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' )
|
234 |
&& ! jQuery( '.' + tab_title_prefix + clicked_position + '_field' ).hasClass( 'yikes_woo_using_reusable_tab' ) ) {
|
235 |
|
236 |
// Add overlay to the current tab && remove it from the next one
|
251 |
// Deal with saved tab checkbox
|
252 |
|
253 |
// Checked / Unchecked
|
254 |
+
if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === true
|
255 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).is( ':checked' ) === false ) {
|
256 |
jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).prop( 'checked', true );
|
257 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', false );
|
258 |
+
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).is( ':checked' ) === false
|
259 |
&& jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).is( ':checked' ) === true ) {
|
260 |
jQuery( '#_yikes_wc_override_reusable_tab_' + next_position ).prop( 'checked', false );
|
261 |
jQuery( '#_yikes_wc_override_reusable_tab_' + clicked_position ).prop( 'checked', true );
|
262 |
}
|
263 |
|
264 |
// Shown / Hidden
|
265 |
+
if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === true
|
266 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).is( ':visible' ) === false ) {
|
267 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).show();
|
268 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).hide();
|
269 |
+
} else if ( jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).is( ':visible' ) === false
|
270 |
&& jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).is( ':visible' ) === true ) {
|
271 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + next_position ).hide();
|
272 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + clicked_position ).show();
|
301 |
var tab_id = jQuery( '#saved_tab_container_' + saved_tab_number ).data( 'tab-id' );
|
302 |
|
303 |
// Replace the lity box with a spinner because some tabs take a while to load
|
304 |
+
jQuery( '.lity-content' ).html( repeatable_custom_tabs.loading_gif ).css( 'width', '50px' );
|
305 |
|
306 |
yikes_woo_fetch_reusable_tab( tab_id, yikes_woo_apply_resuable_tab );
|
307 |
});
|
332 |
yikes_woo_toggle_reusable_override_overlay( 'disable', tab_number );
|
333 |
}
|
334 |
});
|
335 |
+
|
336 |
// Handle two tabs with the same name by creating an overlay and showing an error message
|
337 |
// To-do: make this function more robust - it doesn't handle multiple duplicates well
|
338 |
jQuery( 'body' ).on( 'focusout', '.yikes_woo_tabs_title_field', function() {
|
384 |
});
|
385 |
|
386 |
// Handle saving all the tabs
|
387 |
+
jQuery( '#yikes_woo_save_custom_tabs' ).click( function() {
|
388 |
|
389 |
// If we've added the disabled class, do not go further
|
390 |
if ( jQuery( '#yikes_woo_save_custom_tabs' ).hasClass( 'disabled' ) === true ) {
|
408 |
'security_nonce': repeatable_custom_tabs.save_product_tabs_nonce
|
409 |
};
|
410 |
|
411 |
+
console.log( data );
|
412 |
+
|
413 |
// We're going to collect all the data and send it to the server as if it were a form submission
|
414 |
// So data object should have all the relevant fields like: field_name => field_value
|
415 |
for ( var ii = 1; ii <= number_of_tabs; ii++ ) {
|
416 |
|
417 |
+
console.log( '_yikes_wc_custom_repeatable_product_tabs_tab_title_' + ii );
|
418 |
+
|
419 |
// Title
|
420 |
data['_yikes_wc_custom_repeatable_product_tabs_tab_title_' + ii] = jQuery( '#_yikes_wc_custom_repeatable_product_tabs_tab_title_' + ii ).val();
|
421 |
|
466 |
// Tab number of our created tab will be equal to the number of tabs
|
467 |
var tab_number = jQuery( '#number_of_tabs' ).val();
|
468 |
|
469 |
+
// Apply variables
|
470 |
|
471 |
// Title
|
472 |
jQuery( '#' + tab_title_prefix + tab_number ).val( saved_tab_title );
|
475 |
jQuery( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + tab_number + '_action' ).val( 'add' );
|
476 |
jQuery( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + tab_number ).val( saved_tab_id );
|
477 |
|
478 |
+
|
479 |
// Check if our tinymce instance has been initialized yet
|
480 |
if ( jQuery( '#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_' + tab_number + '_toolbar' ).length > 0 ) {
|
481 |
|
482 |
// Add a class to the items to indicate this is a reusable tab
|
483 |
+
yikes_woo_toggle_reusable_override_overlay( 'disable', tab_number )
|
484 |
} else {
|
485 |
|
486 |
// If our tinymce instance is not initialized, let's set a flag so we know to do it
|
487 |
jQuery( '#' + tab_title_prefix + tab_number ).addClass( 'yikes_woo_disable_this_tab' );
|
488 |
}
|
489 |
+
|
490 |
// Show checkbox to let the user override the reusable tab status
|
491 |
jQuery( '#_yikes_wc_override_reusable_tab_container_' + tab_number ).show();
|
492 |
}
|
493 |
|
494 |
function yikes_woo_fetch_reusable_tab( tab_id, callback_function ) {
|
495 |
+
|
496 |
// Create data object for AJAX call
|
497 |
var data = {
|
498 |
'action': 'yikes_woo_fetch_reusable_tab',
|
536 |
function yikes_woo_handle_reusable_tabs( fetch_tabs_response ) {
|
537 |
|
538 |
if ( typeof( fetch_tabs_response.success ) !== 'undefined' && fetch_tabs_response.success === true ) {
|
539 |
+
|
540 |
// If we have a message, no tabs were found
|
541 |
if ( typeof( fetch_tabs_response.data ) !== 'undefined' && typeof( fetch_tabs_response.data.message ) !== 'undefined' ) {
|
542 |
jQuery( '#yikes_woo_ajax_save_feedback' ).removeClass().addClass( 'yikes_woo_save_success' ).text( fetch_tabs_response.data.message ).fadeIn().delay( '2000' ).fadeOut();
|
543 |
} else {
|
544 |
// Save response data
|
545 |
var saved_tabs = JSON.parse( fetch_tabs_response.data );
|
546 |
+
|
547 |
// Create HTML from response data
|
548 |
lity_html = create_lity_manage_reusable_tabs_html( saved_tabs );
|
549 |
|
550 |
// Display lity box
|
551 |
global_lity = lity( lity_html, { handler: 'inline' } );
|
552 |
+
|
553 |
+
jQuery( '.lity-opened' ).addClass( 'custom-product-tabs select-tab' );
|
554 |
}
|
555 |
|
556 |
} else if ( typeof( fetch_tabs_response.success ) !== 'undefined' && fetch_tabs_response.success === false ) {
|
594 |
lity_html += '<div class="yikes_wc_lity_col_select">';
|
595 |
lity_html += '<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="' + ii + '"></span>';
|
596 |
lity_html += '</div>';
|
597 |
+
lity_html += '</div>';
|
598 |
+
|
599 |
ii++;
|
600 |
});
|
601 |
|
698 |
// Setup variables for use in generating a new tab
|
699 |
var clone_container = jQuery( '#duplicate_this_row' );
|
700 |
var new_count = parseInt( jQuery( '#number_of_tabs' ).val() ) + parseInt( 1 ); /* get new number of cloned element */
|
|
|
701 |
var move_tab_content_buttons = jQuery( '#duplicate_this_row .button-holder' );
|
702 |
var textarea_id = '_yikes_wc_custom_repeatable_product_tabs_tab_content_' + new_count;
|
703 |
var title_id = '_yikes_wc_custom_repeatable_product_tabs_tab_title_' + new_count;
|
714 |
.removeClass( 'hidden_duplicator_row_title_field' ).find( 'label' ).removeAttr( 'for' ).attr( 'for', title_id + '_field' );
|
715 |
}
|
716 |
});
|
717 |
+
|
718 |
// Change content classes
|
719 |
jQuery( '.new_duplicate_row' ).find( 'textarea' ).each( function() {
|
720 |
if ( jQuery( this ).is( 'textarea[name="hidden_duplicator_row_content"]' ) ) {
|
721 |
+
jQuery( this ).parent( '.form-field-tinymce' ).addClass( '_yikes_wc_custom_repeatable_product_tabs_tab_content_field ' + textarea_id );
|
722 |
jQuery( this ).attr( 'name' , textarea_id ).attr( 'id' , textarea_id ).parent( 'div' ).addClass( textarea_id + '_field' ).removeClass( 'hidden_duplicator_row_content_field' )
|
723 |
.find( 'label' ).removeAttr( 'for' ).attr( 'for', textarea_id + '_field' );
|
724 |
}
|
725 |
});
|
726 |
|
727 |
// Change button holder classes
|
728 |
+
jQuery( '.new_duplicate_row.button-holder' ).attr( 'alt', new_count );
|
729 |
jQuery( '.new_duplicate_row' ).find( '.yikes_wc_override_reusable_tab_container' ).attr( 'id', '_yikes_wc_override_reusable_tab_container_' + new_count );
|
|
|
730 |
|
731 |
// Set the new number of tabs value
|
732 |
jQuery( '#number_of_tabs' ).val( new_count );
|
733 |
|
734 |
// Append the divider between tabs
|
735 |
if ( new_count > 1 ) {
|
736 |
+
jQuery( '.new_duplicate_row' ).first().before( '<div class="yikes-woo-custom-tab-divider"></div>' );
|
737 |
}
|
738 |
});
|
739 |
|
745 |
// Change override label
|
746 |
reusable_tab_container.children( '._yikes_wc_override_reusable_tab_label_duplicate' ).attr( 'for', '_yikes_wc_override_reusable_tab_' + new_count ).attr( 'id', '_yikes_wc_override_reusable_tab_label_' + new_count )
|
747 |
.removeClass( '_yikes_wc_override_reusable_tab_label_duplicate' ).addClass( '_yikes_wc_override_reusable_tab_label' );
|
748 |
+
|
749 |
// Change hidden input action field
|
750 |
reusable_tab_container.children( '#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate' )
|
751 |
.attr( 'name', '_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_' + new_count + '_action' )
|
765 |
|
766 |
// Add a loading gif until AJAX returns
|
767 |
jQuery( '.' + textarea_id + '_field' ).html( repeatable_custom_tabs.loading_gif );
|
768 |
+
|
769 |
yikes_woo_get_wp_editor_ajax( textarea_id, true, tab_content );
|
770 |
}
|
771 |
+
|
772 |
+
jQuery( '#duplicate_this_row' ).find( 'input[type="hidden"]' ).removeAttr( 'name' );
|
773 |
+
|
774 |
// Remove some classes
|
775 |
jQuery( '.last-button-holder' ).removeClass( 'last-button-holder' );
|
776 |
jQuery( '.new_duplicate_row' ).removeClass( 'new_duplicate_row' );
|
780 |
jQuery( 'textarea[name^="_yikes_wc_custom_repeatable_product_tabs_tab_content_"]' ).each( function() {
|
781 |
jQuery( this ).addClass( 'yikes_woo_custom_editor_styles' );
|
782 |
});
|
783 |
+
}
|
js/repeatable-custom-tabs.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yikes_woo_apply_resuable_tab(e){var _=e.data,a="_yikes_wc_custom_repeatable_product_tabs_tab_title_",t=_.tab_title,s=_.tab_id;yikes_woo_add_another_tab(_.tab_content);var r=jQuery("#number_of_tabs").val();jQuery("#"+a+r).val(t),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(s),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+r+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",r):jQuery("#"+a+r).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show()}function yikes_woo_fetch_reusable_tab(e,_){var a={action:"yikes_woo_fetch_reusable_tab",tab_id:e,security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,a,function(e){global_lity.close(),_(e)})}function yikes_woo_fetch_reusable_tabs(e,_){var a={action:"yikes_woo_fetch_reusable_tabs",fetch_tab_content:e,security_nonce:repeatable_custom_tabs.fetch_reusable_tabs_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,a,function(e){_(e)})}function yikes_woo_handle_reusable_tabs(e){if(void 0!==e.success&&!0===e.success)if(void 0!==e.data&&void 0!==e.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(e.data.message).fadeIn().delay("2000").fadeOut();else{var _=JSON.parse(e.data);lity_html=create_lity_manage_reusable_tabs_html(_),global_lity=lity(lity_html,{handler:"inline"})}else void 0!==e.success&&!1===e.success&&console.log(response);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}function create_lity_manage_reusable_tabs_html(e){var _=1,a="";return a+='<div class="display_saved_tabs_lity">',a+='<div class="yikes_wc_lity_header">',a+="<span> Choose a Tab </span>",a+="</div>",jQuery.each(e,function(e,t){a+='<div id="saved_tab_container_'+_+'" data-tab-id="'+t.tab_id+'">',a+='<div class="yikes_wc_lity_col_title">',a+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+_+'">',a+=t.tab_title,a+="</span>",a+='<span class="yikes_woo_saved_tab_name_lity" id="yikes_woo_saved_tab_name_'+_+'">',a+=void 0!==t.tab_name?" - "+t.tab_name:"",a+="</span>",a+="</div>",a+='<div class="yikes_wc_lity_col_select">',a+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+_+'"></span>',a+="</div>",a+="</div>",_++}),a+="</div>"}function yikes_woo_toggle_reusable_override_overlay(e,_){"disable"===e?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-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_"+_+"-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_"+_+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-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_"+_+"-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_"+_+"_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(){1==jQuery(this).data("reusable-tab")&&yikes_woo_toggle_reusable_override_overlay("disable",jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number"))})}function yikes_woo_add_another_tab(e){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 _=jQuery("#duplicate_this_row"),a=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),t=(jQuery("#duplicate_this_row .button-holder"),"_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a),s="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a;_.children(".hidden_duplicator_row_title_field, .hidden_duplicator_row_content_field, .hidden_duplicator_row_button_holder").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field hidden_duplicator_row_button_holder").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",s).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",s).parents("p").addClass(s+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",s+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&jQuery(this).attr("name",t).attr("id",t).parent("div").addClass(t+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",t+"_field")}),jQuery(".new_duplicate_row").find(".button-holder").attr("alt",a),jQuery(".new_duplicate_row").find(".yikes_wc_override_reusable_tab_container").attr("id","_yikes_wc_override_reusable_tab_container_"+a),jQuery(".new_duplicate_row").find(".button-holder").css("width","19.25%").unwrap(),jQuery("#number_of_tabs").val(a),a>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')});var r=jQuery(".last-button-holder").children(".yikes_wc_override_reusable_tab_container");r.removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+a).attr("data-tab-number",a),r.children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+a).attr("id","_yikes_wc_override_reusable_tab_label_"+a).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),r.children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action"),r.children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+a),1===parseInt(repeatable_custom_tabs.wp_version_four_eight)?yikes_woo_get_wp_editor_foureight(t,!0,e):(jQuery("."+t+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(t,!0,e)),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(e){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(e){yikes_woo_add_another_tab(""),e.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(e){var _=jQuery(this).parents(".button-holder").attr("alt"),a=jQuery("#number_of_tabs").val(),t="_yikes_wc_custom_repeatable_product_tabs_tab_title_",s="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(_!==a)for(var r=parseInt(_);r<a;){var o,i,c=r+1;o=jQuery("#"+t+c).val(),jQuery("#"+t+r).val(o),i=yikes_woo_get_content_from_wysiwyg(s+c),yikes_woo_set_content_for_wysiwyg(s+r,i);var l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(u);var d=jQuery("#_yikes_wc_override_reusable_tab_"+c).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",d),jQuery("#_yikes_wc_override_reusable_tab_container_"+c).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+c+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",r):yikes_woo_toggle_reusable_override_overlay("enable",r),r++}t="_yikes_wc_custom_repeatable_product_tabs_tab_title_";var b=(s="_yikes_wc_custom_repeatable_product_tabs_tab_content_")+a,y=jQuery("#_yikes_wc_override_reusable_tab_container_"+a),n=jQuery("."+t+a+"_field"),w=jQuery("."+s+a+"_field"),v=jQuery(".yikes-woo-custom-tab-divider").last(),k=jQuery("."+s+a+"_field").next(".button-holder"),p=parseInt(a)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,b),y.remove(),n.remove(),w.remove(),v.remove(),k.remove(),jQuery("#number_of_tabs").val(p),0===parseInt(p)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),e.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var e=jQuery(this).parents(".button-holder").attr("alt");if(1==e)return!1;var _="_yikes_wc_custom_repeatable_product_tabs_tab_title_",a="_yikes_wc_custom_repeatable_product_tabs_tab_content_",t=jQuery("#"+_+e).val(),s=yikes_woo_get_content_from_wysiwyg(a+e),r=parseInt(e)-parseInt(1),o=jQuery("#"+_+r).val(),i=yikes_woo_get_content_from_wysiwyg(a+r);jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",e),yikes_woo_toggle_reusable_override_overlay("disable",r)):jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",e),yikes_woo_toggle_reusable_override_overlay("enable",r));var c=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(),d=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(u),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(c),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(l),!0===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!1===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")?(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!1)):!1===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!0===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")&&(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!0)),!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")?(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).hide()):!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).show()),jQuery("#"+_+e).val(o),jQuery("#"+_+r).val(t),yikes_woo_set_content_for_wysiwyg(a+e,i),yikes_woo_set_content_for_wysiwyg(a+r,s)}),jQuery("body").on("click",".move-tab-data-down",function(){var e=jQuery(this).parents(".button-holder").attr("alt");if(e==jQuery("#number_of_tabs").val())return!1;var _="_yikes_wc_custom_repeatable_product_tabs_tab_title_",a="_yikes_wc_custom_repeatable_product_tabs_tab_content_",t=jQuery("#"+_+e).val(),s=yikes_woo_get_content_from_wysiwyg(a+e),r=parseInt(e)+parseInt(1),o=jQuery("#"+_+r).val(),i=yikes_woo_get_content_from_wysiwyg(a+r);jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",e),yikes_woo_toggle_reusable_override_overlay("disable",r)):jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",e),yikes_woo_toggle_reusable_override_overlay("enable",r));var c=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(),d=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(u),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(c),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(l),!0===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!1===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")?(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!1)):!1===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!0===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")&&(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!0)),!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")?(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).hide()):!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).show()),jQuery("#"+_+e).val(o),jQuery("#"+_+r).val(t),yikes_woo_set_content_for_wysiwyg(a+e,i),yikes_woo_set_content_for_wysiwyg(a+r,s)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){if(jQuery(this).hasClass("disabled"))return!1;jQuery(this).addClass("disabled"),yikes_woo_fetch_reusable_tabs(!1,yikes_woo_handle_reusable_tabs)}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var e=jQuery(this).data("saved-tab-number"),_=jQuery("#saved_tab_container_"+e).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(_,yikes_woo_apply_resuable_tab)}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var e=jQuery(this).data("tab-number");!0===jQuery(this).is(":checked")?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+e,"_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_"+e+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",e)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",e))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var e=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return e.removeClass("_yikes_wc_title_red_overlay"),void e.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var _=jQuery(this).attr("id"),a=jQuery(this).val(),t=!1;jQuery(".yikes_woo_tabs_title_field").each(function(s,r){jQuery(r).attr("id")!=_&&""!=jQuery(r).val()&&jQuery(r).val()===a&&(e.addClass("_yikes_wc_title_red_overlay"),e.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),e.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),t=!0)}),!1===t&&(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(!0!==jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();for(var e=jQuery("#number_of_tabs").val(),_={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:e,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce},a=1;a<=e;a++)_["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a).val(),_["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a),_["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a).val(),_["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,_,function(e){void 0!==e.success&&(!0===e.success?feedback_message_class="yikes_woo_save_success":!1===e.success&&(feedback_message_class="yikes_woo_save_failure")),void 0!==e.data&&void 0!==e.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(e.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
1 |
+
function yikes_woo_apply_resuable_tab(e){var _=e.data,a="_yikes_wc_custom_repeatable_product_tabs_tab_title_",t=_.tab_title,s=_.tab_id;yikes_woo_add_another_tab(_.tab_content);var r=jQuery("#number_of_tabs").val();jQuery("#"+a+r).val(t),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(s),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+r+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",r):jQuery("#"+a+r).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show()}function yikes_woo_fetch_reusable_tab(e,_){var a={action:"yikes_woo_fetch_reusable_tab",tab_id:e,security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,a,function(e){global_lity.close(),_(e)})}function yikes_woo_fetch_reusable_tabs(e,_){var a={action:"yikes_woo_fetch_reusable_tabs",fetch_tab_content:e,security_nonce:repeatable_custom_tabs.fetch_reusable_tabs_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,a,function(e){_(e)})}function yikes_woo_handle_reusable_tabs(e){if(void 0!==e.success&&!0===e.success)if(void 0!==e.data&&void 0!==e.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(e.data.message).fadeIn().delay("2000").fadeOut();else{var _=JSON.parse(e.data);lity_html=create_lity_manage_reusable_tabs_html(_),global_lity=lity(lity_html,{handler:"inline"}),jQuery(".lity-opened").addClass("custom-product-tabs select-tab")}else void 0!==e.success&&!1===e.success&&console.log(response);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}function create_lity_manage_reusable_tabs_html(e){var _=1,a="";return a+='<div class="display_saved_tabs_lity">',a+='<div class="yikes_wc_lity_header">',a+="<span> Choose a Tab </span>",a+="</div>",jQuery.each(e,function(e,t){a+='<div id="saved_tab_container_'+_+'" data-tab-id="'+t.tab_id+'">',a+='<div class="yikes_wc_lity_col_title">',a+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+_+'">',a+=t.tab_title,a+="</span>",a+='<span class="yikes_woo_saved_tab_name_lity" id="yikes_woo_saved_tab_name_'+_+'">',a+=void 0!==t.tab_name?" - "+t.tab_name:"",a+="</span>",a+="</div>",a+='<div class="yikes_wc_lity_col_select">',a+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+_+'"></span>',a+="</div>",a+="</div>",_++}),a+="</div>"}function yikes_woo_toggle_reusable_override_overlay(e,_){"disable"===e?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-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_"+_+"-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_"+_+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+_+"-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_"+_+"-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_"+_+"_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(){1==jQuery(this).data("reusable-tab")&&yikes_woo_toggle_reusable_override_overlay("disable",jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number"))})}function yikes_woo_add_another_tab(e){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 _=jQuery("#duplicate_this_row"),a=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),t=(jQuery("#duplicate_this_row .button-holder"),"_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a),s="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a;_.children(".hidden_duplicator_row_title_field, .hidden_duplicator_row_content_field, .hidden_duplicator_row_button_holder").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field hidden_duplicator_row_button_holder").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",s).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",s).parents("p").addClass(s+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",s+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&(jQuery(this).parent(".form-field-tinymce").addClass("_yikes_wc_custom_repeatable_product_tabs_tab_content_field "+t),jQuery(this).attr("name",t).attr("id",t).parent("div").addClass(t+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",t+"_field"))}),jQuery(".new_duplicate_row.button-holder").attr("alt",a),jQuery(".new_duplicate_row").find(".yikes_wc_override_reusable_tab_container").attr("id","_yikes_wc_override_reusable_tab_container_"+a),jQuery("#number_of_tabs").val(a),a>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')});var r=jQuery(".last-button-holder").children(".yikes_wc_override_reusable_tab_container");r.removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+a).attr("data-tab-number",a),r.children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+a).attr("id","_yikes_wc_override_reusable_tab_label_"+a).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),r.children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action"),r.children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+a),1===parseInt(repeatable_custom_tabs.wp_version_four_eight)?yikes_woo_get_wp_editor_foureight(t,!0,e):(jQuery("."+t+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(t,!0,e)),jQuery("#duplicate_this_row").find('input[type="hidden"]').removeAttr("name"),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(e){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(e){yikes_woo_add_another_tab(""),e.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(e){var _=jQuery(this).parents(".button-holder").attr("alt"),a=jQuery("#number_of_tabs").val(),t="_yikes_wc_custom_repeatable_product_tabs_tab_title_",s="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(_!==a)for(var r=parseInt(_);r<a;){var o,i,c=r+1;o=jQuery("#"+t+c).val(),jQuery("#"+t+r).val(o),i=yikes_woo_get_content_from_wysiwyg(s+c),yikes_woo_set_content_for_wysiwyg(s+r,i);var l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(u);var d=jQuery("#_yikes_wc_override_reusable_tab_"+c).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",d),jQuery("#_yikes_wc_override_reusable_tab_container_"+c).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+c+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",r):yikes_woo_toggle_reusable_override_overlay("enable",r),r++}t="_yikes_wc_custom_repeatable_product_tabs_tab_title_";var b=(s="_yikes_wc_custom_repeatable_product_tabs_tab_content_")+a,y=jQuery("#_yikes_wc_override_reusable_tab_container_"+a),n=jQuery("."+t+a+"_field"),w=jQuery("."+s+a),v=jQuery(".yikes-woo-custom-tab-divider").last(),p=jQuery('.button-holder[alt="'+a+'"]'),k=parseInt(a)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,b),y.remove(),n.remove(),w.remove(),jQuery("."+s+a+"_field").remove(),v.remove(),p.remove(),jQuery("#number_of_tabs").val(k),0===parseInt(k)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),e.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var e=jQuery(this).parents(".button-holder").attr("alt");if(1==e)return!1;var _="_yikes_wc_custom_repeatable_product_tabs_tab_title_",a="_yikes_wc_custom_repeatable_product_tabs_tab_content_",t=jQuery("#"+_+e).val(),s=yikes_woo_get_content_from_wysiwyg(a+e),r=parseInt(e)-parseInt(1),o=jQuery("#"+_+r).val(),i=yikes_woo_get_content_from_wysiwyg(a+r);jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",e),yikes_woo_toggle_reusable_override_overlay("disable",r)):jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",e),yikes_woo_toggle_reusable_override_overlay("enable",r));var c=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(),d=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(u),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(c),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(l),!0===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!1===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")?(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!1)):!1===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!0===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")&&(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!0)),!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")?(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).hide()):!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).show()),jQuery("#"+_+e).val(o),jQuery("#"+_+r).val(t),yikes_woo_set_content_for_wysiwyg(a+e,i),yikes_woo_set_content_for_wysiwyg(a+r,s)}),jQuery("body").on("click",".move-tab-data-down",function(){var e=jQuery(this).parents(".button-holder").attr("alt");if(e==jQuery("#number_of_tabs").val())return!1;var _="_yikes_wc_custom_repeatable_product_tabs_tab_title_",a="_yikes_wc_custom_repeatable_product_tabs_tab_content_",t=jQuery("#"+_+e).val(),s=yikes_woo_get_content_from_wysiwyg(a+e),r=parseInt(e)+parseInt(1),o=jQuery("#"+_+r).val(),i=yikes_woo_get_content_from_wysiwyg(a+r);jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",e),yikes_woo_toggle_reusable_override_overlay("disable",r)):jQuery("."+_+r+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+_+e+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",e),yikes_woo_toggle_reusable_override_overlay("enable",r));var c=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(),u=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(),d=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val(u),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r+"_action").val(c),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+r).val(l),!0===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!1===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")?(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!1)):!1===jQuery("#_yikes_wc_override_reusable_tab_"+e).is(":checked")&&!0===jQuery("#_yikes_wc_override_reusable_tab_"+r).is(":checked")&&(jQuery("#_yikes_wc_override_reusable_tab_"+r).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+e).prop("checked",!0)),!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")?(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).hide()):!1===jQuery("#_yikes_wc_override_reusable_tab_container_"+e).is(":visible")&&!0===jQuery("#_yikes_wc_override_reusable_tab_container_"+r).is(":visible")&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+r).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+e).show()),jQuery("#"+_+e).val(o),jQuery("#"+_+r).val(t),yikes_woo_set_content_for_wysiwyg(a+e,i),yikes_woo_set_content_for_wysiwyg(a+r,s)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){if(jQuery(this).hasClass("disabled"))return!1;jQuery(this).addClass("disabled"),yikes_woo_fetch_reusable_tabs(!1,yikes_woo_handle_reusable_tabs)}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var e=jQuery(this).data("saved-tab-number"),_=jQuery("#saved_tab_container_"+e).data("tab-id");jQuery(".lity-content").html(repeatable_custom_tabs.loading_gif).css("width","50px"),yikes_woo_fetch_reusable_tab(_,yikes_woo_apply_resuable_tab)}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var e=jQuery(this).data("tab-number");!0===jQuery(this).is(":checked")?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+e,"_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_"+e+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",e)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+e+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",e))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var e=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return e.removeClass("_yikes_wc_title_red_overlay"),void e.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var _=jQuery(this).attr("id"),a=jQuery(this).val(),t=!1;jQuery(".yikes_woo_tabs_title_field").each(function(s,r){jQuery(r).attr("id")!=_&&""!=jQuery(r).val()&&jQuery(r).val()===a&&(e.addClass("_yikes_wc_title_red_overlay"),e.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),e.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),t=!0)}),!1===t&&(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(!0!==jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();var e=jQuery("#number_of_tabs").val(),_={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:e,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce};console.log(_);for(var a=1;a<=e;a++)console.log("_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a),_["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+a).val(),_["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+a),_["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a).val(),_["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,_,function(e){void 0!==e.success&&(!0===e.success?feedback_message_class="yikes_woo_save_success":!1===e.success&&(feedback_message_class="yikes_woo_save_failure")),void 0!==e.data&&void 0!==e.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(e.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
languages/yikes-inc-easy-custom-woocommerce-product-tabs.pot
CHANGED
@@ -6,9 +6,9 @@
|
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
-
"Project-Id-Version: custom-product-tabs 1
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
-
"POT-Creation-Date: 2022-
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -123,84 +123,64 @@ msgstr ""
|
|
123 |
msgid "Submit a Support Request"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: admin/class.yikes-woo-generate-html.php:
|
127 |
-
#: admin/class.yikes-woo-generate-html.php:
|
128 |
#: admin/page.yikes-woo-saved-tabs-single.php:63
|
129 |
#: admin/page.yikes-woo-saved-tabs.php:59
|
130 |
#: admin/page.yikes-woo-saved-tabs.php:79
|
131 |
msgid "Tab Title"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: admin/class.yikes-woo-generate-html.php:
|
135 |
-
#: admin/class.yikes-woo-generate-html.php:
|
136 |
msgid "Custom Tab Title"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: admin/class.yikes-woo-generate-html.php:
|
140 |
msgid ""
|
141 |
"For help using Custom Tabs please visit our <a href='https://yikesplugins."
|
142 |
"com/support/knowledge-base/product/easy-custom-product-tabs-for-"
|
143 |
"woocommerce/' target='_blank'>Knowledge Base</a>"
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: admin/class.yikes-woo-generate-html.php:
|
147 |
msgid "Help Me!"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: admin/class.yikes-woo-generate-html.php:
|
|
|
151 |
msgid "Check this box to override the saved tab"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: admin/class.yikes-woo-generate-html.php:
|
155 |
msgid " Override Saved Tab"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: admin/class.yikes-woo-generate-html.php:
|
159 |
-
#: admin/class.yikes-woo-generate-html.php:
|
160 |
-
#: admin/class.yikes-woo-generate-html.php:288
|
161 |
-
msgid "Remove Tab"
|
162 |
-
msgstr ""
|
163 |
-
|
164 |
-
#: admin/class.yikes-woo-generate-html.php:173
|
165 |
-
#: admin/class.yikes-woo-generate-html.php:290
|
166 |
-
msgid "Move tab order"
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: admin/class.yikes-woo-generate-html.php:175
|
170 |
-
#: admin/class.yikes-woo-generate-html.php:292
|
171 |
-
msgid "Move up"
|
172 |
-
msgstr ""
|
173 |
-
|
174 |
-
#: admin/class.yikes-woo-generate-html.php:177
|
175 |
-
#: admin/class.yikes-woo-generate-html.php:294
|
176 |
-
msgid "Move tab up"
|
177 |
-
msgstr ""
|
178 |
-
|
179 |
-
#: admin/class.yikes-woo-generate-html.php:179
|
180 |
#: admin/class.yikes-woo-generate-html.php:296
|
181 |
-
msgid "
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
#: admin/class.yikes-woo-generate-html.php:181
|
185 |
-
#: admin/class.yikes-woo-generate-html.php:298
|
186 |
-
msgid "Move tab down"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: admin/class.yikes-woo-generate-html.php:
|
190 |
#: admin/class.yikes-woo-generate-html.php:269
|
191 |
msgid "Content"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: admin/class.yikes-woo-generate-html.php:
|
195 |
#: admin/class.yikes-woo-generate-html.php:269
|
196 |
msgid "HTML and text to display."
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: admin/class.yikes-woo-generate-html.php:
|
|
|
|
|
|
|
|
|
200 |
msgid "Add a Tab"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: admin/class.yikes-woo-generate-html.php:
|
204 |
msgid "Add a Saved Tab"
|
205 |
msgstr ""
|
206 |
|
@@ -236,15 +216,15 @@ msgstr ""
|
|
236 |
msgid "Custom Tabs"
|
237 |
msgstr ""
|
238 |
|
239 |
-
#: admin/class.yikes-woo-tabs.php:
|
240 |
msgid "Could not find the product!"
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: admin/class.yikes-woo-tabs.php:
|
244 |
msgid "Your tabs have been saved"
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: admin/class.yikes-woo-tabs.php:
|
248 |
msgid "Uh oh! Something went wrong with saving. Please try again."
|
249 |
msgstr ""
|
250 |
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
+
"Project-Id-Version: custom-product-tabs 1\n"
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
+
"POT-Creation-Date: 2022-12-06 00:18-0500\n"
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
123 |
msgid "Submit a Support Request"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: admin/class.yikes-woo-generate-html.php:71
|
127 |
+
#: admin/class.yikes-woo-generate-html.php:215
|
128 |
#: admin/page.yikes-woo-saved-tabs-single.php:63
|
129 |
#: admin/page.yikes-woo-saved-tabs.php:59
|
130 |
#: admin/page.yikes-woo-saved-tabs.php:79
|
131 |
msgid "Tab Title"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: admin/class.yikes-woo-generate-html.php:71
|
135 |
+
#: admin/class.yikes-woo-generate-html.php:215
|
136 |
msgid "Custom Tab Title"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: admin/class.yikes-woo-generate-html.php:137
|
140 |
msgid ""
|
141 |
"For help using Custom Tabs please visit our <a href='https://yikesplugins."
|
142 |
"com/support/knowledge-base/product/easy-custom-product-tabs-for-"
|
143 |
"woocommerce/' target='_blank'>Knowledge Base</a>"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: admin/class.yikes-woo-generate-html.php:139
|
147 |
msgid "Help Me!"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: admin/class.yikes-woo-generate-html.php:164
|
151 |
+
#: admin/class.yikes-woo-generate-html.php:284
|
152 |
msgid "Check this box to override the saved tab"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: admin/class.yikes-woo-generate-html.php:166
|
156 |
msgid " Override Saved Tab"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: admin/class.yikes-woo-generate-html.php:180
|
160 |
+
#: admin/class.yikes-woo-generate-html.php:254
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
#: admin/class.yikes-woo-generate-html.php:296
|
162 |
+
msgid "Remove Tab"
|
|
|
|
|
|
|
|
|
|
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: admin/class.yikes-woo-generate-html.php:230
|
166 |
#: admin/class.yikes-woo-generate-html.php:269
|
167 |
msgid "Content"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: admin/class.yikes-woo-generate-html.php:231
|
171 |
#: admin/class.yikes-woo-generate-html.php:269
|
172 |
msgid "HTML and text to display."
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: admin/class.yikes-woo-generate-html.php:285
|
176 |
+
msgid "Override Saved Tab"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: admin/class.yikes-woo-generate-html.php:336
|
180 |
msgid "Add a Tab"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: admin/class.yikes-woo-generate-html.php:341
|
184 |
msgid "Add a Saved Tab"
|
185 |
msgstr ""
|
186 |
|
216 |
msgid "Custom Tabs"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: admin/class.yikes-woo-tabs.php:335
|
220 |
msgid "Could not find the product!"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: admin/class.yikes-woo-tabs.php:342
|
224 |
msgid "Your tabs have been saved"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: admin/class.yikes-woo-tabs.php:344
|
228 |
msgid "Uh oh! Something went wrong with saving. Please try again."
|
229 |
msgstr ""
|
230 |
|
readme.txt
CHANGED
@@ -4,11 +4,11 @@ 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: 6.0
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Add custom tabs with content to products in WooCommerce.
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -16,7 +16,7 @@ This plugin extends [WooCommerce](www.woothemes.com/woocommerce/) to allow shop
|
|
16 |
|
17 |
Individual product tabs are managed on the WooCommerce Edit Product screen and can be added on a per product basis. You can also create saved tabs and add them to multiple products as needed. Tabs can be easily added, deleted and rearranged.
|
18 |
|
19 |
-
Tab content areas use the standard WordPress text editor and may contain text, images, HTML or shortcodes.
|
20 |
|
21 |
If you experience any problems, please submit a ticket on our [Free WordPress Support Forums](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs) and we'll look in to it as soon as possible.
|
22 |
|
@@ -49,7 +49,7 @@ Upgrade to [Custom Product Tabs Pro](https://yikesplugins.com/plugin/custom-prod
|
|
49 |
When editing a product in WooCommerce, you will find "Custom Tabs" in the bottom left corner of the Product Data box. Click on "Custom Tabs" to reveal the custom tab manager.
|
50 |
|
51 |
= Where will these tabs appear? =
|
52 |
-
When the product is viewed on your website you will see the tabs you created to the right of the default "Description" tab.
|
53 |
|
54 |
= How do I change the order of the tabs? =
|
55 |
To change the order of custom tabs use the up and down "Move tab order" arrows.
|
@@ -89,4 +89,4 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
|
|
89 |
* Tweaked the markup so that when a new tab is added the button holder width is correct.
|
90 |
* Update button styles to match WooCommerce branding.
|
91 |
* Add custom admin footer text on our pages.
|
92 |
-
* Remove extra comma causing PHP 7.2 issues.
|
4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 1.8.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Add custom tabs with content to products in WooCommerce.
|
12 |
|
13 |
== Description ==
|
14 |
|
16 |
|
17 |
Individual product tabs are managed on the WooCommerce Edit Product screen and can be added on a per product basis. You can also create saved tabs and add them to multiple products as needed. Tabs can be easily added, deleted and rearranged.
|
18 |
|
19 |
+
Tab content areas use the standard WordPress text editor and may contain text, images, HTML or shortcodes.
|
20 |
|
21 |
If you experience any problems, please submit a ticket on our [Free WordPress Support Forums](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs) and we'll look in to it as soon as possible.
|
22 |
|
49 |
When editing a product in WooCommerce, you will find "Custom Tabs" in the bottom left corner of the Product Data box. Click on "Custom Tabs" to reveal the custom tab manager.
|
50 |
|
51 |
= Where will these tabs appear? =
|
52 |
+
When the product is viewed on your website you will see the tabs you created to the right of the default "Description" tab.
|
53 |
|
54 |
= How do I change the order of the tabs? =
|
55 |
To change the order of custom tabs use the up and down "Move tab order" arrows.
|
89 |
* Tweaked the markup so that when a new tab is added the button holder width is correct.
|
90 |
* Update button styles to match WooCommerce branding.
|
91 |
* Add custom admin footer text on our pages.
|
92 |
+
* Remove extra comma causing PHP 7.2 issues.
|
yikes-inc-easy-custom-woocommerce-product-tabs.php
CHANGED
@@ -5,12 +5,13 @@
|
|
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: https://www.yikesinc.com
|
8 |
-
* Version: 1.8.
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
|
|
11 |
*
|
12 |
* WC requires at least: 3.0.0
|
13 |
-
* WC tested up to:
|
14 |
*
|
15 |
* Copyright: (c) 2014-2022 YIKES Inc.
|
16 |
*
|
@@ -40,7 +41,7 @@ if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
|
40 |
* Display our error admin notice if WooCommerce is not installed + active.
|
41 |
*/
|
42 |
function yikes_woo_display_admin_notice_error() {
|
43 |
-
?>
|
44 |
<!-- hide the 'Plugin Activated' default message -->
|
45 |
<style>
|
46 |
#message.updated {
|
@@ -75,7 +76,7 @@ function yikes_woo_display_admin_notice_error() {
|
|
75 |
echo $message;
|
76 |
?>
|
77 |
</p>
|
78 |
-
</div>
|
79 |
<?php
|
80 |
}
|
81 |
|
@@ -122,7 +123,7 @@ class YIKES_Custom_Product_Tabs {
|
|
122 |
* Define the plugin's version.
|
123 |
*/
|
124 |
if ( ! defined( 'YIKES_Custom_Product_Tabs_Version' ) ) {
|
125 |
-
define( 'YIKES_Custom_Product_Tabs_Version', '1.8.
|
126 |
}
|
127 |
|
128 |
/**
|
@@ -241,9 +242,9 @@ class YIKES_Custom_Product_Tabs {
|
|
241 |
// Fetch all of the post meta items where meta_key = 'yikes_woo_products_tabs'.
|
242 |
$yikes_woo_products_tabs = $wpdb->get_results(
|
243 |
"
|
244 |
-
SELECT *
|
245 |
FROM {$wpdb->postmeta}
|
246 |
-
WHERE meta_key = 'yikes_woo_products_tabs'
|
247 |
"
|
248 |
);
|
249 |
|
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: https://www.yikesinc.com
|
8 |
+
* Version: 1.8.2
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
+
* Tested up to: 6.1
|
12 |
*
|
13 |
* WC requires at least: 3.0.0
|
14 |
+
* WC tested up to: 7.0
|
15 |
*
|
16 |
* Copyright: (c) 2014-2022 YIKES Inc.
|
17 |
*
|
41 |
* Display our error admin notice if WooCommerce is not installed + active.
|
42 |
*/
|
43 |
function yikes_woo_display_admin_notice_error() {
|
44 |
+
?>
|
45 |
<!-- hide the 'Plugin Activated' default message -->
|
46 |
<style>
|
47 |
#message.updated {
|
76 |
echo $message;
|
77 |
?>
|
78 |
</p>
|
79 |
+
</div>
|
80 |
<?php
|
81 |
}
|
82 |
|
123 |
* Define the plugin's version.
|
124 |
*/
|
125 |
if ( ! defined( 'YIKES_Custom_Product_Tabs_Version' ) ) {
|
126 |
+
define( 'YIKES_Custom_Product_Tabs_Version', '1.8.2' );
|
127 |
}
|
128 |
|
129 |
/**
|
242 |
// Fetch all of the post meta items where meta_key = 'yikes_woo_products_tabs'.
|
243 |
$yikes_woo_products_tabs = $wpdb->get_results(
|
244 |
"
|
245 |
+
SELECT *
|
246 |
FROM {$wpdb->postmeta}
|
247 |
+
WHERE meta_key = 'yikes_woo_products_tabs'
|
248 |
"
|
249 |
);
|
250 |
|