undeexcepturi
Version:
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.
29 lines (24 loc) • 786 B
JavaScript
function load() {
const versions = document.querySelectorAll('.navbar .dropdown ul a');
const types = [`/docs/next`, `/docs`];
let i = 0;
for (const el of versions) {
const match = el.href.match(/\/docs\/(\d+\.\d+(\.\d+)?)$/) || el.href.match(/\/docs\/(\d+\.\d+(\.\d+)?)/);
const version = (types[i++] || match[0]).replace('/docs', '/api');
if (el.classList.contains('api-version-bound')) {
continue;
}
el.addEventListener('click', (e) => {
if (window.location.pathname.startsWith(`/api`)) {
window.location.href = version;
e.preventDefault();
}
});
el.classList.add('api-version-bound');
}
}
setInterval(() => {
if (document.querySelectorAll('.navbar .dropdown ul a').length > 0) {
load();
}
}, 500);