Scrapboxで新規ページを作るブックマークレット

Scrapboxで新規ページを作る場合、プロジェクトのトップページを開いてそこから「+」ボタンを押して作成します。

あるページから新しいページを作るとき、一度トップに戻ってから「+」を押さないといけないのでちょっと面倒です。

個別ページから直接新ページをつくれたらと思い、ブックマークレットをつくりました。

1. 新規ページを作るブックマークレット
javascript:(function()%7Blocation.href=location.href.replace(/(.+%5C/).+$/,'$1')+'new';%7D)();

2. 現在見ているページへのリンクのついた新規ページを作るブックマークレット
javascript:(function()%7Bvar%20u=location.href.replace(/(.+%5C/).+$/,'$1');location.href=u+'new?body='+'%5B'+location.href.replace(u,'')+'%5D';%7D)();

3.今日の日付の新規ページを作るブックマークレット
javascript:(function()%7Bjavascript:%20(function()%20%7Bvar%20date%20=%20new%20Date();var%20predate%20=%20new%20Date(date.getFullYear(),%20date.getMonth(),%20date.getDate()%20-%201);var%20nextdate%20=%20new%20Date(date.getFullYear(),%20date.getMonth(),%20date.getDate()%20+%201);var%20preyear%20=%20new%20Date(date.getFullYear()%20-%201,%20date.getMonth(),%20date.getDate());var%20nextyear%20=%20new%20Date(date.getFullYear()%20+%201,%20date.getMonth(),%20date.getDate());if%20(date.getMonth()%20==%201)%20%7Bif%20(date.getDate()%20==%2029)%20%7Bx%20=%20date.getFullYear();do%20%7Bx%20+=%204;%7D%20while%20(leap(x)%20==%20false);nextyear%20=%20new%20Date(x,%20date.getMonth(),%20date.getDate());x%20=%20date.getFullYear();do%20%7Bx%20-=%204;%7D%20while%20(leap(x)%20==%20false);preyear%20=%20new%20Date(x,%20date.getMonth(),%20date.getDate());%7D%7Dvar%20u%20=%20%22https://scrapbox.io/HOME/%22;location.href%20=%20u%20+%20encodeURIComponent(fd(date))%20+%20'?body='%20+%20encodeURIComponent('%E6%98%A8%E6%97%A5%20%5B'%20+%20fd(predate)%20+%20'%5D%5Cn%E6%98%8E%E6%97%A5%20%5B'%20+%20fd(nextdate)%20+%20'%5D%5Cn%E5%8E%BB%E5%B9%B4%20%5B'%20+%20fd(preyear)%20+%20'%5D%5Cn%E6%9D%A5%E5%B9%B4%20%5B'%20+%20fd(nextyear)%20+%20'%5D');function%20fd(x)%20%7Bvar%20yyyy%20=%20x.getFullYear();var%20mm%20=%20x.getMonth()%20+%201;var%20dd%20=%20x.getDate();if%20(mm%20%3C%2010)%20%7Bmm%20=%20'0'%20+%20mm;%7Dif%20(dd%20%3C%2010)%20%7Bdd%20=%20'0'%20+%20dd;%7Dreturn%20yyyy%20+%20mm%20+%20dd;%7Dfunction%20leap(x)%20%7Bif%20(x%20%25%204%20==%200)%20%7Bif%20(x%20%25%20100%20==%200)%20%7Bif%20(x%20%25%20400%20==%200)%20%7Breturn%20true;%7D%20else%20%7Breturn%20false;%7D%7D%20else%20%7Breturn%20true;%7D%7D%20else%20%7Breturn%20false;%7D%7D%7D)();%7D)();

太字のHOMEのところをご自分のURLアドレスに変更しておつかいください。今日の日付がタイトルになったページに昨日と明日と去年と来年のリンクがついたものができます。

※このページの内容は以上です。「サポート」歓迎しております。いただいたサポートはツールのメンテナンスや要望追加の費用や開発モチベーションに当てさせていただきます。

この記事が気に入ったらサポートをしてみませんか?