File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 11const RENAME_FILE = 'Rename file' ;
2- const CDN = 'https://cdn.jsdelivr.net/gh/cloudcmd/user-menu@1.2.4' ;
2+ const CDN = 'https://cdn.jsdelivr.net' ;
3+ const CDN_GH = `${ CDN } /gh/cloudcmd/user-menu@1.2.4` ;
34
45export default {
56 '__settings' : {
@@ -10,13 +11,7 @@ export default {
1011 await DOM . renameCurrent ( ) ;
1112 } ,
1213
13- 'F6 - Copy URL to current file' : async ( { DOM } ) => {
14- const { copyURLToCurrentFile} = await import ( `${ CDN } /menu/copy-url-to-current-file.js` ) ;
15-
16- await copyURLToCurrentFile ( {
17- DOM ,
18- } ) ;
19- } ,
14+ 'F6 - Copy URL to current file' : runFromCDN ( 'copy-url-to-current-file' ) ,
2015
2116 'R - cd /' : async ( { CloudCmd} ) => {
2217 await CloudCmd . changeDir ( '/' ) ;
@@ -156,3 +151,18 @@ function compare(a, b) {
156151
157152 return result ;
158153}
154+
155+ const MAP = {
156+ 'copy-url-to-current-file' : 'copyURLToCurrentFile' ,
157+ } ;
158+
159+ function runFromCDN ( name ) {
160+ return async ( ...a ) => {
161+ const fnName = MAP [ name ] ;
162+ const {
163+ [ fnName ] : fn ,
164+ } = await import ( `${ CDN_GH } /menu/${ name } .js` ) ;
165+
166+ await fn ( ...a ) ;
167+ } ;
168+ }
You can’t perform that action at this time.
0 commit comments