[α版]はてブエントリーページを旧仕様っぽくする Greasemonkey2011-06-01
はてブのエントリーページを旧仕様っぽくする Greasemonkey 書きました。
まだ超α版なので、user.js ファイルでは置きません。
Chrome でしか確認してないです。まあ Firefox でも動くんじゃないかな?たぶん。
この実装だと、上記の問題解決はかなり難しそうです。
なので、全てのブックマークページをそのまま iframe で埋め込む方法に実装を変更する予定なのですが、とりあえず情報参照だけなら綺麗に動いたのでアルファ版として公開してみました。
フィードバック、改造報告などがあれば是非コメントに!
まだ超α版なので、user.js ファイルでは置きません。
Chrome でしか確認してないです。まあ Firefox でも動くんじゃないかな?たぶん。
// ==UserScript==
// @name Hatebu Entry Page Downgrader
// @namespace https://www.otchy.net/
// @version 0.0.1
// @include http://b.hatena.ne.jp/entry*
// ==/UserScript==
(function (callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
})(function() {
var isMore = (location.href.indexOf('mode=more') >= 0);
if (!isMore) {
var iframe = $('<iframe />');
iframe.hide();
$(document.body).append(iframe);
var href = $('#more-link a').attr('href');
iframe.attr('src', href);
} else {
var pBody = $(parent.document.body);
var iBody = $(document.body);
var bk = iBody.find('#new-bookmarks');
pBody.find('#new-bookmarks').html(bk.html());
pBody.find('ul.bookmark-list li').css({'padding': '5px 0px 5px 30px'}).find('img.profile-image').css({'width': '16px', 'height': '16px', 'margin-left': '-20px'});
var scored = pBody.find('#scored-bookmarks');
var sToggle = $('<span />').toggle(function() {
scored.find('.bookmark-list').hide();
$(this).text('[開く]');
}, function() {
scored.find('.bookmark-list').show();
$(this).text('[閉じる]');
});
scored.find('h4.entry-page-main-subtitle .inner').append(sToggle);
sToggle.css({'cursor': 'pointer'}).click();
}
});
出来る事
- エントリーページの「新着」ブックマークを「全ての」ブックマークに差し替え
- ユーザのアイコンを 16 x 16 に変更
- 人気のブックマークの表示/非表示切り替え
出来ない事
- コメントのみ表示チェックが効かない
- スターが付けられない
- グラフが見れない
この実装だと、上記の問題解決はかなり難しそうです。
なので、全てのブックマークページをそのまま iframe で埋め込む方法に実装を変更する予定なのですが、とりあえず情報参照だけなら綺麗に動いたのでアルファ版として公開してみました。
フィードバック、改造報告などがあれば是非コメントに!
カテゴリ: Development タグ: greasemonkey はてブ