Sort mapped entries
This commit is contained in:
3 files changed
+20
-6
No files matched your search
+3
-3
@@ -7,7 +7,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="static/css/qa.css?6903a867d3d53" />
|
||||
<link rel="stylesheet" type="text/css" href="static/css/qa.css?69130637d6711" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<meta name="theme-color" content="#aa4400" />
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
</head>
|
||||
<body class="loading">
|
||||
|
||||
<!-- <script src="/static/js/qa.js?6903a867d3d54" type="text/javascript" async></script> -->
|
||||
<script src="/static/js/qa.min.js?6903a867d3d55" type="text/javascript" async></script>
|
||||
<!-- <script src="/static/js/qa.js?69130637d6714" type="text/javascript" async></script> -->
|
||||
<script src="/static/js/qa.min.js?69130637d6715" type="text/javascript" async></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+16
-2
@@ -284,12 +284,13 @@ class ConcPage {
|
||||
const resultsWrap = document.createElement("div");
|
||||
convertB.addEventListener('click', function() {
|
||||
|
||||
let lines = [];
|
||||
let keysAreNumeric = false;
|
||||
if (listOptions[1] !== undefined && listOptions[1] !== null) {
|
||||
keysAreNumeric = true;
|
||||
}
|
||||
|
||||
// First gather lines by target type for rough sorting
|
||||
let linesByType = {};
|
||||
for (let m of matchSelects) {
|
||||
|
||||
let line = ("'" + m.getAttribute("data-input") + "'").padEnd(40, " ") + " => ";
|
||||
@@ -300,11 +301,24 @@ class ConcPage {
|
||||
line += "'" + m.value + "',";
|
||||
}
|
||||
line += ' // ' + listOptionsEn[m.value];
|
||||
lines.push(line);
|
||||
|
||||
// A
|
||||
if (linesByType[m.value] === undefined) {
|
||||
linesByType[m.value] = [];
|
||||
}
|
||||
linesByType[m.value].push(line);
|
||||
|
||||
m.setAttribute("readonly", "readonly");
|
||||
}
|
||||
|
||||
// Then put the lines together so they can be joined
|
||||
let lines = [];
|
||||
for (let key in linesByType) {
|
||||
for (let l of linesByType[key]) {
|
||||
lines.push(l);
|
||||
}
|
||||
}
|
||||
|
||||
const output = " ".repeat(8) + lines.join("\n" + " ".repeat(8));
|
||||
console.log(output);
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
"use strict";const MAX_INPUT_SIZE=1048576;'serviceWorker'in navigator&&(console.log("Registering service worker"),navigator.serviceWorker.register('/sw.js'));class ConcPage{lang;tls;domWrapper;domUploaderWrapper;domResultsWrapper;domMainWrapper;constructor(d,e){this.lang=d,this.tls=Object.freeze(e);let c=document.createElement("div");c.id="contentWrapper",this.domWrapper=c;let a=document.createElement("div");a.id="uploader",a.classList.add("uploader"),this.domUploaderWrapper=a;let b=document.createElement("div");b.id="results",b.classList.add("results"),this.domResultsWrapper=b;let f=document.createElement("main");this.domMainWrapper=f}downloadFromString(b,c){const d=new Blob([c],{type:"text/plain"}),a=document.createElement("a");a.download=b,a.href=window.URL.createObjectURL(d),a.dataset.downloadurl=["text/plain",a.download,a.href].join(":");const e=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});a.dispatchEvent(e),a.remove()}renderGenHeader(){const b=document.createElement("header");b.id="mainHeader";const a=document.createElement("a");a.id="logoArea",a.href="https://www.museum-digital.org/";const d=document.createElement("img");d.src="/static/img/mdlogo-code.svg",d.alt="Logo of museum-digital",a.appendChild(d);const l=document.createElement("h2");l.textContent="museum-digital",a.appendChild(l),b.appendChild(a);const c=document.createElement("nav"),f=document.createElement("a");f.href="https://en.about.museum-digital.org/about",f.textContent=this.tls.about,c.appendChild(f);const g=document.createElement("div"),h=document.createElement("a");h.textContent=this.tls.contact,h.href="https://en.about.museum-digital.org/contact/",g.appendChild(h);const i=document.createElement("div"),e=document.createElement("a");e.textContent=this.tls.imprint,e.href="https://en.about.museum-digital.org/impressum",i.appendChild(e);const j=document.createElement("a");j.textContent=this.tls.privacy_policy,j.href="https://en.about.museum-digital.org/privacy/",i.appendChild(j),g.appendChild(i),c.appendChild(g);const k=document.createElement("a");k.textContent=this.tls.news,k.href="https://blog.museum-digital.org/",c.appendChild(k),b.appendChild(c),document.body.appendChild(b)}renderHeader(){const b=document.createElement("header");b.id="appHeader";const c=document.createElement("h1"),a=document.createElement("img");a.width="70",a.height="70",a.src="/static/img/mdlogo-code.svg",a.alt="",c.appendChild(a),c.appendChild(this.createPlainTextElem("span","museum-digital:"+this.tls.concordance_checker)),b.appendChild(c),document.body.appendChild(b)}createP(b){const a=document.createElement("p");return a.textContent=b,a}createPlainTextElem(b,c){const a=document.createElement(b);return a.textContent=c,a}renderText(){const a=document.createElement("h2");a.textContent=this.tls.quality_assessment_tools,this.domMainWrapper.appendChild(a),this.domMainWrapper.appendChild(this.createP(this.tls.intro)),this.domWrapper.appendChild(this.domMainWrapper)}generateBoilerplateForTableSection(f){const a=document.createElement("div"),c=document.createElement("h3");c.textContent=f,a.appendChild(c);const b=document.createElement("table"),d=document.createElement("thead");b.appendChild(d);const e=document.createElement("tbody");return b.appendChild(e),a.appendChild(b),{section:a,thead:d,tbody:e}}generateListResponse(d,e,a,b){while(this.domResultsWrapper.firstChild)this.domResultsWrapper.removeChild(this.domResultsWrapper.firstChild);if(b.passed.length===void 0){const c=this.generateBoilerplateForTableSection(this.tls.passed),d=document.createElement("tr");for(const b of['Input','Match']){const a=document.createElement("th");a.textContent=b,d.appendChild(a)}c.thead.appendChild(d);for(const f in b.passed){const d=b.passed[f],e=document.createElement("tr");e.appendChild(this.createPlainTextElem("td",f)),a[d]?e.appendChild(this.createPlainTextElem("td",a[d])):(valueTd.textContent=d,e.appendChild(this.createPlainTextElem("td",d))),c.tbody.appendChild(e)}this.domResultsWrapper.appendChild(c.section)}const c=this;if(b.not_passed.length!==0){const f=this.generateBoilerplateForTableSection(this.tls.not_yet_matched),h=document.createElement("tr");for(const b of['Input','Select Your Match']){const a=document.createElement("th");a.textContent=b,h.appendChild(a)}f.thead.appendChild(h);let i=[];for(let e of b.not_passed){const d=document.createElement("tr");d.appendChild(this.createPlainTextElem("td",e));const g=document.createElement("td"),c=document.createElement("select");c.setAttribute('data-input',e);for(const d in a){const b=document.createElement("option");b.value=d,b.textContent=a[d],c.appendChild(b)}i.push(c),g.appendChild(c),d.appendChild(g),f.tbody.appendChild(d)}this.domResultsWrapper.appendChild(f.section);const g=document.createElement("button");g.textContent=this.tls.generate_code_snippet,f.section.appendChild(g);const j=document.createElement("div");g.addEventListener('click',function(){let g=[],h=!1;a[1]!==void 0&&a[1]!==null&&(h=!0);for(let aLine truncated
|
||||
"use strict";const MAX_INPUT_SIZE=1048576;'serviceWorker'in navigator&&(console.log("Registering service worker"),navigator.serviceWorker.register('/sw.js'));class ConcPage{lang;tls;domWrapper;domUploaderWrapper;domResultsWrapper;domMainWrapper;constructor(d,e){this.lang=d,this.tls=Object.freeze(e);let c=document.createElement("div");c.id="contentWrapper",this.domWrapper=c;let a=document.createElement("div");a.id="uploader",a.classList.add("uploader"),this.domUploaderWrapper=a;let b=document.createElement("div");b.id="results",b.classList.add("results"),this.domResultsWrapper=b;let f=document.createElement("main");this.domMainWrapper=f}downloadFromString(b,c){const d=new Blob([c],{type:"text/plain"}),a=document.createElement("a");a.download=b,a.href=window.URL.createObjectURL(d),a.dataset.downloadurl=["text/plain",a.download,a.href].join(":");const e=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});a.dispatchEvent(e),a.remove()}renderGenHeader(){const b=document.createElement("header");b.id="mainHeader";const a=document.createElement("a");a.id="logoArea",a.href="https://www.museum-digital.org/";const d=document.createElement("img");d.src="/static/img/mdlogo-code.svg",d.alt="Logo of museum-digital",a.appendChild(d);const l=document.createElement("h2");l.textContent="museum-digital",a.appendChild(l),b.appendChild(a);const c=document.createElement("nav"),f=document.createElement("a");f.href="https://en.about.museum-digital.org/about",f.textContent=this.tls.about,c.appendChild(f);const g=document.createElement("div"),h=document.createElement("a");h.textContent=this.tls.contact,h.href="https://en.about.museum-digital.org/contact/",g.appendChild(h);const i=document.createElement("div"),e=document.createElement("a");e.textContent=this.tls.imprint,e.href="https://en.about.museum-digital.org/impressum",i.appendChild(e);const j=document.createElement("a");j.textContent=this.tls.privacy_policy,j.href="https://en.about.museum-digital.org/privacy/",i.appendChild(j),g.appendChild(i),c.appendChild(g);const k=document.createElement("a");k.textContent=this.tls.news,k.href="https://blog.museum-digital.org/",c.appendChild(k),b.appendChild(c),document.body.appendChild(b)}renderHeader(){const b=document.createElement("header");b.id="appHeader";const c=document.createElement("h1"),a=document.createElement("img");a.width="70",a.height="70",a.src="/static/img/mdlogo-code.svg",a.alt="",c.appendChild(a),c.appendChild(this.createPlainTextElem("span","museum-digital:"+this.tls.concordance_checker)),b.appendChild(c),document.body.appendChild(b)}createP(b){const a=document.createElement("p");return a.textContent=b,a}createPlainTextElem(b,c){const a=document.createElement(b);return a.textContent=c,a}renderText(){const a=document.createElement("h2");a.textContent=this.tls.quality_assessment_tools,this.domMainWrapper.appendChild(a),this.domMainWrapper.appendChild(this.createP(this.tls.intro)),this.domWrapper.appendChild(this.domMainWrapper)}generateBoilerplateForTableSection(f){const a=document.createElement("div"),c=document.createElement("h3");c.textContent=f,a.appendChild(c);const b=document.createElement("table"),d=document.createElement("thead");b.appendChild(d);const e=document.createElement("tbody");return b.appendChild(e),a.appendChild(b),{section:a,thead:d,tbody:e}}generateListResponse(d,e,a,b){while(this.domResultsWrapper.firstChild)this.domResultsWrapper.removeChild(this.domResultsWrapper.firstChild);if(b.passed.length===void 0){const c=this.generateBoilerplateForTableSection(this.tls.passed),d=document.createElement("tr");for(const b of['Input','Match']){const a=document.createElement("th");a.textContent=b,d.appendChild(a)}c.thead.appendChild(d);for(const f in b.passed){const d=b.passed[f],e=document.createElement("tr");e.appendChild(this.createPlainTextElem("td",f)),a[d]?e.appendChild(this.createPlainTextElem("td",a[d])):(valueTd.textContent=d,e.appendChild(this.createPlainTextElem("td",d))),c.tbody.appendChild(e)}this.domResultsWrapper.appendChild(c.section)}const c=this;if(b.not_passed.length!==0){const f=this.generateBoilerplateForTableSection(this.tls.not_yet_matched),h=document.createElement("tr");for(const b of['Input','Select Your Match']){const a=document.createElement("th");a.textContent=b,h.appendChild(a)}f.thead.appendChild(h);let i=[];for(let e of b.not_passed){const d=document.createElement("tr");d.appendChild(this.createPlainTextElem("td",e));const g=document.createElement("td"),c=document.createElement("select");c.setAttribute('data-input',e);for(const d in a){const b=document.createElement("option");b.value=d,b.textContent=a[d],c.appendChild(b)}i.push(c),g.appendChild(c),d.appendChild(g),f.tbody.appendChild(d)}this.domResultsWrapper.appendChild(f.section);const g=document.createElement("button");g.textContent=this.tls.generate_code_snippet,f.section.appendChild(g);const j=document.createElement("div");g.addEventListener('click',function(){let h=!1;a[1]!==void 0&&a[1]!==null&&(h=!0);let b={};for(lLine truncated
|
||||
Reference in new issue
Block a user