* 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
36
index.php
36
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,8 +89,9 @@ function spans($list) {
|
|||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
|
||||
<script>
|
||||
var tags = [];
|
||||
$(document).delegate('span.tag', 'click', function () {
|
||||
(function() {
|
||||
var tags = [];
|
||||
$(document).delegate('span.tag', 'click', function () {
|
||||
var $tag = $(this), tag = $tag.text(), type = $tag.closest('td').attr('class') || 'tags';
|
||||
|
||||
if ($tag.is('.selected')) {
|
||||
|
@ -107,21 +108,21 @@ $(document).delegate('span.tag', 'click', function () {
|
|||
} else {
|
||||
$('tbody tr').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var html = [];
|
||||
$('.tags span.tag').each(function () {
|
||||
var html = [];
|
||||
$('.tags span.tag').each(function () {
|
||||
var $tag = $(this), tag = $tag.text();
|
||||
|
||||
if (!tags[tag]) {
|
||||
tags[tag] = true;
|
||||
html.push('<span class="tag">' + tag + '</span> ');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#tags').append('<strong>Filter demos:</strong> ' + html.sort().join(''));
|
||||
$('#tags').append('<strong>Filter demos:</strong> ' + html.sort().join(''));
|
||||
|
||||
$.getJSON('demos.json', function (data) {
|
||||
$.getJSON('demos.json', function (data) {
|
||||
var i = data.length, $test;
|
||||
while (i--) {
|
||||
if (data[i].test && (new Function('return ' + data[i].test))()) {
|
||||
|
@ -130,22 +131,23 @@ $.getJSON('demos.json', function (data) {
|
|||
$('#test-' + data[i].url).addClass('not-supported').attr('title', 'your browser is NOT supported');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// $('tr td.demo').click(function () {
|
||||
// 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