@@ -110,7 +110,7 @@ globalThis[name] = function copyClickedImages() {
110
110
111
111
const tap = document . createElement ( "div" ) ;
112
112
const rect = overlay . getBoundingClientRect ( ) ;
113
- console . log ( rect ) ;
113
+ // console.log(rect);
114
114
const width = 64 ;
115
115
const height = 64 ;
116
116
const x = evt . clientX - width / 2 ;
@@ -159,15 +159,15 @@ globalThis[name] = function copyClickedImages() {
159
159
*/
160
160
function getImages ( clickedElements ) {
161
161
162
- console . log ( "clickedElements" , clickedElements ) ;
162
+ // console.log("clickedElements", clickedElements);
163
163
164
164
const first = firstImage ( clickedElements ) ;
165
- console . log ( "first" , first ) ;
165
+ // console.log("first", first);
166
166
167
167
return [ first ] ;
168
168
169
169
const leafElements = leaves ( clickedElements ) ;
170
- console . log ( "leafElements" , leafElements ) ;
170
+ // console.log("leafElements", leafElements);
171
171
172
172
/** @type { string[] } */
173
173
let images = [ ] ;
@@ -242,6 +242,18 @@ globalThis[name] = function copyClickedImages() {
242
242
return items . reduce ( ( path , node ) => commonPathToRoot ( node , path ) , undefined ) ;
243
243
}
244
244
245
+ async function main ( ) {
246
+ const images = await getClickedElements ( elements => {
247
+ const images = getImages ( elements ) ;
248
+ navigator . clipboard . writeText ( images . join ( "\n" ) ) ;
249
+ return images ;
250
+ } ) ;
251
+
252
+ return images ;
253
+ }
254
+
255
+ main ( ) . then ( images => console . log ( images ) ) ;
256
+
245
257
} ;
246
258
247
259
globalThis [ name ] ( ) ;
0 commit comments