@@ -18,38 +18,36 @@ async function init() {
1818 try {
1919 await wait ( 1000 ) ;
2020
21- console . log ( "timeout" ) ;
21+ // console.log("timeout");
2222
2323 const copyBtnList = document . getElementsByClassName ( "copy" ) ;
24- console . log ( copyBtnList ) ;
25- console . log ( copyBtnList . length ) ;
24+ // console.log(copyBtnList);
25+ // console.log(copyBtnList.length);
2626
2727 for ( let i = 0 ; i < copyBtnList . length ; i ++ ) {
2828 const btn = copyBtnList [ i ] ;
2929 btn . addEventListener ( "touchend" , async ( ) => {
3030 // 请求剪贴板权限
3131 await requestClipboardPermission ( ) ;
32-
33- alert ( "touchend" ) ;
3432 const parentDiv = btn . parentNode ;
3533 const codeElem = parentDiv . querySelector ( "code" ) ;
3634 const spans = [ ...codeElem . querySelectorAll ( "span" ) ] ;
3735 const textToCopy = [
3836 ...new Set ( spans . map ( ( span ) => span . textContent ) ) ,
3937 ] . join ( "" ) ;
40- console . log ( textToCopy ) ;
38+ // console.log(textToCopy);
4139
4240 try {
4341 await navigator . clipboard . writeText ( textToCopy ) ;
44- console . log ( "Text copied to clipboard" ) ;
42+ // console.log("Text copied to clipboard");
4543 } catch ( error ) {
4644 const textarea = document . createElement ( "textarea" ) ;
4745 textarea . value = textToCopy ;
4846 document . body . appendChild ( textarea ) ;
4947 textarea . select ( ) ;
5048 document . execCommand ( "copy" ) ;
5149 document . body . removeChild ( textarea ) ;
52- console . log ( "Text copied to clipboard" ) ;
50+ // console.log("Text copied to clipboard");
5351 }
5452 } ) ;
5553 }
0 commit comments