Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanbuuren committed Jun 19, 2018
1 parent e94d00f commit 8223853
Show file tree
Hide file tree
Showing 166 changed files with 423 additions and 839 deletions.
7 changes: 2 additions & 5 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions docs/changes_mice3.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 18 additions & 21 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 99 additions & 24 deletions docs/pkgdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,70 @@
$('[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;
var path = paths(links[i].pathname);

var length = prefix_length(cur_path, path);
if (length > max_length) {
max_length = length;
pos = i;
$("#navbar ul li a").each(function(index, value) {
if (value.text == "Home")
return;
if (value.getAttribute("href") === "#")
return;

var path = paths(value.pathname);
if (is_prefix(cur_path, path)) {
// Add class to parent <li>, and enclosing <li> if in dropdown
var menu_anchor = $(value);
menu_anchor.parent().addClass("active");
menu_anchor.closest("li.dropdown").addClass("active");
}
}
});
});

// 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");
// 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();
});

function paths(pathname) {
var pieces = pathname.split("/");
pieces.shift(); // always starts with /
Expand All @@ -52,21 +93,21 @@
return(pieces);
}

function prefix_length(needle, haystack) {
if (needle.length > haystack.length)
return(0);
function is_prefix(needle, haystack) {
if (needle.length > haystack.lengh)
return(false);

// 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);
}

for (var i = 0; i < haystack.length; i++) {
if (needle[i] != haystack[i])
return(i);
return(false);
}

return(haystack.length);
return(true);
}

/* Clipboard --------------------------*/
Expand Down Expand Up @@ -108,3 +149,37 @@
});
}
})(window.jQuery || window.$)
/* 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;
}
4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pandoc: 1.19.2.1
pkgdown: 1.1.0
pkgdown_sha: ~
pkgdown: 1.0.0.9000
pkgdown_sha: ec07721af836595483aa678822a26c3f285c5ffa
articles: []
urls:
reference: http://stefvanbuuren.github.io/mice/reference
Expand Down
7 changes: 2 additions & 5 deletions docs/reference/D1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions docs/reference/D2.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions docs/reference/D3.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8223853

Please sign in to comment.