diff options
author | raylu <raylu@mixpanel.com> | 2011-11-05 03:14:50 -0700 |
---|---|---|
committer | raylu <raylu@mixpanel.com> | 2011-11-05 03:14:50 -0700 |
commit | c29b485df3475e251dce77e68d61462e2619ba9e (patch) | |
tree | b929fa55133c19f2873da899b769fffa6f6c3e30 /includes/header.php | |
parent | a5e930a4e59cb0776cb4ee5826e2e9e3624c9f2a (diff) | |
download | pathery-c29b485df3475e251dce77e68d61462e2619ba9e.tar.xz |
fix async font/js loading issues
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/includes/header.php b/includes/header.php index 1e24e8c..9340c3f 100644 --- a/includes/header.php +++ b/includes/header.php @@ -28,17 +28,26 @@ function htmlFooter() { _gaq.push(['_setAccount', 'UA-371072-3']);
_gaq.push(['_trackPageview']);
+ WebFontConfig = {
+ google: {
+ families: ['Cantarell:400,700:latin']
+ }
+ };
+
(function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ var proto = document.location.protocol;
+ var ga = document.createElement('script');
+ ga.type = 'text/javascript';
+ ga.async = true;
+ ga.src = ('https:' == proto ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.appendChild(ga, s);
- var fo = document.createElement('link');
- fo.rel = 'stylesheet';
- fo.type = 'text/css';
- fo.href = "http://fonts.googleapis.com/css?family=Cantarell:400,700";
- var l = document.getElementsByTagName('link')[0]; l.parentNode.appendChild(fo);
- document.getElementsByTagName('body')[0].style.fontFamily = 'cantarell, helvetica, sans-serif';
+ var wf = document.createElement('script');
+ wf.src = ('https:' == proto ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
+ wf.type = 'text/javascript';
+ wf.async = 'true';
+ s.parentNode.appendChild(wf, s);
})();
</script>
|