...を円で

    @@ -1,6 +1,6 @@ /* * @title ...を円で - * @description 選択した文字列 + "を円で" を Google 検索 + * @description 選択または入力した文字列 + "を円で" を Google 検索 * @include http://* * @license MIT License * @require
  • /*
     * @title ...を円で
     * @description 選択または入力した文字列 + "を円で" を Google 検索
     * @include http://*
     * @license MIT License
     * @require 
     */
    (function () {
      var price, query, url, alternatives, i, matches;
      alternatives = [
        {pattern: /C\$(.+)/, replace: "$1CAD"},
      ];
    
      price = window.getSelection().toString() || prompt("金額を通貨を含めて入力してください");
    
      for (i = 0; i < alternatives.length; i++) {
        price = price.replace(alternatives[i].pattern, alternatives[i].replace);
      }
    
      query = price + "を円で";
      url = "https://www.google.co.jp/search?q=" + encodeURIComponent(query);
      window.open(url, "_blank");
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/04/20 12:22:12 - 2016-04-20
  2. 2016/04/18 11:58:23 - 2016-04-18
  3. 2016/04/18 11:53:19 - 2016-04-18
  4. 2016/04/18 11:53:02 - 2016-04-18
  5. 2016/04/18 11:51:15 - 2016-04-18
  6. 2016/04/18 11:51:01 - 2016-04-18