takker99/takker-scheduler/mobile
takker99/takker-schedulerのmobile版scrapbox用Page Menu
makeJudgeTimeFromSelection()はfor-any-projectで読み込む
任意のprojectでいつでもタスクを追加できるようにしておきたいので
2022-02-22 使わなくなったので外した
バグとか
カーソルのある状態でPageMenuを押すと、menuが押されずに.expandable-menuが閉じてしまう
2023-12-25
16:23:05 間違えてformatまで消してしまっていたのを復元
2023-12-18
12:33:37 計画作成系コマンドを消す
https://github.com/takker99/takker-scheduler/pull/168 で消した
2022-05-09
08:10:32 getLineRange()の定義が抜けてた
06:59:35 takker-workflow@0.0.1/linkToTaskを入れた
2022-04-20
12:35:12 Google Calenderの手動同期機能を入れた
単にGoogle Apps Scriptにdeployしたweb appを起動しているだけ
$ deno check --remote -r=https://scrapbox.io https://scrapbox.io/api/code/takker/takker99%2Ftakker-scheduler%2Fmobile/script.ts
code:script.ts
import {
addTask, startTask, endTask, posterioriEndTask,
walkDay, moveToday, toggleTask,
transport, createTask, toString, format
} from "../takker99%2Ftakker-scheduler/deps.ts";
import {
parse,
toTaskLine,
} from "../takker99%2Ftakker-scheduler/workflow.ts";
import {
caret, getLines, replaceLines, openInTheSameTab,
} from "../scrapbox-userscript-std/dom.ts";
import { isMobile } from "../mobile版scrapboxの判定/script.js";
import type { Scrapbox } from "../scrapbox-jp%2Ftypes/userscript.ts";
declare const scrapbox: Scrapbox;
if (isMobile()) {
const id = "task";
scrapbox.PageMenu.addMenu({
title: id,
image: 'https://img.icons8.com/ios/180/FFFFFF/todo-list--v2.png',
});
scrapbox.PageMenu.addMenu({
title: 'Toggle task',
image: 'https://img.icons8.com/ios/180/FFFFFF/repeat.png',
onClick: toggleTask,
});
scrapbox.PageMenu(id).addItem({
title: 'Add task',
image: 'https://img.icons8.com/ios/180/FFFFFF/plus-math.png',
onClick: addTask,
});
scrapbox.PageMenu(id).addItem({
title: 'Start task',
image: 'https://img.icons8.com/ios/180/FFFFFF/start--v1.png',
onClick: startTask,
});
scrapbox.PageMenu(id).addItem({
title: 'End task',
image: 'https://img.icons8.com/ios/180/FFFFFF/stop-squared.png',
onClick: endTask,
});
scrapbox.PageMenu(id).addItem({
title: 'Posteriori end task',
image: 'https://img.icons8.com/ios/180/FFFFFF/end--v1.png',
onClick: posterioriEndTask,
});
scrapbox.PageMenu(id).addItem({
title: 'Book starting',
image: 'https://img.icons8.com/ios/180/FFFFFF/plus-1day.png',
onClick: async () => {
const start, end = getLineRange();
const text = getLines().slice(start, end + 1).map((line) => {
const text = line.text;
const link = line.text.match(/\[(^\]+)\]/)?.1;
if (!link) return text;
const result = parse(link);
if (!result || !result.ok) return text;
const task = result.value;
if (task.freshness?.status === "done") return text;
const taskLine = toTaskLine(task);
taskLine.title = [${link}];
if (!taskLine) return text;
return toString(taskLine);
}).join("\n");
await replaceLines(start, end, text);
await createTask();
},
});
scrapbox.PageMenu(id).addItem({
title: 'Walk a day',
image: 'https://img.icons8.com/ios/180/FFFFFF/plus-1day.png',
onClick: () => walkDay(),
});
scrapbox.PageMenu(id).addItem({
title: 'Move today',
image: 'https://img.icons8.com/ios/180/FFFFFF/date-to.png',
onClick: () => moveToday(),
});
scrapbox.PageMenu(id).addItem({
title: 'Format',
image: 'https://img.icons8.com/ios/180/FFFFFF/sort-by-start-date.png',
onClick: () => format(scrapbox.Project.name, scrapbox.Page.title!),
});
scrapbox.PageMenu(id).addItem({
title: 'Transport',
onClick: () => transport({
from: {
project: scrapbox.Project.name,
title: scrapbox.Page.title!,
},
to: "takker-memex",
}),
});
scrapbox.PageMenu(id).addItem({
title: 'Sync',
onClick: () => window.open(
"https://script.google.com/macros/s/AKfycbyAgN8nmUXjVXL_tahDzVyyrMzFaI4CJVmIapk8G0GuxxVN-7oUbuDJOf31fP7SFjx9/exec",
),
});
}
/** 選択範囲に含まれる行かカーソルがいる行を返す
*
* ported from https://github.com/takker99/takker-scheduler/blob/0.7.6/commands/getLineRange.ts
*/
const getLineRange = (): readonly number, number => {
const { selectionRange: { start, end }, selectedText, position } = caret();
return selectedText === ""
? position.line, position.line
: start.line > end.line
? end.line, start.line
: start.line, end.line as const;
};
#2023-12-25 16:22:04
#2023-12-18 12:36:00
#2023-10-16 14:00:55
#2023-09-18 08:19:49
#2023-09-17 13:59:16
#2022-08-03 09:10:51
#2022-05-09 06:59:58
#2022-04-20 12:35:07
#2022-02-22 14:48:52
#2022-01-19 21:46:10
#2022-01-17 00:48:44
#2022-01-05