dealextreme diary

  • /*
     * @title dealextreme diary
     * @description dealextreme toukou shimasu
     * @include http://*
     * @license DX License
     */
    (function () {
        var hatenaid = localStorage.getItem('hatenaid');
        if (!hatenaid) {
            hatenaid = window.prompt('input hatena id', '');
            localStorage.setItem('hatenaid', hatenaid);
        }
        
        var affiliate_id = localStorage.getItem('affiliate_id');
        if (!affiliate_id) {
            affiliate_id = window.prompt('input affiliate id', '');
            localStorage.setItem('affiliate_id', affiliate_id);
        }
        
        var meta = document.getElementsByTagName('meta');
        var imgurl;
        for (var i=0;i<meta.length;i++) {
            if(
                meta[i].hasAttribute('property')
                && meta[i].getAttribute('property') == "og:image"
            ) {
                imgurl = meta[i].getAttribute('content');
                break;
            }
        }
        var ebody = "**[" +
            location.href +
            ((affiliate_id) ? '?r=' + affiliate_id : '') +
            ":title]\r\n[" +
            imgurl.replace(/\_small\.jpg/, '.jpg') +
            ":image]";
        location.href = "http://dealextreme.g.hatena.ne.jp/" +
            hatenaid +
            "/?appendbody=" +
            encodeURIComponent(ebody) +
            "#edit_in_place";
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2011/09/16 20:11:10 - 2011-09-16
  2. 2011/09/16 19:37:15 - 2011-09-16
  3. 2011/09/15 23:16:50 - 2011-09-15
  4. 2011/09/15 23:06:55 - 2011-09-15