From e99f48002a95ff20658a177139c3847118ddc102 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Mon, 17 Nov 2014 15:23:58 +0000 Subject: [PATCH] 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. --- resources/report/js/script.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 6cdc904d..a355e1af 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -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;