Added deferred loading of Roboto font.

With Polymer, putting it in the head hides the UI until the font is
loaded, which can take a few seconds on slower connections. By loading
it in JS, the UI font gets "upgraded" while the initialisation process
occurs. Closes #333.
This commit is contained in:
Oliver Hamlet
2014-11-17 15:23:58 +00:00
parent 27fc10c08a
commit e99f48002a
+7
View File
@@ -1260,6 +1260,13 @@ window.addEventListener('polymer-ready', function(e) {
/* Set the plugin list's scroll target to its parent. */
document.getElementById('main').lastElementChild.scrollTarget = document.getElementById('main');
/* Add Roboto font loader. */
var link = document.createElement('link');
link.href = 'http://fonts.googleapis.com/css?family=RobotoDraft:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en';
link.rel = 'stylesheet';
link.type = 'text/css';
document.head.appendChild(link);
require(['bower_components/marked/lib/marked', 'js/l10n', 'js/plugin', 'js/filters'], function(markedResponse, l10nResponse) {
marked = markedResponse;
l10n = l10nResponse;