CI updated the documentation
This commit is contained in:
21
docs/v0.0.1/assets/versionsMenu.js
Normal file
21
docs/v0.0.1/assets/versionsMenu.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { DOC_VERSIONS } from '../../versions.js';
|
||||
|
||||
const select = document.getElementById('plugin-versions-select');
|
||||
|
||||
DOC_VERSIONS.forEach((version) => {
|
||||
const option = document.createElement('option');
|
||||
option.value = version;
|
||||
option.innerHTML = version;
|
||||
select.appendChild(option);
|
||||
});
|
||||
|
||||
const locationSplit = location.pathname.split('/');
|
||||
const thisVersion = locationSplit.find((path) => ['stable', 'dev', ...DOC_VERSIONS].includes(path));
|
||||
select.value = DOC_VERSIONS.includes(thisVersion)
|
||||
? thisVersion
|
||||
: DOC_VERSIONS[0];
|
||||
select.onchange = () => {
|
||||
const newPaths = window.location.pathname.replace(`/${thisVersion}/`, `/${select.value}/`);
|
||||
const newUrl = new URL(newPaths, window.location.origin);
|
||||
window.location.assign(newUrl);
|
||||
};
|
||||
Reference in New Issue
Block a user