|
23 | 23 | <meta name="author" content="Bruno Nicenboim, Daniel J. Schad, and Shravan Vasishth" /> |
24 | 24 |
|
25 | 25 |
|
26 | | -<meta name="date" content="2025-02-12" /> |
| 26 | +<meta name="date" content="2026-01-13" /> |
27 | 27 |
|
28 | 28 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
29 | 29 | <meta name="apple-mobile-web-app-capable" content="yes" /> |
|
375 | 375 | $(this).before(div); |
376 | 376 | $(this).detach().appendTo(div); |
377 | 377 |
|
378 | | - // add a show code button right above |
379 | | - var showCodeText = $('<span>' + (show ? 'Hide' : 'Code') + '</span>'); |
| 378 | + // CRITICAL FIX: Create button with aria-hidden text that won't be copied |
380 | 379 | var showCodeButton = $('<button type="button" class="btn btn-default btn-xs code-folding-btn pull-right"></button>'); |
381 | | - showCodeButton.append(showCodeText); |
382 | 380 | showCodeButton |
383 | 381 | .attr('data-toggle', 'collapse') |
384 | 382 | .attr('data-target', '#' + id) |
385 | 383 | .attr('aria-expanded', show) |
386 | | - .attr('aria-controls', id); |
| 384 | + .attr('aria-controls', id) |
| 385 | + .attr('aria-label', show ? 'Hide code' : 'Show code'); |
| 386 | + |
| 387 | + // Use aria-hidden to prevent screen readers and copy from seeing text |
| 388 | + var showCodeText = $('<span aria-hidden="true" style="user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; pointer-events: none;">' + (show ? 'Hide' : 'Code') + '</span>'); |
| 389 | + showCodeButton.append(showCodeText); |
387 | 390 |
|
388 | 391 | var buttonRow = $('<div class="row"></div>'); |
389 | 392 | var buttonCol = $('<div class="col-md-12"></div>'); |
|
393 | 396 |
|
394 | 397 | div.before(buttonRow); |
395 | 398 |
|
396 | | - // hack: return show to false, otherwise all next codeBlocks will be shown! |
397 | | - show = false; |
398 | | - |
399 | | - // update state of button on show/hide |
400 | | - div.on('hidden.bs.collapse', function () { |
| 399 | + // update the text of the button when it's clicked |
| 400 | + div.on('hide.bs.collapse', function () { |
401 | 401 | showCodeText.text('Code'); |
| 402 | + showCodeButton.attr('aria-label', 'Show code'); |
402 | 403 | }); |
403 | 404 | div.on('show.bs.collapse', function () { |
404 | 405 | showCodeText.text('Hide'); |
| 406 | + showCodeButton.attr('aria-label', 'Hide code'); |
405 | 407 | }); |
| 408 | + |
| 409 | + // hack: return show to false, otherwise all next codeBlocks will be shown! |
| 410 | + show = false; |
406 | 411 | }); |
407 | 412 |
|
408 | 413 | } |
|
793 | 798 | }); |
794 | 799 | </script> |
795 | 800 |
|
| 801 | +<!-- NUCLEAR OPTION: Intercept ALL copy events and strip button text --> |
| 802 | +<script> |
| 803 | +$(document).ready(function() { |
| 804 | + |
| 805 | + // Method 1: Make button spans completely invisible to selection |
| 806 | + function protectButtons() { |
| 807 | + $('.code-folding-btn span').each(function() { |
| 808 | + this.style.setProperty('user-select', 'none', 'important'); |
| 809 | + this.style.setProperty('-webkit-user-select', 'none', 'important'); |
| 810 | + this.style.setProperty('-moz-user-select', 'none', 'important'); |
| 811 | + this.style.setProperty('-ms-user-select', 'none', 'important'); |
| 812 | + this.style.setProperty('pointer-events', 'none', 'important'); |
| 813 | + $(this).attr('unselectable', 'on'); |
| 814 | + $(this).attr('aria-hidden', 'true'); |
| 815 | + }); |
| 816 | + |
| 817 | + $('.code-folding-btn').each(function() { |
| 818 | + this.style.setProperty('user-select', 'none', 'important'); |
| 819 | + this.style.setProperty('-webkit-user-select', 'none', 'important'); |
| 820 | + this.style.setProperty('-moz-user-select', 'none', 'important'); |
| 821 | + this.style.setProperty('-ms-user-select', 'none', 'important'); |
| 822 | + }); |
| 823 | + } |
| 824 | + |
| 825 | + protectButtons(); |
| 826 | + setTimeout(protectButtons, 100); |
| 827 | + setTimeout(protectButtons, 500); |
| 828 | + setTimeout(protectButtons, 1000); |
| 829 | + |
| 830 | + // Method 2: Aggressive copy event interception |
| 831 | + document.addEventListener('copy', function(e) { |
| 832 | + var selection = window.getSelection(); |
| 833 | + var selectedText = selection.toString(); |
| 834 | + |
| 835 | + // Remove "Hide" or "Code" from the start |
| 836 | + if (selectedText) { |
| 837 | + var cleanedText = selectedText |
| 838 | + .replace(/^(Hide|Code)\s*/gm, '') // Remove from start of any line |
| 839 | + .replace(/\s+(Hide|Code)\s*$/gm, ''); // Remove from end |
| 840 | + |
| 841 | + if (cleanedText !== selectedText) { |
| 842 | + e.preventDefault(); |
| 843 | + |
| 844 | + if (e.clipboardData) { |
| 845 | + e.clipboardData.setData('text/plain', cleanedText); |
| 846 | + } else if (window.clipboardData) { |
| 847 | + window.clipboardData.setData('Text', cleanedText); |
| 848 | + } |
| 849 | + } |
| 850 | + } |
| 851 | + }, true); // Use capture phase |
| 852 | + |
| 853 | + // Method 3: Override native copy for code blocks |
| 854 | + $('body').on('copy', 'pre, pre.sourceCode, .sourceCode, code', function(e) { |
| 855 | + var selection = window.getSelection(); |
| 856 | + var selectedText = selection.toString(); |
| 857 | + |
| 858 | + if (selectedText && (selectedText.startsWith('Hide') || selectedText.startsWith('Code'))) { |
| 859 | + e.preventDefault(); |
| 860 | + e.stopPropagation(); |
| 861 | + |
| 862 | + var cleanedText = selectedText.replace(/^(Hide|Code)\s*/, ''); |
| 863 | + |
| 864 | + if (e.originalEvent.clipboardData) { |
| 865 | + e.originalEvent.clipboardData.setData('text/plain', cleanedText); |
| 866 | + } else if (window.clipboardData) { |
| 867 | + window.clipboardData.setData('Text', cleanedText); |
| 868 | + } |
| 869 | + } |
| 870 | + }); |
| 871 | +}); |
| 872 | +</script> |
796 | 873 |
|
797 | 874 | <script data-goatcounter="https://bayescogsci.goatcounter.com/count" |
798 | 875 | async src="//gc.zgo.at/count.js"></script> |
@@ -1436,6 +1513,13 @@ <h1> |
1436 | 1513 | <div class="page-inner"> |
1437 | 1514 |
|
1438 | 1515 | <section class="normal" id="section-"> |
| 1516 | +<div class="book-banner"> |
| 1517 | + <div class="banner-content"> |
| 1518 | + 📚 Get the print version of the book from |
| 1519 | + <a href="https://www.taylorfrancis.com/books/mono/10.1201/9780429342646/introduction-bayesian-data-analysis-cognitive-science-shravan-vasishth-bruno-nicenboim-daniel-schad" target="_blank" rel="noopener">CRC Press</a> or your favorite store. |
| 1520 | + <button class="banner-close" onclick="this.parentElement.parentElement.style.display='none';" aria-label="Close banner">×</button> |
| 1521 | + </div> |
| 1522 | +</div> |
1439 | 1523 | <div id="about-the-authors" class="section level1 unnumbered hasAnchor" number=""> |
1440 | 1524 | <h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="anchor-section" aria-label="Anchor link to header"></a></h1> |
1441 | 1525 | <p>Bruno Nicenboim (<a href="https://bruno.nicenboim.me" class="uri">https://bruno.nicenboim.me</a>) is an assistant professor in the department of Cognitive Science and AI at Tilburg University, the Netherlands, where he is the principal investigator (PI) of the Computational Psycholinguistics research line. He started studying Electronic Engineering at the National University of Rosario, Argentina, then transitioned to Human Sciences and spent eight years in Israel, where he completed a Bachelor’s degree in Sociology and Linguistics and a Master’s degree in Linguistics at Tel Aviv University. During this time, he also worked in several IT companies. He then moved to Germany, where he completed a PhD in Cognitive Science at the University of Potsdam and worked for two years as a postdoctoral researcher. His research interests include Bayesian methods, computational cognitive modeling, sentence comprehension, memory processes, decision making, and predictive processing. He regularly teaches short courses on Bayesian data analysis at workshops and summer schools, and he teaches Bayesian modeling and statistics courses in the master’s programs Cognitive Science & AI and Data Science and Society at Tilburg University.</p> |
|
0 commit comments