Skip to content

Instantly share code, notes, and snippets.

@akio6o6
Last active March 18, 2017 01:06
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 akio6o6/a46bee21eb9c4fc492a57eb68ee948e3 to your computer and use it in GitHub Desktop.
Save akio6o6/a46bee21eb9c4fc492a57eb68ee948e3 to your computer and use it in GitHub Desktop.
Dynalistでタスクの見積もりをするためのスクリプト。
// ==UserScript==
// @name EndTime for Dynalist
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Dynalistでタスクの見積もりをするためのスクリプト。
// @author akio6o6
// @match https://dynalist.io/d/*
// @grant none
// ==/UserScript==
y = setInterval(function() {
var tm = 0;
var d = document.querySelector('div.Document').querySelectorAll('div.Node-children a.node-tag');
for (var i = 0; i < d.length; i++) {
if ((d[i].textContent + " ").indexOf("min ") !== -1) {
var t = d[i].textContent.replace('#','');
tm += parseInt(t);
}
}
var d = document.querySelector('div.Document').querySelectorAll('div.Node-children div.is-checked a.node-tag');
for (var i = 0; i < d.length; i++) {
if ((d[i].textContent + " ").indexOf("min ") !== -1) {
var t = d[i].textContent.replace('#','');
tm -= parseInt(t);
}
}
var s = tm;
var sh = Math.floor((s) / 60);
var sm = Math.floor(s % 60);
if (sm < 10) {
sm = "0" + sm;
}
var f = new Date();
var h = f.getHours();
var m = f.getMinutes();
if (h < 10) {
h = "0" + h;
}
if (m < 10) {
m = "0" + m;
}
f.setMinutes(f.getMinutes() + tm);
var hour = f.getHours();
var min = f.getMinutes();
if (hour < 10) {
hour = "0" + hour;
}
if (min < 10) {
min = "0" + min;
}
var e = document,
a = e.getElementById("_dl_tmcount");
a && e.body.removeChild(a);
a = e.createElement("div");
a.id = "_dl_tmcount";
if (tm <= 0) {
a.innerHTML = "現在 " + h + ":" + m + "<br>( -_-)旦~ フゥ...";
} else {
a.innerHTML = "現在 " + h + ":" + m + "<br>残り " + sh + "h" + sm + "m<br>終了予定 " + hour + ":" + min;
}
a.setAttribute("style", "opacity:1.0;position:fixed;bottom:20px;left:20px;z-index:1000;width:212px;font-size:14px;text-align:center;line-height:2em;font-family:'sans-serif';");
e.body.appendChild(a);
},3000);
@akio6o6
Copy link
Author

akio6o6 commented Mar 17, 2017

各タスクに「#○○min」形式でタグを付けて合計時間を計算して画面左下に表示。

参考 : WorkFlowyでタスクの終了時間を表示するbookmarklet|マロ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment