Commit d56f9717 authored by Jake Mylet's avatar Jake Mylet

Updated GetScanned.js to retrieve information from td elements instead of font...

Updated GetScanned.js to retrieve information from td elements instead of font elements, need some test to prove viability
parent c47f0edd
......@@ -20,35 +20,50 @@
// 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)
if (rowChildren[k].hasAttribute("title")) {
var bookProp = rowChildren[k].title; // Information desired
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;
}
switch (k) {
case 1:
scannedBooks += '{"barcode":"' + bookProp.trim() + '", ';
break;
case 2:
scannedBooks += '"callnum":"' + bookProp.trim() + '", ';
break;
case 3:
scannedBooks += '"title":"' + bookProp.trim() + '"},';
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;
// }
// }
// }
}
}
}
......
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