Wikipedia Simple Redirect with Button

Provide a button to switch to Simple Wikipedia

当前为 2025-02-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Wikipedia Simple Redirect with Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Provide a button to switch to Simple Wikipedia
  6. // @author Drewby123
  7. // @match https://en.wikipedia.org/*
  8. // @grant GM_addStyle
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create a button to switch to Simple Wikipedia
  16. const button = document.createElement('button');
  17. button.textContent = 'Switch to Simple Wikipedia';
  18. button.style.position = 'fixed';
  19. button.style.bottom = '20px';
  20. button.style.right = '20px';
  21. button.style.backgroundColor = '#007bff';
  22. button.style.color = '#fff';
  23. button.style.border = 'none';
  24. button.style.padding = '10px 15px';
  25. button.style.borderRadius = '5px';
  26. button.style.cursor = 'pointer';
  27. button.style.zIndex = '1000';
  28.  
  29. // Add button to the page
  30. document.body.appendChild(button);
  31.  
  32. // On click, redirect to Simple Wikipedia
  33. button.addEventListener('click', () => {
  34. const currentUrl = window.location.href;
  35. if (currentUrl.includes('https://en.wikipedia.org/wiki/')) {
  36. const newUrl = currentUrl.replace('en.wikipedia.org', 'simple.wikipedia.org');
  37. window.location.href = newUrl;
  38. }
  39. });
  40. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址