diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2016-02-27 06:41:16 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2016-02-27 06:41:16 (GMT) |
commit | 738f88f688b7e490725bdcc9186a888998ca0370 (patch) | |
tree | 3931504650da3a98dd0d1165108ca6482ada3d30 /Doc/tools | |
parent | 5d9413404017a829aa5ddb52be6019fb63ec5c09 (diff) | |
parent | 90ba2ca68a829991c0797fc27a26f2e697afa5e7 (diff) | |
download | cpython-738f88f688b7e490725bdcc9186a888998ca0370.zip cpython-738f88f688b7e490725bdcc9186a888998ca0370.tar.gz cpython-738f88f688b7e490725bdcc9186a888998ca0370.tar.bz2 |
#26246: merge with 3.4.
Diffstat (limited to 'Doc/tools')
-rw-r--r-- | Doc/tools/static/copybutton.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Doc/tools/static/copybutton.js b/Doc/tools/static/copybutton.js index 5d82c67..dbd1de5 100644 --- a/Doc/tools/static/copybutton.js +++ b/Doc/tools/static/copybutton.js @@ -38,20 +38,24 @@ $(document).ready(function() { }); // define the behavior of the button when it's clicked - $('.copybutton').toggle( - function() { - var button = $(this); + $('.copybutton').click(function(e){ + e.preventDefault(); + var button = $(this); + if (button.data('hidden') === 'false') { + // hide the code output 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.data('hidden', 'true'); + } else { + // show the code output 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); - }); + button.data('hidden', 'false'); + } + }); }); |