Fotolife individual to post Hatena Blog

  • /*
     * @title Fotolife individual to post Hatena Blog
     * @description フォトライフ個別から、はてなブログ記事投稿します
     * @include http://f.hatena.ne.jp/*
     * @license MIT License
     */
    (function(){
      var l = location.href;
      if (l.indexOf('?') > 0) {
        alert('パラメーター「?...」を除去した正規のページでおこなってください。');
      }
      var regex = new RegExp('^http://f.hatena.ne.jp/.+/[0-9]{14,}$', 'i');
      if (!regex.test(l)) return;
      var edit_uri = 'http://blog.hatena.ne.jp/my/edit';
      var contents = '[' + document.querySelector('#breadcrumbs input[type=text]').value + ']';
      var fototitle = document.querySelector('img.foto').getAttribute('title');
     
      alert('タイトル : ' + fototitle );
      return window.location = edit_uri
      + '?body='
      + encodeURIComponent(contents)
      + '&title='
      + encodeURIComponent(fototitle);
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2015/06/07 21:33:35 - 2015-06-07
  2. 2015/06/07 21:26:01 - 2015-06-07