From f3dace3ad73a797d863dd44a934ae07b134379d1 Mon Sep 17 00:00:00 2001 From: Oleksii Mylotskyi Date: Mon, 18 Jan 2016 16:36:39 +0200 Subject: [PATCH 1/2] Add more specific version of WebFont loader library to prevent broke compatibility of WebFont object. --- src/font.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/font.js b/src/font.js index 6914661..5d7d311 100644 --- a/src/font.js +++ b/src/font.js @@ -34,7 +34,7 @@ define(['propertyParser'], function (propertyParser) { data.inactive = function(){ onLoad(false); }; - req([(document.location.protocol === 'https:'? 'https' : 'http') +'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'], function(){ + req([(document.location.protocol === 'https:'? 'https' : 'http') +'://ajax.googleapis.com/ajax/libs/webfont/1.5/webfont.js'], function(){ WebFont.load(data); }); } From dad96500dd6f4e9058ae36f5eb1f562af7b3f470 Mon Sep 17 00:00:00 2001 From: Oleksii Mylotskyi Date: Thu, 11 Feb 2016 21:55:03 +0200 Subject: [PATCH 2/2] Implement possibilities to declare version of Web Font loader to be used. --- src/font.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/font.js b/src/font.js index 5d7d311..6614e67 100644 --- a/src/font.js +++ b/src/font.js @@ -6,7 +6,7 @@ */ define(['propertyParser'], function (propertyParser) { - var rParts = /^([^,]+),([^\|]+)\|?/; + var rParts = /^([^,]+),([^\|]+)\|?/i; function parseName(name) { var data = {}, @@ -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 + // 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.5/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); }); }