Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
define(['propertyParser'], function (propertyParser) {

var rParts = /^([^,]+),([^\|]+)\|?/;
var rParts = /^([^,]+),([^\|]+)\|?/i;

function parseName(name) {
var data = {},
Expand All @@ -29,12 +29,21 @@ define(['propertyParser'], function (propertyParser) {
if (config.isBuild) {
onLoad(null); //avoid errors on the optimizer
} else {
var data = parseName(name);
var data = parseName(name),
fontLoaderVersion = '1.5'; // Available versions listed at

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use webfontVersion instead of fontLoaderVersion perhaps?
It would look more clear to me, what do you think?

// https://developers.google.com/speed/libraries/#web-font-loader

data.active = onLoad;
data.inactive = function(){
onLoad(false);
};
req([(document.location.protocol === 'https:'? 'https' : 'http') +'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'], function(){

if (config && config.fontLoaderVersion !== undefined) {
fontLoaderVersion = config.fontLoaderVersion;
}

req([(document.location.protocol === 'https:'? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/' + fontLoaderVersion +'/webfont.js'], function(){
WebFont.load(data);
});
}
Expand Down