templateを新しいタブで開く
空ページにtemplate流し込むのではなく、新しいタブを作ってそこにページを開く 00:12:16 ビンゴ!成功した。
/icons/hr.icon
課題
1クリック余計な動作が入る
対策として実装したこと
押すと、自動的に新しいタブを開いてテンプレートを生成する
2020-10-10 12:22:05 projectごとにbuttonを変えた
code:takker.js
import makeNewMemo from '/api/code/takker/日時入りmemoのtemplate/makeNewMemo.js'
import makeNewLog from '/api/code/takker/作業Log_template/script.js';
scrapbox.PageMenu.addMenu({
title: 'NewMemo',
image: '/assets/img/logo.png',
onClick: makeNewMemo
});
scrapbox.PageMenu.addMenu({
title: 'Logging',
image: '/assets/img/logo.png',
onClick: makeNewLog
});
ボタンを文字で置き換える
code:takker.css
a#NewMemo.tool-btn:hover { text-decoration: none }
a#NewMemo.tool-btn::before { position: absolute; left: calc(46px/3 - 1px); content: '\1F4DD'; font: 21px/46px 'FontAwesome' }
a#NewMemo.tool-btn img { opacity: 0 }
a#Logging.tool-btn:hover { text-decoration: none }
a#Logging.tool-btn::before { position: absolute; left: calc(46px/3 - 1px); content: '\1F39E'; font: 21px/46px 'FontAwesome' }
a#Logging.tool-btn img { opacity: 0 }
code:takker-memex.js
import makeNewPlanningSheet from '/api/code/takker/予定の組み立てtemplate/planning.js'
import makeNewLoggingSheet from '/api/code/takker/日刊記録sheet_template/record.js'
import mackCheckPage from '/api/code/takker/失敗の分析template/analysis.js'
import makeNewCourseNote from '/api/code/takker/講義メモを作るUserScript/makeNewCourseNote.js';
import makeTaskPages from '/api/code/takker/期限付きだけど内容が曖昧なものをkeepするUserScript/script.js'
import makeNewMemo from '/api/code/takker/日時入りmemoのtemplate/makeNewMemo.js'
import makeNewLog from '/api/code/takker/作業Log_template/script.js';
import {makeSprint} from '/api/code/takker/takker-sprint_template/makeSprint.js';
import {makeCollectingTask} from '/api/code/takker/情報集め用タスクを作成するUserScript/script.js';
const iconName = 'Templates';
scrapbox.PageMenu.addMenu({
title: iconName,
image: '/assets/img/logo.png',
onClick: () => {}
});
scrapbox.PageMenu(iconName).addItem({
title: '📝New memo',
onClick: makeNewMemo
});
scrapbox.PageMenu(iconName).addItem({
title: '📝講義ノート',
onClick: makeNewCourseNote
});
const taskTools = 'TaskTools';
scrapbox.PageMenu.addMenu({
title: taskTools,
image: '/assets/img/logo.png',
onClick: () => {}
});
scrapbox.PageMenu(taskTools).addItem({
title: '🚧takker-sprint',
onClick: () => makeSprint() // ←default引数に余計なのもが混ざらないようにする
});
scrapbox.PageMenu(taskTools).addItem({
title: '🚧タスクを作成',
onClick: makeTaskPages
});
scrapbox.PageMenu(taskTools).addItem({
title: '🚧情報集めタスク',
onClick: makeCollectingTask
});
scrapbox.PageMenu(taskTools).addItem({
title: '🎞作業内容メモ',
onClick: makeNewLog
});
scrapbox.PageMenu(taskTools).addItem({
title: '🎞日刊記録sheet',
onClick: makeNewLoggingSheet
});
scrapbox.PageMenu(taskTools).addItem({
title: '🚧予定の組み立て',
onClick: makeNewPlanningSheet
});
scrapbox.PageMenu(taskTools).addItem({
title: '📈失敗の分析',
onClick: () => mackCheckPage()
});
import makeBreakfastPage from '/api/code/takker/食べたもの記録用template/breakfast.js';
import makeLunchPage from '/api/code/takker/食べたもの記録用template/lunch.js';
import makeDinnerPage from '/api/code/takker/食べたもの記録用template/dinner.js';
import makeSnackPage from '/api/code/takker/食べたもの記録用template/snack.js';
const mealName = 'Meal';
scrapbox.PageMenu.addMenu({
title: mealName,
image: '/assets/img/logo.png',
onClick: () => {}
});
scrapbox.PageMenu(mealName).addItem({
title: '🥗 今日のあさごはん',
onClick: () => makeBreakfastPage()
});
scrapbox.PageMenu(mealName).addItem({
title: '🍱 今日のひるごはん',
onClick: () => makeLunchPage()
});
scrapbox.PageMenu(mealName).addItem({
title: '🍽 今日のよるごはん',
onClick: () => makeDinnerPage()
});
scrapbox.PageMenu(mealName).addItem({
title: '☕ その他食べたもの',
onClick: () => makeSnackPage()
});
ボタンを文字で置き換える
code:takker-memex.css
a#Templates.tool-btn:hover { text-decoration: none }
a#Templates.tool-btn::before { position: absolute; left: calc(46px/3 - 1px); content: '\1F4DD'; font: 21px/46px 'FontAwesome' }
a#Templates.tool-btn img { opacity: 0 }
a#TaskTools.tool-btn:hover { text-decoration: none }
a#TaskTools.tool-btn::before { position: absolute; left: calc(46px/3 - 1px); content: '\f0ae'; font: 21px/46px 'FontAwesome' }
a#TaskTools.tool-btn img { opacity: 0 }
a#Meal.tool-btn:hover { text-decoration: none }
a#Meal.tool-btn::before { position: absolute; left: calc(46px/3 - 1px); content: '\1F957'; font: 21px/46px 'FontAwesome' }
a#Meal.tool-btn img { opacity: 0 }