File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1
1
<% - include (' partial/header' ); %>
2
2
<% - include (' widget/search' ,{type: " list" }); %>
3
+ <script src =" https://unpkg.com/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js" ></script >
4
+ <script >
5
+ function copied (target , str ) {
6
+ target .classList .add (' active' );
7
+ copyTextToClipboard (target .dataset .code , function () {
8
+ setTimeout (() => {
9
+ target .classList .remove (' active' );
10
+ }, 2000 );
11
+ });
12
+ }
13
+ </script >
14
+
3
15
<div class =" markdown-body" >
4
16
<% if (md_path){ % >
5
17
< span class = " edit_btn" >
Original file line number Diff line number Diff line change @@ -55,6 +55,50 @@ mq-mobile = "screen and (max-width: 479px)"
55
55
}
56
56
}
57
57
58
+
59
+ .markdown-body pre [class* = "language-" ] {
60
+ position : relative ;
61
+ }
62
+ .markdown-body pre [class* = "language-" ] .copied {
63
+ visibility : hidden ;
64
+ display : flex ;
65
+ position : absolute ;
66
+ cursor : pointer ;
67
+ color : #a5 af bb ;
68
+ top : 6px ;
69
+ right : 6px ;
70
+ border-radius : 5px ;
71
+ background : #e3 e3 e3 ;
72
+ padding : 6px ;
73
+ font-size : 12px ;
74
+ transition : all .3s ;
75
+ }
76
+ .markdown-body pre [class* = "language-" ]:hover .copied {
77
+ visibility : visible ;
78
+ }
79
+ .markdown-body pre [class* = "language-" ]:hover .copied :hover {
80
+ background : #4c af 50 ;
81
+ color : #f f f ;
82
+ }
83
+ .markdown-body pre [class* = "language-" ]:hover .copied :active ,
84
+ .markdown-body pre [class* = "language-" ] .active {
85
+ background : #2e 9b 33 ;
86
+ color : #f f f ;
87
+ }
88
+
89
+ .markdown-body pre [class* = "language-" ] .copied .octicon-copy {
90
+ display : block ;
91
+ }
92
+ .markdown-body pre [class* = "language-" ] .copied .octicon-check {
93
+ display : none ;
94
+ }
95
+ .markdown-body pre [class* = "language-" ] .active .octicon-copy {
96
+ display : none ;
97
+ }
98
+ .markdown-body pre [class* = "language-" ] .active .octicon-check {
99
+ display : block ;
100
+ }
101
+
58
102
.markdown-body .octicon {
59
103
display : inline-block ;
60
104
fill : currentColor ;
You can’t perform that action at this time.
0 commit comments