From: Ezio Melotti Date: Sat, 27 Feb 2016 06:39:36 +0000 (+0200) Subject: #26246: update copybutton.js after JQuery update. Patch by Liang-Bo Wang. X-Git-Tag: v3.4.5rc1~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90ba2ca68a829991c0797fc27a26f2e697afa5e7;p=thirdparty%2FPython%2Fcpython.git #26246: update copybutton.js after JQuery update. Patch by Liang-Bo Wang. --- diff --git a/Doc/tools/static/copybutton.js b/Doc/tools/static/copybutton.js index 5d82c672beef..dbd1de5b9688 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'); + } + }); }); diff --git a/Misc/ACKS b/Misc/ACKS index 64014c593e8c..6824554d16e1 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1478,6 +1478,7 @@ Kevin Walzer Rodrigo Steinmuller Wanderley Dingyuan Wang Ke Wang +Liang-Bo Wang Greg Ward Tom Wardill Zachary Ware