Skip to content

Instantly share code, notes, and snippets.

@serinuntius
Created August 9, 2018 01:27
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 serinuntius/12b5d1fbad690812cd5538a8b5b62eff to your computer and use it in GitHub Desktop.
Save serinuntius/12b5d1fbad690812cd5538a8b5b62eff to your computer and use it in GitHub Desktop.
ライチのreadyに入れたタスクをtodaystaskに変換してくれるブックマークレット
javascript: (() => {
const b = document.getElementsByClassName('board')[1];
const t = b.getElementsByClassName('task-card_desc_title');
const tasks = Array.prototype.map.call(t,e => `- ${e.innerText}`);
const template = `
*1.今日は何をする予定ですか?*\n
${tasks.join('\n')}\n
*2.予定より遅延している作業はありますか?*\n\n
*3.その他、何か困っていることや伝えたいことはありますか?*\n\n
`;
function execCopy(string){
var temp = document.createElement('div');
temp.appendChild(document.createElement('pre')).textContent = string;
var s = temp.style;
s.position = 'fixed';
s.left = '-100%';
document.body.appendChild(temp);
document.getSelection().selectAllChildren(temp);
var result = document.execCommand('copy');
document.body.removeChild(temp);
return result;
}
execCopy(template);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment