diff --git a/dip3.js b/dip3.js index f0cb395..5cf640b 100644 --- a/dip3.js +++ b/dip3.js @@ -1,4 +1,6 @@ +/* var COMPARISON_LANGUAGES = {'python2': 'Python 2', 'java': 'Java', 'perl5': 'Perl 5', 'clang': 'C'}; +*/ var TOGGLE_BLOCK_TEXT = {'visible': 'hide', 'hidden': 'show'}; google.load("jquery", "1"); @@ -56,11 +58,13 @@ $(document).ready(function() { }); /* document.ready */ }); /* google.setOnLoadCallback */ +/* function toggleComparisonNotes(lang) { // FIXME: save state in cookie, pass state to toggle(), reset text accordingly $("blockquote." + lang + " div.block").toggle(false); $("blockquote." + lang + " div.widgets a.toggle").text("show " + COMPARISON_LANGUAGES[lang] + " notes"); } +*/ function toggleCodeBlock(id) { $("#" + id).find("div.block").toggle(); diff --git a/dip3.min.js b/dip3.min.js index 29bc688..095d385 100644 --- a/dip3.min.js +++ b/dip3.min.js @@ -1 +1 @@ -var COMPARISON_LANGUAGES={python2:"Python 2",java:"Java",perl5:"Perl 5",clang:"C"};var TOGGLE_BLOCK_TEXT={visible:"hide",hidden:"show"};google.load("jquery","1");google.setOnLoadCallback(function(){$(document).ready(function(){for(var a in COMPARISON_LANGUAGES){$("blockquote.compare").filter("blockquote."+a).each(function(b){$(this).wrapInner('
');$(this).prepend('
[ hide '+COMPARISON_LANGUAGES[a]+" notes ]
")})}$("pre > code").each(function(b){var c=$(this.parentNode);if(c.parents("table").length==0){c.addClass("code")}});$("pre.code, pre.screen").each(function(b){this.id="autopre"+b;$(this).wrapInner('
');$(this).prepend('
["+TOGGLE_BLOCK_TEXT.visible+"] [open in new window]
");$(this).prev("p.download").each(function(c){$(this).next("pre").find("div.widgets").append(" "+$(this).html());this.parentNode.removeChild(this)})});$("pre.code, pre.screen").each(function(){$(this).find("a:not([href])").each(function(d){var c=$(this);var b=c.parents("pre").next("ol").find("li:nth-child("+(d+1)+")");b.add(c).hover(function(){c.addClass("hover");b.addClass("hover")},function(){c.removeClass("hover");b.removeClass("hover")})})});$("table").each(function(){$(this).find("tr:gt(0)").each(function(c){var d=$(this);var b=d.parents("table").next("ol").find("li:nth-child("+(c+1)+")");if(b.length>0){b.add(d).hover(function(){d.addClass("hover");b.addClass("hover")},function(){d.removeClass("hover");b.removeClass("hover")})}})})})});function toggleComparisonNotes(a){$("blockquote."+a+" div.block").toggle(false);$("blockquote."+a+" div.widgets a.toggle").text("show "+COMPARISON_LANGUAGES[a]+" notes")}function toggleCodeBlock(c){$("#"+c).find("div.block").toggle();var b=$("#"+c).find("a.toggle");b.text(b.text()==TOGGLE_BLOCK_TEXT.visible?TOGGLE_BLOCK_TEXT.hidden:TOGGLE_BLOCK_TEXT.visible)}function plainTextOnClick(c){var b=$("#"+c).clone();b.find("div.widgets, span").remove();var a=window.open("about:blank","plaintext","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left=35,top=75");a.document.open();a.document.write("
"+b.html());a.document.close()};
\ No newline at end of file
+var COMPARISON_LANGUAGES={python2:"Python 2",java:"Java",perl5:"Perl 5",clang:"C"};var TOGGLE_BLOCK_TEXT={visible:"hide",hidden:"show"};google.load("jquery","1");google.setOnLoadCallback(function(){$(document).ready(function(){$("pre > code").each(function(a){var b=$(this.parentNode);if(b.parents("table").length==0){b.addClass("code")}});$("pre.code, pre.screen").each(function(a){this.id="autopre"+a;$(this).wrapInner('
');$(this).prepend('
["+TOGGLE_BLOCK_TEXT.visible+"] [open in new window]
");$(this).prev("p.download").each(function(b){$(this).next("pre").find("div.widgets").append(" "+$(this).html());this.parentNode.removeChild(this)})});$("pre.code, pre.screen").each(function(){$(this).find("a:not([href])").each(function(d){var c=$(this);var b=c.parents("pre").next("ol").find("li:nth-child("+(d+1)+")");b.add(c).hover(function(){c.addClass("hover");b.addClass("hover")},function(){c.removeClass("hover");b.removeClass("hover")})})});$("table").each(function(){$(this).find("tr:gt(0)").each(function(b){var c=$(this);var a=c.parents("table").next("ol").find("li:nth-child("+(b+1)+")");if(a.length>0){a.add(c).hover(function(){c.addClass("hover");a.addClass("hover")},function(){c.removeClass("hover");a.removeClass("hover")})}})})})});function toggleComparisonNotes(a){$("blockquote."+a+" div.block").toggle(false);$("blockquote."+a+" div.widgets a.toggle").text("show "+COMPARISON_LANGUAGES[a]+" notes")}function toggleCodeBlock(c){$("#"+c).find("div.block").toggle();var b=$("#"+c).find("a.toggle");b.text(b.text()==TOGGLE_BLOCK_TEXT.visible?TOGGLE_BLOCK_TEXT.hidden:TOGGLE_BLOCK_TEXT.visible)}function plainTextOnClick(c){var b=$("#"+c).clone();b.find("div.widgets, span").remove();var a=window.open("about:blank","plaintext","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left=35,top=75");a.document.open();a.document.write("
"+b.html());a.document.close()};
\ No newline at end of file