doracoin revidoval tento gist . Přejít na revizi
1 file changed, 2 insertions, 2 deletions
gistfile1.txt
| @@ -1,8 +1,8 @@ | |||
| 1 | 1 | // ==UserScript== | |
| 2 | 2 | // @name 在Github和Deepwiki页面右下角添加互相跳转的浮动按钮 | |
| 3 | 3 | // @namespace https://greasyfork.org/zh-CN/scripts/535862-github-to-deepwiki-jump | |
| 4 | - | // @version 0.3 | |
| 5 | - | // @description 在Github和Deepwiki页面右下角添加互相跳转的浮动按钮 | |
| 4 | + | // @version 2025.09.15 | |
| 5 | + | // @description 一个小小的快捷方式,带来大大的方便 | |
| 6 | 6 | // @license MIT | |
| 7 | 7 | // @match https://github.com/* | |
| 8 | 8 | // @match https://deepwiki.com/* | |
doracoin revidoval tento gist . Přejít na revizi
1 file changed, 63 insertions
gistfile1.txt(vytvořil soubor)
| @@ -0,0 +1,63 @@ | |||
| 1 | + | // ==UserScript== | |
| 2 | + | // @name 在Github和Deepwiki页面右下角添加互相跳转的浮动按钮 | |
| 3 | + | // @namespace https://greasyfork.org/zh-CN/scripts/535862-github-to-deepwiki-jump | |
| 4 | + | // @version 0.3 | |
| 5 | + | // @description 在Github和Deepwiki页面右下角添加互相跳转的浮动按钮 | |
| 6 | + | // @license MIT | |
| 7 | + | // @match https://github.com/* | |
| 8 | + | // @match https://deepwiki.com/* | |
| 9 | + | // @icon https://github.githubassets.com/favicons/favicon.png | |
| 10 | + | // @grant none | |
| 11 | + | // @run-at document-end | |
| 12 | + | // @downloadURL https://update.greasyfork.org/scripts/535862/Github%20to%20Deepwiki%20Jump.user.js | |
| 13 | + | // @updateURL https://update.greasyfork.org/scripts/535862/Github%20to%20Deepwiki%20Jump.meta.js | |
| 14 | + | // ==/UserScript== | |
| 15 | + | ||
| 16 | + | (function() { | |
| 17 | + | 'use strict'; | |
| 18 | + | ||
| 19 | + | // 创建浮动按钮 | |
| 20 | + | function createFloatingButton() { | |
| 21 | + | const path = window.location.pathname; | |
| 22 | + | const button = document.createElement('a'); | |
| 23 | + | ||
| 24 | + | // 设置按钮样式 | |
| 25 | + | button.style.position = 'fixed'; | |
| 26 | + | button.style.right = '20px'; | |
| 27 | + | button.style.bottom = '20px'; | |
| 28 | + | button.style.backgroundColor = '#2b3137'; | |
| 29 | + | button.style.color = 'white'; | |
| 30 | + | button.style.padding = '10px 15px'; | |
| 31 | + | button.style.borderRadius = '5px'; | |
| 32 | + | button.style.textDecoration = 'none'; | |
| 33 | + | button.style.fontFamily = 'Arial, sans-serif'; | |
| 34 | + | button.style.fontWeight = 'bold'; | |
| 35 | + | button.style.zIndex = '9999'; | |
| 36 | + | button.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)'; | |
| 37 | + | ||
| 38 | + | // 根据当前域名设置不同的按钮文本和链接 | |
| 39 | + | if (window.location.hostname === 'deepwiki.com') { | |
| 40 | + | button.textContent = '返回GitHub'; | |
| 41 | + | button.href = `https://github.com${path}`; | |
| 42 | + | } else { | |
| 43 | + | button.textContent = '跳转Deepwiki'; | |
| 44 | + | button.href = `https://deepwiki.com${path}`; | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | button.target = '_blank'; | |
| 48 | + | ||
| 49 | + | // 添加悬停效果 | |
| 50 | + | button.addEventListener('mouseover', () => { | |
| 51 | + | button.style.backgroundColor = '#3f4a56'; | |
| 52 | + | }); | |
| 53 | + | button.addEventListener('mouseout', () => { | |
| 54 | + | button.style.backgroundColor = '#2b3137'; | |
| 55 | + | }); | |
| 56 | + | ||
| 57 | + | // 添加到页面 | |
| 58 | + | document.body.appendChild(button); | |
| 59 | + | } | |
| 60 | + | ||
| 61 | + | // 页面加载完成后创建按钮 | |
| 62 | + | window.addEventListener('load', createFloatingButton); | |
| 63 | + | })(); | |