Hatena Haiku Button for Hatena Bookmark
by
wakabatan
2011-03-16 [2011/03/16 20:54:07]
Hatena Haiku Button bookmarklet for Hatena Bookmark entry pages.
@@ -1,8 +1,9 @@
/*
- * @title Hatena Haiku Button
- * @description Hatena Haiku Button bookmarklet.
+ * @title Hatena Haiku Button for Hatena Bookmark
+ * @description Hatena Haiku Button bookmarklet for Hatena Bookmark entry pages.
* @license MIT License
+ Document/Repository: <https://github.com/wakaba/hatena-haiku-button>.
Source: <https://github.com/wakaba/hatena-haiku-button/blob/master/bookmarklets/bookmark-entries.js>.
*/
/*
* @title Hatena Haiku Button for Hatena Bookmark
* @description Hatena Haiku Button bookmarklet for Hatena Bookmark entry pages.
* @license MIT License
Document/Repository: <https://github.com/wakaba/hatena-haiku-button>.
Source: <https://github.com/wakaba/hatena-haiku-button/blob/master/bookmarklets/bookmark-entries.js>.
*/
var links = document.links;
var linksL = links.length;
for (var i = 0; i < linksL; i++) {
var link = links[i];
if (/^http:\/\/b\.hatena\.ne\.jp\/entry\//.test(link.href)) {
var img = document.createElement('img');
img.src = 'http://h.hatena.ne.jp/images/haiku-button.png';
img.className = 'hatena-haiku-button';
img.style.verticalAlign = 'bottom';
var url = link.href
.replace(/^http:\/\/b\.hatena\.ne\.jp\/entry\/https\//, 'https://')
.replace(/^http:\/\/b\.hatena\.ne\.jp\/entry\/https:\/\//, 'https://')
.replace(/^http:\/\/b\.hatena\.ne\.jp\/entry\/http:\/\//, 'http://')
.replace(/^http:\/\/b\.hatena\.ne\.jp\/entry\//, 'http://');
img.setAttribute('data-haiku-word', url);
link.parentNode.insertBefore(img, link.nextSibling);
}
}
var script = document.createElement('script');
script.src = 'https://github.com/wakaba/hatena-haiku-button/raw/master/scripts/hatena-haiku-button.js';
document.body.appendChild(script);
void(0);
/*
Usage: Open <http://b.hatena.ne.jp/> and execute this bookmarklet.
************ LICENSE ************
Copyright 2011 Wakaba.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。