Skip to content

Commit

Permalink
Fix - Webfontloader: force loading after 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomollet committed Jan 4, 2018
1 parent 4863101 commit c8b1ff0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Unreleased

* **Fix** - Webfontloader: force loading after 5 seconds

### 0.4.5: January 4th, 2018
* **Tweak** - Webfontloader: prevent FOUT
Expand Down
5 changes: 1 addition & 4 deletions inc/front/webfonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ function stormbringer_webfonts() {
WebFontConfig = {
{$google_fonts}{$typekit_id}
timeout: 2000,
loading: function() {console.log('WF loading')},
active: function() {console.log('WF active');
active: function() {
sessionStorage.fonts = true;
window.setTimeout (
function(){
console.log('WF active real')
document.documentElement.className += ' wf-active-real';
}
,500);
},
inactive: function() {console.log('WF inactive')},
};
(function(d, t) {
var wf = d.createElement(t),s = d.getElementsByTagName(t)[0];
Expand Down
15 changes: 12 additions & 3 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2236,9 +2236,18 @@ jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
htmlClass = htmlClass.replace(/([.]*)/,'wf-error $1');
}
}
,1000);
, 1000);
window.setTimeout (
function(){
document.documentElement.className += ' wf-inactive';
}
, 5000);

});
jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed

});





});
2 changes: 1 addition & 1 deletion js/scripts.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions js/src/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed

});





});
7 changes: 6 additions & 1 deletion js/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ jQuery(function($) { // DOM is now ready and jQuery's $ alias sandboxed
htmlClass = htmlClass.replace(/([.]*)/,'wf-error $1');
}
}
,1000);
, 1000);
window.setTimeout (
function(){
document.documentElement.className += ' wf-inactive';
}
, 5000);

});

0 comments on commit c8b1ff0

Please sign in to comment.