cppreference Vector Layout

Changes the layout of Wikipedia to the old version

目前為 2023-09-05 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name cppreference Vector Layout
  3. // @namespace http://melashri.net/cppreference
  4. // @version 0.1
  5. // @description Changes the layout of Wikipedia to the old version
  6. // @author Mohamed Elashri
  7. // @match https://*.cppreference.com/*
  8. // @run-at document-start
  9. // @grant none
  10. // @homepage https://github.com/MohamedElashri/vector_cppreference
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. var currentURL = window.location.href;
  17. var questionMarkIndex = currentURL.indexOf('?');
  18. var hashIndex = currentURL.indexOf('#');
  19. if(currentURL.includes("useskin=vector")===false){
  20. if(questionMarkIndex !== -1){
  21. if(hashIndex !== -1){
  22. window.location.replace (currentURL.substring(0, hashIndex) + "&useskin=vector" + currentURL.substring(hashIndex));
  23. }
  24. else{
  25. window.location.replace (currentURL + "&useskin=vector");
  26. }
  27. }
  28. else if(hashIndex !== -1){
  29. window.location.replace (currentURL.substring(0, hashIndex) + "?useskin=vector" + currentURL.substring(hashIndex));
  30. }
  31. else{
  32. window.location.replace (currentURL + "?useskin=vector");
  33. }
  34. }
  35.  
  36. })();