Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../includes
File: admin-script.js
jQuery(function($) {
[0] Fix | Delete
var reduxOptionSearch = function(){
[1] Fix | Delete
[2] Fix | Delete
if(jQuery('.redux_field_search').length > 0){
[3] Fix | Delete
jQuery('.redux_field_search').typeWatch({
[4] Fix | Delete
callback:function( searchString ){
[5] Fix | Delete
searchString = searchString.toLowerCase();
[6] Fix | Delete
var searchArray = searchString.split(' ');
[7] Fix | Delete
var parent = $(this).parents('.redux-container:first');
[8] Fix | Delete
var expanded_options = parent.find('.expand_options');
[9] Fix | Delete
if (searchString != "") {
[10] Fix | Delete
if (!expanded_options.hasClass('expanded')) {
[11] Fix | Delete
expanded_options.click();
[12] Fix | Delete
parent.find('.redux-main').addClass('redux-search');
[13] Fix | Delete
}
[14] Fix | Delete
} else {
[15] Fix | Delete
if (expanded_options.hasClass('expanded')) {
[16] Fix | Delete
expanded_options.click();
[17] Fix | Delete
parent.find('.redux-main').removeClass('redux-search');
[18] Fix | Delete
}
[19] Fix | Delete
//parent.find('.redux-section-field, .redux-info-field, .redux-notice-field, .redux-container-group, .redux-section-desc, .redux-group-tab h3').show();
[20] Fix | Delete
[21] Fix | Delete
if($('.redux-group-tab-link-li.active').length>0){
[22] Fix | Delete
var rel = $('.redux-group-tab-link-li.active a').attr('data-rel');
[23] Fix | Delete
var selector = 'div#'+rel+'_section_group';
[24] Fix | Delete
jQuery(selector).show();
[25] Fix | Delete
jQuery(selector).css('display','block');
[26] Fix | Delete
[27] Fix | Delete
}else{
[28] Fix | Delete
$('.redux-group-tab-link-li.activeChild').click();
[29] Fix | Delete
$('div#'+rel+'_section_group').show();
[30] Fix | Delete
$('#'+rel+'_section_group').css('display','block');
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
}
[34] Fix | Delete
parent.find('.redux-field-container').each(function() {
[35] Fix | Delete
if (searchString != "") {
[36] Fix | Delete
parent.find('div.redux-group-tab').css('display','none');
[37] Fix | Delete
$(this).parents('tr:first').hide();
[38] Fix | Delete
} else {
[39] Fix | Delete
$(this).parents('tr:first').show();
[40] Fix | Delete
}
[41] Fix | Delete
});
[42] Fix | Delete
parent.find('.form-table tr').filter(function () {
[43] Fix | Delete
if(searchString==''){
[44] Fix | Delete
$('.redux-tab-container').show();
[45] Fix | Delete
$('.redux-tab-container').each(function(){
[46] Fix | Delete
$(this).find('.redux-tab-selector:first').click();
[47] Fix | Delete
});
[48] Fix | Delete
return false;
[49] Fix | Delete
}
[50] Fix | Delete
var item = $(this);
[51] Fix | Delete
if(item.hasClass('hide')){
[52] Fix | Delete
return false;
[53] Fix | Delete
}
[54] Fix | Delete
var isMatch = true,
[55] Fix | Delete
text = $(this).find('.redux_field_th').text().toLowerCase();
[56] Fix | Delete
if ( !text || text == "" ) {
[57] Fix | Delete
return false;
[58] Fix | Delete
}
[59] Fix | Delete
$.each(searchArray, function (i, searchStr) {
[60] Fix | Delete
if (text.indexOf(searchStr) == -1) {
[61] Fix | Delete
isMatch = false;
[62] Fix | Delete
}
[63] Fix | Delete
});
[64] Fix | Delete
if (isMatch) {
[65] Fix | Delete
$(this).show();
[66] Fix | Delete
$(this).parents('div.redux-group-tab').css('display','block');
[67] Fix | Delete
}
[68] Fix | Delete
return isMatch;
[69] Fix | Delete
}).show( function() { });
[70] Fix | Delete
parent.find('.redux-group-tab').each(function() {
[71] Fix | Delete
if (searchString != "") {
[72] Fix | Delete
$(this).find("div.redux-section-field").each(function(){
[73] Fix | Delete
var divSectionId = $(this).attr('id');
[74] Fix | Delete
var splitResult = divSectionId.split("-");
[75] Fix | Delete
splitResult.splice(1, 0, "table");
[76] Fix | Delete
var divTableId = splitResult.join("-");
[77] Fix | Delete
var totalTr = $("#"+divTableId).find('tr:visible').length;
[78] Fix | Delete
if(totalTr==0){
[79] Fix | Delete
$(this).hide();
[80] Fix | Delete
}
[81] Fix | Delete
});
[82] Fix | Delete
} else {
[83] Fix | Delete
$(this).find("div.redux-section-field").each(function(){
[84] Fix | Delete
var item = $(this);
[85] Fix | Delete
if(item.hasClass('hide')){
[86] Fix | Delete
return false;
[87] Fix | Delete
}
[88] Fix | Delete
var divSectionId = $(this).attr('id');
[89] Fix | Delete
var splitResult = divSectionId.split("-");
[90] Fix | Delete
splitResult.splice(1, 0, "table");
[91] Fix | Delete
var divTableId = splitResult.join("-");
[92] Fix | Delete
var totalTr = $("#"+divTableId).find('tr:visible').length;
[93] Fix | Delete
if(totalTr>0){
[94] Fix | Delete
$(this).show();
[95] Fix | Delete
}
[96] Fix | Delete
});
[97] Fix | Delete
$(this).find('.form-table-section tbody').each(function(){
[98] Fix | Delete
$(this).find('tr').each(function (i, el) {
[99] Fix | Delete
var item = $(this);
[100] Fix | Delete
if(item.hasClass('hide')){
[101] Fix | Delete
item.hide();
[102] Fix | Delete
}
[103] Fix | Delete
if(item.hasClass('redux-section-indent-start')){
[104] Fix | Delete
item.hide();
[105] Fix | Delete
}
[106] Fix | Delete
});
[107] Fix | Delete
});
[108] Fix | Delete
}
[109] Fix | Delete
}); // parent.find('.redux-group-tab') Closed
[110] Fix | Delete
},
[111] Fix | Delete
wait:400,
[112] Fix | Delete
highlight:false,
[113] Fix | Delete
captureLength:0
[114] Fix | Delete
});
[115] Fix | Delete
}
[116] Fix | Delete
}
[117] Fix | Delete
$('.redux-container').each(function() {
[118] Fix | Delete
if (!$(this).hasClass('redux-no-sections')) {
[119] Fix | Delete
$(this).find('.display_header').append('<span class="search-wrapper"><input class="redux_field_search" name="" type="text" placeholder="Search the controls" style="display:none"/><span class="redux-amp-search-icon"><i class="dashicons-before dashicons-search"></i></span></span>');
[120] Fix | Delete
$('.redux-amp-search-icon').on("click", function(){
[121] Fix | Delete
$('.redux_field_search').toggle('slide');
[122] Fix | Delete
var val = $('.redux_field_search').val();
[123] Fix | Delete
var display = $('.redux_field_search').css('display');
[124] Fix | Delete
if(val!='' && display=='block'){
[125] Fix | Delete
$('.redux_field_search').val('');
[126] Fix | Delete
var parent = jQuery('.redux_field_search').parents('.redux-container:first');
[127] Fix | Delete
var expanded_options = parent.find('.expand_options');
[128] Fix | Delete
if (expanded_options.hasClass('expanded')) {
[129] Fix | Delete
expanded_options.click();
[130] Fix | Delete
parent.find('.redux-main').removeClass('redux-search');
[131] Fix | Delete
}
[132] Fix | Delete
//parent.find('.redux-section-field, .redux-info-field, .redux-notice-field, .redux-container-group, .redux-section-desc, .redux-group-tab h3').show();
[133] Fix | Delete
[134] Fix | Delete
if($('.redux-group-tab-link-li.active').length>0){
[135] Fix | Delete
var rel = $('.redux-group-tab-link-li.active a').attr('data-rel');
[136] Fix | Delete
var selector = 'div#'+rel+'_section_group';
[137] Fix | Delete
jQuery(selector).show();
[138] Fix | Delete
jQuery(selector).css('display','block');
[139] Fix | Delete
[140] Fix | Delete
}else{
[141] Fix | Delete
$('.redux-group-tab-link-li.activeChild').click();
[142] Fix | Delete
$('div#'+rel+'_section_group').show();
[143] Fix | Delete
$('#'+rel+'_section_group').css('display','block');
[144] Fix | Delete
}
[145] Fix | Delete
parent.find('.redux-field-container').each(function() {
[146] Fix | Delete
$(this).parents('tr:first').show();
[147] Fix | Delete
});
[148] Fix | Delete
parent.find('.redux-group-tab').each(function() {
[149] Fix | Delete
$(this).find("div.redux-section-field").each(function(){
[150] Fix | Delete
var item = $(this);
[151] Fix | Delete
if(item.hasClass('hide')){
[152] Fix | Delete
return false;
[153] Fix | Delete
}
[154] Fix | Delete
var divSectionId = $(this).attr('id');
[155] Fix | Delete
var splitResult = divSectionId.split("-");
[156] Fix | Delete
splitResult.splice(1, 0, "table");
[157] Fix | Delete
var divTableId = splitResult.join("-");
[158] Fix | Delete
var totalTr = $("#"+divTableId).find('tr:visible').length;
[159] Fix | Delete
if(totalTr>0){
[160] Fix | Delete
$(this).show();
[161] Fix | Delete
}
[162] Fix | Delete
});
[163] Fix | Delete
$(this).find('.form-table-section tbody').each(function(){
[164] Fix | Delete
$(this).find('tr').each(function (i, el) {
[165] Fix | Delete
var item = $(this);
[166] Fix | Delete
if(item.hasClass('hide')){
[167] Fix | Delete
item.hide();
[168] Fix | Delete
}
[169] Fix | Delete
if(item.hasClass('redux-section-indent-start')){
[170] Fix | Delete
item.hide();
[171] Fix | Delete
}
[172] Fix | Delete
});
[173] Fix | Delete
});
[174] Fix | Delete
});
[175] Fix | Delete
}
[176] Fix | Delete
});
[177] Fix | Delete
reduxOptionSearch();
[178] Fix | Delete
}
[179] Fix | Delete
});
[180] Fix | Delete
[181] Fix | Delete
function ampforwp_get_cookie(cname) {
[182] Fix | Delete
var name = cname + "=";
[183] Fix | Delete
var ca = document.cookie.split(';');
[184] Fix | Delete
for(var i = 0; i < ca.length; i++) {
[185] Fix | Delete
var c = ca[i];
[186] Fix | Delete
while (c.charAt(0) == ' ') {
[187] Fix | Delete
c = c.substring(1);
[188] Fix | Delete
}
[189] Fix | Delete
if (c.indexOf(name) == 0) {
[190] Fix | Delete
return c.substring(name.length, c.length);
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
return "";
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
var ref_lap = ampforwp_get_cookie('ref_lap');
[197] Fix | Delete
if(ref_lap==''){
[198] Fix | Delete
var ref_nonce = ampforwp_get_cookie('ref_nonce');
[199] Fix | Delete
var current_post = ampforwp_get_cookie('current_post');
[200] Fix | Delete
if(current_post!='' && ref_nonce!=''){
[201] Fix | Delete
ampforwp_refresh_related_post(ref_nonce, current_post);
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
function ampforwp_refresh_related_post(ref_nonce='', current_post=''){
[206] Fix | Delete
var elem = document.getElementById("ref_rel_post_bar");
[207] Fix | Delete
var first_int = setInterval(first_frame, 1000);
[208] Fix | Delete
var width = current_post;
[209] Fix | Delete
width++;
[210] Fix | Delete
elem.style.width = width + '%';
[211] Fix | Delete
elem.innerHTML = width * 1 + '%';
[212] Fix | Delete
function first_frame() {
[213] Fix | Delete
width++;
[214] Fix | Delete
elem.style.width = width + '%';
[215] Fix | Delete
elem.innerHTML = width * 1 + '%';
[216] Fix | Delete
}
[217] Fix | Delete
$.ajax({
[218] Fix | Delete
url: ajaxurl,
[219] Fix | Delete
method: 'post',
[220] Fix | Delete
data: {
[221] Fix | Delete
action: 'ampforwp_referesh_related_post',
[222] Fix | Delete
verify_nonce: ref_nonce,
[223] Fix | Delete
current_post: current_post,
[224] Fix | Delete
},
[225] Fix | Delete
success: function(response){
[226] Fix | Delete
clearInterval(first_int);
[227] Fix | Delete
response = response.replace("}0", "}");
[228] Fix | Delete
var resp = JSON.parse(response);
[229] Fix | Delete
resp = parseInt(resp.response);
[230] Fix | Delete
var id = setInterval(frame, 10);
[231] Fix | Delete
var width = current_post;
[232] Fix | Delete
function frame() {
[233] Fix | Delete
if (width >= resp) {
[234] Fix | Delete
clearInterval(id);
[235] Fix | Delete
} else {
[236] Fix | Delete
width++;
[237] Fix | Delete
elem.style.width = width + '%';
[238] Fix | Delete
elem.innerHTML = width * 1 + '%';
[239] Fix | Delete
if(width == '100'){
[240] Fix | Delete
$('#ampforwp-refersh-related-post').remove();
[241] Fix | Delete
$('#redux_builder_amp-ampforwp-refersh-related-post .description').html('All the posts have been refreshed successfully.');
[242] Fix | Delete
}
[243] Fix | Delete
}
[244] Fix | Delete
}
[245] Fix | Delete
}
[246] Fix | Delete
});
[247] Fix | Delete
setTimeout(function(){
[248] Fix | Delete
var ref_nonce = ampforwp_get_cookie('ref_nonce');
[249] Fix | Delete
var current_post = ampforwp_get_cookie('current_post');
[250] Fix | Delete
if(current_post!='' && ref_nonce!='' && current_post<100){
[251] Fix | Delete
ampforwp_refresh_related_post(ref_nonce, current_post);
[252] Fix | Delete
}
[253] Fix | Delete
},30000);
[254] Fix | Delete
}
[255] Fix | Delete
[256] Fix | Delete
$("#ampforwp-refersh-related-post").on('click', function(){
[257] Fix | Delete
var ref_nonce = $(this).attr('data-nonce');
[258] Fix | Delete
var current_post = parseInt($(this).attr('data-id'));
[259] Fix | Delete
ampforwp_refresh_related_post(ref_nonce, current_post);
[260] Fix | Delete
});
[261] Fix | Delete
$(".redux_field_search").on( "keypress", function (evt) {
[262] Fix | Delete
//Deterime where our character code is coming from within the event
[263] Fix | Delete
var charCode = evt.charCode || evt.keyCode;
[264] Fix | Delete
if (charCode == 13) { //Enter key's keycode
[265] Fix | Delete
return false;
[266] Fix | Delete
}
[267] Fix | Delete
});
[268] Fix | Delete
//option panel Section Division
[269] Fix | Delete
var optionSectionDevision = function(){
[270] Fix | Delete
$('.afw-accordion-header').on("click", function(){
[271] Fix | Delete
//Get Cookie Changes
[272] Fix | Delete
if ( $.cookie( "redux_current_section_customize" )){
[273] Fix | Delete
var allReduxTabs = JSON.parse($.cookie( "redux_current_section_customize" ));
[274] Fix | Delete
}else{
[275] Fix | Delete
var allReduxTabs = {};
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
var section = $(this).attr("id");
[279] Fix | Delete
section = section.replace("section-","section-table-");
[280] Fix | Delete
[281] Fix | Delete
if($("#"+section).is(':visible')){
[282] Fix | Delete
$("#"+section).hide();
[283] Fix | Delete
$(this).removeClass("afw-accordion-tab-open").addClass("afw-accordion-tab-close");
[284] Fix | Delete
allReduxTabs[section] = 'hide';
[285] Fix | Delete
}else{
[286] Fix | Delete
$("#"+section).show();
[287] Fix | Delete
$(this).removeClass("afw-accordion-tab-close").addClass("afw-accordion-tab-open");
[288] Fix | Delete
allReduxTabs[section] = 'show';
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
//Set Cookie Changes
[292] Fix | Delete
$.cookie(
[293] Fix | Delete
'redux_current_section_customize', JSON.stringify(allReduxTabs), {
[294] Fix | Delete
expires: 7,
[295] Fix | Delete
path: '/'
[296] Fix | Delete
}
[297] Fix | Delete
);
[298] Fix | Delete
});
[299] Fix | Delete
//While loading at first time
[300] Fix | Delete
if($('.afw-accordion-header').length>0){
[301] Fix | Delete
//console.log($.cookie( "redux_current_section_customize" ));
[302] Fix | Delete
if ( $.cookie( "redux_current_section_customize" ) ){
[303] Fix | Delete
var tabsValue = JSON.parse($.cookie( "redux_current_section_customize" ));
[304] Fix | Delete
}else{
[305] Fix | Delete
var tabsValue = "";
[306] Fix | Delete
}
[307] Fix | Delete
$('.afw-accordion-header').each(function(){
[308] Fix | Delete
[309] Fix | Delete
var reduxAccordianHeader = $(this);
[310] Fix | Delete
var section = reduxAccordianHeader.attr("id");
[311] Fix | Delete
section = section.replace("section-","section-table-");
[312] Fix | Delete
[313] Fix | Delete
if(tabsValue[section]){
[314] Fix | Delete
var currentSettings = tabsValue[section];
[315] Fix | Delete
if(currentSettings=='hide'){
[316] Fix | Delete
reduxAccordianHeader.removeClass("afw-accordion-tab-open").addClass("afw-accordion-tab-close");
[317] Fix | Delete
}else if(currentSettings=='show'){
[318] Fix | Delete
reduxAccordianHeader.removeClass("afw-accordion-tab-close").addClass("afw-accordion-tab-open");
[319] Fix | Delete
}
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
if(reduxAccordianHeader.hasClass('afw-accordion-tab-close')){
[323] Fix | Delete
$("#"+section).hide();
[324] Fix | Delete
}else if(reduxAccordianHeader.hasClass('afw-accordion-tab-open')){
[325] Fix | Delete
$("#"+section).show();
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
})
[329] Fix | Delete
}
[330] Fix | Delete
}//Cloesed function = optionSectionDevision
[331] Fix | Delete
// Dismiss button functionlaity
[332] Fix | Delete
$('#ampforwp-automattic-notice').on('click', 'button', function(){
[333] Fix | Delete
var nonce = $('#ampforwp-automattic-notice').attr('data-nonce');
[334] Fix | Delete
var data_notice = {
[335] Fix | Delete
'action': 'ampforwp_automattic_notice_delete',
[336] Fix | Delete
'security': nonce,
[337] Fix | Delete
};
[338] Fix | Delete
jQuery.post(ajaxurl, data_notice, function(response) {
[339] Fix | Delete
[340] Fix | Delete
});
[341] Fix | Delete
});
[342] Fix | Delete
var hideReduxLeftTabs = function(){
[343] Fix | Delete
jQuery('ul.redux-group-menu > li.redux-group-tab-link-li').siblings('.redux-group-tab-link-li').each(function(key,Data){
[344] Fix | Delete
if(key>3 && jQuery(this).hasClass("otherSectionFields")){
[345] Fix | Delete
jQuery(this).attr("style","display:none;");
[346] Fix | Delete
}
[347] Fix | Delete
});
[348] Fix | Delete
[349] Fix | Delete
jQuery( '.redux-group-tab-link-a' ).on("click", function(){
[350] Fix | Delete
if(jQuery(this).parent('li').hasClass('otherSectionFields')){
[351] Fix | Delete
jQuery(this).parent('li.otherSectionFields').siblings('li.otherSectionFields').hide();
[352] Fix | Delete
if(!jQuery(this).parent('li').is(':visible')){
[353] Fix | Delete
jQuery(this).parent('li').show();
[354] Fix | Delete
}
[355] Fix | Delete
}else{
[356] Fix | Delete
jQuery(this).parent('li').siblings('li.otherSectionFields').hide();
[357] Fix | Delete
jQuery(this).parent('li').siblings('li.active').show();
[358] Fix | Delete
[359] Fix | Delete
}
[360] Fix | Delete
});
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
var showExtensionTabs = function(){
[364] Fix | Delete
var currentTab = getQueryStringValue('tabid');
[365] Fix | Delete
if(currentTab!="" && $("li."+currentTab).length>0){
[366] Fix | Delete
$("li."+currentTab+" a").click();
[367] Fix | Delete
}
[368] Fix | Delete
}
[369] Fix | Delete
var switchTextfunc = function(){
[370] Fix | Delete
var switchText = $('.switch-text');
[371] Fix | Delete
switchText.each(function(e,v){
[372] Fix | Delete
if ( $(this).siblings('input').attr('value') == 1 ) {
[373] Fix | Delete
$(this).parent('div.switch-options').find('.switch-text-on').show();
[374] Fix | Delete
}
[375] Fix | Delete
else if ( $(this).siblings('input').attr('value') == 0 ) {
[376] Fix | Delete
$(this).parent('div.switch-options').find('.switch-text-off').show();
[377] Fix | Delete
}
[378] Fix | Delete
});
[379] Fix | Delete
switchText.siblings('label').on("click", function(){
[380] Fix | Delete
if ( $(this).siblings('input').attr('value') == 1 ) {
[381] Fix | Delete
$(this).parent().find('.switch-text-on').hide();
[382] Fix | Delete
$(this).parent().find('.switch-text-off').show();
[383] Fix | Delete
}
[384] Fix | Delete
else if ( $(this).siblings('input').attr('value') == 0 ) {
[385] Fix | Delete
$(this).parent().find('.switch-text-off').hide();
[386] Fix | Delete
$(this).parent().find('.switch-text-on').show();
[387] Fix | Delete
}
[388] Fix | Delete
});
[389] Fix | Delete
}
[390] Fix | Delete
$(document).ready(function() {
[391] Fix | Delete
if(getQueryStringValue('page')=='amp_options'){
[392] Fix | Delete
//Tab section implementation
[393] Fix | Delete
optionSectionDevision();
[394] Fix | Delete
//To Show title on the top; In front of search bar
[395] Fix | Delete
if($( '.redux-group-tab-link-a' ).length){
[396] Fix | Delete
redux_title_modify();
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
//To Hide Leftsidebar option Below Extension
[400] Fix | Delete
hideReduxLeftTabs();
[401] Fix | Delete
showExtensionTabs();
[402] Fix | Delete
switchTextfunc();
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
[406] Fix | Delete
var gURL, gAPIkey, disableGFonts;
[407] Fix | Delete
[408] Fix | Delete
[409] Fix | Delete
gAPIkey = redux_data.google_font_api_key;
[410] Fix | Delete
disableGFonts = redux_data.amp_google_font_restrict;
[411] Fix | Delete
if(gAPIkey=='' || typeof gAPIkey == 'undefined'){
[412] Fix | Delete
$('.ampforwp-google-font-restrict').css({'display':'none'});
[413] Fix | Delete
}
[414] Fix | Delete
// Append data into selects
[415] Fix | Delete
ampforwp_font_generator();
[416] Fix | Delete
function ampforwp_font_generator() {
[417] Fix | Delete
[418] Fix | Delete
gAPIkey = redux_data.google_font_api_key;
[419] Fix | Delete
fontswitch = redux_data['ampforwp-google-font-switch'];
[420] Fix | Delete
if(fontswitch != 1){
[421] Fix | Delete
return;
[422] Fix | Delete
}
[423] Fix | Delete
disableGFonts = redux_data.amp_google_font_restrict;
[424] Fix | Delete
if($("#google_font_api_key").length>0){
[425] Fix | Delete
$("#google_font_api_key").after("<input type='submit' value='Verify'>");
[426] Fix | Delete
}
[427] Fix | Delete
if(gAPIkey=='' || typeof gAPIkey == 'undefined'){
[428] Fix | Delete
$('.ampforwp-google-font-restrict').css({'display':'none'});
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
if ( ! gAPIkey){
[432] Fix | Delete
gAPIkey = $('#google_font_api_key').val();
[433] Fix | Delete
}
[434] Fix | Delete
if(gAPIkey=='' || typeof gAPIkey == 'undefined'){
[435] Fix | Delete
$('#redux_builder_amp-google_font_api_key').append('<p style="color:red"> Could not connect to API, please double check your API key. </p> ');
[436] Fix | Delete
$('.ampforwp-google-font-class').css({'display':'none'});
[437] Fix | Delete
return ;
[438] Fix | Delete
}
[439] Fix | Delete
if(disableGFonts==1){
[440] Fix | Delete
gAPIkey='';
[441] Fix | Delete
return;
[442] Fix | Delete
}
[443] Fix | Delete
gURL = "https://www.googleapis.com/webfonts/v1/webfonts?key=" + gAPIkey;
[444] Fix | Delete
[445] Fix | Delete
[446] Fix | Delete
if (localStorage.getItem("googlefontapidata") === null) {
[447] Fix | Delete
var gfontData = $.get( gURL );
[448] Fix | Delete
gfontData.done(function( data ) {
[449] Fix | Delete
localStorage.setItem('googlefontapidata', JSON.stringify(data));
[450] Fix | Delete
ampforwp_fonts_select_data(data);
[451] Fix | Delete
});
[452] Fix | Delete
[453] Fix | Delete
gfontData.fail(function(data) {
[454] Fix | Delete
$('#redux_builder_amp-google_font_api_key').append('<p style="color:red"> Could not connect to API, please double check your API key. </p> ');
[455] Fix | Delete
$('.ampforwp-google-font-class').css({'display':'none'});
[456] Fix | Delete
});
[457] Fix | Delete
gfontData.always(function(){
[458] Fix | Delete
amp_font_selector_select_change();
[459] Fix | Delete
})
[460] Fix | Delete
}else{
[461] Fix | Delete
data = localStorage.getItem("googlefontapidata");
[462] Fix | Delete
ampforwp_fonts_select_data(JSON.parse(data));
[463] Fix | Delete
amp_font_selector_select_change();
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
}
[467] Fix | Delete
ampforwp_heading_fonts_select();
[468] Fix | Delete
function ampforwp_heading_fonts_select(){
[469] Fix | Delete
gAPIkey = redux_data.google_font_api_key;
[470] Fix | Delete
fontswitch = redux_data['ampforwp-google-font-switch'];
[471] Fix | Delete
if(fontswitch != 1 || gAPIkey=='' || typeof gAPIkey == 'undefined'){
[472] Fix | Delete
return;
[473] Fix | Delete
}
[474] Fix | Delete
var all_fonts = localStorage.getItem("googlefontapidata");
[475] Fix | Delete
all_fonts = JSON.parse(all_fonts);
[476] Fix | Delete
if(all_fonts != null ){
[477] Fix | Delete
all_fonts_values = Object.values(all_fonts.items);
[478] Fix | Delete
let target_heading_select= jQuery('#amp_font_selector_heading-select');
[479] Fix | Delete
for (const sfont of all_fonts_values) {
[480] Fix | Delete
var selected_heading='';
[481] Fix | Delete
if(redux_data.amp_font_selector_heading==sfont.family){
[482] Fix | Delete
selected_heading ='selected';
[483] Fix | Delete
}
[484] Fix | Delete
target_heading_select.append(jQuery('<option value="'+sfont.family+'" '+selected_heading+'> '+sfont.family+' </option>'));
[485] Fix | Delete
}
[486] Fix | Delete
target_heading_select.trigger('change');
[487] Fix | Delete
}
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
function ampforwp_fonts_select_data(data){
[491] Fix | Delete
if(data && localStorage.getItem("googlefontapidata") != null ){
[492] Fix | Delete
var values = Object.values(data.items);
[493] Fix | Delete
}
[494] Fix | Delete
var allFonts = [];
[495] Fix | Delete
[496] Fix | Delete
for (var i = 0; i < values.length; i++) {
[497] Fix | Delete
allFonts.push({fontFamily: values[i].family });
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function