diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2019-01-31 15:35:31 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2019-01-31 15:40:09 +0100 |
commit | de040ca33f6b13ef89be89718510f30631b67903 (patch) | |
tree | 049ba22116371b4f578c0b315da15371c093ce51 /docs/pkgdown.js | |
parent | 47030f0342b66b1520b8a20844a0569d492d188e (diff) |
Static documentation rebuilt by pkgdown
Diffstat (limited to 'docs/pkgdown.js')
-rw-r--r-- | docs/pkgdown.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/docs/pkgdown.js b/docs/pkgdown.js index de9bd724..eb7e83d2 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -25,9 +25,13 @@ for (var i = 0; i < links.length; i++) { if (links[i].getAttribute("href") === "#") continue; - var path = paths(links[i].pathname); + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); - var length = prefix_length(cur_path, path); + var length = prefix_length(nav_path, cur_path); if (length > max_length) { max_length = length; pos = i; @@ -52,13 +56,14 @@ return(pieces); } + // Returns -1 if not found function prefix_length(needle, haystack) { if (needle.length > haystack.length) - return(0); + return(-1); // Special case for length-0 haystack, since for loop won't run if (haystack.length === 0) { - return(needle.length === 0 ? 1 : 0); + return(needle.length === 0 ? 0 : -1); } for (var i = 0; i < haystack.length; i++) { @@ -78,9 +83,9 @@ element.setAttribute('data-original-title', tooltipOriginalTitle); } - if(Clipboard.isSupported()) { + 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-hidden='true' data-toggle='tooltip' data-placement='left auto' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy' aria-hidden='true'></i></button>"; + 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"); @@ -91,7 +96,7 @@ $('.btn-copy-ex').tooltip({container: 'body'}); // Initialize clipboard: - var clipboardBtnCopies = new Clipboard('[data-clipboard-copy]', { + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { return trigger.parentNode.textContent; } |