1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00
AMR/extra.js

141 lines
8.7 KiB
JavaScript
Raw Normal View History

2022-08-21 16:59:35 +02:00
/*
# ==================================================================== #
2023-07-08 21:10:45 +02:00
# TITLE: #
2022-10-05 12:32:07 +02:00
# AMR: An R Package for Working with Antimicrobial Resistance Data #
2022-08-21 16:59:35 +02:00
# #
2023-07-08 21:10:45 +02:00
# SOURCE CODE: #
2022-08-21 16:59:35 +02:00
# https://github.com/msberends/AMR #
# #
2023-07-08 21:10:45 +02:00
# PLEASE CITE THIS SOFTWARE AS: #
2024-07-16 15:00:55 +02:00
# Berends MS, Luz CF, Friedrich AW, et al. (2022). #
# AMR: An R Package for Working with Antimicrobial Resistance Data. #
# Journal of Statistical Software, 104(3), 1-31. #
2023-05-27 10:53:23 +02:00
# https://doi.org/10.18637/jss.v104.i03 #
2022-10-05 12:32:07 +02:00
# #
2022-12-27 16:14:41 +01:00
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
2022-08-21 16:59:35 +02:00
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
*/
$(document).ready(function() {
2024-10-06 16:35:11 +02:00
// add GPT assistant info
$('aside').prepend('<div class="amr-gpt-assistant"><a target="_blank" href="https://chatgpt.com/g/g-M4UNLwFi5-amr-for-r-assistant"><img src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/AMRforRGPT.svg"></a></div>');
2022-08-21 16:59:35 +02:00
2024-10-06 16:35:11 +02:00
// replace 'Developers' with 'Maintainers' on the main page, and "Contributors" on the Authors page
2022-08-28 22:45:38 +02:00
$(".developers h2").text("Maintainers");
2023-01-14 20:00:10 +01:00
$(".citation h2:nth(0)").text("All contributors");
$(".citation h2:nth(1)").text("How to Cite");
2022-08-28 22:45:38 +02:00
2023-01-14 17:20:52 +01:00
// remove \donttest and \dontrun texts in Examples
2022-08-21 17:29:49 +02:00
if ($("#ref-examples ~ div pre").length > 0) {
2023-01-14 20:00:10 +01:00
$("#ref-examples ~ div pre").html($("#ref-examples ~ div pre").html().replaceAll("# \\donttest{", ""));
$("#ref-examples ~ div pre").html($("#ref-examples ~ div pre").html().replaceAll("# \\dontrun{", ""));
$("#ref-examples ~ div pre").html($("#ref-examples ~ div pre").html().replaceAll("# }", ""));
2022-08-21 16:59:35 +02:00
}
2024-10-06 16:35:11 +02:00
// rename 'Package index' to 'Manual' (weird design choice to pick 'Package index')
2024-10-06 22:53:43 +02:00
if ($(".template-reference-index").length > 0) {
$(".template-reference-index .page-header h1").text("Manual");
document.title = document.title.replace("Package index", "Manual");
}
2023-01-12 23:23:33 +01:00
2022-08-21 16:59:35 +02:00
// remove leading newline in code examples on changelog
if ($("body .template-news").length > 0) {
$("body .template-news").html($("body .template-news").html().replaceAll('sourceCode R">\n<span', 'sourceCode R"><span'));
2022-08-21 17:29:49 +02:00
$("body .template-news").html($("body .template-news").html().replaceAll('sourceCode R"><span></span>\n<span', 'sourceCode R"><span'));
2022-08-21 16:59:35 +02:00
}
2024-09-30 23:21:11 +02:00
// make Python part more fancy - prepare for CSS
if (window.location.href.includes('AMR_for_Python')) {
2024-10-10 16:45:12 +02:00
$('body').addClass('amr-for-python'); /* to set colours in CSS */
$('img[src="../logo.svg"]').attr('src', '../logo_python.svg'); /* replace base logo */
$('img[src="https://github.com/msberends/AMR/raw/main/pkgdown/assets/AMRforRGPT.svg"]').attr('src', 'https://github.com/msberends/AMR/raw/main/pkgdown/assets/AMRforRGPT_python.svg'); /* replace GPT logo */
2024-09-30 23:21:11 +02:00
}
2024-12-09 14:50:15 +01:00
// add country flags
2024-12-09 18:48:59 +01:00
function country_flag(x) {
2024-12-09 14:50:15 +01:00
if (typeof(x) != "undefined") {
2024-12-09 18:48:59 +01:00
const prefix = '<img src="lang_';
const suffix = '.svg" style="height: 13px !important; border: 1px solid #cccccc; aspect-ratio: 1 / 0.6; object-fit: cover; vertical-align: initial !important;"> ';
x = x.replace("Alex", prefix + "de" + suffix + "Alex");
x = x.replace("Andrew", prefix + "us" + suffix + "Andrew");
x = x.replace("Anita", prefix + "au" + suffix + "Anita");
x = x.replace("Annick", prefix + "nl" + suffix + "Annick");
x = x.replace("Anthony", prefix + "en" + suffix + "Anthony");
x = x.replace("Anton", prefix + "uk" + suffix + "Anton");
x = x.replace("Bart", prefix + "nl" + suffix + "Bart");
x = x.replace("Bhanu", prefix + "nl" + suffix + "Bhanu");
x = x.replace("Casper", prefix + "nl" + suffix + "Casper");
x = x.replace("Christian", prefix + "de" + suffix + "Christian");
x = x.replace("Corinna", prefix + "nl" + suffix + "Corinna");
x = x.replace("Dennis", prefix + "nl" + suffix + "Dennis");
x = x.replace("Dmytro", prefix + "uk" + suffix + "Dmytro");
x = x.replace("Eric", prefix + "nl" + suffix + "Eric");
x = x.replace("Erwin", prefix + "nl" + suffix + "Erwin");
x = x.replace("Gwen", prefix + "en" + suffix + "Gwen");
x = x.replace("Jason", prefix + "ca" + suffix + "Jason");
x = x.replace("Javier", prefix + "ca" + suffix + "Javier");
x = x.replace("Jonas", prefix + "de" + suffix + "Jonas");
x = x.replace("Judith", prefix + "nl" + suffix + "Judith");
x = x.replace("Larisse", prefix + "sa" + suffix + "Larisse");
x = x.replace("Matthew", prefix + "ca" + suffix + "Matthew");
x = x.replace("Matthijs", prefix + "nl" + suffix + "Matthijs");
x = x.replace("Peter", prefix + "en" + suffix + "Peter");
x = x.replace("Rogier", prefix + "nl" + suffix + "Rogier");
x = x.replace("Sofia", prefix + "sv" + suffix + "Sofia");
2024-12-09 14:50:15 +01:00
}
return(x);
}
$(".template-authors").html(country_flag($(".template-authors").html()));
$(".template-citation-authors").html(country_flag($(".template-citation-authors").html()));
2024-09-30 23:21:11 +02:00
2022-08-21 16:59:35 +02:00
// add doctoral titles to authors
function doct_tit(x) {
if (typeof(x) != "undefined") {
2024-12-09 10:37:14 +01:00
x = x.replace(/Author, maintainer/g, "Principal developer");
x = x.replace(/Author, contributor/g, "Package maintainer");
2022-10-21 22:03:48 +02:00
x = x.replace(/Thesis advisor/g, "(former) Doctoral advisor");
// contributors
x = x.replace("Alex", "Prof. Alex");
2023-01-12 23:23:33 +01:00
x = x.replace("Andrew", "Dr. Andrew");
2022-11-10 22:16:02 +01:00
x = x.replace("Annick", "Dr. Annick");
2024-02-24 18:58:43 +01:00
x = x.replace("Anthony", "Dr. Anthony");
2022-08-21 16:59:35 +02:00
x = x.replace("Bart", "Dr. Bart");
2022-10-21 22:03:48 +02:00
x = x.replace("Bhanu", "Prof. Bhanu");
x = x.replace("Casper", "Prof. Casper");
2022-08-21 16:59:35 +02:00
x = x.replace("Christian", "Dr. Christian");
x = x.replace("Corinna", "Dr. Corinna");
x = x.replace("Dennis", "Dr. Dennis");
x = x.replace("Gwen", "Dr. Gwen");
2024-02-24 18:58:43 +01:00
x = x.replace("Jason", "Dr. Jason");
x = x.replace("Javier", "Prof. Javier");
2022-10-21 22:03:48 +02:00
x = x.replace("Jonas", "Dr. Jonas");
2022-08-21 16:59:35 +02:00
x = x.replace("Judith", "Dr. Judith");
2024-09-30 23:21:11 +02:00
x = x.replace("Larisse", "Dr. Larisse");
2022-08-21 16:59:35 +02:00
x = x.replace("Matthijs", "Dr. Matthijs");
x = x.replace("Peter", "Dr. Peter");
x = x.replace("Rogier", "Dr. Rogier");
x = x.replace("Sofia", "Dr. Sofia");
}
return(x);
}
$(".template-authors").html(doct_tit($(".template-authors").html()));
$(".template-citation-authors").html(doct_tit($(".template-citation-authors").html()));
$(".developers").html(doct_tit($(".developers").html()));
$(".developers a[href='authors.html']").text("All contributors...");
});
$('head').append("<!-- Global site tag (gtag.js) - Google Analytics --> <script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-172114740-1\"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-172114740-1'); </script><!-- Matomo --><script type='text/javascript'> var _paq = _paq || []; /* tracker methods like 'setCustomDimension' should be called before 'trackPageView' */ _paq.push(['setDomains', ['*.msberends.github.io/AMR']]); _paq.push(['enableCrossDomainLinking']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='https://analyse.uscloud.nl/'; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '3']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })();</script><!-- End Matomo Code -->");