From 18f81041e2f46ce6643f4bb10eb0d45846189cb6 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sat, 24 Oct 2009 16:56:30 -0400 Subject: [PATCH] run less JS in IE --- j/dip3.js | 74 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/j/dip3.js b/j/dip3.js index d81f007..52b5417 100644 --- a/j/dip3.js +++ b/j/dip3.js @@ -164,42 +164,44 @@ $(document).ready(function() { $(this).css({'position':'static','width':'auto','height':'auto'}); }); - /* synchronized highlighting on callouts and their associated lines within code & screen blocks */ - var hip = {'background-color':'#eee','cursor':'default'}; - var unhip = {'background-color':'inherit','cursor':'inherit'}; - $("pre.code, pre.screen").each(function() { - var _this = $(this); - window.setTimeout(function() { - var s = ''; - var ol = _this.next("ol"); - var refs = _this.find("a:not([href])"); - refs.each(function(i) { - var li = ol.find("li:nth-child(" + (i+1) + ")"); - s += "&#x" + (parseInt('2460', 16) + i).toString(16) + ";" + li.html() + ""; - }); - ol.replaceWith("" + s + "
"); - refs.each(function(i) { - var a = $(this); - var li = a.parents("pre").next("table").find("tr:nth-child(" + (i+1) + ") td:nth-child(2)"); - li.add(a).hover(function() { a.css(hip); li.css(hip); }, - function() { a.css(unhip); li.css(unhip); }); - }); - }, 0); - }); - - /* synchronized highlighting on callouts and their associated table rows */ - $("table").each(function() { - $(this).find("tr:gt(0)").each(function(i) { - var tr = $(this); - window.setTimeout(function() { - var li = tr.parents("table").next("ol").find("li:nth-child(" + (i+1) + ")"); - if (li.length > 0) { - li.add(tr).hover(function() { tr.css(hip); li.css(hip); }, - function() { tr.css(unhip); li.css(unhip); }); - } - }, 0); - }); - }); + if (!/*@cc_on!@*/0) { + /* synchronized highlighting on callouts and their associated lines within code & screen blocks */ + var hip = {'background-color':'#eee','cursor':'default'}; + var unhip = {'background-color':'inherit','cursor':'inherit'}; + $("pre.code, pre.screen").each(function() { + var _this = $(this); + window.setTimeout(function() { + var s = ''; + var ol = _this.next("ol"); + var refs = _this.find("a:not([href])"); + refs.each(function(i) { + var li = ol.find("li:nth-child(" + (i+1) + ")"); + s += "&#x" + (parseInt('2460', 16) + i).toString(16) + ";" + li.html() + ""; + }); + ol.replaceWith("" + s + "
"); + refs.each(function(i) { + var a = $(this); + var li = a.parents("pre").next("table").find("tr:nth-child(" + (i+1) + ") td:nth-child(2)"); + li.add(a).hover(function() { a.css(hip); li.css(hip); }, + function() { a.css(unhip); li.css(unhip); }); + }); + }, 0); + }); + + /* synchronized highlighting on callouts and their associated table rows */ + $("table").each(function() { + $(this).find("tr:gt(0)").each(function(i) { + var tr = $(this); + window.setTimeout(function() { + var li = tr.parents("table").next("ol").find("li:nth-child(" + (i+1) + ")"); + if (li.length > 0) { + li.add(tr).hover(function() { tr.css(hip); li.css(hip); }, + function() { tr.css(unhip); li.css(unhip); }); + } + }, 0); + }); + }); + } /* match terms with incoming search keywords and jump to the containing section */ var searchTerms = getSearchTerms();