jQuery(document).on('ready fm_tab_loaded, ready fm_tab_email_loaded', function () { fm_admin_ready(); }); jQuery(window).on('load', function () { jQuery('#fm_loading').hide(); jQuery('#fm_admin_container').show(); if ( typeof add_scroll_width == 'function' ) { add_scroll_width(); } set_no_items(); }); function fm_admin_ready() { // Set click action to add new buttons. jQuery(".wd-header a").on("click", function () { jQuery("input[name='task']").val("add"); jQuery(this).parents("form").submit(); }); // Set no items row width. set_no_items(); jQuery(".wd-datepicker").each(function() { jQuery(this).datepicker(); jQuery(this).datepicker("option", "dateFormat", jQuery(this).data("format")); }); // Open/close section container on its header click. jQuery(".hndle:not(.readonly), .handlediv").each(function () { jQuery(this).off('click').on("click", function () { fm_toggle_postbox(this); }); }); jQuery(".wd-has-placeholder .dashicons.dashicons-list-view, .wd-editor-placeholder .dashicons.dashicons-list-view").each(function () { jQuery(this).attr("title", form_maker.add_placeholder); }); jQuery(document).on("click", ".wd-has-placeholder .dashicons.dashicons-list-view, .wd-editor-placeholder .dashicons.dashicons-list-view", function(){ fm_placeholders_popup(jQuery(this).data("id")); }); fm_disabled_uninstall_btn(); jQuery('.fm-uninstall-form #check_yes').on("click", function () { fm_disabled_uninstall_btn(); }); /* Add tooltip to elements with "wd-info" class. */ if ( typeof jQuery(document).tooltip != "undefined" ) { jQuery(document).tooltip({ show: null, items: ".wd-info", content: function () { var element = jQuery(this); if (element.is(".wd-info")) { var html = jQuery('#' + jQuery(this).data("id")).html(); return html; } }, open: function (event, ui) { if (typeof(event.originalEvent) === 'undefined') { return false; } var $id = jQuery(ui.tooltip).attr('id'); /* close any lingering tooltips. */ jQuery('div.ui-tooltip').not('#' + $id).remove(); }, close: function (event, ui) { ui.tooltip.hover(function () { jQuery(this).stop(true).fadeTo(400, 1); }, function () { jQuery(this).fadeOut('400', function () { jQuery(this).remove(); }); }); }, position: { my: "center top+30", at: "center top", using: function (position, feedback) { jQuery(this).css(position); jQuery("
Changes made in this table should be saved.
"); var i = page_number; jQuery('.fm_order').each(function (e) { if (jQuery(this).find('input').val()) { jQuery(this).find('input').val(i++); } }); } });//.disableSelection(); jQuery("#tbody_arr").sortable("enable"); jQuery("#tbody_arr").find(".handle").show(0); jQuery("#tbody_arr").find(".handle").attr('class', 'handle connectedSortable'); jQuery("#th_order").hide(0); jQuery("#tbody_arr").find(".fm_order").hide(0); jQuery("#show_hide_weights").val("Show order column"); } } function fm_popup(id) { if (typeof id === 'undefined') { var id = ''; } var thickDims, tbWidth, tbHeight; thickDims = function () { var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h; w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 40; h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 40; if (tbWindow.size()) { tbWindow.width(w).height(h); jQuery('#TB_iframeContent').width(w).height(h - 27); tbWindow.css({'margin-left': '-' + parseInt((w / 2), 10) + 'px'}); if (typeof document.body.style.maxWidth != 'undefined') { tbWindow.css({'top': (H - h) / 2, 'margin-top': '0'}); } } }; thickDims(); jQuery(window).resize(function () { thickDims() }); jQuery('a.thickbox-preview' + id).click(function () { tb_click.call(this); var alink = jQuery(this).parents('.available-theme').find('.activatelink'), link = '', href = jQuery(this).attr('href'), url, text; if (tbWidth = href.match(/&width=[0-9]+/)) { tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10); } else { tbWidth = jQuery(window).width() - 120; } if (tbHeight = href.match(/&height=[0-9]+/)) { tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10); } else { tbHeight = jQuery(window).height() - 120; } if (alink.length) { url = alink.attr('href') || ''; text = alink.attr('title') || ''; link = ' ' + text + ''; } else { text = jQuery(this).attr('title') || ''; link = ' ' + text + ''; } jQuery('#TB_title').css({'background-color': '#222', 'color': '#dfdfdf'}); jQuery('#TB_closeAjaxWindow').css({'float': 'right'}); jQuery('#TB_ajaxWindowTitle').css({'float': 'left'}).html(link); jQuery('#TB_iframeContent').width('100%'); thickDims(); return false; }); // Theme details jQuery('.theme-detail').click(function () { jQuery(this).siblings('.themedetaildiv').toggle(); return false; }); } function bwg_inputs() { jQuery(".fm_int_input").keypress(function (event) { var chCode1 = event.which || event.paramlist_keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57) && (chCode1 != 46) && (chCode1 != 45)) { return false; } return true; }); } function fm_check_isnum(e) { var chCode1 = e.which || e.paramlist_keyCode; if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 58) && (chCode1 != 46) && (chCode1 != 45) && (chCode1 < 65 || chCode1 > 70) && (chCode1 < 97 || chCode1 > 102) ) { return false; } return true; } function fm_change_payment_method(payment_method) { switch (payment_method) { case 'paypal': jQuery('.fm_payment_option').show(); jQuery('.fm_paypal_option').show(); jQuery('.fm_payment_option_stripe').hide(); break; case 'stripe': jQuery('.fm_payment_option').hide(); jQuery('.fm_paypal_option').hide(); jQuery('.fm_payment_option_stripe').show(); break; default: jQuery('.fm_payment_option').hide(); jQuery('.fm_paypal_option').hide(); jQuery('.fm_payment_option_stripe').hide(); } } function stopRKey(evt) { var evt = (evt) ? evt : ((event) ? event : null); var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if ((evt.keyCode == 13) && (node.type == "text" || node.type == "search")) { return false; } } document.onkeypress = stopRKey; function fmRemoveHeaderImage(e, callback) { jQuery('#header_image_url').val(''); jQuery("#header_image").css("background-image", ''); jQuery("#header_image").addClass("fm-hide"); } function fmOpenMediaUploader(e, callback) { if (typeof callback == "undefined") { callback = false; } e.preventDefault(); var custom_uploader = wp.media({ title: 'Upload', button: { text: 'Add Image' }, multiple: false }).on('select', function () { var attachment = custom_uploader.state().get('selection').first().toJSON(); jQuery('#header_image_url').val(attachment.url); jQuery("#header_image").css("background-image", 'url("' + attachment.url + '")'); jQuery("#header_image").css("background-position", 'center'); jQuery("#header_image").removeClass("fm-hide"); }).open(); return false; } jQuery(document).ready(function () { jQuery('.pp_display_on #pt0').click(function () { var isChecked = jQuery(this).prop('checked'); jQuery('.pp_display_on input[type="checkbox"]').prop('checked', isChecked); if (isChecked) { jQuery('.fm-posts-show, .fm-pages-show, .fm-cat-show').removeClass('fm-hide').addClass('fm-show'); } else { jQuery('.fm-posts-show, .fm-pages-show, .fm-cat-show').removeClass('fm-show').addClass('fm-hide'); } }); jQuery('.pp_display_on input[type="checkbox"]:not("#pt0")').click(function () { var isChecked = jQuery(this).prop('checked'); var everythingChecked = jQuery('.pp_display_on #pt0').prop('checked'); if (everythingChecked && !isChecked) { jQuery('.pp_display_on #pt0').prop('checked', false); } }); jQuery('.pp_display_on #pt4').click(function () { fm_toggle_pages(this); }); jQuery('.pp_display_on #pt3').click(function () { fm_toggle_posts(this); }); jQuery('body').on('focusin', '.pp_search_posts', function () { var this_input = jQuery(this); this_input.closest('ul').find('.pp_live_search').removeClass('fm-hide'); if (!this_input.hasClass('already_triggered')) { this_input.addClass('already_triggered'); pp_live_search(this_input, 500, true); } }); jQuery(document).click(function () { jQuery('.pp_live_search').addClass('fm-hide'); }); jQuery('body').on('click', '.fm-pp', function () { return false; }); jQuery('body').on('input', '.pp_search_posts', function () { pp_live_search(jQuery(this), 500, true); }); jQuery('body').on('click', '.pp_search_results li', function () { var this_item = jQuery(this); if (!this_item.hasClass('pp_no_res')) { var text = this_item.text(), id = this_item.data('post_id'), main_container = this_item.closest('.fm-pp'), display_box = main_container.find('.pp_selected'), value_field = main_container.find('.pp_exclude'), new_item = '' + text + 'x'; if (-1 === display_box.html().indexOf('data-post_id="' + id + '"')) { display_box.append(new_item); if ('' === value_field.val()) { value_field.val(id); } else { value_field.val(function (index, value) { return value + "," + id; }); } } } return false; }); jQuery('body').on('click', '.pp_selected span.pp_selected_remove', function () { var this_item = jQuery(this).parent(), value_field = this_item.closest('.fm-pp').find('.pp_exclude'), value_string = value_field.val(), id = this_item.data('post_id'); if (-1 !== value_string.indexOf(id)) { var str_toreplace = -1 !== value_string.indexOf(',' + id) ? ',' + id : id + ',', str_toreplace = -1 !== value_string.indexOf(',') ? str_toreplace : id, new_value = value_string; new_value = value_string.replace(str_toreplace, ''); value_field.val(new_value); } this_item.remove(); return false; }); jQuery('body').on('click', '.pp_display_on_categories input[name="display_on_categories[]"]', function () { var all_checkbox = jQuery('.pp_display_on_categories input[name="display_on_categories[]"]'); var all_categories = jQuery('.fm-display-all-categories'); var val = jQuery(this).val(); if ( val == 'select_all_categories') { if ( jQuery(this).is(':checked') ) { all_checkbox.prop('checked', true); } else { all_checkbox.prop('checked', false); } } else { var checked_count = jQuery('input[name="display_on_categories[]"]:checked').length; var all_categories_count = parseInt(all_categories.attr('data-categories-count')); if ( !jQuery(this).prop('checked') ) { checked_count = checked_count - 1; } all_categories.prop('checked', false); if ( checked_count == all_categories_count) { all_categories.prop('checked', true); } } }); }); function fm_toggle_posts(that) { var isChecked = jQuery(that).prop('checked'); if (isChecked) { jQuery('.fm-posts-show, .fm-cat-show').removeClass('fm-hide').addClass('fm-show'); } else { jQuery('.fm-posts-show, .fm-cat-show').removeClass('fm-show').addClass('fm-hide'); } } function fm_toggle_pages(that) { var isChecked = jQuery(that).prop('checked'); if (isChecked) { jQuery('.fm-pages-show').removeClass('fm-hide').addClass('fm-show'); } else { jQuery('.fm-pages-show').removeClass('fm-show').addClass('fm-hide'); } } function fm_apply_options(task) { fm_set_input_value('task', task); document.getElementById('manage_form').submit(); } function pp_live_search(input, delay, full_content) { var this_input = input, search_value = this_input.val(), post_type = this_input.data('post_type'); setTimeout(function () { if (search_value === this_input.val()) { jQuery.ajax({ type: 'POST', url: ajaxurl, data: { action: 'manage_fm', task: 'fm_live_search', nonce: fm_ajax.ajaxnonce, pp_live_search: search_value, pp_post_type: post_type, pp_full_content: full_content }, beforeSend: function (data) { this_input.css('width', '95%'); this_input.parent().find('.fm-loading').css('display', 'inline-block'); }, success: function (data) { this_input.css('width', '100%'); this_input.parent().find('.fm-loading').css('display', 'none'); /* if ( true === full_content ) { */ this_input.closest('.fm-pp').find('.pp_search_results').replaceWith(data); /* } else { this_input.closest('.fm-pp').find('.pp_search_results').append(data); } */ }, error: function (err) { console.log(err); } }); } }, delay); } function fm_toggle(elem) { jQuery(elem).parent().next().toggleClass('hide'); } function change_tab(elem) { jQuery('.fm-subscriber-header .fm-button').removeClass('active-button'); jQuery('.fm-subscriber-header .' + elem).addClass('active-button'); jQuery('.fm-subscriber-content').hide(); jQuery('.' + elem + '-tab').show(); } function change_form_type(type) { jQuery('#fieldset_id').val(type); jQuery('.fm-form-types span').removeClass('active'); jQuery('.fm-form-types').find('.fm-' + type).addClass('active'); jQuery('#type_settings_fieldset .wd-group').removeClass('fm-show').addClass('fm-hide'); } function change_hide_show(className) { jQuery('.' + className + '.fm-hide').removeClass('fm-hide').addClass('fm-temporary'); jQuery('.' + className + '.fm-show').removeClass('fm-show').addClass('fm-hide'); jQuery('.' + className + '.fm-show-table').removeClass('fm-show-table').addClass('fm-hide'); jQuery('.' + className + '.fm-temporary').removeClass('fm-temporary').addClass('fm-show'); if (className != 'fm-embedded') { fm_toggle_posts(jQuery('.pp_display_on #pt3')); fm_toggle_pages(jQuery('.pp_display_on #pt4')); } } function fm_change_radio_checkbox_text(elem) { var labels_array = []; labels_array['stripemode'] = ['Test', 'Live']; labels_array['checkout_mode'] = ['Testmode', 'Production']; labels_array['mail_mode'] = ['Text', 'HTML']; labels_array['mail_mode_user'] = ['Text', 'HTML']; labels_array['value'] = ['1', '0']; labels_array['popover_show_on'] = ['Page Exit', 'Page Load']; labels_array['topbar_position'] = ['Bottom', 'Top']; labels_array['scrollbox_position'] = ['Left', 'Right']; jQuery(elem).val(labels_array['value'][jQuery(elem).val()]); jQuery(elem).next().val(jQuery(elem).val()); var clicked_element = labels_array[jQuery(elem).attr('name')]; jQuery(elem).find('label').html(clicked_element[jQuery(elem).val()]); if (jQuery(elem).hasClass("fm-text-yes")) { jQuery(elem).removeClass('fm-text-yes').addClass('fm-text-no'); jQuery(elem).find("span").animate({ right: parseInt(jQuery(elem).css("width")) - 14 + 'px' }, 400, function () { }); } else { jQuery(elem).removeClass('fm-text-no').addClass('fm-text-yes'); jQuery(elem).find("span").animate({ right: 0 }, 400, function () { }); } } function fm_show_hide(class_name) { if (jQuery('.' + class_name).hasClass('fm-hide')) { jQuery('.' + class_name).removeClass('fm-hide').addClass('fm-show'); } else { jQuery('.' + class_name).removeClass('fm-show').addClass('fm-hide'); } } function fm_delete_ip( id ) { jQuery("#td_ip_"+id+" .loading").css("display","initial"); var url = jQuery("#blocked_ips").attr("action"); jQuery.ajax({ type: 'POST', url: url, data: { "current_id" : id, "nonce_fm" : jQuery("#nonce_fm").val(), "task" : "delete_blocked_ip", }, success: function (response) { var paged = parseInt( jQuery(response).find("#total_for_paging").html() ); if(!isNaN(paged)) { url = url.replace(/(paged=)[^\&]+/, '$1' + paged); } jQuery('#blocked_ips').parent('.wrap').load(url + ' #blocked_ips',function(){ window.history.pushState(null, null, url); if (jQuery(".updated").length != 0) { jQuery(" .updated p strong").html("Items Successfully Deleted"); } else { jQuery("Items Successfully Deleted.
Items Successfully Inserted.
Items Successfully Saved.
Items Successfully Updated.