Compare commits
2 Commits
f078a1e6a1
...
8fd1a4fedb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fd1a4fedb | ||
|
|
566b3ad571 |
@@ -80,7 +80,7 @@
|
|||||||
function loadLastNLines(lastNLines) {
|
function loadLastNLines(lastNLines) {
|
||||||
var result = `<form onsubmit="setLastNLines(this); return false;" action="#">`
|
var result = `<form onsubmit="setLastNLines(this); return false;" action="#">`
|
||||||
result += ` <div>${f}</div>`
|
result += ` <div>${f}</div>`
|
||||||
result += ` <textarea name="lastNLines" style="height: 30em;">`
|
result += ` <textarea id="lastNLinesTextarea" name="lastNLines" style="height: 30em;">`
|
||||||
for (var k in lastNLines) {
|
for (var k in lastNLines) {
|
||||||
result += lastNLines[k] + "\n"
|
result += lastNLines[k] + "\n"
|
||||||
}
|
}
|
||||||
@@ -89,6 +89,22 @@
|
|||||||
result += `</form>`
|
result += `</form>`
|
||||||
document.getElementById("lastNLines").innerHTML = result
|
document.getElementById("lastNLines").innerHTML = result
|
||||||
}
|
}
|
||||||
|
function stage(who, contributesToHouse) {
|
||||||
|
var benefactor = who
|
||||||
|
var beneficiary = "AssetAccount:Chase:5876"
|
||||||
|
if (!contributesToHouse) {
|
||||||
|
var tmp = beneficiary
|
||||||
|
beneficiary = benefactor
|
||||||
|
benefactor = tmp
|
||||||
|
}
|
||||||
|
const zeroPad = (num, places) => String(num).padStart(places, '0')
|
||||||
|
var d = new Date()
|
||||||
|
const today = `${d.getFullYear()}-${zeroPad(1+d.getMonth(), 2)}-${zeroPad(d.getDate(), 2)}`
|
||||||
|
console.log(`@${today} ${benefactor} gave to ${beneficiary}`)
|
||||||
|
document.getElementById("lastNLinesTextarea").value += `\n${today} TODO moolah2`
|
||||||
|
document.getElementById("lastNLinesTextarea").value += `\n ${beneficiary} $0.00`
|
||||||
|
document.getElementById("lastNLinesTextarea").value += `\n ${benefactor}`
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</header>
|
</header>
|
||||||
<body onload="init();" style="min-width: 1024px;">
|
<body onload="init();" style="min-width: 1024px;">
|
||||||
@@ -104,6 +120,16 @@
|
|||||||
</details>
|
</details>
|
||||||
<details open>
|
<details open>
|
||||||
<summary>Edit</summary>
|
<summary>Edit</summary>
|
||||||
|
<div style="display:flex; flex-direction:row; width:100%; justify-content:space-between;">
|
||||||
|
<div>
|
||||||
|
<input type="button" onclick="stage('AssetAccount:Zach', true)" value="Stage Zach's Payment"/>
|
||||||
|
<input type="button" onclick="stage('AssetAccount:Zach', false)" value="Stage Zach's Charge"/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="button" onclick="stage('AssetAccount:Bel', true)" value="Stage Bel's Payment"/>
|
||||||
|
<input type="button" onclick="stage('AssetAccount:Bel', false)" value="Stage Bel's Charge"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="lastNLinesStatus">
|
<div id="lastNLinesStatus">
|
||||||
</div>
|
</div>
|
||||||
<div id="lastNLines">
|
<div id="lastNLines">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -54,6 +55,9 @@ func (files Files) TempSetLastNLines(n int, lines []string) error {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
for i := range lines {
|
for i := range lines {
|
||||||
|
if len(strings.TrimSpace(lines[i])) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, err := fmt.Fprintln(w, lines[i]); err != nil {
|
if _, err := fmt.Fprintln(w, lines[i]); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -87,7 +91,7 @@ func peekLastNLines(w io.Writer, r *bufio.Reader, n int) ([]string, error) {
|
|||||||
lastNLines := make([]string, 0, n)
|
lastNLines := make([]string, 0, n)
|
||||||
for {
|
for {
|
||||||
line, err := r.ReadBytes('\n')
|
line, err := r.ReadBytes('\n')
|
||||||
if len(line) > 0 {
|
if len(bytes.TrimSpace(line)) > 0 {
|
||||||
lastNLines = append(lastNLines, string(bytes.TrimRight(line, "\n")))
|
lastNLines = append(lastNLines, string(bytes.TrimRight(line, "\n")))
|
||||||
for i := 0; i < len(lastNLines)-n; i++ {
|
for i := 0; i < len(lastNLines)-n; i++ {
|
||||||
fmt.Fprintln(w, lastNLines[i])
|
fmt.Fprintln(w, lastNLines[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user