Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
空白の変更を非表示
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
テキストスタイル
外観を変更
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
invoice-code-update
作成日
2 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
15 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
80 行
すべてコピー
20 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
82 行
すべてコピー
import { v4 as uuidv4 } from 'uuid'
import { v4 as uuidv4 } from 'uuid'
const washCarBtn = document.getElementById("wash-car-btn")
const washCarBtn = document.getElementById("wash-car-btn")
const mowLawnBtn = document.getElementById("mow-lawn-btn")
const mowLawnBtn = document.getElementById("mow-lawn-btn")
const pullWeedsBtn = document.getElementById("pull-weeds-btn")
const pullWeedsBtn = document.getElementById("pull-weeds-btn")
const taskP = document.getElementById("tasks")
const taskP = document.getElementById("tasks")
const totalH2 = document.getElementById("total-amount")
const totalH2 = document.getElementById("total-amount")
let total = []
let total = []
let tasks = [{
let tasks = [{
"task": "Wash Car",
"task": "Wash Car",
"total": 10
"total": 10
},
},
{"task": "Mow Lawn",
{"task": "Mow Lawn",
"total": 20
"total": 20
},
},
{"task": "Pull Weeds",
{"task": "Pull Weeds",
"total": 30
"total": 30
}]
}]
washCarBtn.addEventListener("click", function(){
washCarBtn.addEventListener("click", function(){
コピー
コピー済み
コピー
コピー済み
const id = uuidv4(); // Generate a unique id
taskP.innerHTML += `
taskP.innerHTML += `
<div class = "outer-task-total-div">
<div class = "outer-task-total-div">
<div class = "task-total-div">
<div class = "task-total-div">
<p>${tasks[0].task}</p>
<p>${tasks[0].task}</p>
<p>$${tasks[0].total}</p>
<p>$${tasks[0].total}</p>
</div>
</div>
コピー
コピー済み
コピー
コピー済み
<p class = "remove-btn" data-
share = ${tasks[0].task}
>Remove</p>
<p class = "remove-btn" data-
id="${id}"
>Remove</p>
</div>`
</div>`
コピー
コピー済み
コピー
コピー済み
total.push({id:
uuidv4()
, total: tasks[0].total})
total.push({id:
id
, total: tasks[0].total})
render()
render()
})
})
mowLawnBtn.addEventListener("click", function(){
mowLawnBtn.addEventListener("click", function(){
コピー
コピー済み
コピー
コピー済み
const id = uuidv4(); // Generate a unique id
taskP.innerHTML += `
taskP.innerHTML += `
<div class = "outer-task-total-div">
<div class = "outer-task-total-div">
<div class = "task-total-div">
<div class = "task-total-div">
<p>${tasks[1].task}</p>
<p>${tasks[1].task}</p>
<p>$${tasks[1].total}</p>
<p>$${tasks[1].total}</p>
</div>
</div>
コピー
コピー済み
コピー
コピー済み
<p class = "remove-btn" data-
share = ${tasks[1].task}
>Remove</p>
<p class = "remove-btn" data-
id="${id}"
>Remove</p>
</div>`
</div>`
コピー
コピー済み
コピー
コピー済み
total.push({id:
uuidv4()
, total: tasks[1].total})
total.push({id:
id
, total: tasks[1].total})
render()
render()
})
})
pullWeedsBtn.addEventListener("click", function(){
pullWeedsBtn.addEventListener("click", function(){
コピー
コピー済み
コピー
コピー済み
const id = uuidv4(); // Generate a unique id
taskP.innerHTML += `
taskP.innerHTML += `
<div class = "outer-task-total-div">
<div class = "outer-task-total-div">
<div class = "task-total-div">
<div class = "task-total-div">
<p>${tasks[2].task}</p>
<p>${tasks[2].task}</p>
<p>$${tasks[2].total}</p>
<p>$${tasks[2].total}</p>
</div>
</div>
コピー
コピー済み
コピー
コピー済み
<p class = "remove-btn" data-
share = ${tasks[2].task}
>Remove</p>
<p class = "remove-btn" data-
id="${id}"
>Remove</p>
</div>`
</div>`
コピー
コピー済み
コピー
コピー済み
total.push({id:
uuidv4()
, total: tasks[2].total})
total.push({id:
id
, total: tasks[2].total})
render()
render()
})
})
function render(){
function render(){
const totalAmount = total.reduce((accumulator, currentValue) => {
const totalAmount = total.reduce((accumulator, currentValue) => {
コピー
コピー済み
コピー
コピー済み
return accumulator + currentValue.total
}, 0);
return accumulator + currentValue.total
;
}, 0);
totalH2.innerHTML = `$${totalAmount}`
totalH2.innerHTML = `$${totalAmount}`
}
}
document.addEventListener("click", function(e){
document.addEventListener("click", function(e){
コピー
コピー済み
コピー
コピー済み
if (e.target.dataset.
share){
if (e.target.dataset.
id) {
e.target.parentElement.remove()
const id = e.target.dataset.id; // Get the id from the dataset
e.target.parentElement.remove()
;
removeItem(id); // Call the remove function to update the total array
render(); // Recalculate the total
}
}
})
})
コピー
コピー済み
コピー
コピー済み
function removeItem(id) {
//HELP! Need help getting this function working to remove the removed items from totals array
function removeItem(id) {
total = total.filter(item => item.id !== id); // Filter out the item with the matching id
const index = total.indexOf(id);
}
if (index !== -1) {
total.splice(index, 1);
}
return total;
保存された差分
原文
ファイルを開く
import { v4 as uuidv4 } from 'uuid' const washCarBtn = document.getElementById("wash-car-btn") const mowLawnBtn = document.getElementById("mow-lawn-btn") const pullWeedsBtn = document.getElementById("pull-weeds-btn") const taskP = document.getElementById("tasks") const totalH2 = document.getElementById("total-amount") let total = [] let tasks = [{ "task": "Wash Car", "total": 10 }, {"task": "Mow Lawn", "total": 20 }, {"task": "Pull Weeds", "total": 30 }] washCarBtn.addEventListener("click", function(){ taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[0].task}</p> <p>$${tasks[0].total}</p> </div> <p class = "remove-btn" data-share = ${tasks[0].task}>Remove</p> </div>` total.push({id: uuidv4(), total: tasks[0].total}) render() }) mowLawnBtn.addEventListener("click", function(){ taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[1].task}</p> <p>$${tasks[1].total}</p> </div> <p class = "remove-btn" data-share = ${tasks[1].task}>Remove</p> </div>` total.push({id: uuidv4(), total: tasks[1].total}) render() }) pullWeedsBtn.addEventListener("click", function(){ taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[2].task}</p> <p>$${tasks[2].total}</p> </div> <p class = "remove-btn" data-share = ${tasks[2].task}>Remove</p> </div>` total.push({id: uuidv4(), total: tasks[2].total}) render() }) function render(){ const totalAmount = total.reduce((accumulator, currentValue) => { return accumulator + currentValue.total}, 0); totalH2.innerHTML = `$${totalAmount}` } document.addEventListener("click", function(e){ if (e.target.dataset.share){ e.target.parentElement.remove() } }) function removeItem(id) { //HELP! Need help getting this function working to remove the removed items from totals array const index = total.indexOf(id); if (index !== -1) { total.splice(index, 1); } return total;
変更されたテキスト
ファイルを開く
import { v4 as uuidv4 } from 'uuid' const washCarBtn = document.getElementById("wash-car-btn") const mowLawnBtn = document.getElementById("mow-lawn-btn") const pullWeedsBtn = document.getElementById("pull-weeds-btn") const taskP = document.getElementById("tasks") const totalH2 = document.getElementById("total-amount") let total = [] let tasks = [{ "task": "Wash Car", "total": 10 }, {"task": "Mow Lawn", "total": 20 }, {"task": "Pull Weeds", "total": 30 }] washCarBtn.addEventListener("click", function(){ const id = uuidv4(); // Generate a unique id taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[0].task}</p> <p>$${tasks[0].total}</p> </div> <p class = "remove-btn" data-id="${id}">Remove</p> </div>` total.push({id: id, total: tasks[0].total}) render() }) mowLawnBtn.addEventListener("click", function(){ const id = uuidv4(); // Generate a unique id taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[1].task}</p> <p>$${tasks[1].total}</p> </div> <p class = "remove-btn" data-id="${id}">Remove</p> </div>` total.push({id: id, total: tasks[1].total}) render() }) pullWeedsBtn.addEventListener("click", function(){ const id = uuidv4(); // Generate a unique id taskP.innerHTML += ` <div class = "outer-task-total-div"> <div class = "task-total-div"> <p>${tasks[2].task}</p> <p>$${tasks[2].total}</p> </div> <p class = "remove-btn" data-id="${id}">Remove</p> </div>` total.push({id: id, total: tasks[2].total}) render() }) function render(){ const totalAmount = total.reduce((accumulator, currentValue) => { return accumulator + currentValue.total; }, 0); totalH2.innerHTML = `$${totalAmount}` } document.addEventListener("click", function(e){ if (e.target.dataset.id) { const id = e.target.dataset.id; // Get the id from the dataset e.target.parentElement.remove(); removeItem(id); // Call the remove function to update the total array render(); // Recalculate the total } }) function removeItem(id) { total = total.filter(item => item.id !== id); // Filter out the item with the matching id }
違いを見つける