Last active
December 13, 2018 04:47
-
-
Save TakamiChie/e1ad388d67a13fd6ca7637d7a34dabfd to your computer and use it in GitHub Desktop.
Zaimの日ごとの履歴一覧画面にチェックボックスを表示する(するだけ)
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
// Zaimの日ごとの履歴一覧画面にチェックボックスを表示するBookmarklet | |
// 日ごとの履歴一覧を表示した状態で、ブックマークレットを実行してください。 | |
// 下記サイトでコンパイル可能です。 | |
// https://closure-compiler.appspot.com/ | |
// ==ClosureCompiler== | |
// @output_file_name default.js | |
// @compilation_level SIMPLE_OPTIMIZATIONS | |
// ==/ClosureCompiler== | |
javascript:(function(){ | |
let table = document.querySelector("#main .list"); | |
let th = document.createElement("th"); | |
th.textContent = "✓"; | |
table.rows[0].insertBefore(th, table.rows[0].cells[2]); | |
// 各行への項目追加 | |
for(let l = 1; l < table.rows.length; l++){ | |
if(table.rows[l].cells[0].className.startsWith("edit")){ | |
let c = table.rows[l].insertCell(2); | |
let i = document.createElement("input"); | |
i.type= "checkbox"; | |
i.addEventListener("click", function(e){ | |
e.target.parentNode.parentNode.style.backgroundColor = | |
e.target.checked ? "lightcyan" : "transparent"; | |
}); | |
table.rows[l].addEventListener("click", function(e){ | |
i.click(); | |
}); | |
c.appendChild(i); | |
}else{ | |
let c = table.rows[l].querySelector("td:first-child"); | |
if(c.colSpan == 2) c.colSpan = 3; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment