|
39 | 39 | </span> |
40 | 40 |
|
41 | 41 | <div style='flex:1'></div> |
| 42 | + |
| 43 | + <span id=console-show class=radio> |
| 44 | + <input type=checkbox checked> |
| 45 | + console |
| 46 | + </span> |
| 47 | + <span id=console-echo class=radio> |
| 48 | + <input type=checkbox checked> |
| 49 | + echo |
| 50 | + </span> |
| 51 | + <span id=console-persist class=radio> |
| 52 | + <input type=checkbox checked> |
| 53 | + persist |
| 54 | + </span> |
| 55 | + |
42 | 56 | <button id=kill style='margin-right:20px'>kill</button> |
43 | 57 | </div> |
44 | 58 |
|
|
126 | 140 |
|
127 | 141 |
|
128 | 142 | var hdr = $(shadow,'#hdr'); |
| 143 | + |
129 | 144 | chk['allow-scripts'] = $.chkbox(hdr,'#allow-scripts'); |
130 | 145 | chk['allow-modals'] = $.chkbox(hdr,'#allow-modals'); |
131 | 146 | chk['allow-popups'] = $.chkbox(hdr,'#allow-popups'); |
132 | 147 |
|
| 148 | + chk['console-show'] = $.chkbox(hdr,'#console-show',btn.show_console); |
| 149 | + chk['console-echo'] = $.chkbox(hdr,'#console-echo'); |
| 150 | + chk['console-persist'] = $.chkbox(hdr,'#console-persist'); |
| 151 | + |
133 | 152 | $(hdr,'#kill').onclick = btn.kill; |
134 | 153 |
|
135 | 154 |
|
|
152 | 171 | }//kill |
153 | 172 |
|
154 | 173 |
|
| 174 | + btn.show_console = function(chk){ |
| 175 | + |
| 176 | + console.log(chk); |
| 177 | + |
| 178 | + //webconsole.host.s |
| 179 | + |
| 180 | + }//show_console |
| 181 | + |
| 182 | + |
155 | 183 | obj.glass = function(show=true){ |
156 | 184 |
|
157 | 185 | var display = 'none'; |
|
180 | 208 |
|
181 | 209 |
|
182 | 210 |
|
183 | | - obj.srcdoc = function(html){ |
| 211 | + build.sandbox = function(){ |
184 | 212 |
|
185 | 213 | var attr = def_sandbox; |
186 | 214 | //console.log(attr); |
|
200 | 228 | //console.log(attr); |
201 | 229 | iframe.setAttribute('sandbox',attr); |
202 | 230 |
|
| 231 | + }//sandbox |
| 232 | + |
| 233 | + |
| 234 | + obj.srcdoc = function(html){ |
| 235 | + |
| 236 | + build.sandbox(); |
| 237 | + |
| 238 | + if(!chk['console-persist'].checked){ |
| 239 | + console.clear(); |
| 240 | + } |
| 241 | + |
203 | 242 | iframe.srcdoc = html; |
204 | 243 |
|
205 | 244 | }//srcdoc |
206 | 245 |
|
207 | 246 |
|
208 | 247 | obj.sandbox = function(html){ |
209 | 248 | debug('sandbox'); |
210 | | - iframe.contentWindow.postMessage({type:'run',html},'*'); |
| 249 | + build.sandbox(); |
| 250 | + |
| 251 | + if(!chk['console-persist'].checked){ |
| 252 | + console.clear(); |
| 253 | + } |
| 254 | + var echo = chk['console-echo'].checked; |
| 255 | + iframe.contentWindow.postMessage({type:'run',html,echo},'*'); |
211 | 256 |
|
212 | 257 | }//sandbox |
213 | 258 |
|
|
0 commit comments