fromdmtoamzn

    
      
  • /*
     * @title short url for amazon
     * @description AmazonのURLを短くします
     * @license MIT License
     */
    
    (function(_d,_a,_b,_c,df,box){
    function c(t){return _d.createElement(t)}
    function e(id){return _d.getElementById(id)}
    function addCSS(cssText,r,s){
    	s=_d.createElement('style');
    	s.type='text/css';
    	r=_d.getElementsByTagName('head')[0]||_d.documentElement;
    	s.textContent=cssText;
    	return r.appendChild(s).s
    }
    function closeBtn(p){
    	p=this.parentNode;
    	p.parentNode.removeChild(p);
    }
    function makeBtn(elm,formText,f,g,h){
    	f=c('form');
    	f.id=_c;
    	elm.appendChild(f);
    	g=c('textarea');
    	g.value=formText;
    	g.id=_a;
    	f.appendChild(g);
    	h=c('button');
    	f.appendChild(h);
    	h.appendChild(_d.createTextNode('\u00D7'));
    	h.setAttribute('type','button');
    	h.addEventListener('click',closeBtn,false);
    	h.title='close';
    }
    var inputElm = e('ASIN') || _d.getElementsByName('ASIN.0')[0];
    var inputASIN = (inputElm)?inputElm.value : '' ;
    var isbnID=inputASIN || window.sitbAsin;
    if(!isbnID)return;
    var pdTitle = e('productTitle')||e('btAsinTitle'),
    textElm = pdTitle.textContent + ' ' + 'http://amazon.jp/dp/' + isbnID;
    df=_d.createDocumentFragment();
    if(e(_b)){
    	if(e(_c))e(_c).parentNode.removeChild(e(_c));
    	makeBtn(df,textElm);
    	e(_b).appendChild(df);
    }else{
    	addCSS('#'+_a+'{top:30px;right:25px;width:400px;height:60px;z-index:9998;position:fixed;padding:8px;border:5px solid #888;padding:5px;opacity:0.7;}#'+_c+' button{top:20px;right:16px;z-index:9999;position:fixed;background-color:#FF514C;border:3px solid #fff;color:#fff;font-size:15px;height:23px;width:23px;padding:0;opacity:1;cursor:pointer;border-radius:15px;box-shadow:-1px 2px 6px #777;}');
    	box=c('div');
    	box.id=_b;
    	df.appendChild(box);
    	makeBtn(box,textElm);
    	_d.body.appendChild(df);
    }
    e(_a).focus();
    })(document,'rko_amzn_textarea','rko_amzn','rko_amzn_form');
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/01/24 11:04:19 - 2016-01-24
  2. 2016/01/24 11:01:55 - 2016-01-24
  3. 2016/01/24 11:01:00 - 2016-01-24
  4. 2016/01/24 00:42:14 - 2016-01-24
  5. 2016/01/24 00:36:46 - 2016-01-24
  6. 2016/01/24 00:36:16 - 2016-01-24
  7. 2016/01/24 00:34:44 - 2016-01-24
  8. 2016/01/24 00:31:58 - 2016-01-24
  9. 2016/01/24 00:26:54 - 2016-01-24
  10. 2016/01/24 00:24:21 - 2016-01-24
  11. 2016/01/24 00:05:55 - 2016-01-24
  12. 2016/01/24 00:02:55 - 2016-01-24
  13. 2016/01/24 00:01:34 - 2016-01-24
  14. 2016/01/23 23:52:46 - 2016-01-23
  15. 2016/01/23 23:49:42 - 2016-01-23
  16. 2016/01/23 23:43:32 - 2016-01-23
  17. 2016/01/23 23:41:48 - 2016-01-23
  18. 2016/01/23 23:32:45 - 2016-01-23
  19. 2016/01/23 23:30:35 - 2016-01-23
  20. 2016/01/23 23:20:27 - 2016-01-23
  21. 2016/01/23 22:57:31 - 2016-01-23
  22. 2016/01/23 22:38:20 - 2016-01-23
  23. 2016/01/23 17:15:51 - 2016-01-23
  24. 2016/01/23 12:45:54 - 2016-01-23
  25. 2016/01/23 11:49:25 - 2016-01-23
  26. 2016/01/23 11:49:19 - 2016-01-23