diff --git a/userstuff/hsmusic/Switch HSMusic websites.user.js b/userstuff/hsmusic/Switch HSMusic websites.user.js
new file mode 100644
index 0000000..47c2d0b
--- /dev/null
+++ b/userstuff/hsmusic/Switch HSMusic websites.user.js
@@ -0,0 +1,71 @@
+// ==UserScript==
+// @name Switch HSMusic websites
+// @description Then try to take over the world!
+// @include http://localhost:8002/*
+// @match https://hsmusic.wiki/*
+// @match https://preview.hsmusic.wiki/*
+// ==/UserScript==
+
+const header = document.getElementById('header');
+const page = header.parentElement;
+const headerContainer = document.createElement('div');
+const customNav = document.createElement('div');
+
+Object.assign(headerContainer.style, {
+ display: 'flex',
+ flexDirection: 'row',
+});
+Object.assign(header.style, {
+ flexGrow: '1',
+});
+Object.assign(customNav.style, {
+ minWidth: '140px',
+ textAlign: 'right',
+});
+
+page.replaceChild(headerContainer, header);
+headerContainer.appendChild(header);
+headerContainer.appendChild(customNav);
+
+const pathname = () => {
+ let p = location.pathname;
+ p = p.replace(/^\/preview-en/, '');
+ return p;
+};
+
+const customNavLink = (text, basenameOrFn) => {
+ const href = typeof basenameOrFn === 'function' ? basenameOrFn() : basenameOrFn + pathname();
+ const link = document.createElement('a');
+ link.appendChild(document.createTextNode(text));
+ link.setAttribute('href', href);
+ customNav.appendChild(link);
+ Object.assign(link.style, {
+ display: 'inline-block',
+ border: '1px dotted var(--primary-color)',
+ borderRadius: '2px',
+ padding: '2px 8px',
+ margin: '2px 2px',
+ background: '#000c',
+ });
+ if (location.href === href) {
+ Object.assign(link.style, {
+ fontWeight: '800',
+ borderStyle: 'solid',
+ });
+ }
+};
+
+customNavLink('L', 'http://localhost:8002');
+customNavLink('P', 'https://preview.hsmusic.wiki');
+customNavLink('R', 'https://hsmusic.wiki');
+
+let match = location.href.match(/album\/([^/]*)/);
+if (match) {
+ customNavLink('G', () => `https://github.com/hsmusic/hsmusic-data/tree/preview/album/${match[1]}.yaml`);
+}
+
+match = location.href.match(/track\/([^/]*)/);
+if (match) {
+ const directory = getComputedStyle(document.body).getPropertyValue('--album-directory');
+ customNavLink('G', () => `https://github.com/hsmusic/hsmusic-data/tree/preview/album/${directory}.yaml`);
+}
|