Check if the google font is an array or not

This commit is contained in:
Amauri CHAMPEAUX 2023-03-31 11:50:03 +02:00
parent ab980fd942
commit 12a71b8a8b
1 changed files with 14 additions and 5 deletions

View File

@ -2961,11 +2961,20 @@ tarteaucitron.services.googlefonts = {
return;
}
tarteaucitron.addScript('//ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', '', function () {
WebFont.load({
google: {
families: tarteaucitron.user.googleFonts
}
});
if (tarteaucitron.user.googleFonts instanceof Array) {
WebFont.load({
google: {
families: tarteaucitron.user.googleFonts
}
});
} else {
WebFont.load({
google: {
families: [tarteaucitron.user.googleFonts]
}
});
}
});
}
};