Skip to content

Instantly share code, notes, and snippets.

@khsk
Last active August 17, 2017 03:05
Show Gist options
  • Save khsk/31e02d24607dd7de7408eb2a8ba9451b to your computer and use it in GitHub Desktop.
Save khsk/31e02d24607dd7de7408eb2a8ba9451b to your computer and use it in GitHub Desktop.
はてブではてなお気に入りユーザーのスターを強調するユーザースクリプト ref: http://qiita.com/khsk/items/9b6c16651ede5715eb47
// ==UserScript==
// @name bookmark style
// @namespace khsk
// @include http://b.hatena.ne.jp/entry/*
// @version 1
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// ==/UserScript==
const Hatena = unsafeWindow.Hatena
const favoritesUrl = 'http://s.hatena.ne.jp' + Hatena.Bookmark.user.link + 'favorites.json';
GM_xmlhttpRequest({
method: "GET",
url: favoritesUrl,
onload: function(response) {
favorites = JSON.parse(response.responseText).favorites;
favorites.forEach((obj) => {
// 大きくなる理由はよーわからん 好きに装飾してね
GM_addStyle('a[href="http://b.hatena.ne.jp/' + obj.name + '/"] > img.hatena-star-star { width:3%;}');
})
},
onerror: function(response) {
console.log(response.responseText);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment