Skip to content

Instantly share code, notes, and snippets.

@TakamiChie
Last active December 13, 2018 04:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakamiChie/e1ad388d67a13fd6ca7637d7a34dabfd to your computer and use it in GitHub Desktop.
Save TakamiChie/e1ad388d67a13fd6ca7637d7a34dabfd to your computer and use it in GitHub Desktop.
Zaimの日ごとの履歴一覧画面にチェックボックスを表示する(するだけ)
// 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