Commit 71c754e2 authored by Jake Mylet's avatar Jake Mylet

Update some comments in the JS files and added content to ScanJS doc

parent bb7277d7
......@@ -2,10 +2,9 @@
var scannedDiv = document.getElementById("ScannedListDiv");
var scannedTB = scannedDiv.children[0].children[0];
var allRows = scannedTB.children;
var scannedRows = []; // Array of tr elements
var scannedRows = [];
var scannedBooks = '{ "books" : [';
// Go through all rows, except header, to get all scanned rows
for (var i = 1; i < allRows.length; i++) {
if (allRows[i].childElementCount !== 0) { // Ignore empty spacing rows
scannedRows[scannedRows.length] = allRows[i];
......@@ -35,35 +34,6 @@
break;
}
}
// if (rowChildren[k].childElementCount !== 0) { // If the td has children (font)
//
// var bookProp = rowChildren[k].children[0]; // font element
// var tdElement = rowChildren[k];
// // Contents of font element
// var contents = bookProp.innerHTML;
//
// if (bookProp.innerHTML != "&nbsp;" && contents !== "") {
// switch (k) {
// case 1:
// scannedBooks += '{"barcode":"' + contents.trim() + '", ';
//
// // Look for error bgcolor contained in first td element
// if (tdElement.bgColor == "#ffffcc") {
// scannedBooks += '"error":"true", ';
// }
// else {
// scannedBooks += '"error":"false", ';
// }
// break;
// case 2: // Call Num
// scannedBooks += '"callnum":"' + contents.trim() + '", ';
// break;
// case 3: // Title
// scannedBooks += '"title":"' + contents.trim() + '"},';
// break;
// }
// }
// }
}
}
}
......
......@@ -2,7 +2,18 @@
The JS functions specified below are run only on the Scan Page.
### [GetScanned.js](/WAMI/WAMI/GetScanned.js)
Used to retrieve all information of past scans on the scan page. This will only return scanned items contained in the table on the page, as it will ignore empty rows.
Used to retrieve all information of past scans on the scan page. This will only return scanned items contained in the table on the page, as it will ignore empty rows. It does this by iterate through all rows in scan table, ignoring the first header rows and empty spacing rows, to save all others in an array.
```javascript
for (var i = 1; i < allRows.length; i++) {
if (allRows[i].childElementCount !== 0) {
scannedRows[scannedRows.length] = allRows[i];
}
}
```
Header rows are ignored by starting at the 2nd row, index 1, rather than the first, index 0. Empy rows are ignored by checking if the row has any child elements.
After retrieving all scan rows, iterate through each of these rows and each column in the row
### [ScanBarcode.js](/WAMI/WAMI/ScanBarcode.js)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment