CINXE.COM
ALA Labs
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> <meta charset="utf-8"> <meta name="generator" content="quarto-1.5.55"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>ALA Labs</title> <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} ul.task-list li input[type="checkbox"] { width: 0.8em; margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ vertical-align: middle; } </style> <script src="site_libs/quarto-nav/quarto-nav.js"></script> <script src="site_libs/quarto-nav/headroom.min.js"></script> <script src="site_libs/clipboard/clipboard.min.js"></script> <script src="site_libs/quarto-search/autocomplete.umd.js"></script> <script src="site_libs/quarto-search/fuse.min.js"></script> <script src="site_libs/quarto-search/quarto-search.js"></script> <meta name="quarto:offset" content="./"> <link href="./images/favicon.ico" rel="icon"> <script src="site_libs/quarto-html/quarto.js"></script> <script src="site_libs/quarto-html/popper.min.js"></script> <script src="site_libs/quarto-html/tippy.umd.min.js"></script> <link href="site_libs/quarto-html/tippy.css" rel="stylesheet"> <link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"> <script src="site_libs/bootstrap/bootstrap.min.js"></script> <link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> <link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light"> <link href="site_libs/quarto-contrib/fontawesome6-0.1.0/all.css" rel="stylesheet"> <link href="site_libs/quarto-contrib/fontawesome6-0.1.0/latex-fontsize.css" rel="stylesheet"> <script id="quarto-search-options" type="application/json">{ "location": "navbar", "copy-button": false, "collapse-after": 3, "panel-placement": "end", "type": "overlay", "limit": 50, "keyboard-shortcut": [ "f", "/", "s" ], "show-item-context": false, "language": { "search-no-results-text": "No results", "search-matching-documents-text": "matching documents", "search-copy-link-title": "Copy link to search", "search-hide-matches-text": "Hide additional matches", "search-more-match-text": "more match in this document", "search-more-matches-text": "more matches in this document", "search-clear-button-title": "Clear", "search-text-placeholder": "", "search-detached-cancel-button-title": "Cancel", "search-submit-button-title": "Submit", "search-label": "Search" } }</script> <meta property="og:title" content="ALA Labs"> <meta property="og:description" content="Demo projects, experiments, debugging data and so on from the Atlas of Living Australia (ALA)"> <meta property="og:image" content="https://labs.ala.org.au/twitter-card-preview_frog-small.png"> <meta property="og:site_name" content="ALA Labs"> <meta property="og:image:alt" content="A Southern Brown Tree Frog with the ALA Labs logo"> <meta property="og:image:height" content="397"> <meta property="og:image:width" content="735"> <meta name="twitter:title" content="ALA Labs"> <meta name="twitter:description" content="Demo projects, experiments, debugging data and so on from the Atlas of Living Australia (ALA)"> <meta name="twitter:image" content="https://labs.ala.org.au/twitter-card-preview_frog-small.png"> <meta name="twitter:image:alt" content="A Southern Brown Tree Frog with the ALA Labs logo"> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image-height" content="397"> <meta name="twitter:image-width" content="735"> </head><body class="nav-fixed fullcontent"><div class="hero-container"> <div class="hero-image"> <div class="image-text"> <div class="ALA-top">ALA</div> <div class="ALA-bottom">LABS</div> <div class="ALA-byline"> Experiments in code, data analysis & visualisation<br> from the Atlas of Living Australia </div> </div> <div class="credit-text"> <span class="ALA-species-credit"> Southern Brown Tree Frog (<i>Litoria ewingii</i>)<br> </span> <span class="ALA-image-credit"> <i class="fas fa-camera"></i> by Third Silence Nature Photography (CC-BY-NC)</span> </div> </div> </div> <link rel="stylesheet" href="theme.css"> <link rel="stylesheet" href="custom_theme.scss"> <link rel="stylesheet" href="index.css"> <div id="quarto-search-results"></div> <header id="quarto-header" class="headroom fixed-top"> <nav class="navbar navbar-expand-lg " data-bs-theme="dark"> <div class="navbar-container container-fluid"> <div class="navbar-brand-container mx-auto"> <a href="./index.html" class="navbar-brand navbar-brand-logo"> <img src="./images/logos/ALA_Logo_Inline_REV-RGB.png" alt="" class="navbar-logo"> </a> <a class="navbar-brand" href="./index.html"> <span class="navbar-title">ALA Labs</span> </a> </div> <div id="quarto-search" class="" title="Search"></div> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarCollapse"> <ul class="navbar-nav navbar-nav-scroll ms-auto"> <li class="nav-item"> <a class="nav-link active" href="./index.html" aria-current="page"> <i class="bi bi-house-door-fill" role="img"> </i> <span class="menu-text"> </span></a> </li> <li class="nav-item"> <a class="nav-link" href="./about/index.html"> <span class="menu-text">About</span></a> </li> <li class="nav-item"> <a class="nav-link" href="./posts/index.html"> <span class="menu-text">Posts</span></a> </li> <li class="nav-item dropdown "> <a class="nav-link dropdown-toggle" href="#" id="nav-menu-research" role="link" data-bs-toggle="dropdown" aria-expanded="false"> <span class="menu-text">Research</span> </a> <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="nav-menu-research"> <li> <a class="dropdown-item" href="./research/highlights/index.html"> <span class="dropdown-text">Highlights</span></a> </li> <li> <a class="dropdown-item" href="./research/citations/index.html"> <span class="dropdown-text">All citations</span></a> </li> </ul> </li> <li class="nav-item"> <a class="nav-link" href="./software/index.html"> <span class="menu-text">Software</span></a> </li> <li class="nav-item"> <a class="nav-link" href="./books/index.html"> <span class="menu-text">Books</span></a> </li> <li class="nav-item"> <a class="nav-link" href="./gallery/index.html"> <span class="menu-text">Gallery</span></a> </li> <li class="nav-item compact"> <a class="nav-link" href="https://www.ala.org.au"> <i class="bi bi-ala" role="img"> </i> <span class="menu-text"></span></a> </li> <li class="nav-item compact"> <a class="nav-link" href="https://github.com/AtlasOfLivingAustralia/ala-labs"> <i class="bi bi-github" role="img"> </i> <span class="menu-text"></span></a> </li> </ul> </div> <!-- /navcollapse --> <div class="quarto-navbar-tools"> </div> </div> <!-- /container-fluid --> </nav> <div id="quarto-announcement" data-announcement-id="c48823b1d2d163af8fc7077bea444426" class="alert alert-light hidden"><i class="bi bi-info-circle quarto-announcement-icon"></i><div class="quarto-announcement-content"> <p>Check out the new <em>Cleaning Biodiversity Data in R</em> book! <a href="https://labs.ala.org.au/books/">Click here to find out more</a>.</p> </div><i class="bi bi-x-lg quarto-announcement-action"></i></div> </header> <!-- content --> <div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar"> <!-- sidebar --> <!-- margin-sidebar --> <!-- main --> <main class="content page-columns page-full" id="quarto-document-content"> <script src="https://cdn.usefathom.com/script.js" data-site="QDWZORBB" defer=""></script> <section id="welcome-to-ala-labs" class="level1 page-columns page-full"> <h1>Welcome to ALA Labs</h1> <p>This site is a resource for coding projects that use data sourced from <a href="https://ala.org.au/">the ALA</a>. We hope that users will find interesting content, whether their focus is ecological modelling, data visualisation, or simply investigating the natural world through a digital lens. Enjoy!</p> <p><br></p> <hr> <div class="column-screen page-columns page-full"> <div class="column-screen-inset"> <div class="home-column-image col-right"> <p><a href="https://labs.ala.org.au/lens"> <img src="images/homepage/lens-bubble-image.png" class="home-img-lens img-fluid"> </a></p> </div> <div class="home-column-text col-left"> <center> <a href="https://labs.ala.org.au/lens"> <h1 class="heading-home"> ALA <img src="images/logos/lens-logo.svg" class="lens-logo"> Lens </h1> </a><p><a href="https://labs.ala.org.au/lens"></a></p> <p><span>Dive into data using a <a href="https://labs.ala.org.au/lens">new interactive interface</a> for exploring ALA data. Try out new views of the ALA, designed to encourage exploration and discovery of species, data and place.</span><br></p> <p><span style="font-face:italic;">Designed by <a href="https://mtchl.net/">Mitchell Whitelaw</a> and <a href="https://researchportalplus.anu.edu.au/en/persons/adrian-mackenzie">Adrian Mackenzie</a> of the <a href="https://www.anu.edu.au/">Australian National University (ANU)</a></span><br></p> <p><span style="font-size:.7rem; color:#a7abb4;">Images (all CC-BY-NC): Kai Squires, andrewpavlov, mikegrow, kerrbrad, Matt Campbell, Toby Esplin, darcywhittaker</span></p> </center> </div> </div> </div> <div class="column-screen page-columns page-full" style="background-color:#B8573E;"> <div class="column-screen-inset"> <div class="home-column-image col-left"> <p><a href="https://labs.ala.org.au/posts/"></a></p><a href="https://labs.ala.org.au/posts/"> <p><img src="images/homepage/home_ala-plots.png" class="home-img img-fluid"></p> </a><p><a href="https://labs.ala.org.au/posts/"></a></p> </div> <div class="home-column-text col-right"> <center> <h1 class="heading-home" style="color: #fff;"> Posts </h1> <span style="color: #fff; font-style: italic">How-to articles for solving scientific problems</span> </center> <div class="cell"> <div class="cell-output-display"> <div class="category-row"> <div class="category-column"> <a href="posts/index.html#category=Summaries"> <img href="posts/index.html#category=Summaries" src="images/vectors/barplot.svg" style="color:#fff !important;" class="category-image honey-white"> </a> <h4 style="text-align:center;"> <a class="white" href="posts/index.html#category=Summaries">Summaries</a> </h4> </div> <div class="category-column"> <a href="posts/index.html#category=Maps"> <img href="posts/index.html#category=Maps" src="images/vectors/Australia.svg" style="color:#fff !important;" class="category-image honey-white"> </a> <h4 style="text-align:center"> <a class="white" href="posts/index.html#category=Maps">Maps</a> </h4> </div> <div class="category-column"> <a href="posts/index.html#category:Trees"> <img href="posts/index.html#category=Trees" src="images/vectors/tree.svg" style="color:#fff !important;" class="category-image honey-white"> </a> <h4 style="text-align:center"> <a class="white" href="posts/index.html#category=Trees">Trees</a> </h4> </div> </div> </div> </div> </div> </div> </div> <div class="column-screen page-columns page-full"> <div class="column-screen-inset"> <div class="home-column-image col-right"> <p><a href="https://labs.ala.org.au/research/highlights/"> <img src="images/homepage/home_ala-research.png" class="home-img img-fluid"> </a></p> </div> <div class="home-column-text col-left"> <center> <h1 class="heading-home"> Research </h1> <p><span style="font-style: italic">Highlighting research supported by ALA data</span></p> </center> <div class="cell"> <div class="cell-output-display"> <div class="category-row"> <div class="category-column" style="width: 50%"> <a href="research/highlights/index.html"> <img href="research/highlights/index.html" src="images/vectors/seedling-solid.svg" class="category-image honey"> </a> <h4 style="text-align:center;"> <a href="research/highlights/index.html">Selected highlights</a> </h4> </div> <div class="category-column" style="width: 50%"> <a href="research/citations/index.html"> <img href="research/citations/index.html" src="images/vectors/table-list-solid.svg" class="category-image honey"> </a> <h4 style="text-align:center;"> <a href="research/citations/index.html">Complete list</a> </h4> </div> </div> </div> </div> </div> </div> </div> <div class="column-screen page-columns page-full" style="background-color:#B8573E;"> <div class="column-screen-inset"> <div class="home-column-image col-left"> <p><a href="https://labs.ala.org.au/software/index.html"></a></p><a href="https://labs.ala.org.au/software/index.html"> <p><img src="images/homepage/home_ala-software-c.png" class="home-img-transparent img-fluid"></p> </a><p><a href="https://labs.ala.org.au/software/index.html"></a></p> <!-- :::{.hexBadges} --> <!-- <a href="https://labs.ala.org.au/software.html"> --> <!-- <img src = "https://raw.githubusercontent.com/AtlasOfLivingAustralia/ala-labs/science-impact-testing/images/hex/galah_logo.png" class = "r1 c0"></img> --> <!-- </a> --> <!-- <a href="https://labs.ala.org.au/software.html"> --> <!-- <img src = "https://raw.githubusercontent.com/AtlasOfLivingAustralia/ala-labs/science-impact-testing/images/hex/potions-logo.png" class = "r2 c1" style = "width:265px;"></img> --> <!-- </a> --> <!-- ::: --> </div> <div class="home-column-text col-right"> <center> <h1 class="heading-home" style="color: #fff;"> Software </h1> <p><span style="font-style: italic; color: #fff;">Tools supported by the Science & Decision Support Team</span></p> </center> <div class="cell"> <div class="cell-output-display"> <div class="category-row"> <div class="category-column" style="width: 100%"> <a href="software/index.html"> <img href="software/index.html" src="images/vectors/hexagon-vector.svg" style="color:#fff !important;" class="category-image honey-white"> </a> <h4 style="text-align:center;"> <a class="white" href="software/index.html">Packages</a> </h4> </div> </div> </div> </div> </div> </div> </div> <div class="column-screen page-columns page-full" style="background-color:#ffffff;"> <div class="column-screen-inset"> <div class="home-column-image col-left"> <center> <h1 class="heading-home" style="color: #222322;"> Books </h1> <p><span style="font-style: italic;">Long-form resources by the Science & Decision Support Team</span></p> </center> <div class="cell"> <div class="cell-output-display"> <div class="category-row"> <div class="category-column" style="width: 100%"> <a href="books/index.html"> <img href="books/index.html" src="images/vectors/book-solid.svg" class="category-image honey"> </a> <h4 style="text-align:center;"> <a href="books/index.html">Books</a> </h4> </div> </div> </div> </div> </div> <div class="home-column-text col-right"> <center> <p><a href="https://labs.ala.org.au/books/index.html"></a></p><a href="https://labs.ala.org.au/books/index.html"> <p><img src="books/images/covers/cleaner-shrimp_cover.png" class="home-img-transparent img-fluid" style="border-radius:2%;;width:45.0%"></p> </a> </center> </div> </div> </div> <hr> <div class="column-screen page-columns page-full" style="background-color:#fff;"> <div class="column-page"> <center> <h1> <i class="fa-solid fa-earth-oceania" aria-label="earth-oceania"></i> We value </h1> </center> </div> <div class="column-screen"> <div class="cell"> <div class="cell-output-display"> <div class="values-row"> <div class="col-lg-4 px-0"> <div class="value-block value-feature"> <h3 class="value-text" data-anchor-id="welcome-to-ala-labs"> <i class="fas fa-book-open"></i> Openness </h3> <p>Data are most useful when they are widely available and easy to use. We try to encourage the sharing of tools that make data from the Atlas of Living Australia more open and useful for everyone</p> </div> </div> <div class="col-lg-4 px-0"> <div class="value-block value-feature"> <h3 class="value-text"> <i class="fas fa-dna"></i> Scientific transparency </h3> <p>Transparency is necessary for reproducible science. We encourage that decisions, methods and deviations are clear and transparent in a workflow from the planning phase, to the retrieval and analysis of data, to the final output</p> </div> </div> <div class="col-lg-4 px-0"> <div class="value-block value-feature"> <h3 class="value-text"> <i class="far fa-chart-bar"></i> Robust methods </h3> <p>No method or analytic procedure is perfect. We value consideration for strengths and limitations of each method or analysis. This attitude helps researchers choose methods that provide robust results for their specific question</p> </div> </div> </div> </div> </div> </div> </div> </section> </main> <!-- /main --> <!-- ALA Template Footer --> <style> /*-- Copyright --*/ .copyright-container { display: flex!important; width: 100%; margin-bottom: 30px; margin-top: 30px; } .copyright-row { width: 100%; position: relative; background-color: #c44d34; background-position: bottom; background-size: cover; display: flex; } .copyright-width { display: flex; width: 100%; max-width: 1140px; padding-left: 15px; padding-right: 15px; padding-bottom: 0px; margin: auto; } .copyright-column-left { float: left; width: 50%; max-width: 50%; padding-left: 15px; padding-right: 15px; position: relative; min-height: 1px; display: flex!important; flex-direction:column; display:inline-block; } .copyright-column-right { float: right; text-align: right; width: 50%; max-width: 50%; padding-left: 15px; padding-right: 15px; position: relative; min-height: 1px; display: flex!important; flex-direction: column; display:inline-block; } .copyright-text { color: white; font-size: 12px; padding-top: 10px} .copyright-text a:hover { color: #222322; } /*-- Logos and acknowledgement --*/ .footer-container { display: flex!important; width: 100%; max-width: 1140px; padding-left: 15px; padding-right: 15px; padding-top: 50px; padding-bottom: 50px; margin: auto; } .distill-site-footer { padding-top: 0px; padding-bottom: 10px; text-align: left; } .row-footer { /* Do not change the name of this column - it causes issues */ display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; } .column-footer { /* Do not change the name of this column - it causes issues */ float: left; width: 50%; max-width: 50%; padding-left: 15px; padding-right: 15px; position: relative; min-height: 1px; display: flex; flex-direction:column; display:inline-block; } .footer-logo { text-align: left; margin:5px; } .footer-text { font-family: "Lato", sans-serif; font-weight: 700; font-size: 1.1rem; line-height: 1.2; color: #565656; text-align: left; } .footer-text-small { font-family: Roboto,sans-serif; font-size: .82rem; font-weight: 400; line-height: 1.5; font-family: "Roboto", sans-serif; font-weight: 400; color: #565656; text-align: left; margin-top: 10px; } /*-- Back to ALA button --*/ .link-container { margin-top: 30px; margin-bottom: 30px; display: block; width: 30em; margin-left: auto; margin-right: auto; } .link-button { border: none; color: #E06E53; padding: 10px 15px; text-align: center; text-decoration: none; display: inline-block; font-size: 18px; margin: 4px 2px; transition-duration: 0.3s; cursor: pointer; background-color: white; border: 2px solid #E06E53; border-radius: 10px; } .link-button:hover { background-color: #222322; border: 2px solid #222322; color: #E06E53; } .ala-icon { height: 20px; width: auto; /* Other styles here */ } @media screen and (max-width: 952px) { .link-container { margin: auto; margin-top: 20px; margin-bottom: 20px; } .footer-container { width: 100%; max-width: 100%; display: flex; flex-wrap: wrap; } .column-footer { float:left; width: 100%; max-width: 100%; display: block; margin-top: 20px; } .link-container { display: block; width: 20em; margin: auto; } .copyright-column-left { width: 50%; } .copyright-column-right { width: 50%; } .copyright-row { height: 100px; margin-bottom: -3.75vw; } } .logo-ncris { width: auto; height: 109px; margin-right: 15px; margin-top: 20px; } .logo-csiro { width: auto; height: 109px; margin-right: 15px; margin-top: 20px; } .logo-gbif { width: auto; height: 109px; } @media (min-width: 992px) {} body .page-columns{ grid-column: screen-start/screen-end; z-index: 998; transform: translate3d(0, 0, 0); } } </style> <hr style="padding-top: 1px"> <div class="footer-container column-screen page-columns page-full"> <!--<div class = "row-footer">--> <div class="column-footer"> <p class="footer-text">The ALA is made possible by contributions from its partners, is supported by <a href="https://www.education.gov.au/national-collaborative-research-infrastructure-strategy-ncris" class="footer-link">NCRIS</a>, is hosted by <a href="https://csiro.au/" class="footer-link">CSIRO</a>, and is the Australian node of <a href="https://www.gbif.org/en/" id="d-article" class="footer-link">GBIF</a>. </p> <a href="https://www.education.gov.au/national-collaborative-research-infrastructure-strategy-ncris"> <img src="images/logos/NCRIS_logo.png" class="logo-ncris" alt="NCRIS logo"> </a> <a href="https://csiro.au/"> <img src="images/logos/CSIRO_logo.png" class="logo-csiro" alt="CSIRO logo"> </a> <a href="https://www.gbif.org/en/"> <img src="images/logos/GBIF_109px.png" class="logo-gbif" alt="GBIF logo"> </a> </div> <div class="column-footer" id="footer-logo"> <p class="footer-text"><strong>Acknowledgement of Traditional Owners and Country</strong></p> <p class="footer-text-small">The Atlas of Living Australia acknowledges Australia's Traditional Owners and pays respect to the past and present Elders of the nation's Aboriginal and Torres Strait Islander communities. We honour and celebrate the spiritual, cultural and customary connections of Traditional Owners to country and the biodiversity that forms part of that country.<br><br></p> </div> <!-- </div>--> </div> <div class="copright-container column-screen"> <div class="copyright-row"> <div class="copyright-width"> <div class="copyright-column-left"> <p class="copyright-text"> This work is licensed under a <a style="color:#fff!important;" href="https://creativecommons.org/licenses/by/3.0/au/">Creative Commons Attribution 3.0 Australia License</a> <a rel="license" href="http://creativecommons.org/licenses/by/3.0/au/"><img alt="Creative Commons License" style="border-width:0" src="images/logos/cc-by.png"></a> </p> </div><!--col end --> <div class="copyright-column-right"> <p class="copyright-text"> <a style="color:#fff!important;" href="https://www.ala.org.au/terms-of-use#cy">Copyright</a> <a style="color:#fff!important;" href="https://www.ala.org.au/terms-of-use">Terms of Use</a> <a style="color:#fff!important;" href="https://status.ala.org.au/">System Status</a> </p> </div> </div> </div><!-- row end --> </div> <script id="quarto-html-after-body" type="application/javascript"> window.document.addEventListener("DOMContentLoaded", function (event) { const toggleBodyColorMode = (bsSheetEl) => { const mode = bsSheetEl.getAttribute("data-mode"); const bodyEl = window.document.querySelector("body"); if (mode === "dark") { bodyEl.classList.add("quarto-dark"); bodyEl.classList.remove("quarto-light"); } else { bodyEl.classList.add("quarto-light"); bodyEl.classList.remove("quarto-dark"); } } const toggleBodyColorPrimary = () => { const bsSheetEl = window.document.querySelector("link#quarto-bootstrap"); if (bsSheetEl) { toggleBodyColorMode(bsSheetEl); } } toggleBodyColorPrimary(); const isCodeAnnotation = (el) => { for (const clz of el.classList) { if (clz.startsWith('code-annotation-')) { return true; } } return false; } const onCopySuccess = function(e) { // button target const button = e.trigger; // don't keep focus button.blur(); // flash "checked" button.classList.add('code-copy-button-checked'); var currentTitle = button.getAttribute("title"); button.setAttribute("title", "Copied!"); let tooltip; if (window.bootstrap) { button.setAttribute("data-bs-toggle", "tooltip"); button.setAttribute("data-bs-placement", "left"); button.setAttribute("data-bs-title", "Copied!"); tooltip = new bootstrap.Tooltip(button, { trigger: "manual", customClass: "code-copy-button-tooltip", offset: [0, -8]}); tooltip.show(); } setTimeout(function() { if (tooltip) { tooltip.hide(); button.removeAttribute("data-bs-title"); button.removeAttribute("data-bs-toggle"); button.removeAttribute("data-bs-placement"); } button.setAttribute("title", currentTitle); button.classList.remove('code-copy-button-checked'); }, 1000); // clear code selection e.clearSelection(); } const getTextToCopy = function(trigger) { const codeEl = trigger.previousElementSibling.cloneNode(true); for (const childEl of codeEl.children) { if (isCodeAnnotation(childEl)) { childEl.remove(); } } return codeEl.innerText; } const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', { text: getTextToCopy }); clipboard.on('success', onCopySuccess); if (window.document.getElementById('quarto-embedded-source-code-modal')) { // For code content inside modals, clipBoardJS needs to be initialized with a container option // TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860) const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', { text: getTextToCopy, container: window.document.getElementById('quarto-embedded-source-code-modal') }); clipboardModal.on('success', onCopySuccess); } var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//); var mailtoRegex = new RegExp(/^mailto:/); var filterRegex = new RegExp("https:\/\/labs\.ala\.org\.au\/"); var isInternal = (href) => { return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href); } // Inspect non-navigation links and adorn them if external var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)'); for (var i=0; i<links.length; i++) { const link = links[i]; if (!isInternal(link.href)) { // undo the damage that might have been done by quarto-nav.js in the case of // links that we want to consider external if (link.dataset.originalHref !== undefined) { link.href = link.dataset.originalHref; } } } function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) { const config = { allowHTML: true, maxWidth: 500, delay: 100, arrow: false, appendTo: function(el) { return el.parentElement; }, interactive: true, interactiveBorder: 10, theme: 'quarto', placement: 'bottom-start', }; if (contentFn) { config.content = contentFn; } if (onTriggerFn) { config.onTrigger = onTriggerFn; } if (onUntriggerFn) { config.onUntrigger = onUntriggerFn; } window.tippy(el, config); } const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]'); for (var i=0; i<noterefs.length; i++) { const ref = noterefs[i]; tippyHover(ref, function() { // use id or data attribute instead here let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href'); try { href = new URL(href).hash; } catch {} const id = href.replace(/^#\/?/, ""); const note = window.document.getElementById(id); if (note) { return note.innerHTML; } else { return ""; } }); } const xrefs = window.document.querySelectorAll('a.quarto-xref'); const processXRef = (id, note) => { // Strip column container classes const stripColumnClz = (el) => { el.classList.remove("page-full", "page-columns"); if (el.children) { for (const child of el.children) { stripColumnClz(child); } } } stripColumnClz(note) if (id === null || id.startsWith('sec-')) { // Special case sections, only their first couple elements const container = document.createElement("div"); if (note.children && note.children.length > 2) { container.appendChild(note.children[0].cloneNode(true)); for (let i = 1; i < note.children.length; i++) { const child = note.children[i]; if (child.tagName === "P" && child.innerText === "") { continue; } else { container.appendChild(child.cloneNode(true)); break; } } if (window.Quarto?.typesetMath) { window.Quarto.typesetMath(container); } return container.innerHTML } else { if (window.Quarto?.typesetMath) { window.Quarto.typesetMath(note); } return note.innerHTML; } } else { // Remove any anchor links if they are present const anchorLink = note.querySelector('a.anchorjs-link'); if (anchorLink) { anchorLink.remove(); } if (window.Quarto?.typesetMath) { window.Quarto.typesetMath(note); } // TODO in 1.5, we should make sure this works without a callout special case if (note.classList.contains("callout")) { return note.outerHTML; } else { return note.innerHTML; } } } for (var i=0; i<xrefs.length; i++) { const xref = xrefs[i]; tippyHover(xref, undefined, function(instance) { instance.disable(); let url = xref.getAttribute('href'); let hash = undefined; if (url.startsWith('#')) { hash = url; } else { try { hash = new URL(url).hash; } catch {} } if (hash) { const id = hash.replace(/^#\/?/, ""); const note = window.document.getElementById(id); if (note !== null) { try { const html = processXRef(id, note.cloneNode(true)); instance.setContent(html); } finally { instance.enable(); instance.show(); } } else { // See if we can fetch this fetch(url.split('#')[0]) .then(res => res.text()) .then(html => { const parser = new DOMParser(); const htmlDoc = parser.parseFromString(html, "text/html"); const note = htmlDoc.getElementById(id); if (note !== null) { const html = processXRef(id, note); instance.setContent(html); } }).finally(() => { instance.enable(); instance.show(); }); } } else { // See if we can fetch a full url (with no hash to target) // This is a special case and we should probably do some content thinning / targeting fetch(url) .then(res => res.text()) .then(html => { const parser = new DOMParser(); const htmlDoc = parser.parseFromString(html, "text/html"); const note = htmlDoc.querySelector('main.content'); if (note !== null) { // This should only happen for chapter cross references // (since there is no id in the URL) // remove the first header if (note.children.length > 0 && note.children[0].tagName === "HEADER") { note.children[0].remove(); } const html = processXRef(null, note); instance.setContent(html); } }).finally(() => { instance.enable(); instance.show(); }); } }, function(instance) { }); } let selectedAnnoteEl; const selectorForAnnotation = ( cell, annotation) => { let cellAttr = 'data-code-cell="' + cell + '"'; let lineAttr = 'data-code-annotation="' + annotation + '"'; const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; return selector; } const selectCodeLines = (annoteEl) => { const doc = window.document; const targetCell = annoteEl.getAttribute("data-target-cell"); const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); const lines = annoteSpan.getAttribute("data-code-lines").split(","); const lineIds = lines.map((line) => { return targetCell + "-" + line; }) let top = null; let height = null; let parent = null; if (lineIds.length > 0) { //compute the position of the single el (top and bottom and make a div) const el = window.document.getElementById(lineIds[0]); top = el.offsetTop; height = el.offsetHeight; parent = el.parentElement.parentElement; if (lineIds.length > 1) { const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); const bottom = lastEl.offsetTop + lastEl.offsetHeight; height = bottom - top; } if (top !== null && height !== null && parent !== null) { // cook up a div (if necessary) and position it let div = window.document.getElementById("code-annotation-line-highlight"); if (div === null) { div = window.document.createElement("div"); div.setAttribute("id", "code-annotation-line-highlight"); div.style.position = 'absolute'; parent.appendChild(div); } div.style.top = top - 2 + "px"; div.style.height = height + 4 + "px"; div.style.left = 0; let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); if (gutterDiv === null) { gutterDiv = window.document.createElement("div"); gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); gutterDiv.style.position = 'absolute'; const codeCell = window.document.getElementById(targetCell); const gutter = codeCell.querySelector('.code-annotation-gutter'); gutter.appendChild(gutterDiv); } gutterDiv.style.top = top - 2 + "px"; gutterDiv.style.height = height + 4 + "px"; } selectedAnnoteEl = annoteEl; } }; const unselectCodeLines = () => { const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; elementsIds.forEach((elId) => { const div = window.document.getElementById(elId); if (div) { div.remove(); } }); selectedAnnoteEl = undefined; }; // Handle positioning of the toggle window.addEventListener( "resize", throttle(() => { elRect = undefined; if (selectedAnnoteEl) { selectCodeLines(selectedAnnoteEl); } }, 10) ); function throttle(fn, ms) { let throttle = false; let timer; return (...args) => { if(!throttle) { // first call gets through fn.apply(this, args); throttle = true; } else { // all the others get throttled if(timer) clearTimeout(timer); // cancel #2 timer = setTimeout(() => { fn.apply(this, args); timer = throttle = false; }, ms); } }; } // Attach click handler to the DT const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); for (const annoteDlNode of annoteDls) { annoteDlNode.addEventListener('click', (event) => { const clickedEl = event.target; if (clickedEl !== selectedAnnoteEl) { unselectCodeLines(); const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); if (activeEl) { activeEl.classList.remove('code-annotation-active'); } selectCodeLines(clickedEl); clickedEl.classList.add('code-annotation-active'); } else { // Unselect the line unselectCodeLines(); clickedEl.classList.remove('code-annotation-active'); } }); } const findCites = (el) => { const parentEl = el.parentElement; if (parentEl) { const cites = parentEl.dataset.cites; if (cites) { return { el, cites: cites.split(' ') }; } else { return findCites(el.parentElement) } } else { return undefined; } }; var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); for (var i=0; i<bibliorefs.length; i++) { const ref = bibliorefs[i]; const citeInfo = findCites(ref); if (citeInfo) { tippyHover(citeInfo.el, function() { var popup = window.document.createElement('div'); citeInfo.cites.forEach(function(cite) { var citeDiv = window.document.createElement('div'); citeDiv.classList.add('hanging-indent'); citeDiv.classList.add('csl-entry'); var biblioDiv = window.document.getElementById('ref-' + cite); if (biblioDiv) { citeDiv.innerHTML = biblioDiv.innerHTML; } popup.appendChild(citeDiv); }); return popup.innerHTML; }); } } }); </script> </div> <!-- /content --> </body></html>