リッスンジャパンの中間ページを飛ばすやつ
もうすぐ七夕ですね、そうですね。ということで超お久しぶりのbonlifeです。
ニュースの一覧から、記事を選ぶじゃないですか。そうすると、記事の途中までしか表示されなくて、全文を読もうとすると「ニュース全文を読む」ってのをまた押さなきゃいけないんですけど、なんとかならないですかね。
と、書いておけば願いが聞き届けられたりしませんかね、もうすぐ七夕ですし。
そういうのってFirefox使ってたらGreasemonkeyだよね!ということで、慣れないJavaScript書いてみましたよ。
// ==UserScript== // @name Skip meaningless news pages of listen.jp // @namespace http://d.hatena.ne.jp/bonlife/ // @description overwrite hyperlinks of intermediate news pages // @include http://listen.jp/* // ==/UserScript== function xpath(query) { return document.evaluate(query, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); } var a_list = xpath("//a[contains(@href,'/store/musicnews_')]"); for (var i = 0; i < a_list.snapshotLength; i++ ){ target_a = a_list.snapshotItem(i); new_href = target_a['href'].replace(/_(\d+)(\.html?)/,'_$1_all$2'); target_a.setAttribute("href",new_href); }
これで↓こういうリンクが
http://listen.jp/store/musicnews_24256.htm
こう書き換えられるわけですよ。
http://listen.jp/store/musicnews_24256_all.htm
でも、リッスンジャパンってFirefoxだと試聴ができないマジック!!SleipnirのSeaHorseでやれば良いのかな、とか思いましたが、面倒なのでパス…。