* Remove unneeded `type="text/css"`.
* Wrap all scripts in a closure to avoid polluting the global namespace as much as possible. * Use optimized asynchronous Google Analytics snippet (http://mathiasbynens.be/notes/async-analytics-snippet) instead of the ancient `document.write`-based one.
This commit is contained in:
parent
a534f8bf27
commit
e259920065
18
index.php
18
index.php
|
@ -41,7 +41,7 @@ function spans($list) {
|
|||
<meta charset=utf-8 />
|
||||
<meta name="viewport" content="width=620" />
|
||||
<title>HTML5 Demos and Examples</title>
|
||||
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
|
||||
<link rel="stylesheet" href="/css/html5demos.css" />
|
||||
<script src="js/h5utils.js"></script>
|
||||
<script src="js/modernizr.custom.js"></script>
|
||||
</head>
|
||||
|
@ -89,6 +89,7 @@ function spans($list) {
|
|||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var tags = [];
|
||||
$(document).delegate('span.tag', 'click', function () {
|
||||
var $tag = $(this), tag = $tag.text(), type = $tag.closest('td').attr('class') || 'tags';
|
||||
|
@ -136,16 +137,17 @@ $.getJSON('demos.json', function (data) {
|
|||
// window.location = $(this).find('a').attr('href');
|
||||
// });
|
||||
|
||||
}());
|
||||
</script>
|
||||
<a href="http://github.com/remy/html5demos"><img style="position: absolute; top: 0; left: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub" /></a>
|
||||
<script>
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
var _gaq = [['_setAccount', 'UA-1656750-18'], ['_trackPageview']];
|
||||
(function(d, t) {
|
||||
var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
|
||||
g.async = 1;
|
||||
g.src = '//www.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g, s);
|
||||
}(document, 'script'));
|
||||
</script>
|
||||
<script>
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-1656750-18");
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue