Created
June 18, 2013 15:52
-
-
Save thinktainer/5806527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Page = window.Page || {}; | |
Page.DataParser = function (tableId, rowFormat) { | |
self.tableId = tableId; | |
self.rowFormat = rowFormat; | |
}; | |
// rowformat = [""] | |
Page.DataParser.prototype = (function () { | |
var parseTableRow = function (row) { | |
var thRowFormat = ["Date", "Successful", "TimeOut", "Failed"]; | |
var result = {}; | |
for (var i = 0; i < thRowFormat.length; i++) { | |
result[thRowFormat[i]] = row.find('td').eq(i).text(); | |
} | |
return result; | |
}; | |
var parseTableRows = function () { | |
var result = []; | |
$(tableId).find('tr').next().each(function (index, element) { | |
result.push(parseTableRow($(element))); | |
}); | |
return result; | |
}; | |
// public | |
return { | |
parseTableRows: parseTableRows | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment