170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
-
+
-
+
-
+
|
PS.e.previewModeLabel.innerText =
PS.renderModeLabels[PS.renderModes[PS.renderModes.selectedIndex]];
/**
The 'pikchr-ready' event is fired (with no payload) when the
wasm module has finished loading. */
PS.addMsgHandler('pikchr-ready', function(){
PS.addMsgHandler('pikchr-ready', function(event){
PS.clearMsgHandlers('pikchr-ready');
F.page.onPikchrshowLoaded();
F.page.onPikchrshowLoaded(event.data);
});
/**
Performs all app initialization which must wait until after the
worker module is loaded. This function removes itself when it's
called.
*/
F.page.onPikchrshowLoaded = function(){
F.page.onPikchrshowLoaded = function(pikchrVersion){
delete this.onPikchrshowLoaded;
// Unhide all elements which start out hidden
EAll('.initially-hidden').forEach((e)=>e.classList.remove('initially-hidden'));
const taInput = E('#input');
const btnClearIn = E('#btn-clear');
btnClearIn.addEventListener('click',function(){
taInput.value = '';
|
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
|
+
+
+
|
link in the forum. */
const src = window.sessionStorage.getItem('pikchr-xfer');
if( src && (new URL(self.location.href).searchParams).has('fromSession') ){
taInput.value = src;
window.sessionStorage.removeItem('pikchr-xfer');
}
}
D.append(E('fieldset.options > div'),
D.append(D.addClass(D.span(), 'labeled-input'),
'pikchr v. '+pikchrVersion));
PS.e.btnRender.click();
/** Debounce handler for auto-rendering while typing. */
const debounceAutoRender = F.debounce(function f(){
if(!PS._isDirty) return;
const text = getCurrentText();
|