PK ! jj#9( 9( % assets/settings-tabs/settings-tabs.jsnu [ (function ($) { //jQuery(document).ready(function($){ $(document).ready(function () { $(".settings-tabs-loading").fadeOut(); $(".settings-tabs").fadeIn(); accordion = $(".settings-tabs .accordion").accordion({ heightStyle: 'content', active: 99, header: "> div > h3", collapsible: true, }); $(".settings-tabs [colorPicker]").wpColorPicker(); $(".settings-tabs .accordion[sortable='true']").sortable({ axis: "y", handle: "h3", stop: function (event, ui) { // IE doesn't register the blur when sorting // so trigger focusout handlers to remove .ui-state-focus ui.item.children("h3").triggerHandler("focusout"); // Refresh accordion to handle new order $(this).accordion("refresh"); } }) $(".settings-tabs .sortable").sortable({ handle: ".sort" }); $(document).on('click', '.settings-tabs .tab-nav', function () { $(this).parent().parent().children('.tab-navs').children('.tab-nav').removeClass('active'); $(this).addClass('active'); id = $(this).attr('data-id'); $('input[name="tab"], input.current_tab').val(id); $(this).parent().parent().children('.tab-content').removeClass('active'); $(this).parent().parent().children('.tab-content#' + id).addClass('active'); $(this).parent().parent().children('.settings-tabs-right-panel').children('.right-panel-content').removeClass('active'); $(this).parent().parent().children('.settings-tabs-right-panel').children('.right-panel-content-' + id).addClass('active'); }) $(document).on('click', '.settings-tabs .field-media-wrapper .clear ', function (e) { $(this).parent().children().children('.media-preview').attr('src', ''); $(this).parent().children().children('.media-title').html(''); $(this).parent().children('.media-input-value').val(''); placeholder = $(this).attr('placeholder'); $(this).parent().children().children('.media-preview').attr('src', placeholder); }) $(document).on('click', '.settings-tabs .field-media-wrapper .media-upload', function (e) { var side_uploader; this_ = $(this); //alert(target_input); e.preventDefault(); //If the uploader object has already been created, reopen the dialog if (side_uploader) { side_uploader.open(); return; } //Extend the wp.media object side_uploader = wp.media.frames.file_frame = wp.media({ title: 'Choose Image', button: { text: 'Choose Image' }, multiple: false }); //When a file is selected, grab the URL and set it as the text field's value side_uploader.on('select', function () { attachment = side_uploader.state().get('selection').first().toJSON(); attachmentId = attachment.id; src_url = attachment.url; src_filename = attachment.filename; $(this_).prev().val(attachmentId); $(this_).parent().children('.media-preview-wrap').children('img').attr('src', src_url); $(this_).parent().children().children('.media-title').html(src_filename); }); //Open the uploader dialog side_uploader.open(); }) $(document).on('click', '.settings-tabs .field-media-url-wrapper .media-upload', function (e) { var side_uploader; this_ = $(this); //alert(target_input); e.preventDefault(); //If the uploader object has already been created, reopen the dialog if (side_uploader) { side_uploader.open(); return; } //Extend the wp.media object side_uploader = wp.media.frames.file_frame = wp.media({ title: 'Choose Image', button: { text: 'Choose Image' }, multiple: false }); //When a file is selected, grab the URL and set it as the text field's value side_uploader.on('select', function () { attachment = side_uploader.state().get('selection').first().toJSON(); attachmentId = attachment.id; src_url = attachment.url; $(this_).prev().val(src_url); $(this_).parent().children('.media-preview-wrap').children('img').attr('src', src_url); }); //Open the uploader dialog side_uploader.open(); }) $(document).on('click', '.settings-tabs .field-media-url-wrapper .clear', function (e) { $(this).parent().children('.media-preview-wrap').children('img').attr('src', ''); $(this).parent().children('input').val(''); }) jQuery(document).on('click', '.settings-tabs .input-text-multi-wrapper .add-item', function () { dataName = $(this).attr('data-name'); dataSort = $(this).attr('data-sort'); dataClone = $(this).attr('data-clone'); dataPlaceholder = $(this).attr('data-placeholder'); html = '