Skip to content

Commit c8b1ff0

Browse files
committed
Fix - Webfontloader: force loading after 5 seconds
1 parent 4863101 commit c8b1ff0

File tree

6 files changed

+27
-12
lines changed

6 files changed

+27
-12
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Unreleased
2-
2+
* **Fix** - Webfontloader: force loading after 5 seconds
33

44
### 0.4.5: January 4th, 2018
55
* **Tweak** - Webfontloader: prevent FOUT

inc/front/webfonts.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ function stormbringer_webfonts() {
1717
WebFontConfig = {
1818
{$google_fonts}{$typekit_id}
1919
timeout: 2000,
20-
loading: function() {console.log('WF loading')},
21-
active: function() {console.log('WF active');
20+
active: function() {
2221
sessionStorage.fonts = true;
2322
window.setTimeout (
2423
function(){
25-
console.log('WF active real')
2624
document.documentElement.className += ' wf-active-real';
2725
}
2826
,500);
2927
},
30-
inactive: function() {console.log('WF inactive')},
3128
};
3229
(function(d, t) {
3330
var wf = d.createElement(t),s = d.getElementsByTagName(t)[0];

js/scripts.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -2236,9 +2236,18 @@ jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
22362236
htmlClass = htmlClass.replace(/([.]*)/,'wf-error $1');
22372237
}
22382238
}
2239-
,1000);
2239+
, 1000);
2240+
window.setTimeout (
2241+
function(){
2242+
document.documentElement.className += ' wf-inactive';
2243+
}
2244+
, 5000);
22402245

22412246
});
22422247
jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
2243-
2244-
});
2248+
2249+
2250+
2251+
2252+
2253+
});

js/scripts.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/application.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
2-
3-
});
2+
3+
4+
5+
6+
7+
});

js/src/common.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
319319
htmlClass = htmlClass.replace(/([.]*)/,'wf-error $1');
320320
}
321321
}
322-
,1000);
322+
, 1000);
323+
window.setTimeout (
324+
function(){
325+
document.documentElement.className += ' wf-inactive';
326+
}
327+
, 5000);
323328

324329
});

0 commit comments

Comments
 (0)