mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2025-01-12 05:58:23 +01:00
Add debug mode
This commit is contained in:
parent
74feabe94a
commit
f0673256b1
@ -26,6 +26,7 @@ draft: false
|
||||
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
|
||||
<script src="/js/DebugMode.js"></script>
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script>
|
||||
function adjustSticky() {
|
||||
@ -83,6 +84,9 @@ draft: false
|
||||
}
|
||||
$("<li/>").text(txt).appendTo(extl)
|
||||
var cbli = $("<li/>")
|
||||
if(!DebugMode.Enabled && value==(1 << 31)){
|
||||
cbli.hide()
|
||||
}
|
||||
$("<input/>", { type: "checkbox", id: "cb_" + name, name: name, value: Number(value) }).change(nestedCheckbox_change).appendTo(cbli);
|
||||
$('<label />', { 'for': 'cb_' + name, text: txt }).appendTo(cbli);
|
||||
cbextl.append(cbli);
|
||||
|
@ -14,6 +14,7 @@ draft: false
|
||||
<script src="/js/getPublis.js"></script>
|
||||
<script src="/js/websiteFile.js"></script>
|
||||
<script src="/js/numberUtils.js"></script>
|
||||
<script src="/js/DebugMode.js"></script>
|
||||
<script src="/js/createPubliUI.js"></script>
|
||||
{{< getDataFilesName >}}
|
||||
<script>
|
||||
|
19
static/js/DebugMode.js
Normal file
19
static/js/DebugMode.js
Normal file
@ -0,0 +1,19 @@
|
||||
class DebugMode {
|
||||
static get Enabled() {
|
||||
var debug = window.sessionStorage.getItem("debug")
|
||||
if (debug == null) {
|
||||
return false
|
||||
}
|
||||
else {
|
||||
return Boolean(JSON.parse(debug))
|
||||
}
|
||||
}
|
||||
|
||||
static set Enabled(value) {
|
||||
const newval = Boolean(value)
|
||||
if (this.Enabled !== newval) {
|
||||
window.sessionStorage.setItem("debug", newval)
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
@ -234,7 +234,10 @@ class dataFileBase {
|
||||
return (JSON.stringify(e.initial) === JSON.stringify(ex.initial)) && (JSON.stringify(e.final) === JSON.stringify(ex.final))
|
||||
})
|
||||
if (ex2 !== undefined) {
|
||||
if (DebugMode.Enabled) {
|
||||
console.assert(ex.type == 0 || (ex2.type ^ (excitationTypes.Rydberg | excitationTypes.Valence) == ex.type ^ (excitationTypes.Rydberg | excitationTypes.Valence)), "Excitation type error", [ex, ex2, data.sourceFile])
|
||||
}
|
||||
|
||||
ex.type = ex2.type
|
||||
}
|
||||
}
|
||||
@ -329,6 +332,7 @@ class dataFileBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DebugMode.Enabled) {
|
||||
var stfy = dat.excitations.map(e => JSON.stringify([e.initial, e.final]))
|
||||
var double = []
|
||||
stfy.forEach(function (element, i) {
|
||||
@ -346,6 +350,7 @@ class dataFileBase {
|
||||
console.assert(Number.isNaN(ex.T1.valueOf()) | ex.T1 > 50 | ex.isUnsafe == true, "Must be unsafe", dat, ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
return dat
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user