Commit 7ff641ee authored by Alex Moore's avatar Alex Moore

Commit before library test

parent 15bd8d58
......@@ -74,7 +74,7 @@
<constraint firstAttribute="height" constant="30" id="7sn-wt-pgi"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="book log" lineBreakMode="tailTruncation" numberOfLines="30" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kwP-90-kst">
<rect key="frame" x="342" y="232" width="242" height="348"/>
......
(function() {
// TODO: Possibly extra to get and be able to display previous 5 scans
// TODO: these previous five are in table
})();
\ No newline at end of file
(function() {
var scannedDiv = document.getElementById("ScannedListDiv");
var scannedTB = scannedDiv.children[0].children[0];
var allRows = scannedTB.children;
var scannedRows = []; // Array of tr elements
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];
}
}
// Go through scanned rows
for (var j = 0; j < scannedRows.length; j++) {
if (scannedRows[j].children.length !== 0) {
// Scanned rows is a tr element with td children
var rowChildren = scannedRows[j].children; // Array of tds
// Go through each td element in a row
for (var k = 0; k < rowChildren.length; k++) { // k is col num
if (rowChildren[k].childElementCount !== 0) { // If the td has children (font)
var bookProp = rowChildren[k].children[0]; // font element
// If the col isn't empty
var a = bookProp.innerHTML;
if (bookProp.innerHTML != "&nbsp;" && bookProp.innerHTML !== "") {
switch(k) {
case 1: // ID Prop
scannedBooks += '{"id":"' + bookProp.innerHTML.trim() + '", ';
break;
case 2: // Call Num
scannedBooks += '"callnum":"' + bookProp.innerHTML.trim() + '", ';
break;
case 3: // Title
scannedBooks += '"title":"' + bookProp.innerHTML.trim() + '"},';
break;
}
}
}
}
}
}
scannedBooks = scannedBooks.substring(0, scannedBooks.length-1);
return scannedBooks + ']}';
})();
\ No newline at end of file
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