| @@ -8,3 +8,4 @@ | |||
| ^node_modules$ | |||
| ^\.eslintrc$ | |||
| ^inst/examples/demo$ | |||
| ^tic\.R$ | |||
| @@ -0,0 +1,58 @@ | |||
| # OS: Linux + macOS ------------------------------------------------------------ | |||
| # tic documentation: https://docs.ropensci.org/tic/dev/ | |||
| matrix: | |||
| include: | |||
| - os: osx | |||
| r: devel | |||
| - os: osx | |||
| r: release | |||
| - os: osx | |||
| r: oldrelease | |||
| - os: linux | |||
| r: devel | |||
| - os: linux | |||
| r: release | |||
| - os: linux | |||
| r: oldrelease | |||
| # meta ------------------------------------------------------------------------- | |||
| language: r | |||
| cache: | |||
| - packages | |||
| - $HOME/.ccache | |||
| - $HOME/Library/Caches/Homebrew | |||
| latex: false | |||
| env: | |||
| global: | |||
| - MAKEFLAGS="-j 2" | |||
| # Stages ----------------------------------------------------------------------- | |||
| before_install: | |||
| - echo -e "options(Ncpus = 8, repos = structure(c(CRAN = 'https://cloud.r-project.org/')))" > $HOME/.Rprofile | |||
| - mkdir $HOME/.R && echo -e 'CXX_STD = CXX14\n\nCC=ccache gcc -std=gnu99\nCXX=ccache g++\nCXX11=ccache g++ -std=gnu99\nCXX14=ccache g++ -std=gnu99\nC11=ccache g++\nC14=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars | |||
| - mkdir -p $HOME/.ccache && echo -e 'max_size = 5.0G\nsloppiness = include_file_ctime\nhash_dir=false' > $HOME/.ccache/ccache.conf | |||
| - R -q -e 'if (!requireNamespace("remotes")) install.packages("remotes")' | |||
| - R -q -e 'if (getRversion() < "3.2" && !requireNamespace("curl")) install.packages("curl")' | |||
| - R -q -e 'remotes::install_github("ropenscilabs/tic"); print(tic::dsl_load()); tic::prepare_all_stages()' | |||
| - R -q -e 'tic::before_install()' | |||
| install: | |||
| - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew install ccache; fi | |||
| - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi | |||
| - R -q -e 'tic::install()' | |||
| before_script: R -q -e 'tic::before_script()' | |||
| script: R -q -e 'tic::script()' | |||
| after_success: R -q -e 'tic::after_success()' | |||
| after_failure: R -q -e 'tic::after_failure()' | |||
| before_deploy: R -q -e 'tic::before_deploy()' | |||
| deploy: | |||
| provider: script | |||
| script: R -q -e 'tic::deploy()' | |||
| on: | |||
| all_branches: true | |||
| after_deploy: R -q -e 'tic::after_deploy()' | |||
| after_script: R -q -e 'tic::after_script()' | |||
| # Custom user code ------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| Package: js4shiny | |||
| Title: Companion Package for JavaScript for Shiny Users | |||
| Version: 0.0.21 | |||
| Version: 0.0.22 | |||
| Authors@R: | |||
| person(given = "Garrick", | |||
| family = "Aden-Buie", | |||
| @@ -0,0 +1,7 @@ | |||
| ## js4shiny 0.0.22 | |||
| - Added pkgdown site and travis | |||
| ## js4shiny 0.0.21 | |||
| - Added R, HTML, CSS, and JavaScript snippets with a helper function `snippets_install()`. You can run the installer whenever you update the package to update to the latest snippets. | |||
| @@ -17,12 +17,14 @@ | |||
| #' rmarkdown::render( | |||
| #' input = css_ex, | |||
| #' output_file = tmp_html_init, | |||
| #' output_options = list(version = "initial") | |||
| #' output_options = list(version = "initial"), | |||
| #' quiet = TRUE | |||
| #' ) | |||
| #' rmarkdown::render( | |||
| #' input = css_ex, | |||
| #' output_file = tmp_html_sol, | |||
| #' output_options = list(version = "solution") | |||
| #' output_options = list(version = "solution"), | |||
| #' quiet = TRUE | |||
| #' ) | |||
| #' | |||
| #' # View tmp_html_init/sol | |||
| @@ -0,0 +1,29 @@ | |||
| # tic documentation: https://docs.ropensci.org/tic/dev/ | |||
| # Download script file from GitHub | |||
| init: | |||
| ps: | | |||
| $ErrorActionPreference = "Stop" | |||
| Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" | |||
| Import-Module '..\appveyor-tool.ps1' | |||
| install: | |||
| - ps: Bootstrap | |||
| - cmd: Rscript -e "writeLines('options(repos = \'https://cloud.r-project.org\')', '~/.Rprofile')" | |||
| - cmd: Rscript -e "getOption('repos')" | |||
| - cmd: Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'binary')" | |||
| - cmd: Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'binary')" | |||
| - cmd: Rscript -e "options(pkgType = 'binary'); remotes::install_github('ropenscilabs/tic'); print(tic::dsl_load()); tic::prepare_all_stages()" | |||
| before_build: Rscript -e "tic::before_install()" | |||
| build_script: Rscript -e "tic::install()" | |||
| after_build: Rscript -e "tic::after_install()" | |||
| before_test: Rscript -e "tic::before_script()" | |||
| test_script: Rscript -e "tic::script()" | |||
| on_success: Rscript -e "try(tic::after_success(), silent = TRUE)" | |||
| on_failure: Rscript -e "tic::after_failure()" | |||
| before_deploy: Rscript -e "tic::before_deploy()" | |||
| deploy_script: Rscript -e "tic::deploy()" | |||
| after_deploy: Rscript -e "tic::after_deploy()" | |||
| on_finish: Rscript -e "tic::after_script()" | |||
| # Custom user code ------------------------------------------------------------- | |||
| @@ -0,0 +1,135 @@ | |||
| <!-- Generated by pkgdown: do not edit by hand --> | |||
| <!DOCTYPE html> | |||
| <html lang="en"> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |||
| <title>Page not found (404) • js4shiny</title> | |||
| <!-- jquery --> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | |||
| <!-- Bootstrap --> | |||
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" /> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script> | |||
| <!-- Font Awesome icons --> | |||
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous" /> | |||
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous" /> | |||
| <!-- clipboard.js --> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script> | |||
| <!-- headroom.js --> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script> | |||
| <!-- pkgdown --> | |||
| <link href="pkgdown.css" rel="stylesheet"> | |||
| <script src="pkgdown.js"></script> | |||
| <meta property="og:title" content="Page not found (404)" /> | |||
| <!-- mathjax --> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script> | |||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script> | |||
| <!--[if lt IE 9]> | |||
| <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> | |||
| <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |||
| <![endif]--> | |||
| </head> | |||
| <body> | |||
| <div class="container template-title-body"> | |||
| <header> | |||
| <div class="navbar navbar-default navbar-fixed-top" role="navigation"> | |||
| <div class="container"> | |||
| <div class="navbar-header"> | |||
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"> | |||
| <span class="sr-only">Toggle navigation</span> | |||
| <span class="icon-bar"></span> | |||
| <span class="icon-bar"></span> | |||
| <span class="icon-bar"></span> | |||
| </button> | |||
| <span class="navbar-brand"> | |||
| <a class="navbar-link" href="index.html">js4shiny</a> | |||
| <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.0.21</span> | |||
| </span> | |||
| </div> | |||
| <div id="navbar" class="navbar-collapse collapse"> | |||
| <ul class="nav navbar-nav"> | |||
| <li> | |||
| <a href="index.html"> | |||
| <span class="fas fa fas fa-home fa-lg"></span> | |||
| </a> | |||
| </li> | |||
| <li> | |||
| <a href="reference/index.html">Reference</a> | |||
| </li> | |||
| </ul> | |||
| <ul class="nav navbar-nav navbar-right"> | |||
| <li> | |||
| <a href="https://github.com/gadenbuie/js4shiny"> | |||
| <span class="fab fa fab fa-github fa-lg"></span> | |||
| </a> | |||
| </li> | |||
| </ul> | |||
| </div><!--/.nav-collapse --> | |||
| </div><!--/.container --> | |||
| </div><!--/.navbar --> | |||
| </header> | |||
| <div class="row"> | |||
| <div class="contents col-md-9"> | |||
| <div class="page-header"> | |||
| <h1>Page not found (404)</h1> | |||
| </div> | |||
| Content not found. Please use links in the navbar. | |||
| </div> | |||
| </div> | |||
| <footer> | |||
| <div class="copyright"> | |||
| <p>Developed by Garrick Aden-Buie.</p> | |||
| </div> | |||
| <div class="pkgdown"> | |||
| <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.4.1.</p> | |||
| </div> | |||
| </footer> | |||
| </div> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,85 @@ | |||
| $(function() { | |||
| // register a handler to move the focus to the search bar | |||
| // upon pressing shift + "/" (i.e. "?") | |||
| $(document).on('keydown', function(e) { | |||
| if (e.shiftKey && e.keyCode == 191) { | |||
| e.preventDefault(); | |||
| $("#search-input").focus(); | |||
| } | |||
| }); | |||
| $(document).ready(function() { | |||
| // do keyword highlighting | |||
| /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ | |||
| var mark = function() { | |||
| var referrer = document.URL ; | |||
| var paramKey = "q" ; | |||
| if (referrer.indexOf("?") !== -1) { | |||
| var qs = referrer.substr(referrer.indexOf('?') + 1); | |||
| var qs_noanchor = qs.split('#')[0]; | |||
| var qsa = qs_noanchor.split('&'); | |||
| var keyword = ""; | |||
| for (var i = 0; i < qsa.length; i++) { | |||
| var currentParam = qsa[i].split('='); | |||
| if (currentParam.length !== 2) { | |||
| continue; | |||
| } | |||
| if (currentParam[0] == paramKey) { | |||
| keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); | |||
| } | |||
| } | |||
| if (keyword !== "") { | |||
| $(".contents").unmark({ | |||
| done: function() { | |||
| $(".contents").mark(keyword); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| }; | |||
| mark(); | |||
| }); | |||
| }); | |||
| /* Search term highlighting ------------------------------*/ | |||
| function matchedWords(hit) { | |||
| var words = []; | |||
| var hierarchy = hit._highlightResult.hierarchy; | |||
| // loop to fetch from lvl0, lvl1, etc. | |||
| for (var idx in hierarchy) { | |||
| words = words.concat(hierarchy[idx].matchedWords); | |||
| } | |||
| var content = hit._highlightResult.content; | |||
| if (content) { | |||
| words = words.concat(content.matchedWords); | |||
| } | |||
| // return unique words | |||
| var words_uniq = [...new Set(words)]; | |||
| return words_uniq; | |||
| } | |||
| function updateHitURL(hit) { | |||
| var words = matchedWords(hit); | |||
| var url = ""; | |||
| if (hit.anchor) { | |||
| url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; | |||
| } else { | |||
| url = hit.url + '?q=' + escape(words.join(" ")); | |||
| } | |||
| return url; | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | |||
| <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | |||
| viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"> | |||
| <style type="text/css"> | |||
| .st0{fill:#75AADB;} | |||
| </style> | |||
| <path class="st0" d="M4,11.3h1.3v1.3H4c-2,0-4-2.3-4-4.7s2.1-4.7,4-4.7h5.3c1.9,0,4,2.3,4,4.7c0,1.9-1.2,3.6-2.7,4.3v-1.5 | |||
| C11.4,10.2,12,9.1,12,8c0-1.7-1.4-3.3-2.7-3.3H4C2.7,4.7,1.3,6.3,1.3,8S2.7,11.3,4,11.3z M16,7.3h-1.3v1.3H16c1.3,0,2.7,1.6,2.7,3.3 | |||
| s-1.4,3.3-2.7,3.3h-5.3C9.4,15.3,8,13.7,8,12c0-1.1,0.6-2.2,1.3-2.8V7.7C7.9,8.4,6.7,10.1,6.7,12c0,2.4,2.1,4.7,4,4.7H16 | |||
| c1.9,0,4-2.3,4-4.7S18,7.3,16,7.3z"/> | |||
| </svg> | |||
| @@ -0,0 +1,256 @@ | |||
| /* Sticky footer */ | |||
| /** | |||
| * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ | |||
| * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css | |||
| * | |||
| * .Site -> body > .container | |||
| * .Site-content -> body > .container .row | |||
| * .footer -> footer | |||
| * | |||
| * Key idea seems to be to ensure that .container and __all its parents__ | |||
| * have height set to 100% | |||
| * | |||
| */ | |||
| html, body { | |||
| height: 100%; | |||
| } | |||
| body > .container { | |||
| display: flex; | |||
| height: 100%; | |||
| flex-direction: column; | |||
| } | |||
| body > .container .row { | |||
| flex: 1 0 auto; | |||
| } | |||
| footer { | |||
| margin-top: 45px; | |||
| padding: 35px 0 36px; | |||
| border-top: 1px solid #e5e5e5; | |||
| color: #666; | |||
| display: flex; | |||
| flex-shrink: 0; | |||
| } | |||
| footer p { | |||
| margin-bottom: 0; | |||
| } | |||
| footer div { | |||
| flex: 1; | |||
| } | |||
| footer .pkgdown { | |||
| text-align: right; | |||
| } | |||
| footer p { | |||
| margin-bottom: 0; | |||
| } | |||
| img.icon { | |||
| float: right; | |||
| } | |||
| img { | |||
| max-width: 100%; | |||
| } | |||
| /* Fix bug in bootstrap (only seen in firefox) */ | |||
| summary { | |||
| display: list-item; | |||
| } | |||
| /* Typographic tweaking ---------------------------------*/ | |||
| .contents .page-header { | |||
| margin-top: calc(-60px + 1em); | |||
| } | |||
| /* Section anchors ---------------------------------*/ | |||
| a.anchor { | |||
| margin-left: -30px; | |||
| display:inline-block; | |||
| width: 30px; | |||
| height: 30px; | |||
| visibility: hidden; | |||
| background-image: url(./link.svg); | |||
| background-repeat: no-repeat; | |||
| background-size: 20px 20px; | |||
| background-position: center center; | |||
| } | |||
| .hasAnchor:hover a.anchor { | |||
| visibility: visible; | |||
| } | |||
| @media (max-width: 767px) { | |||
| .hasAnchor:hover a.anchor { | |||
| visibility: hidden; | |||
| } | |||
| } | |||
| /* Fixes for fixed navbar --------------------------*/ | |||
| .contents h1, .contents h2, .contents h3, .contents h4 { | |||
| padding-top: 60px; | |||
| margin-top: -40px; | |||
| } | |||
| /* Sidebar --------------------------*/ | |||
| #sidebar { | |||
| margin-top: 30px; | |||
| position: -webkit-sticky; | |||
| position: sticky; | |||
| top: 70px; | |||
| } | |||
| #sidebar h2 { | |||
| font-size: 1.5em; | |||
| margin-top: 1em; | |||
| } | |||
| #sidebar h2:first-child { | |||
| margin-top: 0; | |||
| } | |||
| #sidebar .list-unstyled li { | |||
| margin-bottom: 0.5em; | |||
| } | |||
| .orcid { | |||
| height: 16px; | |||
| /* margins are required by official ORCID trademark and display guidelines */ | |||
| margin-left:4px; | |||
| margin-right:4px; | |||
| vertical-align: middle; | |||
| } | |||
| /* Reference index & topics ----------------------------------------------- */ | |||
| .ref-index th {font-weight: normal;} | |||
| .ref-index td {vertical-align: top;} | |||
| .ref-index .icon {width: 40px;} | |||
| .ref-index .alias {width: 40%;} | |||
| .ref-index-icons .alias {width: calc(40% - 40px);} | |||
| .ref-index .title {width: 60%;} | |||
| .ref-arguments th {text-align: right; padding-right: 10px;} | |||
| .ref-arguments th, .ref-arguments td {vertical-align: top;} | |||
| .ref-arguments .name {width: 20%;} | |||
| .ref-arguments .desc {width: 80%;} | |||
| /* Nice scrolling for wide elements --------------------------------------- */ | |||
| table { | |||
| display: block; | |||
| overflow: auto; | |||
| } | |||
| /* Syntax highlighting ---------------------------------------------------- */ | |||
| pre { | |||
| word-wrap: normal; | |||
| word-break: normal; | |||
| border: 1px solid #eee; | |||
| } | |||
| pre, code { | |||
| background-color: #f8f8f8; | |||
| color: #333; | |||
| } | |||
| pre code { | |||
| overflow: auto; | |||
| word-wrap: normal; | |||
| white-space: pre; | |||
| } | |||
| pre .img { | |||
| margin: 5px 0; | |||
| } | |||
| pre .img img { | |||
| background-color: #fff; | |||
| display: block; | |||
| height: auto; | |||
| } | |||
| code a, pre a { | |||
| color: #375f84; | |||
| } | |||
| a.sourceLine:hover { | |||
| text-decoration: none; | |||
| } | |||
| .fl {color: #1514b5;} | |||
| .fu {color: #000000;} /* function */ | |||
| .ch,.st {color: #036a07;} /* string */ | |||
| .kw {color: #264D66;} /* keyword */ | |||
| .co {color: #888888;} /* comment */ | |||
| .message { color: black; font-weight: bolder;} | |||
| .error { color: orange; font-weight: bolder;} | |||
| .warning { color: #6A0366; font-weight: bolder;} | |||
| /* Clipboard --------------------------*/ | |||
| .hasCopyButton { | |||
| position: relative; | |||
| } | |||
| .btn-copy-ex { | |||
| position: absolute; | |||
| right: 0; | |||
| top: 0; | |||
| visibility: hidden; | |||
| } | |||
| .hasCopyButton:hover button.btn-copy-ex { | |||
| visibility: visible; | |||
| } | |||
| /* headroom.js ------------------------ */ | |||
| .headroom { | |||
| will-change: transform; | |||
| transition: transform 200ms linear; | |||
| } | |||
| .headroom--pinned { | |||
| transform: translateY(0%); | |||
| } | |||
| .headroom--unpinned { | |||
| transform: translateY(-100%); | |||
| } | |||
| /* mark.js ----------------------------*/ | |||
| mark { | |||
| background-color: rgba(255, 255, 51, 0.5); | |||
| border-bottom: 2px solid rgba(255, 153, 51, 0.3); | |||
| padding: 1px; | |||
| } | |||
| /* vertical spacing after htmlwidgets */ | |||
| .html-widget { | |||
| margin-bottom: 10px; | |||
| } | |||
| /* fontawesome ------------------------ */ | |||
| .fab { | |||
| font-family: "Font Awesome 5 Brands" !important; | |||
| } | |||
| /* don't display links in code chunks when printing */ | |||
| /* source: https://stackoverflow.com/a/10781533 */ | |||
| @media print { | |||
| code a:link:after, code a:visited:after { | |||
| content: ""; | |||
| } | |||
| } | |||
| @@ -0,0 +1,113 @@ | |||
| /* http://gregfranko.com/blog/jquery-best-practices/ */ | |||
| (function($) { | |||
| $(function() { | |||
| $('.navbar-fixed-top').headroom(); | |||
| $('body').css('padding-top', $('.navbar').height() + 10); | |||
| $(window).resize(function(){ | |||
| $('body').css('padding-top', $('.navbar').height() + 10); | |||
| }); | |||
| $('body').scrollspy({ | |||
| target: '#sidebar', | |||
| offset: 60 | |||
| }); | |||
| $('[data-toggle="tooltip"]').tooltip(); | |||
| var cur_path = paths(location.pathname); | |||
| var links = $("#navbar ul li a"); | |||
| 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 | |||
| if (pos >= 0) { | |||
| var menu_anchor = $(links[pos]); | |||
| menu_anchor.parent().addClass("active"); | |||
| menu_anchor.closest("li.dropdown").addClass("active"); | |||
| } | |||
| }); | |||
| function paths(pathname) { | |||
| 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 --------------------------*/ | |||
| function changeTooltipMessage(element, msg) { | |||
| var tooltipOriginalTitle=element.getAttribute('data-original-title'); | |||
| element.setAttribute('data-original-title', msg); | |||
| $(element).tooltip('show'); | |||
| element.setAttribute('data-original-title', tooltipOriginalTitle); | |||
| } | |||
| if(ClipboardJS.isSupported()) { | |||
| $(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>"; | |||
| $(".examples, div.sourceCode").addClass("hasCopyButton"); | |||
| // Insert copy buttons: | |||
| $(copyButton).prependTo(".hasCopyButton"); | |||
| // Initialize tooltips: | |||
| $('.btn-copy-ex').tooltip({container: 'body'}); | |||
| // Initialize clipboard: | |||
| var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { | |||
| text: function(trigger) { | |||
| return trigger.parentNode.textContent; | |||
| } | |||
| }); | |||
| clipboardBtnCopies.on('success', function(e) { | |||
| changeTooltipMessage(e.trigger, 'Copied!'); | |||
| e.clearSelection(); | |||
| }); | |||
| clipboardBtnCopies.on('error', function() { | |||
| changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); | |||
| }); | |||
| }); | |||
| } | |||
| })(window.jQuery || window.$) | |||
| @@ -0,0 +1,5 @@ | |||
| pandoc: 2.8.1 | |||
| pkgdown: 1.4.1 | |||
| pkgdown_sha: ~ | |||
| articles: [] | |||
| @@ -30,12 +30,14 @@ tmp_html_sol <- tempfile("solution", fileext = ".html") | |||
| rmarkdown::render( | |||
| input = css_ex, | |||
| output_file = tmp_html_init, | |||
| output_options = list(version = "initial") | |||
| output_options = list(version = "initial"), | |||
| quiet = TRUE | |||
| ) | |||
| rmarkdown::render( | |||
| input = css_ex, | |||
| output_file = tmp_html_sol, | |||
| output_options = list(version = "solution") | |||
| output_options = list(version = "solution"), | |||
| quiet = TRUE | |||
| ) | |||
| # View tmp_html_init/sol | |||
| @@ -0,0 +1,71 @@ | |||
| url: https://pkg.garrickadenbuie.com/js4shiny/ | |||
| authors: | |||
| Garrick Aden-Buie: | |||
| href: https://www.garrickadenbuie.com | |||
| navbar: | |||
| structure: | |||
| left: | |||
| - home | |||
| - intro | |||
| - reference | |||
| - articles | |||
| - tutorials | |||
| right: | |||
| - news | |||
| - github | |||
| - garrick | |||
| components: | |||
| home: | |||
| icon: ~ | |||
| text: Overview | |||
| href: index.html | |||
| reference: | |||
| text: Reference | |||
| href: reference/index.html | |||
| news: | |||
| icon: fa fa-newspaper-o fa-lg | |||
| href: news/index.html | |||
| text: "" | |||
| title: "Changelog" | |||
| github: | |||
| icon: fa-github fa-lg | |||
| href: https://github.com/gadenbuie/js4shiny | |||
| garrick: | |||
| icon: fa-home fa-lg | |||
| href: https://garrickadenbuie.com | |||
| title: Garrick Aden-Buie | |||
| twitter: | |||
| icon: fa-twitter fa-lg | |||
| href: https://twitter.com/grrrck | |||
| reference: | |||
| - title: REPL | |||
| desc: Real Time Web Development Tinkering in RStudio | |||
| contents: | |||
| - '`repl`' | |||
| - title: Literate JavaScript Documents | |||
| desc: Live JavaScript in R Markdown | |||
| contents: | |||
| - '`js4shiny_rmd`' | |||
| - starts_with("html_document") | |||
| - title: Web Development Helpers | |||
| desc: Utilities and snippets to improve the web dev experience in RStudio | |||
| contents: | |||
| - '`mdn_search`' | |||
| - '`snippets_install`' | |||
| - '`launch_shiny_in`' | |||
| - title: Data Sets | |||
| desc: ~ | |||
| contents: | |||
| - '`first_sentences`' | |||
| - '`us_cities_ranked`' | |||
| - title: HTML and Knitr Dependencies | |||
| desc: Helpers and dependencies exported for hackers | |||
| contents: | |||
| - '`html_dependency_js4shiny`' | |||
| - '`html_setup`' | |||
| - '`knitr_js_engine`' | |||
| - '`register_knitr`' | |||
| @@ -0,0 +1,7 @@ | |||
| # installs dependencies, runs R CMD check, runs covr::codecov() | |||
| do_package_checks() | |||
| if (ci_on_travis()) { | |||
| # creates pkgdown site and pushes to gh-pages branch | |||
| do_pkgdown() | |||
| } | |||