Skip to content

Commit 9fd06ba

Browse files
committed
Merge pull request tastejs#485 from passy/source-link
Add link to source to footer of every example (close tastejs#369)
2 parents a3bfc1b + 9556113 commit 9fd06ba

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

assets/base.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,20 @@
44
if (location.hostname === 'todomvc.com') {
55
var _gaq=[['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));
66
}
7+
8+
function appendSourceLink() {
9+
var sourceLink = document.createElement('a');
10+
var paragraph = document.createElement('p');
11+
var footer = document.getElementById('info');
12+
var urlBase = 'https://github.com/addyosmani/todomvc/tree/gh-pages';
13+
14+
if (footer) {
15+
sourceLink.href = urlBase + location.pathName;
16+
sourceLink.appendChild(document.createTextNode('Check out the source'));
17+
paragraph.appendChild(sourceLink);
18+
footer.appendChild(paragraph);
19+
}
20+
}
21+
22+
appendSourceLink();
723
})();

0 commit comments

Comments
 (0)