diff options
author | mathieui <mathieui@mathieui.net> | 2015-02-07 20:54:20 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-02-07 21:14:48 +0100 |
commit | 61f28d7ffeae0b6a8fd8ca0617e082e2196df622 (patch) | |
tree | 293bb9830aa215e415f34bb24c8846cb8d13b3b7 /doc/source/theme/static/copybutton.js | |
parent | cc91486f8a3619a61e803d990284b040797a1944 (diff) | |
download | poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.gz poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.bz2 poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.xz poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.zip |
Change the sphinx theme to one derived from readthedocs
(without stuff like the unicode codepoint agressions and external
resources)
This should be cleaner and look good on mobile devices too.
Diffstat (limited to 'doc/source/theme/static/copybutton.js')
-rw-r--r-- | doc/source/theme/static/copybutton.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/doc/source/theme/static/copybutton.js b/doc/source/theme/static/copybutton.js deleted file mode 100644 index 5d82c672..00000000 --- a/doc/source/theme/static/copybutton.js +++ /dev/null @@ -1,57 +0,0 @@ -$(document).ready(function() { - /* Add a [>>>] button on the top-right corner of code samples to hide - * the >>> and ... prompts and the output and thus make the code - * copyable. */ - var div = $('.highlight-python .highlight,' + - '.highlight-python3 .highlight') - var pre = div.find('pre'); - - // get the styles from the current theme - pre.parent().parent().css('position', 'relative'); - var hide_text = 'Hide the prompts and output'; - var show_text = 'Show the prompts and output'; - var border_width = pre.css('border-top-width'); - var border_style = pre.css('border-top-style'); - var border_color = pre.css('border-top-color'); - var button_styles = { - 'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0', - 'border-color': border_color, 'border-style': border_style, - 'border-width': border_width, 'color': border_color, 'text-size': '75%', - 'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em', - 'border-radius': '0 3px 0 0' - } - - // create and add the button to all the code blocks that contain >>> - div.each(function(index) { - var jthis = $(this); - if (jthis.find('.gp').length > 0) { - var button = $('<span class="copybutton">>>></span>'); - button.css(button_styles) - button.attr('title', hide_text); - jthis.prepend(button); - } - // tracebacks (.gt) contain bare text elements that need to be - // wrapped in a span to work with .nextUntil() (see later) - jthis.find('pre:has(.gt)').contents().filter(function() { - return ((this.nodeType == 3) && (this.data.trim().length > 0)); - }).wrap('<span>'); - }); - - // define the behavior of the button when it's clicked - $('.copybutton').toggle( - function() { - var button = $(this); - button.parent().find('.go, .gp, .gt').hide(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden'); - button.css('text-decoration', 'line-through'); - button.attr('title', show_text); - }, - function() { - var button = $(this); - button.parent().find('.go, .gp, .gt').show(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible'); - button.css('text-decoration', 'none'); - button.attr('title', hide_text); - }); -}); - |