Last active
September 2, 2024 05:50
-
-
Save saviorxzero98/4529577a7f6626fd80c0ca59d59481c0 to your computer and use it in GitHub Desktop.
UserScrtip,進入將手機版網頁時自動切換至桌面版
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 進入將手機版網頁時自動切換至桌面版 | |
// @namespace http://tampermonkey.net/ | |
// @version 1.1 | |
// @description 進入將手機版網頁時自動切換至桌面版 | |
// @author saviorxzero98 | |
// @license MIT | |
// @match https://*.m.wikipedia.org/* | |
// @match https://ithelp.ithome.com.tw/m/* | |
// @match https://m.gamer.com.tw/* | |
// @match https://m.mobile01.com/* | |
// @updateURL https://gist.github.com/saviorxzero98/4529577a7f6626fd80c0ca59d59481c0/raw/MobileWeb2PC.user.js | |
// @grant none | |
// ==/UserScript== | |
function redirectToDesktopWeb(url, mobileHost, desktopHost) { | |
url = url.replace(mobileHost, desktopHost); | |
window.location.replace(url); | |
} | |
(function() { | |
window.stop(); | |
var url = document.URL; | |
if (url.includes("m.wikipedia.org")) { | |
redirectToDesktopWeb(url, "m.wikipedia.org", "wikipedia.org"); | |
} | |
else if (url.includes("ithelp.ithome.com.tw/m")) { | |
redirectToDesktopWeb(url, "ithelp.ithome.com.tw/m", "ithelp.ithome.com.tw"); | |
} | |
else if (url.includes("m.gamer.com.tw")) { | |
redirectToDesktopWeb(url, "m.gamer.com.tw", "www.gamer.com.tw"); | |
} | |
else if (url.includes("m.mobile01.com")) { | |
redirectToDesktopWeb(url, "m.mobile01.com", "www.mobile01.com"); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment