Last active
September 2, 2019 09:41
-
-
Save hashedhyphen/fe7cbbfe1f3ac243a1b9ba578c7d7ca5 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
function exec(csv) { | |
function removeQuotes(str) { | |
return str.replace(/^"(.*)"$/, "$1") | |
} | |
const table = document.querySelectorAll("div.tabContainer table")[0] | |
const rows = [...table.querySelectorAll("tr:nth-child(n+2)")] | |
const lines = csv.split("\n").filter(l => /^\d+/.test(l)) | |
lines.forEach((line, index) => { | |
const columns = line.split(",") | |
const startVal = removeQuotes(columns[4]) | |
const endVal = removeQuotes(columns[5]) | |
if (startVal && endVal) { | |
const row = rows[index] | |
const inputs = [...row.querySelectorAll("td.reportDetail__txt input")] | |
inputs[0].value = startVal | |
inputs[1].value = endVal | |
inputs[2].value = "01:00" | |
$(inputs[2]).trigger("focusout") | |
inputs[inputs.length - 1].value = "機能開発" | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment