Skip to content

Commit

Permalink
Make WebFontConfig extendable by nextend
Browse files Browse the repository at this point in the history
see #217 for reasoning.

thanks @nextend !
  • Loading branch information
nextend authored and futtta committed Nov 28, 2018
1 parent 9b82cf2 commit ab71fef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/autoptimizeExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ public function filter_optimize_google_fonts( $in )
$fonts_markup .= $fnt . "','";
}
$fonts_markup = trim( trim( $fonts_markup, "'" ), ',' );
$fonts_markup .= '] },classes:false, events:false, timeout:1500};(function() {var wf = document.createElement(\'script\');wf.src=\'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';wf.type=\'text/javascript\';wf.async=\'true\';var s=document.getElementsByTagName(\'script\')[0];s.parentNode.insertBefore(wf, s);})();</script>';
$fonts_markup .= '] },classes:false, events:false, timeout:1500};</script>';

$fonts_library_markup = '<script data-cfasync="false" id="ao_optimized_gfonts" type="text/javascript">(function() {var wf = document.createElement(\'script\');wf.src=\'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';wf.type=\'text/javascript\';wf.async=\'true\';var s=document.getElementsByTagName(\'script\')[0];s.parentNode.insertBefore(wf, s);})();</script>';
$in = substr_replace( $in, $fonts_library_markup . '</head>', strpos( $in, '</head>' ), strlen( '</head>' ) );
}

// Replace back in markup.
Expand Down

0 comments on commit ab71fef

Please sign in to comment.