Copy Wiki URL on Wikiwand

Allows to quickly copy wiki url on wikiwand page.

// ==UserScript==
// @name         Copy Wiki URL on Wikiwand
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Allows to quickly copy wiki url on wikiwand page.
// @author       psxvoid
// @match        https://www.wikiwand.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=wikiwand.com
// @grant        GM_registerMenuCommand
// @grant        GM_setClipboard
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

        GM_registerMenuCommand('Copy Wiki URL', () => {
            const wikiwandUrl = document.location.href;

            const lang = wikiwandUrl.match(/wikiwand\.com\/(.*)\//)[1];

            const wikiUrl = wikiwandUrl
              .replace("www.", "")
              .replace(`wikiwand.com/${lang}/`, `${lang}.wikipedia.org/wiki/`);


            GM_setClipboard(wikiUrl);
    }, 'r');
})();