Friday, 7. December 2007, 11:21:44
UserJS
私はわりと音楽が好きなのですが、あまり音質にこだわる方ではないので、CDを買ったらすぐリッピングしてPCで聴いています。PCで音楽を聴くとわざわざCDを入れ替えたりしなくでいいので便利なのですが、HDDにあるアルバムが数百枚になってくると、タイトルもうろ覚えになってきて聴きたい音楽を探すのが困難になります。で、アルバムのジャケットの画像を音楽のファイルがあるディレクトリに入れておくと探しやすくなっていいのですが、いちいちジャケット画像をスキャンしてPCに取り込むのはめんどくさすぎる。なので、Webでジャケット画像を探す事になるのですが、なかなかいいサイトがないんですよね。
基本的にはDiscogsを使うことが多いのですが、このサイトはクラブミュージック関係にはめっぽう強いけれど、他の分野はいまいち。Amazonは網羅的なのですが商品画像をダウンロードしようとすると不必要な枠付きの画像しかダウンロードできないんですよね。これは困った。
と、思ってたのですが、今日Xenophiasさんのブログで枠無しのジャケット画像をダウンロードする方法を知りました。
こりゃいいやという事でAmazonで商品画像をダウンロードしやすくするユーザーJavaScriptを作りました。商品画像の下にダウンロード用のリンクを追加します。
あんまりテストしてないので動かないページがあると思います。その場合は報告などしていただけると嬉しいです。
// ==UserScript==
// @name Amazon - Append download image link
// @author Satoru Watanabe
// @namespace http://my.opera.com/Watanabe/
// @version 1.0.0
// @include http://amazon.co.jp/*
// @include http://www.amazon.co.jp/*
// ==/UserScript==
(function () {
document.addEventListener('DOMContentLoaded', function () {
var image = $('prodImage');
if (image != null && image.src.match(/(.*)\._.*_(\.jpg|\.gif)/)) {
var uri = RegExp.$1 + RegExp.$2;
var caption = $('prodImageCaption');
var a = document.createElement('a');
a.setAttribute('href', uri);
a.setAttribute('style', 'margin-left: 1em;');
a.textContent = '\u30A4\u30E1\u30FC\u30B8\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9';
caption.appendChild(a);
}
}, false);
function $(id) {
return document.getElementById(id);
}
}) ();
ダウンロード
- Opera用
- amazon-append-download-image-link.js
- Firefox用
- amazon-append-download-image-link.user.js
Thursday, 6. December 2007, 18:02:15
UserJS
先日、Tumblrでポストしたコンテンツを誰がReblogしているか見ることができる機能が追加されたのですが、これはDashboardでしか見ることができないのでちょっと不便です。そこで、個々のTumblrのページのパーマリンクからNotesを表示できるようにするユーザーJavaScriptを作りました。
本格的にテキトーです。もうちょっとなんとかしてくれる方募集中。
// ==UserScript==
// @name Tumblr - Append notes to post
// @author Satoru Watanabe
// @namespace http://my.opera.com/Watanabe/
// @version 1.0.0
// @include http://*.tumblr.com/post/*
// @exclude http://www.tumblr.com/*
// ==/UserScript==
(function () {
if (location.href.match(/post\/(\d+)/)) {
var id = RegExp.$1;
var o = document.createElement('object');
o.style = 'width: 100%; padding-top: 10px;';
o.setAttribute('data', 'http://www.tumblr.com/dashboard/notes/' + id);
o.setAttribute('type', 'text/html');
var exp = document.createExpression('//div[@class="post"][last()]', null);
var post = exp.evaluate(document, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (post != null) {
post.appendChild(o);
}
}
}) ();
ダウンロード
tumblr-append-notes-to-post.user.js
追記: 2007-12-07T10:09:27+09:00
今朝Tumblrを見てみると、Dashboard以外からNotesにアクセスできないよう仕様変更されてました。ははは……。という事でこのユーザーJavaScriptは使っても意味ありません。
Friday, 21. September 2007, 10:56:45
Opera Community, UserJS
最近、個人的にはてなスターブームが到来したのでOpera Communityではてなスターを付ける事ができるようにするユーザーJavaScriptを作りました。
とりあえずブログにだけ対応。Firefoxでも使えます。そもそも私以外に使いたいと思う人間が一人も存在しないような気もしますが、そこら辺は気にしない方向で。
my.opera.comドメインで付けられているはてなスターの一覧ははてなスター - Opera Communityから確認できるようです。
// ==UserScript==
// @name my.opera.com - Append Hatena Star
// @author Satoru Watanabe
// @namespace http://my.opera.com/Watanabe/
// @version 1.0.0
// @include http://my.opera.com/*/blog/*
// @include http://my.opera.com/*/archive/*
// ==/UserScript==
(function () {
var w = typeof unsafeWindow != "undefined" ? unsafeWindow : window;
var t = setInterval(function(){
if (!w.Hatena) return;
init();
clearInterval(t);
}, 100);
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('charset', 'utf-8');
script.setAttribute('src', 'http://s.hatena.ne.jp/js/HatenaStar.js');
document.getElementsByTagName('head')[0].appendChild(script);
function init() {
w.Hatena.Star.EntryLoader.loadEntries = function () {
var entries = [];
var posts = w.Ten.DOM.getElementsByTagAndClassName('div', 'post', document.body);
for (var i = 0, len = posts.length; i < len; i++) {
entries.push(new w.Hatena.Star.Entry.MyOpera(posts[i]));
}
return entries;
}
w.Hatena.Star.Entry.MyOpera = new w.Ten.Class({
initialize: function (post) {
var entry = w.Ten.DOM.getElementsByClassName('title', post)[0];
this.title = w.Ten.DOM.scrapeText(entry);
var a = entry.getElementsByTagName('a')[0];
this.uri = a == null ? location.href : a.href;
this.comment_container = w.Hatena.Star.EntryLoader.createCommentContainer();
entry.appendChild(this.comment_container);
this.star_container = w.Hatena.Star.EntryLoader.createStarContainer();
entry.appendChild(this.star_container);
}
});
}
}) ();
ダウンロード
my-opera-com-append-hatena-star.user.js
Showing posts 1 -
3 of
26.