Skip to content

Commit 7d2de0d

Browse files
save file
1 parent a65b199 commit 7d2de0d

File tree

1 file changed

+50
-103
lines changed

1 file changed

+50
-103
lines changed

utils/editors/srcdoc/srcdoc.html

Lines changed: 50 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,53 @@
99
<html>
1010

1111
<head>
12-
13-
<title>srcdoc</title>
14-
<meta name=description content='Load and render remote HTML with full header control using fetch and iframe srcdoc. A powerful tool for developers who need dynamic previews, authentication, or custom request handling'>
12+
<meta charset=utf-8>
13+
14+
<title>
15+
srcdoc
16+
</title>
1517

16-
<base href='https://javascript-2020.github.io/utils/editors/srcdoc/srcdoc.html'>
18+
<meta name=description content='Load and render remote HTML with full header control using fetch and iframe srcdoc. A powerful tool for developers who need dynamic previews, authentication, or custom request handling.'>
19+
20+
<base href='https://ext-code.com/utils/editors/srcdoc/'>
1721
<link rel=canonical href='https://ext-code.com/utils/editors/srcdoc/srcdoc.html'>
1822

1923
<meta name=viewport content='width=device-width, initial-scale=1'>
20-
<link rel=icon type='image/png' href='images/srcdoc.png'>
24+
<link rel=icon type='image/png' href='iVBORw0KGgoAAAANSUhEUgAAACgAAAAsCAMAAAAgsQpJAAAAWlBMVEVHcExXpP9XpP9XpP9XpP9XpP9XpP9bpv9WpP9XpP9XpP9XpP9XpP9Wo/9XpP9XpP9XpP9XpP9XpP9XpP9Zpv9WpP9XpP+cyv+Txf9/uv91tf9iqv+KwP9rr/9r+fBYAAAAF3RSTlMAHeFk6nAK/Xs0BNNJwicTpLfdP/WSXXgcQWoAAAGfSURBVDjLvZRZtoMgEAWFqCgqGDCRqfe/zQeSAQIZvl7lHPNTQjf2pWkC6HqqMvdNRn8mdbZLbiJhVA1NSG4iofcablvbp9lzzoQulztEeXqYbJ0mQWyJUbsjy7klQxT9K0ONhYBSBgDsEpfsMGpqXIiFsP1uUpFmRBFcNFORreeEpTtEqw0JZiqiy5pyirV7iH7ZugJljEn8g/j4EKlIUQ1aiuOES6axFHltyq68FH+u8Wexl3OJ7CvNiLZEVJqhY43+P5rhXWVyO1SKbJlKlrHhUaTPZnzAMsbjfOSMjXMwzZLReo1XvEVu18DWDrSMQrg4wOUYgYoorKzpF/NyE2jMiihcUCIqozLxhSgq0Lu2GtwX0VnrdgMKrH6KlD8DwOkh6hBqZY3f3UfxLvooiBshAUEE4rd0x8NadRf5tbsTEhBEB35nbVUs4VONyq8JEL0vXWt9lKiSrtMo+AQ8zlGrlwNPoyDGD1+mzxNAV6tzYOLV6RnPcSTF1t5mcw5jJlnBKA/mdojzGWZ8xi1+R4ulH8Hj5//l6T2SPsr5A6avRJ8t3CbuAAAAAElFTkSuQmCC'>
2125

26+
<script type='application/ld+json'>
27+
{
28+
"@context" : "https://schema.org",
29+
"@type" : "SoftwareApplication",
30+
"name" : "srcdoc",
31+
"url" : "https://ext-code.com/utils/editors/srcdoc/srcdoc.html",
32+
"author" : {"@type":"Person","name":"Matthew Richards"},
33+
"description" : "Load and render remote HTML with full header control using fetch and iframe srcdoc. A powerful tool for developers who need dynamic previews, authentication, or custom request handling.",
34+
"applicationCategory" : "DeveloperApplication",
35+
"operatingSystem" : "All",
36+
"browserRequirements" : "Requires JavaScript-enabled browser",
37+
"softwareVersion" : "1.0.0",
38+
"offers" : {"@type":"Offer","price":"0","priceCurrency":"GBP"}
39+
}
40+
</script>
41+
2242

2343
<script src='https://libs.ext-code.com/js/dom/component/component.js'></script>
2444

2545
<script init>
2646
console.clear();
47+
console.log('srcdoc.html');
48+
console.log();
2749
console.json=v=>console.log(JSON.stringify(v));
28-
var version = 'v1.0';
50+
var df=true,version='v2.0'
51+
;
2952

30-
var df = true;
31-
32-
3353
var ext;
3454
var $;
3555
var datatype;
56+
var menumod;
57+
var keydown;
58+
var debug;
3659
var github;
3760

3861

@@ -42,86 +65,27 @@
4265
await initdom(document.body);
4366

4467

45-
init.complete();
46-
47-
48-
4968
}//init
5069

5170

52-
//:
53-
54-
55-
init.stack = [];
56-
init.stack.ct = 0;
57-
init.stack.total = 1;
58-
init.stack.mode = '';
59-
init.stack.complete = false;
60-
Object.defineProperty(init.stack,'add',{get:()=>{
61-
init.stack.total++;
62-
init.stack.mode && console[init.stack.mode]('add',init.stack.ct,init.stack.total);
63-
}});
64-
Object.defineProperty(init.stack,'complete',{get:()=>{
65-
init.stack.ct++;
66-
init.stack.mode && console[init.stack.mode]('complete',init.stack.ct,init.stack.total);
67-
init.stack.ct>=init.stack.total && init();
68-
}});
69-
70-
// (typeof init!='undefined' && init?.stack && init.stack.add)
71-
// (typeof init!='undefined' && init?.stack && init.stack.complete)
72-
73-
74-
init.complete = function(){
75-
76-
init.complete.stack.forEach(fn=>setTimeout(fn,50));
77-
78-
}//complete
79-
80-
init.complete.stack = [];
81-
init.complete.add = fn=>init.complete.stack.push(fn);
82-
83-
84-
8571
(async()=>{
86-
87-
init.stack.add;
8872

73+
mod.stack.add;
8974

90-
var url;
91-
var headers;
92-
var token = localStorage['github-token'];
93-
if(token){
94-
url = 'https://api.github.com/repos/javascript-2020/ext-code/contents/ext-loader.js';
95-
headers = {accept:'application/vnd.github.raw',authorization:`bearer ${token}`};
96-
}else{
97-
url = 'https://raw.githubusercontent.com/javascript-2020/ext-code/main/ext-loader.js';
98-
}
99-
100-
var res = await fetch(url,{headers});
101-
var txt = await res.text();
102-
103-
if(res.headers.get('content-type').includes('json')){
104-
console.log('*** ext : json');
105-
var json = JSON.parse(txt);
106-
var b64 = json.content;
107-
txt = atob(b64);
108-
}else{
109-
console.log('*** ext : text');
110-
}
111-
112-
ext = eval(txt);
113-
114-
75+
({ext} = await import('https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js'));
76+
11577
var promise = ext.load.libs(
116-
'js/dom/$.js.api',
78+
'js/dom/$.js',
11779
'js/core/datatype.js',
118-
'github/github.js.api'
80+
'js/dom/menumod/menumod.js',
81+
'js/dom/keydown/keydown.js',
82+
'js/debug/debug.js',
83+
'js/io/github/github.js',
11984
);
120-
[$,datatype,github] = await promise;
121-
122-
123-
init.stack.complete;
124-
85+
[$,datatype,menumod,keydown,debug,github] = await promise;
86+
87+
mod.stack.complete;
88+
12589
})();
12690

12791
</script init>
@@ -181,7 +145,7 @@
181145

182146

183147
<script>
184-
debug(version);
148+
185149

186150
var input;
187151
var iframe;
@@ -302,32 +266,15 @@
302266

303267
input.value = json.url;
304268

305-
if(json.auto!==false){
306-
btn.go();
307-
}
308-
309269
}//load
310270

311271

312-
//:
313272

314273

315-
function debug(){
316-
317-
if(!df){
318-
return;
319-
}
320-
var str = [...arguments].join(' ');
321-
console.log(`[ srcdoc ]`,str);
322-
323-
}//debug
324-
325-
326-
327-
328-
init.stack.complete;
329-
330-
331274
</script>
332275

333-
</html>
276+
</html>
277+
278+
279+
280+

0 commit comments

Comments
 (0)