Skip to content

Commit 9245d2c

Browse files
committed
banner and hide button
1 parent 3fb3fa9 commit 9245d2c

100 files changed

Lines changed: 23016 additions & 20842 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

18-lognormalrace.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ The location $\mu_{v_w}$ of the distribution of rates of accumulation of evidenc
399399
This assumption can be modeled with a linear regression over $\mu_{v_w}$, with parameters that represent the bias to categorize a string as a word, $\alpha_{w}$, the effect of lexicality, $\beta_{lex_{w}}$, and the effect of log-frequency $\beta_{\mathit{lfreq}_{w}}$.
400400

401401
\begin{equation}
402-
mu_{v_{w,n}} = \alpha_w + \mathit{lex}_n \cdot \beta_{lex_{w}} + \mathit{\mathit{lfreq}}_n \cdot \beta_{\mathit{lfreq}_{w}}
402+
\mu_{v_{w,n}} = \alpha_w + \mathit{lex}_n \cdot \beta_{lex_{w}} + \mathit{\mathit{lfreq}}_n \cdot \beta_{\mathit{lfreq}_{w}}
403403
\end{equation}
404404

405405
For the non-word accumulator, the location for the rate of accumulation of evidence is defined similarly:
406406

407407
\begin{equation}
408-
mu_{v_{nw,n}}= \alpha_{nw} + \mathit{lex}_n \cdot \beta_{lex_{nw}} + \mathit{lfreq}_n \cdot \beta_{\mathit{lfreq}_{nw}}
408+
\mu_{v_{nw,n}}= \alpha_{nw} + \mathit{lex}_n \cdot \beta_{lex_{nw}} + \mathit{lfreq}_n \cdot \beta_{\mathit{lfreq}_{nw}}
409409
\end{equation}
410410

411411

_output.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ bookdown::gitbook:
1515
facebook: no
1616
includes:
1717
in_header: html/preamble_code.html
18+
before_body: html/banner.html
1819
bookdown::html_chapters:
19-
code_fold: show
2020
md_extensions: +fenced_divs
2121
bookdown::pdf_book:
2222
includes:

css/style.css

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,110 @@ h2, h3, h4, h5, h6 {
8282
border: solid 5px #488214;
8383
}
8484

85+
86+
87+
/* Banner for book purchase - Simple, light background with black text */
88+
.book-banner {
89+
background: #f0f4f8; /* Light blue-gray background */
90+
color: #000; /* Black text */
91+
padding: 12px 20px;
92+
position: sticky;
93+
top: 0;
94+
z-index: 1000;
95+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
96+
font-size: 15px;
97+
line-height: 1.6;
98+
border-bottom: 1px solid #d0d7de;
99+
}
100+
101+
.banner-content {
102+
max-width: 1200px;
103+
margin: 0 auto;
104+
text-align: center;
105+
position: relative;
106+
display: flex;
107+
align-items: center;
108+
justify-content: center;
109+
flex-wrap: wrap;
110+
gap: 8px;
111+
}
112+
113+
/* Simple black text links with underline */
114+
.book-banner a {
115+
color: #000; /* Black text */
116+
text-decoration: underline;
117+
font-weight: 600;
118+
transition: opacity 0.2s;
119+
}
120+
121+
.book-banner a:hover {
122+
opacity: 0.7;
123+
}
124+
125+
.banner-close {
126+
background: transparent;
127+
border: 1px solid #999;
128+
color: #000;
129+
font-size: 20px;
130+
line-height: 1;
131+
padding: 2px 8px;
132+
cursor: pointer;
133+
border-radius: 3px;
134+
margin-left: 12px;
135+
transition: all 0.2s;
136+
}
137+
138+
.banner-close:hover {
139+
background: #e0e0e0;
140+
border-color: #666;
141+
}
142+
143+
/* Fix for code copy button to exclude fold button text */
144+
.sourceCode {
145+
position: relative;
146+
}
147+
148+
/* Ensure code folding buttons don't interfere with copying */
149+
pre.sourceCode::before,
150+
pre.sourceCode::after {
151+
-webkit-user-select: none;
152+
-moz-user-select: none;
153+
-ms-user-select: none;
154+
user-select: none;
155+
}
156+
157+
.fold-hide, .fold-show {
158+
-webkit-user-select: none !important;
159+
-moz-user-select: none !important;
160+
-ms-user-select: none !important;
161+
user-select: none !important;
162+
}
163+
164+
/* Style for code fold buttons */
165+
.sourceCode .fold-hide::before,
166+
.sourceCode .fold-show::before {
167+
-webkit-user-select: none;
168+
-moz-user-select: none;
169+
-ms-user-select: none;
170+
user-select: none;
171+
}
172+
173+
/* Make code folding button text completely non-selectable */
174+
.code-folding-btn,
175+
.code-folding-btn span,
176+
.code-folding-btn * {
177+
-webkit-user-select: none !important;
178+
-moz-user-select: none !important;
179+
-ms-user-select: none !important;
180+
user-select: none !important;
181+
}
182+
183+
/* Ensure code content IS selectable */
184+
.sourceCode code,
185+
pre code,
186+
.hljs {
187+
-webkit-user-select: text !important;
188+
-moz-user-select: text !important;
189+
-ms-user-select: text !important;
190+
user-select: text !important;
191+
}

docs/about-the-authors.html

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<meta name="author" content="Bruno Nicenboim, Daniel J. Schad, and Shravan Vasishth" />
2424

2525

26-
<meta name="date" content="2025-02-12" />
26+
<meta name="date" content="2026-01-13" />
2727

2828
<meta name="viewport" content="width=device-width, initial-scale=1" />
2929
<meta name="apple-mobile-web-app-capable" content="yes" />
@@ -375,15 +375,18 @@
375375
$(this).before(div);
376376
$(this).detach().appendTo(div);
377377

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
380379
var showCodeButton = $('<button type="button" class="btn btn-default btn-xs code-folding-btn pull-right"></button>');
381-
showCodeButton.append(showCodeText);
382380
showCodeButton
383381
.attr('data-toggle', 'collapse')
384382
.attr('data-target', '#' + id)
385383
.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);
387390

388391
var buttonRow = $('<div class="row"></div>');
389392
var buttonCol = $('<div class="col-md-12"></div>');
@@ -393,16 +396,18 @@
393396

394397
div.before(buttonRow);
395398

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 () {
401401
showCodeText.text('Code');
402+
showCodeButton.attr('aria-label', 'Show code');
402403
});
403404
div.on('show.bs.collapse', function () {
404405
showCodeText.text('Hide');
406+
showCodeButton.attr('aria-label', 'Hide code');
405407
});
408+
409+
// hack: return show to false, otherwise all next codeBlocks will be shown!
410+
show = false;
406411
});
407412

408413
}
@@ -793,6 +798,78 @@
793798
});
794799
</script>
795800

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>
796873

797874
<script data-goatcounter="https://bayescogsci.goatcounter.com/count"
798875
async src="//gc.zgo.at/count.js"></script>
@@ -1436,6 +1513,13 @@ <h1>
14361513
<div class="page-inner">
14371514

14381515
<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">&times;</button>
1521+
</div>
1522+
</div>
14391523
<div id="about-the-authors" class="section level1 unnumbered hasAnchor" number="">
14401524
<h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="anchor-section" aria-label="Anchor link to header"></a></h1>
14411525
<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 &amp; AI and Data Science and Society at Tilburg University.</p>

0 commit comments

Comments
 (0)