Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PLUC Inventory - Senior Design
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Andrew D'Abbraccio
PLUC Inventory - Senior Design
Commits
d022fde9
Commit
d022fde9
authored
Apr 27, 2015
by
Jake Mylet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update JS to remove unneccessary empty check, and removed inline comments.
All comments should be in documentation.
parent
450320bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
41 deletions
+34
-41
WAMI/WAMI/GetScanned.js
WAMI/WAMI/GetScanned.js
+34
-40
WAMI/WAMI/ScanBarcode.js
WAMI/WAMI/ScanBarcode.js
+0
-1
No files found.
WAMI/WAMI/GetScanned.js
View file @
d022fde9
(
function
()
{
var
scannedDiv
=
document
.
getElementById
(
"
ScannedListDiv
"
);
var
scannedTB
=
scannedDiv
.
children
[
0
].
children
[
0
];
var
allRows
=
scannedTB
.
children
;
var
scannedRows
=
[];
var
scannedBooks
=
'
{ "books"
: [
'
;
(
function
()
{
var
scannedDiv
=
document
.
getElementById
(
"
ScannedListDiv
"
);
var
scannedTB
=
scannedDiv
.
children
[
0
].
children
[
0
];
var
allRows
=
scannedTB
.
children
;
var
scannedRows
=
[];
var
scannedBooks
=
'
{ "books"
: [
'
;
for
(
var
i
=
1
;
i
<
allRows
.
length
;
i
++
)
{
if
(
allRows
[
i
].
childElementCount
!==
0
)
{
// Ignore empty spacing rows
scannedRows
[
scannedRows
.
length
]
=
allRows
[
i
];
}
}
for
(
var
i
=
1
;
i
<
allRows
.
length
;
i
++
)
{
if
(
allRows
[
i
].
childElementCount
!==
0
)
{
scannedRows
[
scannedRows
.
length
]
=
allRows
[
i
];
}
}
for
(
var
j
=
0
;
j
<
scannedRows
.
length
;
j
++
)
{
var
curRow
=
scannedRows
[
j
].
children
;
// 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
for
(
var
k
=
0
;
k
<
curRow
.
length
;
k
++
)
{
if
(
curRow
[
k
].
hasAttribute
(
"
title
"
))
{
var
bookProp
=
curRow
[
k
].
title
;
// Go through each td element in a row
for
(
var
k
=
0
;
k
<
rowChildren
.
length
;
k
++
)
{
// k is col num
if
(
rowChildren
[
k
].
hasAttribute
(
"
title
"
))
{
var
bookProp
=
rowChildren
[
k
].
title
;
// Information desired
switch
(
k
)
{
case
1
:
scannedBooks
+=
'
{"barcode":"
'
+
bookProp
.
trim
()
+
'
",
'
;
break
;
case
2
:
scannedBooks
+=
'
"callnum":"
'
+
bookProp
.
trim
()
+
'
",
'
;
break
;
case
3
:
scannedBooks
+=
'
"title":"
'
+
bookProp
.
trim
()
+
'
"},
'
;
break
;
}
}
}
}
scannedBooks
=
scannedBooks
.
substring
(
0
,
scannedBooks
.
length
-
1
);
switch
(
k
)
{
case
1
:
scannedBooks
+=
'
{"barcode":"
'
+
bookProp
.
trim
()
+
'
",
'
;
break
;
case
2
:
scannedBooks
+=
'
"callnum":"
'
+
bookProp
.
trim
()
+
'
",
'
;
break
;
case
3
:
scannedBooks
+=
'
"title":"
'
+
bookProp
.
trim
()
+
'
"},
'
;
break
;
}
}
}
}
}
scannedBooks
=
scannedBooks
.
substring
(
0
,
scannedBooks
.
length
-
1
);
return
scannedBooks
+
'
]}
'
;
})();
\ No newline at end of file
return
scannedBooks
+
'
]}
'
;
})();
\ No newline at end of file
WAMI/WAMI/ScanBarcode.js
View file @
d022fde9
...
...
@@ -2,6 +2,5 @@
var
barcode
=
document
.
getElementById
(
"
BarcodeInput
"
);
barcode
.
value
=
code
;
// TODO: Think this is good enough to call function present
recordBarcode
();
})();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment