jQuery(function($) { var reduxOptionSearch = function(){ jQuery('.redux_field_search').typeWatch({ callback:function( searchString ){ searchString = searchString.toLowerCase(); var searchArray = searchString.split(' '); var parent = $(this).parents('.redux-container:first'); var expanded_options = parent.find('.expand_options'); if (searchString != "") { if (!expanded_options.hasClass('expanded')) { expanded_options.click(); parent.find('.redux-main').addClass('redux-search'); } } else { if (expanded_options.hasClass('expanded')) { expanded_options.click(); parent.find('.redux-main').removeClass('redux-search'); } //parent.find('.redux-section-field, .redux-info-field, .redux-notice-field, .redux-container-group, .redux-section-desc, .redux-group-tab h3').show(); if($('.redux-group-tab-link-li.active').length>0){ var rel = $('.redux-group-tab-link-li.active a').attr('data-rel'); var selector = 'div#'+rel+'_section_group'; jQuery(selector).show(); jQuery(selector).css('display','block'); }else{ $('.redux-group-tab-link-li.activeChild').click(); $('div#'+rel+'_section_group').show(); $('#'+rel+'_section_group').css('display','block'); } } parent.find('.redux-field-container').each(function() { if (searchString != "") { parent.find('div.redux-group-tab').css('display','none'); $(this).parents('tr:first').hide(); } else { $(this).parents('tr:first').show(); } }); parent.find('.form-table tr').filter(function () { if(searchString==''){ $('.redux-tab-container').show(); $('.redux-tab-container').each(function(){ $(this).find('.redux-tab-selector:first').click(); }); return false; } var item = $(this); var isMatch = true, text = $(this).find('.redux_field_th').text().toLowerCase(); if ( !text || text == "" ) { return false; } $.each(searchArray, function (i, searchStr) { if (text.indexOf(searchStr) == -1) { isMatch = false; } }); if (isMatch) { $(this).show(); $(this).parents('div.redux-group-tab').css('display','block'); } return isMatch; }).show( function() { }); parent.find('.redux-group-tab').each(function() { if (searchString != "") { $(this).find("div.redux-section-field").each(function(){ var divSectionId = $(this).attr('id'); var splitResult = divSectionId.split("-"); splitResult.splice(1, 0, "table"); var divTableId = splitResult.join("-"); var totalTr = $("#"+divTableId).find('tr:visible').length; if(totalTr==0){ $(this).hide(); } }); } else { $(this).find("div.redux-section-field").each(function(){ var divSectionId = $(this).attr('id'); var splitResult = divSectionId.split("-"); splitResult.splice(1, 0, "table"); var divTableId = splitResult.join("-"); var totalTr = $("#"+divTableId).find('tr:visible').length; if(totalTr>0){ $(this).show(); } }); } }); // parent.find('.redux-group-tab') Closed }, wait:400, highlight:false, captureLength:0 }); } //option panel Section Division var optionSectionDevision = function(){ $('.afw-accordion-header').click(function(){ //Get Cookie Changes if ( $.cookie( "redux_current_section_customize" )){ var allReduxTabs = JSON.parse($.cookie( "redux_current_section_customize" )); }else{ var allReduxTabs = {}; } var section = $(this).attr("id"); section = section.replace("section-","section-table-"); if($("#"+section).is(':visible')){ $("#"+section).hide(); $(this).removeClass("afw-accordion-tab-open").addClass("afw-accordion-tab-close"); allReduxTabs[section] = 'hide'; }else{ $("#"+section).show(); $(this).removeClass("afw-accordion-tab-close").addClass("afw-accordion-tab-open"); allReduxTabs[section] = 'show'; } //Set Cookie Changes $.cookie( 'redux_current_section_customize', JSON.stringify(allReduxTabs), { expires: 7, path: '/' } ); }); //While loading at first time if($('.afw-accordion-header').length>0){ //console.log($.cookie( "redux_current_section_customize" )); if ( $.cookie( "redux_current_section_customize" ) ){ var tabsValue = JSON.parse($.cookie( "redux_current_section_customize" )); }else{ var tabsValue = ""; } $('.afw-accordion-header').each(function(){ var reduxAccordianHeader = $(this); var section = reduxAccordianHeader.attr("id"); section = section.replace("section-","section-table-"); if(tabsValue[section]){ var currentSettings = tabsValue[section]; if(currentSettings=='hide'){ reduxAccordianHeader.removeClass("afw-accordion-tab-open").addClass("afw-accordion-tab-close"); }else if(currentSettings=='show'){ reduxAccordianHeader.removeClass("afw-accordion-tab-close").addClass("afw-accordion-tab-open"); } } if(reduxAccordianHeader.hasClass('afw-accordion-tab-close')){ $("#"+section).hide(); }else if(reduxAccordianHeader.hasClass('afw-accordion-tab-open')){ $("#"+section).show(); } }) } }//Cloesed function = optionSectionDevision var hideReduxLeftTabs = function(){ jQuery('ul.redux-group-menu > li.redux-group-tab-link-li').siblings('.redux-group-tab-link-li').each(function(key,Data){ if(key>3){ jQuery(this).attr("style","display:none;").addClass("otherSectionFields"); } }); jQuery( '.redux-group-tab-link-a' ).click(function(){ if(jQuery(this).parent('li').hasClass('otherSectionFields')){ jQuery(this).parent('li.otherSectionFields').siblings('li.otherSectionFields').hide(); if(!jQuery(this).parent('li').is(':visible')){ jQuery(this).parent('li').show(); } }else{ jQuery(this).parent('li').siblings('li.otherSectionFields').hide(); jQuery(this).parent('li').siblings('li.active').show(); } }); } var showExtensionTabs = function(){ var currentTab = getQueryStringValue('tabid'); if(currentTab!="" && $("li."+currentTab).length>0){ $("li."+currentTab+" a").click(); } } var switchTextfunc = function(){ var switchText = $('.switch-text'); switchText.each(function(e,v){ if ( $(this).siblings('input').attr('value') == 1 ) { $(this).parent('div.switch-options').find('.switch-text-on').show(); } else if ( $(this).siblings('input').attr('value') == 0 ) { $(this).parent('div.switch-options').find('.switch-text-off').show(); } }); switchText.siblings('label').click(function(){ if ( $(this).siblings('input').attr('value') == 1 ) { $(this).parent().find('.switch-text-on').hide(); $(this).parent().find('.switch-text-off').show(); } else if ( $(this).siblings('input').attr('value') == 0 ) { $(this).parent().find('.switch-text-off').hide(); $(this).parent().find('.switch-text-on').show(); } }); } $(document).ready(function() { if(getQueryStringValue('page')=='amp_options'){ //Tab section implementation optionSectionDevision(); //To Show title on the top; In front of search bar if($( '.redux-group-tab-link-a' ).length){ redux_title_modify(); } //To Hide Leftsidebar option Below Extension hideReduxLeftTabs(); showExtensionTabs(); switchTextfunc(); } var gURL, gAPIkey; gAPIkey = redux_data.google_font_api_key; // Append data into selects ampforwp_font_generator(); function ampforwp_font_generator() { if ( ! gAPIkey){ gAPIkey = $('#google_font_api_key').val(); } if(gAPIkey=='' || typeof gAPIkey == 'undefined'){ $('#redux_builder_amp-google_font_api_key').append('

Could not connect to API, please double check your API key.

'); $('.ampforwp-google-font-class').css({'display':'none'}); return ; } gURL = "https://www.googleapis.com/webfonts/v1/webfonts?key=" + gAPIkey; var gfontData = $.get( gURL ); gfontData.done(function( data ) { var values = Object.values(data.items); var allFonts = []; for (var i = 0; i < values.length; i++) { allFonts.push({fontFamily: values[i].family }); } // Creating a select var s = $('"); } if($('#amp_font_selector-select').length>0){ // Adding Default Font Family $('#s2id_amp_font_selector-select a').removeClass('select2-default'); if(redux_data.amp_font_selector==''){ redux_data.amp_font_selector = 'Poppins' } $('#s2id_amp_font_selector-select .select2-chosen').html(redux_data.amp_font_selector); $('#amp_font_selector-select option[value="'+redux_data.amp_font_selector+'"]').attr("selected", "selected"); $('#amp_font_selector-select').select2('val',redux_data.amp_font_selector).trigger("change"); $('#amp_font_selector_content_single-select option[value="'+redux_data.amp_font_selector+'"]').attr("selected", "selected"); $('#amp_font_selector_content_single-select').select2('val',redux_data.amp_font_selector).trigger("change"); // Build select data let fontData = redux_data.google_current_font_data; // fontData = JSON.parse(fontData); console.log(fontData); if (! fontData.variants) { for (var i in fontData.variants) { $('#amp_font_type-select').append($("")).trigger('change'); } } if(redux_data.amp_font_type==''){ redux_data.amp_font_type = ['regular','500','700']; } // Add Default selected if ( redux_data.amp_font_type ) { $('#s2id_autogen4').remove(); for (var i in redux_data.amp_font_type) { $('#s2id_amp_font_type-select ul').append('
  • '+redux_data.amp_font_type[i]+'
  • '); //s2.append($('