Permalink
Browse files

Merge pull request #112 from Costo/master

Fixes for IE8
  • Loading branch information...
2 parents ef8667a + d4bb3ca commit 31f1054f2124b2be65e638e26037278f494cff69 @Raynos Raynos committed Jan 27, 2012
Showing with 33 additions and 5 deletions.
  1. +8 −0 js/libs/augment.js
  2. +24 −5 js/script.js
  3. +1 −0 template.html
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -2,6 +2,22 @@
*/
+// el.innerText / el.textContent helper
+var text;
+if (document.body.innerText) {
+ text = function (el, v) { return v ? el.innerText = v : el.innerText; };
+} else if (document.body.textContent) {
+ text = function (el, v) { return v ? el.textContent = v : el.textContent; };
+}
+
+// el.addEventListener / el.attachEvent helper
+var addEvent;
+if (window.attachEvent) {
+ addEvent = function (el, ev, cb) { el.attachEvent("on" + ev, cb); };
+} else if (window.addEventListener) {
+ addEvent = function (el, ev, cb, capture) { el.addEventListener(ev, cb, capture); };
+}
+
// gtieX augments. so a search is matching .gtie8,
// need to match .gtie7 and .gtie6 too
var ies = ['gtie6', 'gtie7', 'gtie8', 'gtie9', 'gtie10'];
@@ -13,7 +29,7 @@ var search = document.getElementById('livesearch'),
[].map.call(searchresults, function(result) {
var tags = result.querySelector('.tags'),
- tagslist = tags.textContent.split(' '),
+ tagslist = text(tags).split(' '),
ielist = tagslist.filter(function(tag) {
return tag.match(/gtie.*/);
});
@@ -80,15 +96,18 @@ function showsearch(hash) {
};
// keyboard shortcut for / to go to search box.
-addEventListener('keyup', function(e){
+addEvent(window, 'keyup', function(e){
if (e.which == 191 && document.activeElement != search)
search.focus();
});
var moredetails = document.getElementById("clickmore");
moredetails.onclick = function(e) {
- classList(e.target).toggle('active');
- classList(document.getElementById(/#(.*)/.exec(e.target.href)[1])).toggle('active');
- e.preventDefault();
+ e || (e = window.event);
+ var target = e.target || e.srcElement;
+
+ classList(target).toggle('active');
+ classList(document.getElementById(/#(.*)/.exec(target.href)[1])).toggle('active');
+ e.preventDefault && e.preventDefault();
};
View
@@ -89,6 +89,7 @@ <h4 class="kind {{kind}}">{{kind}}</h4>
</footer>
<!-- scripts concatenated and minified via ant build script -->
+ <script src="js/libs/augment.js"></script>
<script src="js/libs/list.js"></script>
<script src="js/libs/classList.js"></script>
<script src="js/script.js"></script>

0 comments on commit 31f1054

Please sign in to comment.