99 cors extension
1010 </ title >
1111
12+ < script src ='https://libs.ext-code.com/js/dom/component/component.js '> </ script >
13+ < script src ='https://libs.ext-code.com/js/dom/init-hdr/init-hdr.js '> </ script >
14+
1215 < style >
16+
1317 html
1418 {font-family : arial}
1519
1620 # hdr
1721 {display : flex;justify-content : space-between}
1822
19- .item
20- {display : flex; gap : 30 px }
23+ .desc
24+ {margin : 20 px 0 }
2125
22- .item a
23- {width : 200 px ; text-align : right }
26+ .download
27+ {text-decoration : underline; cursor : pointer }
2428
2529 </ style >
30+
2631 </ head >
2732
2833
5156
5257
5358 < div >
54- < div id =chrome style =' text-decoration:underline ' >
59+ < div id =chrome class = download >
5560 download chrome
5661 </ div >
57- < div id =firefox style =' text-decoration:underline ' >
62+ < div id =firefox class = download >
5863 download firefox
5964 </ div >
6065 </ div >
6671
6772 < script >
6873
69- var $ = ( root , css ) => ( ! css && ( css = root , root = document ) , root . querySelector ( css ) ) ;
74+ var df = true
75+ ;
7076
77+ var $ = ( root , css ) => ( ! css && ( css = root , root = document ) , root . querySelector ( css ) ) ;
7178
7279
73- window . onload = async function ( ) {
7480
81+ async function init ( ) {
82+ debug ( 'init' ) ;
7583 await libs ( ) ;
7684 initdom ( ) ;
7785
99107 //:
100108
101109
102- funciton initdom ( ) {
110+ function initdom ( ) {
103111
104112 $ ( '#chrome' ) . onclick = btn . chrome ;
105113 $ ( '#firefox' ) . onclick = btn . firefox ;
@@ -113,37 +121,29 @@ <h3>
113121 btn . chrome = function ( ) {
114122
115123 var dir = {
116- 'xml-http-request' :{ directory :{
117- 'xhr-upload.html' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/xhr-upload.html' } } } ,
118- 'upload-server.js' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/upload-server.js' } } } ,
119- 'xhr-download.html' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/xhr-download.html' } } } ,
120- 'download-server.js' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/download-server.js' } } } ,
121- node_modules : { directory :{
122- 'a.txt' : { file :{ contents :'a' } } ,
123- } }
124+ 'cors-chrome' :{ directory :{
125+ 'manifest.json' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/chrome/manifest.json' } } } ,
126+ 'extension.js' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/chrome/extension.js' } } } ,
127+ 'asterisk.png' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/chrome/asterisk.png' } } } ,
124128 } }
125129 } ;
126130
127- var blob = await create ( dir , { download :true , df :true } ) ;
131+ create ( dir , { download :'cors-chrome' , df :true } ) ;
128132 console . log ( 'zip' , blob . type , blob . size ) ;
129133 } //chrome
130134
131135
132136 btn . firefox = function ( ) {
133137
134138 var dir = {
135- 'xml-http-request' :{ directory :{
136- 'xhr-upload.html' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/xhr-upload.html' } } } ,
137- 'upload-server.js' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/upload-server.js' } } } ,
138- 'xhr-download.html' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/xhr-download.html' } } } ,
139- 'download-server.js' : { file :{ github :{ repo :'javascript-2020.github.io' , path :'/blog/25-07-31/xml-http-request/ex/download-server.js' } } } ,
140- node_modules : { directory :{
141- 'a.txt' : { file :{ contents :'a' } } ,
142- } }
139+ 'cors-firefox' :{ directory :{
140+ 'manifest.json' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/firefox/manifest.json' } } } ,
141+ 'extension.js' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/firefox/extension.js' } } } ,
142+ 'asterisk.png' : { file :{ github :{ repo :'browser-extensions' , path :'/cors/firefox/asterisk.png' } } } ,
143143 } }
144144 } ;
145145
146- var blob = await create ( dir , { download :true , df :true } ) ;
146+ create ( dir , { download :'cors-firefox' , df :true } ) ;
147147
148148 } //firefox
149149
@@ -152,10 +152,8 @@ <h3>
152152
153153
154154
155- console . log ( 'zip' , blob . type , blob . size ) ;
156-
157-
158-
155+
156+
159157 async function create ( dir , { download= true , test, df= false } = { } ) {
160158 df && console . log ( 'download' , ! ! download ) ;
161159 df && console . log ( 'test' , ! ! test ) ;
178176 if ( download ) {
179177 var url = window . URL . createObjectURL ( blob ) ;
180178 var a = document . createElement ( 'a' ) ;
181- a . download = 'https-file-server' ;
179+ a . download = download ;
182180 a . href = url ;
183181 a . click ( ) ;
184182 }
0 commit comments