From 26cbe2ebc71986034ffad59b5761b1d729be80ad Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Tue, 4 Aug 2009 17:31:26 -0700 Subject: [PATCH] gnarly hack to add custom list markers. DO NOT TYR THIS AT HOME --- j/dip3.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/j/dip3.js b/j/dip3.js index 32e6f31..a902c0d 100644 --- a/j/dip3.js +++ b/j/dip3.js @@ -141,12 +141,21 @@ $(document).ready(function() { var hip = {'background-color':'#eee','cursor':'default'}; var unhip = {'background-color':'inherit','cursor':'inherit'}; $("pre.code, pre.screen").each(function() { - $(this).find("a:not([href])").each(function(i) { + 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("ol").find("li:nth-child(" + (i+1) + ")"); + 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); }); }); + }); /* synchronized highlighting on callouts and their associated table rows */