orna codex lang switcher

orna codex lang switcher!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         orna codex lang switcher
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  orna codex lang switcher!
// @author       Rplus
// @match        https://playorna.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=playorna.com
// @grant        none
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';
  let qs = new URLSearchParams(location.search);
  let nav = document.querySelector('#nav');
  let a = nav.querySelector('a.nav-item');
  let a_en = a.cloneNode();
  let a_zh = a.cloneNode();

  a_zh.textContent = 'zh';
  qs.set('lang', 'zh-hant');
  a_zh.href = '?' + qs.toString();

  a_en.textContent = 'en';
  qs.set('lang', 'en');
  a_en.href = '?' + qs.toString();

  nav.append(a_en);
  nav.append(a_zh);
})();