aboutsummaryrefslogtreecommitdiff
path: root/docs/pkgdown.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/pkgdown.js')
-rw-r--r--docs/pkgdown.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/docs/pkgdown.js b/docs/pkgdown.js
index de9bd72..087a762 100644
--- a/docs/pkgdown.js
+++ b/docs/pkgdown.js
@@ -2,14 +2,12 @@
(function($) {
$(function() {
- $("#sidebar")
- .stick_in_parent({offset_top: 40})
- .on('sticky_kit:bottom', function(e) {
- $(this).parent().css('position', 'static');
- })
- .on('sticky_kit:unbottom', function(e) {
- $(this).parent().css('position', 'relative');
- });
+ $('.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',
@@ -25,9 +23,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 +54,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 +81,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 +94,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;
}

Contact - Imprint