Skip to content

Commit

Permalink
Bug 820834: Add support for about:home v4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kelly committed Dec 21, 2012
1 parent e3928a7 commit 3e15635
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions standard-js/snippet.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<script type="text/javascript">
//<![CDATA[
(function() {
(function(showDefaultSnippets) {

var SAMPLE_RATE = 0.1;
var STATS_URL = 'https://snippets-stats.mozilla.org/foo.html';

// showDefaultSnippets polyfill, available in about:home v4
if (typeof showDefaultSnippets !== 'function') {
showDefaultSnippets = function() {
localStorage['snippets'] = '';
showSnippets();
}
}

var snippets = (document.getElementById('snippetContainer')
.getElementsByClassName('snippet'));
if (snippets.length > 0) {
Expand Down Expand Up @@ -32,8 +40,7 @@
show_snippet_id);
modifyLinks(show_snippet.getElementsByTagName('a'), parameters);
} else {
localStorage['snippets'] = '';
showSnippets();
showDefaultSnippets();
}

// Notifies stats server that the given snippet ID
Expand Down Expand Up @@ -64,6 +71,6 @@
}
}

})();
})(window.showDefaultSnippets);
//]]>
</script>
</script>

0 comments on commit 3e15635

Please sign in to comment.