# HG changeset patch # User Steve Losh # Date 1278270547 14400 # Node ID 8534b74192a86e61c2b197f31d4ba0fcaa838c38 # Parent 6bb74f05c1ad231bd043daf348c17dbe9c232a93 Add print links. diff -r 6bb74f05c1ad -r 8534b74192a8 layout/skeleton/_base.html --- a/layout/skeleton/_base.html Sun Jul 04 15:08:54 2010 -0400 +++ b/layout/skeleton/_base.html Sun Jul 04 15:09:07 2010 -0400 @@ -16,15 +16,10 @@ {% endblock %} {% block css %} - - - + + + + {% block extra_css %}{% endblock %} {% endblock %} @@ -33,6 +28,7 @@ + {% block extra_js %}{% endblock %} diff -r 6bb74f05c1ad -r 8534b74192a8 media/css/base.less --- a/media/css/base.less Sun Jul 04 15:08:54 2010 -0400 +++ b/media/css/base.less Sun Jul 04 15:09:07 2010 -0400 @@ -1,5 +1,3 @@ -/* @override http://localhost:8080/media/css/base.css */ - @pink: #e50053; @bodytext: #111111; @@ -9,6 +7,7 @@ } body { font-family: "Helvetica Neue", HelveticaNeue, Arial, Helvetica, sans-serif; + text-rendering: optimizeLegibility; color: @bodytext; } div#main-wrap { @@ -338,3 +337,8 @@ margin-right: 1em; } } + +/* Print link styles */ +.print-links { + display: none; +} diff -r 6bb74f05c1ad -r 8534b74192a8 media/css/print.less --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/media/css/print.less Sun Jul 04 15:09:07 2010 -0400 @@ -0,0 +1,77 @@ +body { + font: normal 10pt/1.25 HelveticaNeue, "Helvetica Neue", Arial, Helvetica, sans-serif; + text-rendering: optimizeLegibility; +} + +#nav, #leaf-title, #comment-header, #disqus_thread, .dsq-brlink, .toc { + display: none; +} +#header { + font-size: 0.85em; + text-transform: capitalize; + + a, a:active, a:visited { + text-decoration: none; + color: black; + } +} +#leaf-title { + display: none; +} +#leaf-stats { + a { + text-decoration: underline; + color: #c06; + } +} +#leaf-content { + a { + text-decoration: underline; + color: #c06; + } + ul.print-links { + display: block; + font-size: 1em; + list-style-type: none; + margin-left: 0em; + + a { + text-decoration: none; + } + } + code, pre { + font: normal 9pt Menlo, Monaco, Consolas, "Courier New", Courier, monospace; + } + img { + display: block; + margin-left: auto; + margin-right: auto; + border: 1.43em solid #e5e5e5; + padding: 1px; + background: black; + } + img.left, img.right { + border: none; + background: none; + padding: none; + } + img.left { + margin: 0 1.5em 1em 0; + float: left; + } + img.right { + margin: 0 0 .75em 1em; + float: right; + } +} +div#leaf-content.with-diagrams img { + display: block; + margin-left: auto; + margin-right: auto; + background: none; + border: none; +} +span.amp { + font-family: "Palatino", "Constantia", "Palatino Linotype", serif; + font-style: italic; +} diff -r 6bb74f05c1ad -r 8534b74192a8 media/js/print.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/media/js/print.js Sun Jul 04 15:09:07 2010 -0400 @@ -0,0 +1,21 @@ +$(function() { + $('#leaf-content p:has(a)').add('#leaf-content ol:has(a)').add('#leaf-content ul:has(a)').each(function() { + var printing_links = $(this).find('a') + .not("[href^='#']") + .not(":has(img)") + .clone(); + $(this).after(printing_links); + + printing_links.wrap('
  • ') + .parent() + .wrapAll(''); + + printing_links.each(function() { + var href = $(this).attr('href'); + if (href.match("^/")) { + href = 'http://stevelosh.com' + href; + } + $(this).after(': ' + href); + }); + }); +});