Skip to content

Instantly share code, notes, and snippets.

@hashedhyphen
Last active September 2, 2019 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashedhyphen/fe7cbbfe1f3ac243a1b9ba578c7d7ca5 to your computer and use it in GitHub Desktop.
Save hashedhyphen/fe7cbbfe1f3ac243a1b9ba578c7d7ca5 to your computer and use it in GitHub Desktop.
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