import-old
2021-11-16 18:11:41 archived
/icons/hr.icon
2021-01-10 11:18:27 動的importのときにログを出力するようにした
2021-01-03 09:07:22 UserScriptの読み込みを制御できるようにした
2020-09-22 21:03:32 機能毎に選んでimport出来るようにした
Log出力機能付きimport
code:script.js
let VERBOSE = true;
async function importWithLogger(source) {
if (VERBOSE) console.log([import@/${scrapbox.Project.name}] Start importing '${source}'...);
try {
const promise = await import(source);
if (VERBOSE) console.log([import@/${scrapbox.Project.name}] Finish importing '${source}'.);
return promise;
} catch(e) {
if (!(e instanceof SyntaxError)) return undefined;
console.error([import@/${scrapbox.Project.name}] ${e.message});
console.error([import@/${scrapbox.Project.name}] file: ${e.fileName}, line: ${e.lineNumber}, col: ${e.columnNumber});
console.error(e.stack);
throw Error(e);
}
}
code:script.js
import {selfURLParameters} from '../scrapbox-url-parameters/script.js';
(() => {
if (selfURLParameters.get('noscript') === 'true') {
// これ以降のscriptを読み込まない
return;
}
if (selfURLParameters.get('verbose') === 'false') VERBOSE = false;
// 共通して読み込むscript
//importWithLogger('./common.js');
importWithLogger('../for-any-project/script.js');
projectに応じて読み込むscriptを変える
code:script.js
switch (scrapbox.Project.name) {
case 'takker':
importWithLogger('./takker.js');
break;
case 'takker-memex':
importWithLogger('./takker-memex.js');
break;
case 'customize':
case 'scrapboxlab':
break;
case 'villagepump':
importWithLogger ('./villagepump.js');
break;
case 'programming-notes':
// themeをpaper-dark-darkにする
importWithLogger('../scrapbox-theme-customizer/script.js')
.then(({setTheme}) => setTheme('paper-dark-dark'));
break;
default:
break;
}
})();
全てのprojectで使うscript
code:common.js
import {GYAZO_ACCESS_TOKEN} from '/api/code/takker-memex/GYAZO_ACCESS_TOKEN/auth.js';
import {addGyazoMenu} from '../Gyazoにuploadした画像URLをコピペするPage_Menu/script.js';
addGyazoMenu({GYAZO_ACCESS_TOKEN, imageNum: 10, theme: 'dark'});
code:common.js
import '../Open_Google_Calendar_PageMenu/script.js';
code:common.js
import '../from-programming-notes/index.js';
code:common.js
import {scrapBindings} from '../ScrapBindings/script.js';
import {config} from '../ScrapBindings-settings/config.js';
scrapBindings.install()
.then(() => scrapBindings.push(...config));
code:common.js
import "../@takker%2Fscrapjupyter-min/mod.js";
code:common.js
import { setup as setup2 } from "../アナログ時計を表示するUserScript/script.js";
if (!isMobile()) setup2();
一時的なテスト
動いていないので外した
code:common.js.disabled(js)
import {external, icon, bare} from '../external-completion-3/script.js';
import {projects} from './project-list.js';
external(projects);
if (!takker_list.includes(scrapbox.Project.name)) {
document.head.insertAdjacentHTML('beforeend',
`<style>
--completion-item-text-color: var(--page-text-color);
--completion-item-hover-text-color: var(--page-text-color);
}
</style>`);
} else {
document.head.insertAdjacentHTML('beforeend',
`<style>
suggest-container {
--completion-item-text-color: var(--page-text-color);
--completion-item-hover-text-color: var(--page-text-color);
}
</style>`);
}
code:project-list.js
export const projects = [
'hub',
'shokai',
'nishio',
'masui',
'rakusai',
'yuiseki',
'june29',
'villagepump',
'rashitamemo',
'thinkandcreateteck',
'customize',
'scrapboxlab',
'scrasobox',
'foldrr',
'scrapbox-drinkup',
'nota-techconf',
'motoso',
'public-mrsekut',
'mrsekut-p',
'marshmallow-rm',
'wkpmm',
'sushitecture',
'nwtgck',
'dojineko',
'kadoyau',
'inteltank',
'sta',
'kn1cht',
'miyamonz',
'rmaruon',
'MISONLN41',
'yuta0801',
'tus-survey-1',
'aviutl',
'ePi5131',
'choiyakiBox',
'choiyaki-hondana',
'suto3',
'spud-oimo',
'keroxp',
'aioilight',
'NDLSH-SB',
'programming-notes',
'takker-private',
'takker-books',
'takker-CEPM',
'hitorigakusai',
'kagerw',
'yosider',
'bluepegasusyk',
'unnamedcamp',
'ayu-mushi',
'kidaaam-92022284',
'issac-37765679',
'ima1zumi',
];
privateになっちゃったやつ
u-labo's Scrapbox 授業関連 アーカイブ
code:common.js
import {popupBindings} from '../Popup_Menuに独自のkeyboard_shortcutを割り当てるUserScript/script.js';
popupBindings.start();
popupBindings.push(
{key: '-', buttonName: '\uf0cc'}, // 複数行打ち消し線
{key: ']', buttonName: '\uf127'}, // リンクを外す
{key: 'c', buttonName: 'Copy plain'},
);
その他script
code:common.js
import '../popup/script.js';
import '../mobileからtimestampを行頭に挿入するUserScript/script.js';
import {isMobile} from '../mobile版scrapboxの判定/script.js';
import {isolate} from '../custom-new-page-2/script.js';
import {settings} from '../custom-new-page-2-settings/script.js';
import {setup} from '../scrapbox-keicho/script.js';
if (isMobile()) {
scrapbox.PageMenu.addMenu({
title: 'New Page',
onClick: () => isolate(settings),
});
} else {
setup();
}
import '../scrapbox-icon-button/script.js';
import '../scrapbox-pomodoro-timer-2/import.js';
import '../メモ帳を表示するPage_Menu/script.js';
import {initialize} from '../scrapbox-speech-input/script.js';
//import {initialize} from '/api/code/programming-notes/scrapbox-speech-input/script.js';
initialize();
import '../Kakeruを開くPage_Menu/script.js';
// タイムスタンプを消す
scrapbox.TimeStamp.removeAllFormats();
カスタム日時挿入
2021-01-18 08:56:23 やめた
code:common.js_disabled
scrapbox.TimeStamp.addFormat('#YYYY-MM-DD HH:mm:ss');
scrapbox.TimeStamp.addFormat('HH:mm:ss ');
scrapbox.TimeStamp.addFormat(']/icons/done.icon[HH:mm:ss '); scrapbox.TimeStamp.addFormat(']YYYY-MM-DD[');
scrapbox.TimeStamp.addFormat('YYYY-MM-DD HH:mm:ss ');
scrapbox.TimeStamp.addFormat('🔳');
scrapbox.TimeStamp.addFormat('✅');
}
code:takker.js
import '../New_Buttonで開くページを変更する/script.js';
import {scrapboxDOM} from '../scrapbox-dom-accessor/script.js';
window.scrapboxDOM = scrapboxDOM;
//import '../WebからコピペしたらSB記法に変換する_-_Scrapboxとあそぶ/script2.js';
import {execute} from '../IME_onの時、キー入力をScrapboxに渡すUserScript/script.js';
execute();
//import '../Scanした紙のノートをScrapboxに取り込むUserScript/script.js';
import '../scrapbox-open-episopass/script.js';
code:takker-memex.js
import '../New_Buttonで開くページを変更する/script.js';
import '../LETUS_online_editor形式に変換してcopyするPopupMenu/script.js';
import '../選択範囲をspell_checkするPopupMenu/script.js';
import '../文字カウント_(scrapbox)/script.js';
import {scrapBindings} from '../ScrapBindings/script.js';
import {task} from '../ScrapBindings-settings/task.js';
scrapBindings.install()
.then(() => scrapBindings.push(...task));
import '../takker-scheduler-3%2Fmobile/script.js';
import '../scrapbox-open-episopass/script.js';
code:villagepump.js
import {execute as execute1} from '../Scrapbox-theme-saver/script.js';
import '../pin-diary-4-min/script.js';
/icons/hr.icon
UserCSS