Browse Source

OK, be consistent in the right way

Piotr Czajkowski 3 years ago
parent
commit
311a51a3d4
1 changed files with 18 additions and 18 deletions
  1. 18 18
      static/processResults.js

+ 18 - 18
static/processResults.js

@@ -1,12 +1,12 @@
 const app = {};
 
 app.filterTable = function(value) {
-	const data = document.getElementById("dataRows");
-	const rows = data.getElementsByTagName("tr");
-	if (value === "") {
+	const data = document.getElementById('dataRows');
+	const rows = data.getElementsByTagName('tr');
+	if (value === '') {
 		for (let i = 0; i < rows.length; i++) {
 			const row = rows[i];
-			row.style.display = "";
+			row.style.display = '';
 		}
 		return;
 	}
@@ -15,43 +15,43 @@ app.filterTable = function(value) {
 
 	for (let i = 0; i < rows.length; i++) {
 		const row = rows[i];
-		row.style.display = "none";
+		row.style.display = 'none';
 
-		const cells = row.getElementsByTagName("td");
+		const cells = row.getElementsByTagName('td');
 		for (let j = 0; j < cells.length; j++) {
 			const cell = cells[j];
 
 			if (cell.innerText.toUpperCase().indexOf(filter) > -1) {
-				row.style.display = "";
+				row.style.display = '';
 				break;
 			}
 		}
 	}
 };
 
-app.sorted = " (sorted)";
+app.sorted = ' (sorted)';
 
 app.clearFilter = function() {
-	const filter = document.getElementById("filter");
-	filter.value = "";
-	app.filterTable("");
+	const filter = document.getElementById('filter');
+	filter.value = '';
+	app.filterTable('');
 
-	document.querySelectorAll("th").forEach(th => {
-		th.textContent = th.textContent.replace(app.sorted, "");
+	document.querySelectorAll('th').forEach(th => {
+		th.textContent = th.textContent.replace(app.sorted, '');
 	});
 };
 
 app.getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent;
 
 app.comparer = (idx, asc) => (a, b) => ((v1, v2) =>
-	v1 !== "" && v2 !== "" && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
+	v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
 )(app.getCellValue(asc ? a : b, idx), app.getCellValue(asc ? b : a, idx));
 
 app.sortTable = function() {
 	// borrowed from https://stackoverflow.com/a/49041392/7342859
-	document.querySelectorAll("th").forEach(th => th.addEventListener("click", () => {
-		const table = document.getElementById("dataRows");
-		Array.from(table.querySelectorAll("tr"))
+	document.querySelectorAll('th').forEach(th => th.addEventListener('click', () => {
+		const table = document.getElementById('dataRows');
+		Array.from(table.querySelectorAll('tr'))
 			.sort(app.comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))
 			.forEach(tr => table.appendChild(tr));
 
@@ -61,7 +61,7 @@ app.sortTable = function() {
 
 		th.parentNode.childNodes.forEach((child) => {
 			if (child !== th) {
-				child.textContent = child.textContent.replace(app.sorted, "");
+				child.textContent = child.textContent.replace(app.sorted, '');
 			}
 		});
 	}));