#chiroruLab

趣味と日々の雑記録

Write SpaceのテキストをDropboxに送るブックマークレット

f:id:chiroru_27:20131114235337p:plain
Textwellのアクション的な感じで。

「Write Space」そのまま実行リンク
「Write Space」DLリンク

javascript:
var TEXT = {
            Title : "Write Space "+ getNow(),
            Body  : text.value
           };
function getNow(){
 var now = new Date(), year, month, day, hour, min, sec, nowDate;
 year    = (now.getYear()    < 2000) ? now.getYear()+1900   : now.getYear();
 month   = (now.getMonth()+1 < 10)   ? "0"+now.getMonth()+1 : now.getMonth()+1;
 day     = (now.getDate()    < 10)   ? "0"+now.getDate()    : now.getDate();
 hour    = (now.getHours()   < 10)   ? "0"+now.getHours()   : now.getHours();
 min     = (now.getMinutes() < 10)   ? "0"+now.getMinutes() : now.getMinutes();
 sec     = (now.getSeconds() < 10)   ? "0"+now.getSeconds() : now.getSeconds();
 nowDate = "" + year + month + day + hour + min + sec;
 
 return nowDate;
}

location = "writeroom://new/"+ encodeURIComponent(TEXT.Title) +"?body="+ encodeURIComponent(TEXT.Body);

今無料セール中のWriteRoomを経由してDropboxにアップする仕組み。
使いやすいオススメのアプリなので、ぜひこの機会に!


コールバック機能があるアプリなら、より自然な動作に出来そう。

Bywordならこんな感じかな。

location = "byword://new?location=dropbox&name="+ encodeURIComponent(TEXT.Title) +"&text="+ encodeURIComponent(TEXT.Body) +"&x-success="+ location.href;

以上、@chiroru_27 でした!
(まさか無料になるとは・・・orz)

ヒトコト

デザインの設定を書き出せるようになりました。
export,(title),(format)
()はオプションなので、無くても使えます。
formatは、htmlとtextの2種類を用意しました。