File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = isProd =>
2
+ `// ==UserScript==
3
+ // @name GitHub 工具箱
4
+ // @name:en GitHub ToolBox
5
+ // @version 1.0.0
6
+ // @description 添加用VS Code阅读代码按钮(github1s)
7
+ // @description:en Read code with VS Code(github1s)
8
+ // @author sakura-flutter
9
+ // @namespace https://github.com/sakura-flutter/tampermonkey-scripts
10
+ // @license MIT
11
+ // @compatible chrome Latest
12
+ // @compatible firefox Latest
13
+ // @compatible edge Latest
14
+ // @noframes
15
+ // @grant window.onurlchange
16
+ // @match https://github.com/*
17
+ // ==/UserScript==
18
+ `
Original file line number Diff line number Diff line change
1
+ import { $ } from '@/utils/selector'
2
+
3
+ function insert1sButton ( ) {
4
+ const actions = $ ( '.pagehead-actions' )
5
+ if ( actions == null || $ ( '#github1s-button' ) ) return
6
+
7
+ const btnHTML = '<li><a id="github1s-button" class="btn btn-sm" target="_blank">Github1s</a></li>'
8
+ actions . insertAdjacentHTML ( 'afterBegin' , btnHTML )
9
+ $ ( '#github1s-button' ) . onmouseenter = function ( ) {
10
+ const github1sURL = new URL ( location )
11
+ github1sURL . host = 'github1s.com'
12
+ this . href = github1sURL . href
13
+ }
14
+ }
15
+
16
+ insert1sButton ( )
17
+ window . addEventListener ( 'urlchange' , info => {
18
+ setTimeout ( insert1sButton , 200 )
19
+ } )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module.exports = (env, argv) => ({
21
21
widescreen : './src/scripts/widescreen' ,
22
22
redirect : './src/scripts/redirect' ,
23
23
pixiv : './src/scripts/pixiv' ,
24
+ github : './src/scripts/github' ,
24
25
'view-ui' : './src/scripts/view-ui' ,
25
26
'element-ui' : './src/scripts/element-ui' ,
26
27
'mdn-web-docs' : './src/scripts/mdn-web-docs' ,
You can’t perform that action at this time.
0 commit comments