Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions assets/js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,25 @@
return string.replace(/^\s+|\s+$/g, '')
}

/**
* credit: https://stackoverflow.com/a/13348618
*/
function isChrome() {
const isChromium = window.chrome;
const winNav = window.navigator;
const vendorName = winNav.vendor;
const isOpera = typeof window.opr !== "undefined";
const isIEedge = winNav.userAgent.indexOf("Edge") > -1;
const isIOSChrome = winNav.userAgent.match("CriOS");
return (
isIOSChrome ||
(isChromium !== null &&
isChromium !== undefined &&
vendorName === "Google Inc." &&
isOpera === false &&
isIEedge === false)
);
}
/*--------------------------------------------------------------------------*/

var Menu = React.createClass({
Expand Down Expand Up @@ -455,6 +474,13 @@
parent.appendChild(button)
})
}

if (location.hash && isChrome()) {
const hash = document.querySelector(location.hash);
if (hash) {
hash.scrollIntoView();
}
}
}

if (document.readyState == 'loading') {
Expand Down