mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-22 05:20:23 +01:00
new page
This commit is contained in:
parent
e2a6a6b7c6
commit
bd1cdbff26
@ -7,3 +7,5 @@
|
|||||||
^docs$
|
^docs$
|
||||||
^\.github$
|
^\.github$
|
||||||
^codecov\.yml$
|
^codecov\.yml$
|
||||||
|
^_pkgdown\.yml$
|
||||||
|
^pkgdown$
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
.Rhistory
|
.Rhistory
|
||||||
.Rproj.user
|
.Rproj.user
|
||||||
test-data/
|
test-data/
|
||||||
|
|
||||||
|
4
_pkgdown.yml
Normal file
4
_pkgdown.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
url: ~
|
||||||
|
template:
|
||||||
|
bootstrap: 5
|
||||||
|
|
7
docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js
vendored
Normal file
7
docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map
Normal file
1
docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map
Normal file
File diff suppressed because one or more lines are too long
6
docs/deps/bootstrap-5.2.2/bootstrap.min.css
vendored
Normal file
6
docs/deps/bootstrap-5.2.2/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4
docs/deps/data-deps.txt
Normal file
4
docs/deps/data-deps.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||||
|
<link href="deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
<script src="deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script>
|
10881
docs/deps/jquery-3.6.0/jquery-3.6.0.js
vendored
Normal file
10881
docs/deps/jquery-3.6.0/jquery-3.6.0.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
docs/deps/jquery-3.6.0/jquery-3.6.0.min.js
vendored
Normal file
2
docs/deps/jquery-3.6.0/jquery-3.6.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
docs/deps/jquery-3.6.0/jquery-3.6.0.min.map
Normal file
1
docs/deps/jquery-3.6.0/jquery-3.6.0.min.map
Normal file
File diff suppressed because one or more lines are too long
172
docs/pkgdown.js
172
docs/pkgdown.js
@ -2,70 +2,30 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
$('.navbar-fixed-top').headroom();
|
$('nav.navbar').headroom();
|
||||||
|
|
||||||
$('body').css('padding-top', $('.navbar').height() + 10);
|
Toc.init({
|
||||||
$(window).resize(function(){
|
$nav: $("#toc"),
|
||||||
$('body').css('padding-top', $('.navbar').height() + 10);
|
$scope: $("main h2, main h3, main h4, main h5, main h6")
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
if ($('#toc').length) {
|
||||||
|
$('body').scrollspy({
|
||||||
var cur_path = paths(location.pathname);
|
target: '#toc',
|
||||||
var links = $("#navbar ul li a");
|
offset: $("nav.navbar").outerHeight() + 1
|
||||||
var max_length = -1;
|
});
|
||||||
var pos = -1;
|
|
||||||
for (var i = 0; i < links.length; i++) {
|
|
||||||
if (links[i].getAttribute("href") === "#")
|
|
||||||
continue;
|
|
||||||
// Ignore external links
|
|
||||||
if (links[i].host !== location.host)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var nav_path = paths(links[i].pathname);
|
|
||||||
|
|
||||||
var length = prefix_length(nav_path, cur_path);
|
|
||||||
if (length > max_length) {
|
|
||||||
max_length = length;
|
|
||||||
pos = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add class to parent <li>, and enclosing <li> if in dropdown
|
// Activate popovers
|
||||||
if (pos >= 0) {
|
$('[data-bs-toggle="popover"]').popover({
|
||||||
var menu_anchor = $(links[pos]);
|
container: 'body',
|
||||||
menu_anchor.parent().addClass("active");
|
html: true,
|
||||||
menu_anchor.closest("li.dropdown").addClass("active");
|
trigger: 'focus',
|
||||||
}
|
placement: "top",
|
||||||
});
|
sanitize: false,
|
||||||
|
});
|
||||||
|
|
||||||
function paths(pathname) {
|
$('[data-bs-toggle="tooltip"]').tooltip();
|
||||||
var pieces = pathname.split("/");
|
|
||||||
pieces.shift(); // always starts with /
|
|
||||||
|
|
||||||
var end = pieces[pieces.length - 1];
|
|
||||||
if (end === "index.html" || end === "")
|
|
||||||
pieces.pop();
|
|
||||||
return(pieces);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns -1 if not found
|
|
||||||
function prefix_length(needle, haystack) {
|
|
||||||
if (needle.length > haystack.length)
|
|
||||||
return(-1);
|
|
||||||
|
|
||||||
// Special case for length-0 haystack, since for loop won't run
|
|
||||||
if (haystack.length === 0) {
|
|
||||||
return(needle.length === 0 ? 0 : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < haystack.length; i++) {
|
|
||||||
if (needle[i] != haystack[i])
|
|
||||||
return(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(haystack.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clipboard --------------------------*/
|
/* Clipboard --------------------------*/
|
||||||
|
|
||||||
@ -78,7 +38,7 @@
|
|||||||
|
|
||||||
if(ClipboardJS.isSupported()) {
|
if(ClipboardJS.isSupported()) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' type = 'submit' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left auto' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
|
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>";
|
||||||
|
|
||||||
$("div.sourceCode").addClass("hasCopyButton");
|
$("div.sourceCode").addClass("hasCopyButton");
|
||||||
|
|
||||||
@ -89,20 +49,108 @@
|
|||||||
$('.btn-copy-ex').tooltip({container: 'body'});
|
$('.btn-copy-ex').tooltip({container: 'body'});
|
||||||
|
|
||||||
// Initialize clipboard:
|
// Initialize clipboard:
|
||||||
var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', {
|
var clipboard = new ClipboardJS('[data-clipboard-copy]', {
|
||||||
text: function(trigger) {
|
text: function(trigger) {
|
||||||
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
|
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
clipboardBtnCopies.on('success', function(e) {
|
clipboard.on('success', function(e) {
|
||||||
changeTooltipMessage(e.trigger, 'Copied!');
|
changeTooltipMessage(e.trigger, 'Copied!');
|
||||||
e.clearSelection();
|
e.clearSelection();
|
||||||
});
|
});
|
||||||
|
|
||||||
clipboardBtnCopies.on('error', function() {
|
clipboard.on('error', function() {
|
||||||
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
|
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Search marking --------------------------*/
|
||||||
|
var url = new URL(window.location.href);
|
||||||
|
var toMark = url.searchParams.get("q");
|
||||||
|
var mark = new Mark("main#main");
|
||||||
|
if (toMark) {
|
||||||
|
mark.mark(toMark, {
|
||||||
|
accuracy: {
|
||||||
|
value: "complementary",
|
||||||
|
limiters: [",", ".", ":", "/"],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search --------------------------*/
|
||||||
|
/* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
|
||||||
|
// Initialise search index on focus
|
||||||
|
var fuse;
|
||||||
|
$("#search-input").focus(async function(e) {
|
||||||
|
if (fuse) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(e.target).addClass("loading");
|
||||||
|
var response = await fetch($("#search-input").data("search-index"));
|
||||||
|
var data = await response.json();
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
keys: ["what", "text", "code"],
|
||||||
|
ignoreLocation: true,
|
||||||
|
threshold: 0.1,
|
||||||
|
includeMatches: true,
|
||||||
|
includeScore: true,
|
||||||
|
};
|
||||||
|
fuse = new Fuse(data, options);
|
||||||
|
|
||||||
|
$(e.target).removeClass("loading");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Use algolia autocomplete
|
||||||
|
var options = {
|
||||||
|
autoselect: true,
|
||||||
|
debug: true,
|
||||||
|
hint: false,
|
||||||
|
minLength: 2,
|
||||||
|
};
|
||||||
|
var q;
|
||||||
|
async function searchFuse(query, callback) {
|
||||||
|
await fuse;
|
||||||
|
|
||||||
|
var items;
|
||||||
|
if (!fuse) {
|
||||||
|
items = [];
|
||||||
|
} else {
|
||||||
|
q = query;
|
||||||
|
var results = fuse.search(query, { limit: 20 });
|
||||||
|
items = results
|
||||||
|
.filter((x) => x.score <= 0.75)
|
||||||
|
.map((x) => x.item);
|
||||||
|
if (items.length === 0) {
|
||||||
|
items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback(items);
|
||||||
|
}
|
||||||
|
$("#search-input").autocomplete(options, [
|
||||||
|
{
|
||||||
|
name: "content",
|
||||||
|
source: searchFuse,
|
||||||
|
templates: {
|
||||||
|
suggestion: (s) => {
|
||||||
|
if (s.title == s.what) {
|
||||||
|
return `${s.dir} > <div class="search-details"> ${s.title}</div>`;
|
||||||
|
} else if (s.previous_headings == "") {
|
||||||
|
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.what}`;
|
||||||
|
} else {
|
||||||
|
return `${s.dir} > <div class="search-details"> ${s.title}</div> > ${s.previous_headings} > ${s.what}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]).on('autocomplete:selected', function(event, s) {
|
||||||
|
window.location.href = s.path + "?q=" + q + "#" + s.id;
|
||||||
|
});
|
||||||
|
});
|
||||||
})(window.jQuery || window.$)
|
})(window.jQuery || window.$)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,5 +2,5 @@ pandoc: 2.19.2
|
|||||||
pkgdown: 2.0.7
|
pkgdown: 2.0.7
|
||||||
pkgdown_sha: ~
|
pkgdown_sha: ~
|
||||||
articles: {}
|
articles: {}
|
||||||
last_built: 2023-03-07T20:04Z
|
last_built: 2023-03-08T11:12Z
|
||||||
|
|
||||||
|
1
docs/search.json
Normal file
1
docs/search.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user