Quantcast
Channel: W&R : Jazzと読書の日々
Viewing all articles
Browse latest Browse all 1492

Textwellの内蔵ブラウザでT.closeletsを活用するアクション RealTime

$
0
0

カタから入る。


T.closeletsのカタ

Textwell 1.6.2
分類: 仕事効率化,ユーティリティ
価格: \360 (Sociomedia)

基本形としてYahooリアルタイム検索のアクションを作ってみました。

T.closelets([
  {title: "Open",
  fn: function(){
    T(location.href);
  }}
],function(){
  location="http://realtime.search.yahoo.co.jp/search?p="+T.stdin.currentText;
})

閉じるとき「Open」でSafariに移動します。T(location.href)だけでSafariが開く。最終行の「location=〜」を書き換えれば、どのサイトの検索にも対応できます。

Import Textwell ActionRealTime α


メニューを増やす

titleとfnのセットを追加すればメニューが増えます。つまり、選択肢をいくらでも組み込むことが出来る。ためしにリンクを取得する機能も付けてみましょう。

T.closelets([
  {title: "Open",
  fn: function(){
    url=location.href;
    T(url);
  }},
  {title: "Link",
  fn: function(){
    url=location.href;
    T("replaceCurrent",{text:url});
  }}
],function(){
  location="http://realtime.search.yahoo.co.jp/search?p="+T.stdin.currentText;
})

replaceCurrentはカーソル行にテキストを書き込む呪文。

Import Textwell ActionRealTime β


ツィートを引用する

ブログにツィートを貼り付けたいときがある。タイムスタンプをタップするとツィートが単体表示されます。そして内蔵ブラウザを閉じると「Open/Link」のメニューが出てくるので「Link」を選択。Twitterが定めた書式でTextwellに取り込むアクションです。

T.closelets([
  {title: "Open",
  fn: function(){
    url=location.href;
    T(url);
  }},
  {title: "Link",
  fn: function(){
    url=location.href;
    title=document.title;
  if(/twitter\.com/.test(url)){
    url=url.replace(/mobile\./,"");
    link = "<blockquote class='twitter-tweet'><a href='"+url+"'>"+title+"</a></blockquote><script async src='http://platform.twitter.com/widgets.js’ charset='utf-8'></scr"+"ipt>\n";
  }else{
    link="<iframe title='"+title+"' src='http://hatenablog.com/embed?url="+url+"' width=400 frameborder=0 scrolling=no></iframe>\n";
  }
  T("replaceCurrent",{text:link});
  }}
],function(){
  location="http://realtime.search.yahoo.co.jp/search?p="+T.stdin.currentText;
})

ツィート以外のときはブログカードが貼りつきます。

Import Textwell ActionRealTime


まとめ

Safariでも出来ることだけれど、それだとサイトごとにブックマークレットを用意しなくちゃあいけない。対応するスクリプトをリストから探すのは面倒です。それがTextwellだと、検索サイトとブックマークレットのユニットとして扱える。そこがT.closeletsの利点。


Viewing all articles
Browse latest Browse all 1492

Trending Articles