Skip to content

Instantly share code, notes, and snippets.

@iwa4
Last active October 23, 2022 23:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwa4/5907911 to your computer and use it in GitHub Desktop.
Save iwa4/5907911 to your computer and use it in GitHub Desktop.
Feedly にはてぶ数を表示するUserscript
// ==UserScript==
// @name Feedly にはてぶ数を表示するUserscript
// @version 0.1.2
// @namespace http://cloud.feedly.com
// @include http://cloud.feedly.com/*
// ==/UserScript==
(function(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-2.0.0.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")(jQuery.noConflict(true));";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
})(function($) {
var getHatebu = function($obj) {
var url = $obj.data('alternate-link');
return $('<a>').attr('href', 'http://b.hatena.ne.jp/entry/' + url).attr('target', '_blank')
.append($('<img>').attr('src', 'http://b.st-hatena.com/entry/image/' + url));
};
var overwriteLastModified = function($obj) {
$obj.find('.lastModified').empty().append(getHatebu($obj));
};
setTimeout(function() {
$('#section0_column0').find('.u0Entry ').each(function() {
overwriteLastModified($(this));
});
$('#mainBar').on('DOMNodeInserted', function(e) {
var t = e.target;
if (!t.id || !t.id.match(/_main$/))
return;
var $target = $(t);
if ($target.find('.u100Entry')) {
$target.find('.wikiWidgetSave').after(getHatebu($target.find('.u100Entry')));
}
$target.each(function() {
overwriteLastModified($(this));
});
});
}, 1000); //wait for feedly[core][reader@cloud]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment