├── icon48.png ├── background.js ├── README.md ├── manifest.json └── contentscript.js /icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iiilin/PiPiGuiOnPC/HEAD/icon48.png -------------------------------------------------------------------------------- /background.js: -------------------------------------------------------------------------------- 1 | chrome.browserAction.onClicked.addListener(function (activeTab) { 2 | var newURL = "https://m.pipigui.cc/"; 3 | chrome.tabs.create({ url: newURL }); 4 | }); 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PiPiGui On PC 2 | 3 | **使用方法** 4 | 1. 下载解压 5 | 2. 打开 chrome 扩展页面(或者直接访问 `chrome://extensions/`) 6 | 3. 点开右边的开发者按钮 7 | 4. 加载已解压的扩展程序,选择 PiPiGuiOnPc 这个文件夹就好了 8 | 9 | **其他** 10 | 只修改了` *://*.pipigui.cc/*` 下的 UA ,所以访问其他网站 `navigator.userAgent` 和 `navigator.platform `的值仍然是系统的,不用担心 11 | 12 | **修改** 13 | 14 | 如果其他网站也有这种套路:**前端验证指定 UA 或者 JS 某些属性的**,也可以用类似的思路搞定,具体参考上面的 Stack Overflow 的链接啦加油 15 | 16 | 17 | 18 | Chrome 70.0.3538.77(正式版本)(64 位) 19 | 2018.11.10 20 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PiPiGui on PC", 3 | "description": "For yayayayayayayayaya", 4 | "version": "1.0", 5 | "manifest_version": 2, 6 | "content_scripts": [{ 7 | "run_at": "document_start", 8 | "js": ["contentscript.js"], 9 | "matches": [ 10 | "*://*.pipigui.cc/*" 11 | ] 12 | }], 13 | "icons": { 14 | "48": "icon48.png" 15 | }, 16 | "background": { 17 | "scripts": ["background.js"] 18 | }, 19 | "browser_action": { 20 | "default_icon": { 21 | "48": "icon48.png" 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /contentscript.js: -------------------------------------------------------------------------------- 1 | var actualCode = '(' + function() { 2 | 'use strict'; 3 | var navigator = window.navigator; 4 | var modifiedNavigator; 5 | if ('userAgent' in Navigator.prototype) { 6 | // Chrome 43+ moved all properties from navigator to the prototype, 7 | // so we have to modify the prototype instead of navigator. 8 | modifiedNavigator = Navigator.prototype; 9 | 10 | } else { 11 | // Chrome 42- defined the property on navigator. 12 | modifiedNavigator = Object.create(navigator); 13 | Object.defineProperty(window, 'navigator', { 14 | value: modifiedNavigator, 15 | configurable: false, 16 | enumerable: false, 17 | writable: false 18 | }); 19 | } 20 | // Pretend to be Windows XP 21 | Object.defineProperties(modifiedNavigator, { 22 | userAgent: { 23 | value: 'Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MIX 2 Build/OPR1.170623.027) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.2.2', 24 | configurable: false, 25 | enumerable: true, 26 | writable: false 27 | }, 28 | appVersion: { 29 | value: 'Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MIX 2 Build/OPR1.170623.027) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.2.2', 30 | configurable: false, 31 | enumerable: true, 32 | writable: false 33 | }, 34 | platform: { 35 | value: 'Android', 36 | configurable: false, 37 | enumerable: true, 38 | writable: false 39 | }, 40 | }); 41 | } + ')();'; 42 | 43 | var s = document.createElement('script'); 44 | s.textContent = actualCode; 45 | document.documentElement.appendChild(s); 46 | s.remove(); 47 | --------------------------------------------------------------------------------