diff --git a/docs/docs/index.html b/docs/docs/index.html index 583986d6..620c2f92 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -27,20 +27,27 @@ plugins: [ function (hook, vm) { hook.ready(function() { - const version = window.location.host.match(/^[0-9\.|master|legacy]+/) || 'master'; - [].forEach.call(document.querySelectorAll('.app-nav a'), a => { - a.setAttribute('href', a.getAttribute('href').replace('https://', `https://${version}-`)) - }) - const $select = document.querySelector('[data-version]') - const $options = document.querySelectorAll(`[data-version] option`) - const $selectedOption = document.querySelector(`option[value="${version}"]`) - const selectedOptionIndex = Array.prototype.indexOf.call($options, $selectedOption) - $select.selectedIndex = selectedOptionIndex >= 0 ? selectedOptionIndex : 0 - $select.addEventListener('change', event => { - const version = event.target.value - const url = event.target.options[event.target.selectedIndex].dataset.url - window.location.href = url || `https://${version}-docs.syncano.io` - }) + setTimeout(() => { + const version = window.location.host.match(/^[0-9\.|master|legacy]+/) || 'master'; + + [].forEach.call(document.querySelectorAll('.app-nav a'), a => { + a.setAttribute('href', a.getAttribute('href').replace('https://', `https://${version}-`)) + }) + + const $select = document.querySelector('[data-version]') + const $options = document.querySelectorAll(`[data-version] option`) + const $selectedOption = document.querySelector(`option[value="${version}"]`) + const selectedOptionIndex = Array.prototype.indexOf.call($options, $selectedOption) + + $select.selectedIndex = selectedOptionIndex >= 0 ? selectedOptionIndex : 0 + + $select.addEventListener('change', event => { + const version = event.target.value + const url = event.target.options[event.target.selectedIndex].dataset.url + + window.location.href = url || `https://${version}-docs.syncano.io` + }) + }, 100); }) } ]