mobileからtimestampを行頭に挿入するUserScript
移動した
2021-03-22 02:21:07 絵文字も挿入できるようにした
2021-03-15
06:02:59
libraryのupdate
format
を lightFormat
に変える
2021-03-13
dependencies
script.jsimport {lightFormat} from '../date-fns.min.js/script.js';
import {insertText} from '/api/code/takker/scrapbox-insert-text-2/script.js';
import {isMobile} from '../mobile版scrapboxの判定/script.js';
if (isMobile()) {
const id = 'Timestamp';
scrapbox.PageMenu.addMenu({
title: id,
image: 'https://img.icons8.com/ios/180/FFFFFF/add-time.png',
// light themeのときは↓を使う
//image: 'https://img.icons8.com/ios/180/add-time.png',
});
scrapbox.PageMenu(id).addItem({
title: '#YYYY-MM-DD HH:mm:ss ',
onClick: () => insertText(lightFormat(new Date(), '#yyyy-MM-dd HH:mm:ss ')),
});
scrapbox.PageMenu(id).addItem({
title: 'YYYY-MM-DD HH:mm:ss ',
onClick: () => insertText(lightFormat(new Date(), 'yyyy-MM-dd HH:mm:ss ')),
});
scrapbox.PageMenu(id).addItem({
title: 'YYYY-MM-DD',
onClick: () => insertText(lightFormat(new Date(), 'yyyy-MM-dd')),
});
scrapbox.PageMenu(id).addItem({
title: 'HH:mm:ss ',
onClick: () => insertText(lightFormat(new Date(), 'HH:mm:ss ')),
});
scrapbox.PageMenu(id).addItem({
title: '⬜',
onClick: () => insertText('⬜'),
});
scrapbox.PageMenu(id).addItem({
title: '🚧',
onClick: () => insertText('🚧'),
});
scrapbox.PageMenu(id).addItem({
title: '⌛',
onClick: () => insertText('⌛'),
});
scrapbox.PageMenu(id).addItem({
title: '📝',
onClick: () => insertText('📝'),
});
scrapbox.PageMenu(id).addItem({
title: '✅',
onClick: () => insertText('✅'),
});
scrapbox.PageMenu(id).addItem({
title: '❌',
onClick: () => insertText('❌'),
});
}