prts redirector

auto redirect to desktop version

当前为 2020-11-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name prts redirector
  3. // @namespace https://github.com/x94fujo6rpg/SomeTampermonkeyScripts
  4. // @version 0.1
  5. // @description auto redirect to desktop version
  6. // @author x94fujo6
  7. // @match http://prts.wiki/*
  8. // @exclude http://prts.wiki/index.php?title=*&mobileaction=toggle_view_desktop
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. let link = window.location.href;
  16.  
  17. if (!link.includes("prts.wiki/w/")) return;
  18. if (link.includes("toggle_view_desktop")) return;
  19.  
  20. link = link.replace("http://prts.wiki/w/", "").split("/");
  21.  
  22. let title = "";
  23. for (let index in link) {
  24. if (index == 0) {
  25. title += link[index];
  26. } else {
  27. title += `/${link[index]}`;
  28. }
  29. }
  30.  
  31. window.location.href = `http://prts.wiki/index.php?title=${title}&mobileaction=toggle_view_desktop`;
  32. })();