TextwellにScrapboxのページリンクを挿入してくれるアクション
挿入したいリンクページ名をアバウトにTextwellに記述してアクション実行 (例 TextwellにScrap
検索結果から目的のページを開いてから閉じる(例えばこのページ)
すると[TextwellにScrapboxのページリンクを挿入してくれるアクション]に置き換わる
code:Scrapbox.js
// Scrapboxアドレスを書いてください。
// スクリプト本体
T.setData("scheme","replace");
T.closelets([
// ここが追加分
{title:"Link(self)",
fn:function(){
let name = location.href;
name = name.split("/")
T("replaceCurrent",{text: "+ decodeURI(name) + ""});
}},
// ここまで
{title:"Link",
fn:function(){
T("replaceCurrent",{text:location.href+"\n"});
}},
{title:"Save ",
fn:function(){
url = location.href;
if(/\/api\/code\//.test(url)){
s = document.body.innerText;
}else{
s = scrapbox.Page.lines.map((x) => x.text).join('\n');
text = s.substr(title.length);
}
T(T.data.scheme,{text:s});
}},
{title:"Open",
fn:function(){
T(location.href);
}}],function(){
if(T.text){
s = T.current;
if(s){
T.setData("scheme","replaceCurrent");
if(/https:\/\/scrapbox\.io/.test(s)){
HOME = s;
}else{
HOME+= "search/page?q="+T.stdin.currentText;
}
}else{
HOME+= encodeURIComponent(title)+"?body="+encodeURIComponent(T.lines(2,null));
}
}
location = HOME;
})