-
まず、/mt-static/images に
←の画像をアップロード
/mt-static/mt_ja.js に以下のコードを追加
function AmazonLink(e) { if (!canFormat) return; var associate_id = 'twinklexxx'; // 自分のアソシエイト ID に変更 var xslt = 'https://aws.twinkle.cc/amazon.xsl'; // 自分の XSLT のアドレスに変更 var access_key = '152ZP71KPB47XM09CS02'; // 自分の Web サービス Access Key ID に変更 var str = getSelected(e); var asin = prompt('Enter Amazon ASIN',''); var country = prompt('Enter Country (us or jp)', 'us'); if (asin != null && country != null) {
} return false; }if (str == '') { if(country == 'jp') { code = '-22'; } else if(country == 'us') { code = '-20'; } setSelection(e, '<iframe src="https://xml-' + country + '.amznxslt.com/onca/xml?Service=AWSECommerceService&ItemId=' + asin + '&AssociateTag=' + associate_id + code + '&AWSAccessKeyId=' + access_key + '&Operation=ItemLookup&IdType=ASIN&ContentType=text%2Fhtml&Version=2006-03-08&Page=1&ResponseGroup=ItemAttributes,Images,Offers&Style=' + xslt + '" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" height="175"></iframe>\n'); } else { setSelection(e, '<iframe src="https://xml-' + country + '.amznxslt.com/onca/xml?Service=AWSECommerceService&ItemId=' + asin + '&AssociateTag=' + associate_id + code + '&AWSAccessKeyId=' + access_key + '&Operation=ItemLookup&IdType=ASIN&ContentType=text%2Fhtml&Version=2006-03-08&Page=1&ResponseGroup=ItemAttributes,Images,Offers&Style=' + xslt + '" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" height="175"></iframe>\n'); } -
次に、/tmpl/cms/edit_entry.tmpl 583 と 642 行目あたりに以下のコードをそれぞれ追加(通常のエントリー書き込み部分と「続きを読む」用に、2ヶ所修正が必要)
write('<img title="<MT_TRANS phrase="Quote">" onclick="return formatStr(document.entry_form.text, \'blockquote\')" src="<TMPL_VAR NAME=STATIC_URI>images/formatting-icons/quote.gif" alt="<MT_TRANS phrase="Quote">" width="26" height="19" />'); <strong>write('<a title="<MT_TRANS phrase="AmazonLink">" href="#" onclick="return AmazonLink(document.entry_form.text)"><img src="<TMPL_VAR NAME=STATIC_URI>images/amazon.gif" alt="<MT_TRANS phrase="AmazonLink">" width="26" height="19" /></a>');</strong>write('<img title="<MT_TRANS phrase="Quote">" onclick="return formatStr(document.entry_form.text_more, \'blockquote\')" src="<TMPL_VAR NAME=STATIC_URI>images/formatting-icons/quote.gif" alt="<MT_TRANS phrase="Quote">" width="26" height="19" />'); write('<a title="<MT_TRANS phrase="AmazonLink">" href="#" onclick="return AmazonLink(document.entry_form.text_more)"><img src="<TMPL_VAR NAME=STATIC_URI>images/amazon.gif" alt="<MT_TRANS phrase="AmazonLink">" width="26" height="19" /></a>'); -
最後に、/tmpl/cms/bm_entry.tmpl 334 と 373 行目あたりに以下のコードをそれぞれ追加(同様に通常のエントリー書き込み部分と「続きを読む」用に、2ヶ所修正が必要)
write('<a title="<MT_TRANS phrase="AmazonLink">" href="#" onclick="return AmazonLink(document.entry_form.text)">write('<a title="<MT_TRANS phrase="Quote">" href="#" onclick="return formatStr(document.entry_form.text, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>');images/amazon.gif" alt="" width="26" height="19" />');
write('<a title="<MT_TRANS phrase="Quote">" href="#" onclick="return formatStr(document.entry_form.text_more, \'blockquote\')"><img src="<TMPL_VAR NAME=STATIC_URI>images/html-quote.gif" alt="<MT_TRANS phrase="Quote">" width="22" height="16" /></a>'); <strong>write('<a title="<MT_TRANS phrase="AmazonLink">" href="#" onclick="return AmazonLink(document.entry_form.text_more)"><img src="<TMPL_VAR NAME=STATIC_URI>images/amazon.gif" alt="<MT_TRANS phrase="AmazonLink">" width="26" height="19" /></a>');</strong>
Updated: 2007/04/21
Created: 2007/07/01
Comments
Amazon アソシエイトで、Movable Type を使ったアフィリエイトを簡単にする方法