選択範囲を取得

    
      
  • /*
     * @title bookmarklet
     * @description my bookmarklet
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    
    var selection
        = window.getSelection   ? window.getSelection()
        : document.getSelection ? document.getSelection()
        : document.selection    ? document.selection.createRange().text
        :                         0
        ;
    console.log(selection);
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2012/03/08 14:48:05 - 2012-03-08
  2. 2012/03/08 14:45:41 - 2012-03-08
  3. 2012/03/08 14:41:31 - 2012-03-08
  4. 2012/03/08 14:38:15 - 2012-03-08
  5. 2012/03/08 14:36:51 - 2012-03-08
  6. 2012/03/08 14:35:46 - 2012-03-08