Skip to content

Commit 57a3a82

Browse files
update
1 parent 4e6d35c commit 57a3a82

File tree

2 files changed

+304
-0
lines changed

2 files changed

+304
-0
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
2+
3+
<output-root>
4+
5+
<template shadowrootmode=open>
6+
7+
<style>
8+
9+
:host {display:flex;flex-direction:column;height:100%}
10+
11+
#hdr {display:flex}
12+
13+
#hldr {flex:1;box-sizing:border-box;position:relative}
14+
iframe {width:100%;height:100%}
15+
#glass {position:absolute;left:0;top:0;width:100%;height:100%;display:none}
16+
17+
</style>
18+
19+
<div id=hdr>
20+
<div style='flex:1'></div>
21+
<button id=kill style='margin-right:20px'>kill</button>
22+
</div>
23+
24+
<div id=hldr>
25+
<iframe></iframe>
26+
<div id=glass></div>
27+
</div>
28+
29+
</template>
30+
31+
<script>
32+
33+
function output(){
34+
true && console.log('output');
35+
var obj = {};
36+
37+
38+
obj.initmod=function(params){
39+
}//initmod
40+
41+
//vars:-
42+
43+
var hldr;
44+
var iframe;
45+
var glass;
46+
47+
48+
var btn = {};
49+
50+
//:
51+
52+
obj.init=function(){
53+
}//init
54+
55+
//:
56+
57+
obj.initdom=function(rootnode){
58+
59+
root = $.$(rootnode,'output-root');
60+
shadow = root.shadowRoot;
61+
62+
var style = $(shadow,'style');
63+
$.stylesheet.insert(style,'button','.icon');
64+
65+
66+
var hdr = $(shadow,'#hdr');
67+
68+
$(hdr,'#kill').onclick = btn.kill;
69+
70+
71+
hldr = $(shadow,'#hldr');
72+
iframe = $(shadow,'iframe');
73+
glass = $(shadow,'#glass');
74+
75+
76+
}//initdom
77+
78+
79+
btn.kill=function(){
80+
81+
kill();
82+
83+
}//kill
84+
85+
86+
obj.glass=function(show=true){
87+
88+
var display = 'none';
89+
if(show){
90+
display = 'block';
91+
}
92+
glass.style.display = display;
93+
94+
}//glass
95+
96+
97+
obj.horiz=function(){
98+
99+
iframe.style.width = '100%';
100+
iframe.style.height = '50%';
101+
102+
}//horiz
103+
104+
105+
obj.vert=function(){
106+
107+
iframe.style.width = '50%';
108+
iframe.style.height = '100%';
109+
110+
}//vert
111+
112+
113+
114+
obj.srcdoc=function(html){
115+
116+
iframe.srcdoc = html;
117+
118+
}//srcdoc
119+
120+
121+
obj.kill=function(){return kill()} //d
122+
123+
function kill(){
124+
125+
var niframe = iframe.cloneNode(true);
126+
niframe.srcdoc = null;
127+
hldr.replaceChild(niframe,iframe);
128+
iframe = niframe;
129+
130+
}//kill
131+
132+
133+
134+
135+
return obj;
136+
137+
}//output
138+
139+
</script>
140+
141+
</output-root>
142+
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
2+
3+
<output-html>
4+
5+
<template shadowrootmode=open>
6+
7+
<style>
8+
9+
:host
10+
{display:flex;flex-direction:column;height:100%}
11+
12+
#hdr
13+
{display:flex}
14+
15+
#hldr
16+
{flex:1;box-sizing:border-box;position:relative}
17+
iframe
18+
{width:100%;height:100%}
19+
#glass
20+
{position:absolute;left:0;top:0;width:100%;height:100%;display:none}
21+
22+
</style>
23+
24+
<div id=hdr>
25+
<div style='flex:1'></div>
26+
<button id=kill style='margin-right:20px'>kill</button>
27+
</div>
28+
29+
<div id=hldr>
30+
<iframe></iframe>
31+
<div id=glass></div>
32+
</div>
33+
34+
</template>
35+
36+
<script>
37+
38+
(function output_html({mod,dom,host}){
39+
40+
var obj = {
41+
version : 'v2.0',
42+
};
43+
44+
var ext,$;
45+
46+
obj.initmod=function(params){
47+
48+
ext = params.ext;
49+
$ = params.$;
50+
51+
}//initmod
52+
53+
54+
//vars:-
55+
56+
var hldr;
57+
var iframe;
58+
var glass;
59+
60+
61+
var btn = {};
62+
63+
64+
//:
65+
66+
67+
obj.init = async function(){
68+
}//init
69+
70+
71+
//:
72+
73+
74+
obj.initdom = function(rootnode){
75+
76+
root = $.$(rootnode,'output-root');
77+
shadow = root.shadowRoot;
78+
79+
var style = $(shadow,'style');
80+
$.stylesheet.insert(style,'button','.icon');
81+
82+
83+
var hdr = $(shadow,'#hdr');
84+
85+
$(hdr,'#kill').onclick = btn.kill;
86+
87+
88+
hldr = $(shadow,'#hldr');
89+
iframe = $(shadow,'iframe');
90+
glass = $(shadow,'#glass');
91+
92+
93+
}//initdom
94+
95+
96+
//:
97+
98+
99+
btn.kill = function(){
100+
101+
kill();
102+
103+
}//kill
104+
105+
106+
obj.glass = function(show=true){
107+
108+
var display = 'none';
109+
if(show){
110+
display = 'block';
111+
}
112+
glass.style.display = display;
113+
114+
}//glass
115+
116+
117+
obj.horiz = function(){
118+
119+
iframe.style.width = '100%';
120+
iframe.style.height = '50%';
121+
122+
}//horiz
123+
124+
125+
obj.vert = function(){
126+
127+
iframe.style.width = '50%';
128+
iframe.style.height = '100%';
129+
130+
}//vert
131+
132+
133+
134+
obj.srcdoc = function(html){
135+
136+
iframe.srcdoc = html;
137+
138+
}//srcdoc
139+
140+
141+
obj.kill = function(){return kill()} //d
142+
143+
function kill(){
144+
145+
var niframe = iframe.cloneNode(true);
146+
niframe.srcdoc = null;
147+
hldr.replaceChild(niframe,iframe);
148+
iframe = niframe;
149+
150+
}//kill
151+
152+
153+
154+
155+
return obj;
156+
157+
})//output_html
158+
159+
</script>
160+
161+
</output-html>
162+

0 commit comments

Comments
 (0)