label {
cursor: pointer;
}
+ .error {
+ color: red;
+ background-color: yellow;
+ }
</style>
</head>
<body>
<div class='ta-wrapper'>
<textarea id="output" readonly rows="18" placeholder="Shell output"></textarea>
<div class='button-bar'>
+ <button data-cmd='.help' disabled>Help</button>
<button id='btn-clear-output' disabled>Clear</button>
</div>
</div>
<label for='opt-cb-sbs'>Side-by-side</label>
</div>
</fieldset>
- <hr>
<script type='text/javascript'>
(function(){
/**
doExec(sql);
}
},false);
- doExec()/*sets up the db and outputs the header*/;
+ doExec(null)/*sets up the db and outputs the header*/;
let e = document.querySelector('#opt-cb-sbs');
const mainWrapper = document.querySelector('#main-wrapper');
e.addEventListener('change', function(){
mainWrapper.classList[this.checked ? 'add' : 'remove']('side-by-side');
}, false);
+
+ /* For all buttons with data-cmd=X, map a click handler which
+ calls doExec(X). */
+ const cmdClick = function(){doExec(this.dataset.cmd);};
+ document.querySelectorAll('button[data-cmd]').forEach(
+ e => e.addEventListener('click', cmdClick, false)
+ );
};
/**
- What follow is part of the emscripten core setup. Do not modify without
- understanding what it's doing...
+ What follows is part of the emscripten core setup. Do not
+ modify without understanding what it's doing...
*/
- var statusElement = document.getElementById('status');
- var progressElement = document.getElementById('progress');
- var spinnerElement = document.getElementById('spinner');
- window.Module = {
+ const statusElement = document.getElementById('status');
+ const progressElement = document.getElementById('progress');
+ const spinnerElement = document.getElementById('spinner');
+ const Module = window.Module = {
preRun: [],
postRun: [],
onRuntimeInitialized: function(){
}
f._.value = ''; // clear browser cache
return function(text) {
- if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
+ if(arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&");
//text = text.replace(/</g, "<");
f._.scrollTop = f._.scrollHeight; // focus on bottom
};
})(),
- setStatus: function(text) {
- if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
- if (text === Module.setStatus.last.text) return;
- var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
- var now = Date.now();
- if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
- Module.setStatus.last.time = now;
- Module.setStatus.last.text = text;
- if (m) {
+ setStatus: function f(text) {
+ if(!f.last) f.last = { time: Date.now(), text: '' };
+ if(text === f.last.text) return;
+ const m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
+ const now = Date.now();
+ if(m && now - f.last.time < 30) return; // if this is a progress update, skip it if too soon
+ f.last.time = now;
+ f.last.text = text;
+ if(m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
- if (!text) spinnerElement.hidden = true;
+ if(!text) spinnerElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
- Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
+ this.setStatus(left
+ ? ('Preparing... (' + (this.totalDependencies-left)
+ + '/' + this.totalDependencies + ')')
+ : 'All downloads complete.');
}
};
- Module.printErr = Module.print/*redirect stderr*/;
+ Module.printErr = Module.print/*capture stderr output*/;
Module.setStatus('Downloading...');
- window.onerror = function() {
+ window.onerror = function(/*message, source, lineno, colno, error*/) {
+ const err = arguments[4];
+ if(err && 'ExitStatus'==err.name){
+ Module.printErr("FATAL ERROR:", err.message);
+ Module.printErr("Restarting the app requires reloading the page.");
+ const taOutput = document.querySelector('#output');
+ if(taOutput) taOutput.classList.add('error');
+ }
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
- if (text) console.error('[post-exception status] ' + text);
+ if(text) console.error('[post-exception status] ' + text);
};
};
})();
-C Code\sstyle\sfixes:\ss/char\sconst/const\schar/.
-D 2022-05-18T18:10:17.699
+C Improved\shandling/reporting\sof\sconditions\swhich\strigger\san\sexit()\sfrom\snative\scode,\se.g.\scalling\sthe\s'.read'\scommand.\sAdded\sa\sHelp\sbutton\swhich\ssimply\ssubmits\sthe\s'.help'\scommand.\sAdded\scommented-out\svariants\sof\svarious\s-Ox\sflags\sto\ssimplify\sexperimenting\swith\sthem.
+D 2022-05-18T21:18:21.599
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
-F Makefile.in ff32504cde350caaf4d52abfdca5dd1fa88b21e53071a0f9cc3539b6789c3606
+F Makefile.in 92890acbab78c76f32ebb1ad50b961c3fc413f7b05052663c8b17d1b7f74a697
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc b28a8a7a977e7312f6859f560348e1eb110c21bd6cf9fab0d16537c0a514eef3
F README.md 8b8df9ca852aeac4864eb1e400002633ee6db84065bd01b78c33817f97d31f5e
F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b
F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72
F ext/fiddle/Makefile ea647919e6ac4b50edde1490f60ee87e8ccd75141e4aa650718c6f28eb323bbc
-F ext/fiddle/fiddle.in.html aef414dcdede5842ae8328bd17aa0d97ee5f592098c1936ce26f9d4d26ab40fa
+F ext/fiddle/fiddle.in.html be6f4402b5b3e6287004b1b4d76c049d1fc0a5ae3b642578241e77e853fda30e
F ext/fiddle/index.md 08d25ec6fe2a56923e8ea6e5d6c80907bf3a60f9c40a6841a8f402e402dd5f22
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4eec05457fabe8248b8fd48d6187e772b69429ed64e99f02d0ad6b1230b5835e
-R 827e31b4bc83d11855fefe2a58e8b6d3
+P 9bf042b2eb2137239a59e421e89eb463e719b264eac3db2adae44e321b9a4ad3
+R 7e80413f51d07b2a693b13b3778bbe1a
U stephan
-Z d569a8b85b6a19a19ff04cd6f21c4eda
+Z 307b97d13682722e9b5c5bfc0074797a
# Remove this line to create a well-formed Fossil manifest.