qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

QMKLayout.vue (810B)


      1 <script setup>
      2 import DefaultTheme from 'vitepress/theme'
      3 import { useRouter } from 'vitepress'
      4 import { onBeforeMount } from 'vue';
      5 import aliases from "../../../../docs/_aliases.json";
      6 
      7 const router = useRouter()
      8 onBeforeMount(async () => {
      9     // Convert from docsify-style to vitepress-style URLs
     10     let newUrl = window.location.href.replace(/\/#\//, '/').replace(/\?id=/, '#');
     11 
     12     // Convert any aliases
     13     let testUrl = new URL(newUrl);
     14     while (testUrl.pathname in aliases) {
     15         testUrl.pathname = aliases[testUrl.pathname];
     16     }
     17     newUrl = testUrl.toString();
     18 
     19     // Redirect if required
     20     if (newUrl != window.location.href) {
     21         window.history.replaceState({}, '', newUrl);
     22         await router.go(newUrl);
     23     }
     24 });
     25 </script>
     26 
     27 <template>
     28     <DefaultTheme.Layout/>
     29 </template>