diff --git a/src/diffenator2/templates/_base.html b/src/diffenator2/templates/_base.html index ec2bced..96f9ee2 100644 --- a/src/diffenator2/templates/_base.html +++ b/src/diffenator2/templates/_base.html @@ -211,37 +211,6 @@

{% block content_name %}{% endblock %}

fontToggle.addEventListener("click", switchFonts); } - function render(node, toplevel) { - var wrapper = $("
"); - if (!node) { return wrapper } - if (Array.isArray(node)) { - var before = $(""); - before.addClass("attr-before"); - before.html(" " + node[0] + " "); - var after = $(""); - after.addClass("attr-after"); - after.append(node[1]); - wrapper.append(before); - wrapper.append(after); - return wrapper - } - for (const [key, value] of Object.entries(node)) { - var display = $("
"); - display.addClass("node") - if (!toplevel && ! key.match(/^\d+$/)) { - display.hide() - } - display.append(key); - display.append(render(value, false).children()); - wrapper.append(display) - } - return wrapper - - } - $(function() { - $("#difftable").append(render(fontdiff, true).children()) - $(".node").on("click", function(event){ $(this).children().toggle(); event.stopPropagation() }) - }); {% block js %} {% endblock %} diff --git a/src/diffenator2/templates/diffbrowsers_glyphs.html b/src/diffenator2/templates/diffbrowsers_glyphs.html index 7ecb13c..94aa722 100644 --- a/src/diffenator2/templates/diffbrowsers_glyphs.html +++ b/src/diffenator2/templates/diffbrowsers_glyphs.html @@ -22,7 +22,7 @@ {% for font_class in font_styles or font_styles_old or font_styles_new %}
{{ font_class.class_name }} {{ pt_size }}pt
- + {% for character in characters %}
{{ character }}
{% endfor %} diff --git a/src/diffenator2/templates/diffbrowsers_waterfall.html b/src/diffenator2/templates/diffbrowsers_waterfall.html index 660b23c..6159bb6 100644 --- a/src/diffenator2/templates/diffbrowsers_waterfall.html +++ b/src/diffenator2/templates/diffbrowsers_waterfall.html @@ -8,13 +8,13 @@ {% for font_class in font_styles or font_styles_old or font_styles_new %} {% for pt_size in [7, 10, 11, 12, 14, 16, 18, 21, 27, 32] %}
-
{{ font_class.class_name }} {{ pt_size }}pt
- +
{{ font_class.class_name }} {{ pt_size }}pt
+
QUICK WAFTING ZEPHYRS VEX BOLD JIM.
quick wafting zephyrs vex bold jim.
$14.95
- -
+
+
{% endfor %} {% endfor %} {% endblock %} diff --git a/src/diffenator2/templates/diffenator.html b/src/diffenator2/templates/diffenator.html index 8496e58..e8526cc 100644 --- a/src/diffenator2/templates/diffenator.html +++ b/src/diffenator2/templates/diffenator.html @@ -113,6 +113,37 @@ {% endfor %} {% endblock %} {% block js %} + function render(node, toplevel) { + var wrapper = $("
"); + if (!node) { return wrapper } + if (Array.isArray(node)) { + var before = $(""); + before.addClass("attr-before"); + before.html(" " + node[0] + " "); + var after = $(""); + after.addClass("attr-after"); + after.append(node[1]); + wrapper.append(before); + wrapper.append(after); + return wrapper + } + for (const [key, value] of Object.entries(node)) { + var display = $("
"); + display.addClass("node") + if (!toplevel && ! key.match(/^\d+$/)) { + display.hide() + } + display.append(key); + display.append(render(value, false).children()); + wrapper.append(display) + } + return wrapper + + } + $(function() { + $("#difftable").append(render(fontdiff, true).children()) + $(".node").on("click", function(event){ $(this).children().toggle(); event.stopPropagation() }) + }); function wordBreaks() { words = document.getElementsByClassName("cell-word")