引用なう

  • /*
     * @title 引用なう
     * @description ページ内容を選択(しなくても可)してTwitterにつぶやくスクリプト。
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    (function () {
    
      var d = document, w = window;
    
      function getSelectedText () {
        if('\v' === 'v')
          return d.selection.createRange().text;
        else
          return ('getSelection' in w ? w : d).getSelection().toString();
      };
      
      var title = d.getElementsByTagName('title')[0].innerHTML
      ,   selectedText = getSelectedText()
      ,   uri = location.href
      ,   result = '';
    
      if(selectedText)
        result += '「' + selectedText + '」';
    
      if(title)
        result += title + ' | ';
    
      result += uri;
    
      w.open('http://twitter.com/home?status=' + encodeURIComponent(result));
    
      return;
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2012/04/11 14:42:11 - 2012-04-11
  2. 2012/04/11 14:34:10 - 2012-04-11