Skip to content

Commit aef498b

Browse files
Re-format CSS/JS assets (#2910)
The recent ragg 1.5.0 release updated the windows GHA as it presumably required a newer R version for compilation; that's also reflected here (`oldrel-3` instead of `oldrel-4`) r-lib/ragg@7d8e74e
1 parent 290661e commit aef498b

5 files changed

Lines changed: 386 additions & 192 deletions

File tree

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- {os: windows-latest, r: 'release'}
3030
# use 4.0 or 4.1 to check with rtools40's older compiler
31-
- {os: windows-latest, r: 'oldrel-4'}
31+
- {os: windows-latest, r: 'oldrel-3'}
3232

3333
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
3434
- {os: ubuntu-latest, r: 'release'}

inst/BS5/assets/katex-auto.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ document.addEventListener("DOMContentLoaded", function () {
1111
macros: macros,
1212
fleqn: false
1313
});
14-
}}});
14+
}
15+
}
16+
});

inst/BS5/assets/lightswitch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const setTheme = theme => {
2626
}
2727
}
2828

29-
function bsSetupThemeToggle () {
29+
function bsSetupThemeToggle() {
3030
'use strict'
3131

3232
const showActiveTheme = (theme, focus = false) => {
@@ -35,7 +35,7 @@ function bsSetupThemeToggle () {
3535
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
3636
const buttonTheme = element.getAttribute('data-bs-theme-value')
3737
const isActive = buttonTheme == theme
38-
38+
3939
element.classList.toggle('active', isActive)
4040
element.setAttribute('aria-pressed', isActive)
4141

inst/BS5/assets/pkgdown.js

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* http://gregfranko.com/blog/jquery-best-practices/ */
2-
(function($) {
3-
$(function() {
2+
(function ($) {
3+
$(function () {
44

55
$('nav.navbar').headroom();
66

@@ -27,45 +27,45 @@
2727

2828
$('[data-bs-toggle="tooltip"]').tooltip();
2929

30-
/* Clipboard --------------------------*/
30+
/* Clipboard --------------------------*/
3131

32-
function changeTooltipMessage(element, msg) {
33-
var tooltipOriginalTitle=element.getAttribute('data-bs-original-title');
34-
element.setAttribute('data-bs-original-title', msg);
35-
$(element).tooltip('show');
36-
element.setAttribute('data-bs-original-title', tooltipOriginalTitle);
37-
}
32+
function changeTooltipMessage(element, msg) {
33+
var tooltipOriginalTitle = element.getAttribute('data-bs-original-title');
34+
element.setAttribute('data-bs-original-title', msg);
35+
$(element).tooltip('show');
36+
element.setAttribute('data-bs-original-title', tooltipOriginalTitle);
37+
}
3838

39-
if(ClipboardJS.isSupported()) {
40-
$(document).ready(function() {
41-
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
39+
if (ClipboardJS.isSupported()) {
40+
$(document).ready(function () {
41+
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
4242

43-
$("div.sourceCode").addClass("hasCopyButton");
43+
$("div.sourceCode").addClass("hasCopyButton");
4444

45-
// Insert copy buttons:
46-
$(copyButton).prependTo(".hasCopyButton");
45+
// Insert copy buttons:
46+
$(copyButton).prependTo(".hasCopyButton");
4747

48-
// Initialize tooltips:
49-
$('.btn-copy-ex').tooltip({container: 'body'});
48+
// Initialize tooltips:
49+
$('.btn-copy-ex').tooltip({ container: 'body' });
5050

51-
// Initialize clipboard:
52-
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
53-
text: function(trigger) {
54-
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
55-
}
56-
});
51+
// Initialize clipboard:
52+
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
53+
text: function (trigger) {
54+
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
55+
}
56+
});
5757

58-
clipboard.on('success', function(e) {
59-
changeTooltipMessage(e.trigger, 'Copied!');
60-
e.clearSelection();
61-
});
58+
clipboard.on('success', function (e) {
59+
changeTooltipMessage(e.trigger, 'Copied!');
60+
e.clearSelection();
61+
});
6262

63-
clipboard.on('error', function(e) {
64-
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
65-
});
63+
clipboard.on('error', function (e) {
64+
changeTooltipMessage(e.trigger, 'Press Ctrl+C or Command+C to copy');
65+
});
6666

67-
});
68-
}
67+
});
68+
}
6969

7070
/* Search marking --------------------------*/
7171
var url = new URL(window.location.href);
@@ -80,80 +80,80 @@
8080
});
8181
}
8282

83-
/* Search --------------------------*/
84-
/* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
83+
/* Search --------------------------*/
84+
/* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
8585
// Initialise search index on focus
86-
var fuse;
87-
$("#search-input").focus(async function(e) {
88-
if (fuse) {
89-
return;
90-
}
91-
92-
$(e.target).addClass("loading");
93-
var response = await fetch($("#search-input").data("search-index"));
94-
var data = await response.json();
86+
var fuse;
87+
$("#search-input").focus(async function (e) {
88+
if (fuse) {
89+
return;
90+
}
91+
92+
$(e.target).addClass("loading");
93+
var response = await fetch($("#search-input").data("search-index"));
94+
var data = await response.json();
95+
96+
var options = {
97+
keys: ["what", "text", "code"],
98+
ignoreLocation: true,
99+
threshold: 0.1,
100+
includeMatches: true,
101+
includeScore: true,
102+
};
103+
fuse = new Fuse(data, options);
104+
105+
$(e.target).removeClass("loading");
106+
});
95107

108+
// Use algolia autocomplete
96109
var options = {
97-
keys: ["what", "text", "code"],
98-
ignoreLocation: true,
99-
threshold: 0.1,
100-
includeMatches: true,
101-
includeScore: true,
110+
autoselect: true,
111+
debug: true,
112+
hint: false,
113+
minLength: 2,
102114
};
103-
fuse = new Fuse(data, options);
104-
105-
$(e.target).removeClass("loading");
106-
});
107-
108-
// Use algolia autocomplete
109-
var options = {
110-
autoselect: true,
111-
debug: true,
112-
hint: false,
113-
minLength: 2,
114-
};
115-
var q;
116-
async function searchFuse(query, callback) {
117-
await fuse;
118-
119-
var items;
120-
if (!fuse) {
121-
items = [];
122-
} else {
123-
q = query;
124-
var results = fuse.search(query, { limit: 20 });
125-
items = results
126-
.filter((x) => x.score <= 0.75)
127-
.map((x) => x.item);
128-
if (items.length === 0) {
129-
items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}];
115+
var q;
116+
async function searchFuse(query, callback) {
117+
await fuse;
118+
119+
var items;
120+
if (!fuse) {
121+
items = [];
122+
} else {
123+
q = query;
124+
var results = fuse.search(query, { limit: 20 });
125+
items = results
126+
.filter((x) => x.score <= 0.75)
127+
.map((x) => x.item);
128+
if (items.length === 0) {
129+
items = [{ dir: "Sorry 😿", previous_headings: "", title: "No results found.", what: "No results found.", path: window.location.href }];
130+
}
131+
}
132+
callback(items);
130133
}
131-
}
132-
callback(items);
133-
}
134-
$("#search-input").autocomplete(options, [
135-
{
136-
name: "content",
137-
source: searchFuse,
138-
templates: {
139-
suggestion: (s) => {
140-
if (s.title == s.what) {
141-
return `${s.dir} > <div class="search-details"> ${s.title}</div>`;
142-
} else if (s.previous_headings == "") {
143-
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.what}`;
144-
} else {
145-
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.previous_headings} > ${s.what}`;
146-
}
134+
$("#search-input").autocomplete(options, [
135+
{
136+
name: "content",
137+
source: searchFuse,
138+
templates: {
139+
suggestion: (s) => {
140+
if (s.title == s.what) {
141+
return `${s.dir} > <div class="search-details"> ${s.title}</div>`;
142+
} else if (s.previous_headings == "") {
143+
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.what}`;
144+
} else {
145+
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.previous_headings} > ${s.what}`;
146+
}
147+
},
147148
},
148149
},
149-
},
150-
]).on('autocomplete:selected', function(event, s) {
151-
window.location.href = s.path + "?q=" + q + "#" + s.id;
152-
});
150+
]).on('autocomplete:selected', function (event, s) {
151+
window.location.href = s.path + "?q=" + q + "#" + s.id;
152+
});
153153
});
154154
})(window.jQuery || window.$)
155155

156-
document.addEventListener('keydown', function(event) {
156+
document.addEventListener('keydown', function (event) {
157157
// Check if the pressed key is '/'
158158
if (event.key === '/') {
159159
event.preventDefault(); // Prevent any default action associated with the '/' key

0 commit comments

Comments
 (0)