blog/content/post/2007/10/27/2007-10-27-00000630.md

62 lines
13 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 情報は集約されていなければ意味がない!
author: kazu634
date: 2007-10-27
wordtwit_post_info:
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:3283;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- つれづれ
---
<div class="section">
<p>
 自分は<a href="http://www.mozilla-japan.org/products/firefox/" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.mozilla-japan.org/products/firefox/', 'Firefox');" target="blank">Firefox</a>というブラウザを使っているのですが、そのFirefoxはGreasemonkeyというもので機能を拡張できます。そこで色々なことが出来るのですが、例えば<a href="http://www.amazon.co.jp/" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.amazon.co.jp/', 'Amazon');" target="blank">Amazon</a>の商品ページで図書館や他のオンライン書店へとリンクをつけることが出来ます。これは結構便利なんです(興味がある人は<a href="http://firefox.geckodev.org/index.php?Greasemonkey" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://firefox.geckodev.org/index.php?Greasemonkey', '「Greasemonkey &#8211; Mozilla Firefox まとめサイト」');" target="blank">「Greasemonkey &#8211; Mozilla Firefox まとめサイト」</a>を見てみてください)。
</p>
<p>
 でも、不満もありました。一つ一つが独立しているために、Amazon側で商品ページを変更されてしまうと、個別にインストールしなければいけなかったのです。これは面倒くさい。また、ASINAmazonが商品に割り当てているユニークな番号のこと。書籍だと<a href="http://ja.wikipedia.org/wiki/ISBN" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://ja.wikipedia.org/wiki/ISBN', 'ISBN');" target="blank">ISBN</a>を割り当てている)を日本の書籍に決めうちしているのも不満点でした。これだと洋書が検索できないではないか!
</p>
<p>
 というわけで、自分が活用していたGreasemonkeyスクリプトを一つのスクリプトに統合しました。情報はやっぱり集約されていないと、意味がないと思います。結局こんな感じになりました画像左下に注目
</p>
<p>
<center>
<a href="http://image.blog.livedoor.jp/simoom634/imgs/7/7/77ebcc7f.JPG" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://image.blog.livedoor.jp/simoom634/imgs/7/7/77ebcc7f.JPG', '');" target="_blank"><img width="360" alt="my amazon" src="http://image.blog.livedoor.jp/simoom634/imgs/7/7/77ebcc7f.JPG" border="0" /></a>
</center>
<br />
<hr />
<code>// ==UserScript==&lt;br />// @name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Amazon Link Aggregator&lt;br />// @namespace&#160;&#160;&#160;&#160; &lt;br />// @description&#160; Temporary Script.&lt;br />// @include&#160;&#160;&#160;&#160;&#160;&#160; &lt;a href="http://*.amazon.*" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://*.amazon.*', 'http://*.amazon.*');" target="_blank">http://*.amazon.*&lt;/a>&lt;br />// ==/UserScript==&lt;/p>
&lt;p>// HTML文章でなければ、何もせずに終了&lt;br />if(document.contentType != 'text/html') return;&lt;/p>
&lt;p>// ASINを探す&lt;br />document.body.parentNode.innerHTML.match(/name=\"ASIN\" value=\"([0-9A-Z]{10})([/-_a-zA-Z0-9]*)/i);&lt;/p>
&lt;p>// ASINを見つけられなければ、何もせずに終了&lt;br />if (RegExp.$1 == '')&#160;&#160; &#160;return;&lt;/p>
&lt;p>// 変数asinにASINを代入&lt;br />var asin = RegExp.$1&lt;/p>
&lt;p>// ISBN13の値を一応計算&lt;br />isbn13 = cvISBN13(asin);&lt;/p>
&lt;p>// 楽天Booksへのリンク作成&lt;br />var raku_link = document.createElement('a');&lt;br />raku_link.setAttribute('href', '&lt;a href="http://esearch.rakuten.co.jp/rms/sd/esearch/vc?sitem='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://esearch.rakuten.co.jp/rms/sd/esearch/vc?sitem=\'', 'http://esearch.rakuten.co.jp/rms/sd/esearch/vc?sitem=');" target="_blank">http://esearch.rakuten.co.jp/rms/sd/esearch/vc?sitem=&lt;/a> + asin + '&sv=30');&lt;/p>
&lt;p>// 本やタウンへのリンク作成&lt;br />var honya_link = document.createElement('a');&lt;br />honya_link.setAttribute('href', '&lt;a href="http://www.honya-town.co.jp/hst/HTdispatch?free=&free_andor=0&title=&title_andor=0&title_title=1&title_subtitle=1&title_series=1&title_original=1&author=&author_list=0&publisher=&date_yy_from=&date_mm_from=&date_yy_to=&date_mm_to=&vague_search=1&list_kensu=20&stamp_style=0&price_from=&price_to=&isbn_cd='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.honya-town.co.jp/hst/HTdispatch?free=&free_andor=0&title=&title_andor=0&title_title=1&title_subtitle=1&title_series=1&title_original=1&author=&author_list=0&publisher=&date_yy_from=&date_mm_from=&date_yy_to=&date_mm_to=&vague_search=1&list_kensu=20&stamp_style=0&price_from=&price_to=&isbn_cd=\'', 'http://www.honya-town.co.jp/hst/HTdispatch?free=&#038;free_andor=0&#038;title=&#038;title_andor=0&#038;title_title=1&#038;title_subtitle=1&#038;title_series=1&#038;title_original=1&#038;author=&#038;author_list=0&#038;publisher=&#038;date_yy_from=&#038;date_mm_from=&#038;date_yy_to=&#038;date_mm_to=&#038;vague_search=1&#038;list_kensu=20&#038;stamp_style=0&#038;price_from=&#038;price_to=&#038;isbn_cd=');" target="_blank">http://www.honya-town.co.jp/hst/HTdispatch?free=&#38;free_andor=0&#38;title=&#38;title_andor=0&#38;title_title=1&#38;title_subtitle=1&#38;title_series=1&#38;title_original=1&#38;author=&#38;author_list=0&#38;publisher=&#38;date_yy_from=&#38;date_mm_from=&#38;date_yy_to=&#38;date_mm_to=&#38;vague_search=1&#38;list_kensu=20&#38;stamp_style=0&#38;price_from=&#38;price_to=&#38;isbn_cd=&lt;/a> + asin + '&pub_stat=2&submit.x=78&submit.y=10&nips_cd=');&lt;/p>
&lt;p>// G-Toolsへのリンク作成&lt;br />var gtools_link = document.createElement('a');&lt;br />gtools_link.setAttribute('href', '&lt;a href="http://www.umizoi.com/g-tools/foward_ecs4.php?view=detail&region=jp&asin='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.umizoi.com/g-tools/foward_ecs4.php?view=detail&region=jp&asin=\'', 'http://www.umizoi.com/g-tools/foward_ecs4.php?view=detail&#038;region=jp&#038;asin=');" target="_blank">http://www.umizoi.com/g-tools/foward_ecs4.php?view=detail&#38;region=jp&#38;asin=&lt;/a> + asin);&lt;/p>
&lt;p>// Lead2Amazonへのリンク作成&lt;br />var bibtex_link = document.createElement('a');&lt;br />bibtex_link.setAttribute('href', '&lt;a href="http://keijisaito.info/lead2amazon/j/?key='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://keijisaito.info/lead2amazon/j/?key=\'', 'http://keijisaito.info/lead2amazon/j/?key=');" target="_blank">http://keijisaito.info/lead2amazon/j/?key=&lt;/a> + asin + '&si=all&op=bt&so=sa&ht=jp');&lt;/p>
&lt;p>// Yahoo! Booksへのリンク作成&lt;br />var yahoo_link = document.createElement('a');&lt;br />yahoo_link.setAttribute('href', '&lt;a href="http://books.yahoo.co.jp/book_search/isbn?os=1&isbn='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://books.yahoo.co.jp/book_search/isbn?os=1&isbn=\'', 'http://books.yahoo.co.jp/book_search/isbn?os=1&#038;isbn=');" target="_blank">http://books.yahoo.co.jp/book_search/isbn?os=1&#38;isbn=&lt;/a> + asin);&lt;/p>
&lt;p>// BOOK OFFへのリンク作成&lt;br />var bookoff_link = document.createElement('a');&lt;br />bookoff_link.setAttribute('href', '&lt;a href="http://www.bookoffonline.co.jp/display/L001,st=u,q='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.bookoffonline.co.jp/display/L001,st=u,q=\'', 'http://www.bookoffonline.co.jp/display/L001,st=u,q=');" target="_blank">http://www.bookoffonline.co.jp/display/L001,st=u,q=&lt;/a> + asin);&lt;/p>
&lt;p>// addallへのリンク作成&lt;br />var addall_link = document.createElement('a');&lt;br />addall_link.setAttribute('href', '&lt;a href="http://used.addall.com/SuperRare/submitRare.cgi?author=&title=&keyword=&isbn='" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://used.addall.com/SuperRare/submitRare.cgi?author=&title=&keyword=&isbn=\'', 'http://used.addall.com/SuperRare/submitRare.cgi?author=&#038;title=&#038;keyword=&#038;isbn=');" target="_blank">http://used.addall.com/SuperRare/submitRare.cgi?author=&#38;title=&#38;keyword=&#38;isbn=&lt;/a> + asin + '&order=PRICE&ordering=ASC&dispCurr=JPY&binding=Any+Binding&min=&max=&timeout=20&match=Y&store=Abebooks&store=AbebooksDE&store=AbebooksFR&store=AbebooksUK&store=Alibris&store=Amazon&store=AmazonCA&store=AmazonUK&store=AmazonDE&store=AmazonFR&store=Antiqbook&store=Biblio&store=Biblion&store=Bibliophile&store=Bibliopoly&store=Booksandcollectibles&store=Half&store=ILAB&store=LivreRareBook&store=Maremagnum&store=Powells&store=Strandbooks&store=Tomfolio&store=ZVAB');&lt;/p>
&lt;p>// 表示する情報パネルの設定&lt;br />var GM_infoPanel = document.createElement('div')&lt;/p>
&lt;p>with(GM_infoPanel.style) {&lt;br />&#160;&#160;&#160;&#160; bottom = 0;&lt;br />&#160;&#160;&#160;&#160; left = 0;&lt;br />&#160;&#160;&#160;&#160; padding = '2px';&lt;br />&#160;&#160;&#160;&#160; opacity = 0.8;&lt;br />&#160;&#160;&#160;&#160; fontsize = 'x-small';&lt;br />&#160;&#160;&#160;&#160; color = '#000000';&lt;br />&#160;&#160;&#160;&#160; backgroundColor = '#EEEEEE';&lt;br />&#160;&#160;&#160;&#160; border = '1px solid #C0C0C0';&lt;br />&#160;&#160;&#160;&#160; &lt;br />&#160;&#160;&#160;&#160; zIndex = 100;&lt;br />&#160;&#160;&#160;&#160; position = 'fixed';&lt;br />}&lt;/p>
&lt;p>// 実際の表示部分作成&lt;br />GM_infoPanel.innerHTML = 'Link Search&lt;br />[ISBN10(ASIN): ' + asin + ']&lt;br />[ISBN13: ' + isbn13 + ']&lt;br />BibTex Search: &lt;a target="blank" href="./%27%20+%20bibtex_link%20+%20%27">Lead2Amazon&lt;/a>&lt;br />Blog: &lt;a target="blank" href="./%27%20+%20gtools_link%20+%20%27">G-Tools&lt;/a>&lt;br />Books (New): &lt;a target="blank" href="./%27%20+%20honya_link%20+%20%27">HonyaTown&lt;/a> / &lt;a target="blank" href="./%27%20+%20raku_link%20+%20%27">Rakuten&lt;/a> / &lt;a target="blank" href="./%27%20+%20yahoo_link%20+%20%27">Yahoo!&lt;/a>&lt;br />Books (Used): &lt;a target="blank" href="./%27%20+%20bookoff_link%20+%20%27">BookOff&lt;/a> / &lt;a target="blank" href="./%27%20+%20addall_link%20+%20%27">AddAll&lt;/a>&lt;br />Libraries: &lt;a href="http://www.library.tohoku.ac.jp/opac/expert-query" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.library.tohoku.ac.jp/opac/expert-query', 'Tohoku Univ');" target="blank">Tohoku Univ&lt;/a> / &lt;a href="http://www.library.pref.miyagi.jp/WoDetail.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.library.pref.miyagi.jp/WoDetail.html', 'Miyagi Pref');" target="blank">Miyagi Pref&lt;/a> / &lt;a href="https://lib-www.smt.city.sendai.jp/licsxp-opac/WOpacTifSchCmpdDispAction.do" onclick="__gaTracker('send', 'event', 'outbound-article', 'https://lib-www.smt.city.sendai.jp/licsxp-opac/WOpacTifSchCmpdDispAction.do', 'Sendai City');" target="blank">Sendai City&lt;/a>';&lt;/p>
&lt;p>// 表示&lt;br />document.body.appendChild(GM_infoPanel);&lt;/p>
&lt;p>// ISBN10 to ISBN13&lt;br />// 基本的に丸ごとぱくりでやす。。。&lt;br />// Thanks to &lt;a href="http://d.hatena.ne.jp/natu_n/" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://d.hatena.ne.jp/natu_n/', 'http://d.hatena.ne.jp/natu_n/');" target="_blank">http://d.hatena.ne.jp/natu_n/&lt;/a>&lt;/p>
&lt;p>function cvISBN13(ISBN){&lt;br />&#160;&#160;&#160;&#160; _odd = 0;&lt;br />&#160;&#160;&#160;&#160; _even = 0;&lt;br />&#160;&#160;&#160;&#160; _bISBN = "978" + String(ISBN).substr(0,9);&lt;br />&#160;&#160;&#160;&#160; for(var i=0;i&#60;11;i+=2){&lt;br />&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; _odd += Number(_bISBN.substr(i,1));&lt;br />&#160;&#160;&#160;&#160; }&lt;br />&#160;&#160;&#160;&#160; for(var i=1;i&#60;12;i+=2){&lt;br />&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; _even += Number(_bISBN.substr(i,1&lt;br />
));&lt;br />&#160;&#160;&#160;&#160; }&lt;br />&#160;&#160;&#160;&#160; _even = _even * 3;&lt;br />&#160;&#160;&#160;&#160; _SUM = String(_odd + _even);&lt;br />&#160;&#160;&#160;&#160; _Mod = Number(_SUM.substr&lt;span class="footnote">&lt;a href="/sirocco634/#f1" name="fn1" title="_SUM.length - 1),1">*1&lt;/a>&lt;/span>;&lt;br />&#160;&#160;&#160;&#160; if (_Mod == 0){&lt;br />&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; _Mod = "0";&lt;br />&#160;&#160;&#160;&#160; } else {&lt;br />&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; _Mod = 10 - _Mod;&lt;br />&#160;&#160;&#160;&#160; }&lt;br />&#160;&#160;&#160;&#160; ISBN = Number(_bISBN.substr(0,12) + _Mod);&lt;br />&#160;&#160;&#160;&#160; return ISBN;&lt;br />}&lt;br /></code><br />
<hr />
</div>
<div class="footnote">
<p class="footnote">
<a href="/sirocco634/#fn1" name="f1">*1</a>_SUM.length &#8211; 1),1
</p>
</div>