(function ($) { 'use strict'; $(document).ready(function () { // Before we change the html structure we add identifier to the original settings tables in order to keep the tabs working. // Also changed the class-atr-woo-global-price-options-settings.php js accordingly $('table.form-table:eq( 0 )').addClass('main-section-wrap section-tab-content'); $('table.form-table:gt( 0 )').addClass('other-section-wrap section-tab-content'); // Tab 1 (Main) Remove default table elements wrapping the fields $('.gpo-settings-fields-wrap table.form-table.main-section-wrap tr').wrap('
').contents().unwrap(); $( ".gpo-settings-fields-wrap table.form-table.main-section-wrap th:contains('Option title')" ).wrapInner("
"); $( ".gpo-settings-fields-wrap table.form-table.main-section-wrap th:contains('Option price')" ).wrapInner("
"); $( ".gpo-settings-fields-wrap table.form-table.main-section-wrap th:contains('Price list display')" ).parents('.tr-content').addClass('list-control-label-wrapper'); $( ".gpo-settings-fields-wrap table.form-table.main-section-wrap th:contains('Price list display')" ).wrapInner("
"); $('.th-content').unwrap(); //$('.gpo-settings-fields-wrap table.form-table td').wrapInner("
"); $('.gpo-settings-fields-wrap table.form-table.main-section-wrap td').find( '.gpo-settings-title' ).parents('td').wrapInner("
"); $('.gpo-settings-fields-wrap table.form-table.main-section-wrap td').find( '.gpo-settings-price' ).parents('td').wrapInner("
"); $('.td-content').unwrap(); $('.gpo-settings-fields-wrap table.form-table.main-section-wrap').children().wrapAll("
"); $('.gpo-settings-fields-wrap table.form-table.main-section-wrap tbody').children().unwrap(); $('.gpo-settings-fields-wrap table.form-table.main-section-wrap').children().unwrap(); $('#gpo-settings-option-count-p_0_fields_count').parents('.tr-content').addClass('p-0-fields-count-wrap'); $('div[id^="gpo-settings-title-p_0_ttl_"]').parents('.tr-content').addClass('p-0-fields-ttl-wrap gpo-settings-price-option-row-half'); $('div[id^="gpo-settings-price-p_0_price_"]').parents('.tr-content').addClass('p-0-fields-price-wrap gpo-settings-price-option-row-half'); //Odd even BG for rows var $els = $('.gpo-settings-price-option-row-half'); for (var i = 0; i < $els.length; i += 2) { $els.slice(i, i + 2).wrapAll('
') } $(".gpo-settings-option-inner-wrap").append('Add price optionAdd price option'); $('#gpo-settings-price-p_0_price_1 .remove_button').css('display','none'); var maxField = 10; //Input fields increment limitation var wrapper = $('.gpo-settings-option-inner-wrap'); $('.add_button').click(function () { //Once add button is clickeadd_buttond $('#gpo-settings-price-p_0_price_1 .remove_button').css('display','inline-block'); $( '.gpo-settings-price-option-row:last' ).clone().find("input:text").val("").end().insertBefore( $(this) );// Add field html rearrange_inputs_ids(wrapper); }); $(wrapper).on('click', '.remove_button', function (e) { //Once remove button is clicked e.preventDefault(); $(this).parents('div.gpo-settings-price-option-row').remove(); //Remove field html rearrange_inputs_ids(wrapper); }); /* Categories treeview */ jQuery(function($){ var $ul = $('ul.gpo-cat-list'); var $ul_li = $('ul.gpo-cat-list li'); $ul.find('li[parent-id]').each(function () { $ul.find('li[parent-id=' + $(this).attr('li-id') + ']').wrapAll('