Wikipedia Simple Redirect with Button

Provide a button to switch to Simple Wikipedia

As of 18.02.2025. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey 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 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.

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

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

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         Wikipedia Simple Redirect with Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Provide a button to switch to Simple Wikipedia
// @author       Drewby123
// @match        https://en.wikipedia.org/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create a button to switch to Simple Wikipedia
    const button = document.createElement('button');
    button.textContent = 'Switch to Simple Wikipedia';
    button.style.position = 'fixed';
    button.style.bottom = '20px';
    button.style.right = '20px';
    button.style.backgroundColor = '#007bff';
    button.style.color = '#fff';
    button.style.border = 'none';
    button.style.padding = '10px 15px';
    button.style.borderRadius = '5px';
    button.style.cursor = 'pointer';
    button.style.zIndex = '1000';

    // Add button to the page
    document.body.appendChild(button);

    // On click, redirect to Simple Wikipedia
    button.addEventListener('click', () => {
        const currentUrl = window.location.href;
        if (currentUrl.includes('https://en.wikipedia.org/wiki/')) {
            const newUrl = currentUrl.replace('en.wikipedia.org', 'simple.wikipedia.org');
            window.location.href = newUrl;
        }
    });
})();