diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2016-02-27 08:39:36 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2016-02-27 08:39:36 +0200 |
commit | 97075db61ce85471886cb5af7e683aa5482fd2bd (patch) | |
tree | 0f44c393cad87ceb65e1bb7fb2efd694d4efcf8e | |
parent | b08b2eefa31c5df9e6e6e5232f5fa0acb9b86ecb (diff) | |
download | python-97075db61ce85471886cb5af7e683aa5482fd2bd.tar.gz |
#26246: update copybutton.js after JQuery update. Patch by Liang-Bo Wang.
-rw-r--r-- | Doc/tools/static/copybutton.js | 18 | ||||
-rw-r--r-- | Misc/ACKS | 1 |
2 files changed, 12 insertions, 7 deletions
diff --git a/Doc/tools/static/copybutton.js b/Doc/tools/static/copybutton.js index a3b1099e3a..593b594984 100644 --- a/Doc/tools/static/copybutton.js +++ b/Doc/tools/static/copybutton.js @@ -37,20 +37,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'); + } + }); }); @@ -1449,6 +1449,7 @@ Kevin Walzer Rodrigo Steinmuller Wanderley Dingyuan Wang Ke Wang +Liang-Bo Wang Greg Ward Tom Wardill Zachary Ware |