]> granicus.if.org Git - python/commitdiff
#26246: update copybutton.js after JQuery update. Patch by Liang-Bo Wang.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 27 Feb 2016 06:39:36 +0000 (08:39 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 27 Feb 2016 06:39:36 +0000 (08:39 +0200)
Doc/tools/static/copybutton.js
Misc/ACKS

index a3b1099e3a7fbfab6a5cd721e2542598e0155a9d..593b59498463fe3caff90c3f678b1a1d9a0a81c2 100644 (file)
@@ -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');
+        }
+    });
 });
 
index 2370960a15ffcf03fcf1e93aa9a1caf11bad5113..038dfbd209f0295d0778e0aaeb9f445064f8c018 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1449,6 +1449,7 @@ Kevin Walzer
 Rodrigo Steinmuller Wanderley
 Dingyuan Wang
 Ke Wang
+Liang-Bo Wang
 Greg Ward
 Tom Wardill
 Zachary Ware