Skip to content

Instantly share code, notes, and snippets.

@KurohimeAkari
Last active October 27, 2015 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KurohimeAkari/10292d72bf35d151dc93 to your computer and use it in GitHub Desktop.
Save KurohimeAkari/10292d72bf35d151dc93 to your computer and use it in GitHub Desktop.
カテゴリー別な表示.js
/* none させなくても良いですが上に設置してると読み込むまで数値(1)などが表示されます。*/
.hatena-module-category > .hatena-module-body > .hatena-urllist li a{
display:none;
}
/*-----------------------------------------------------------
// (C) Kurohime Akari + TMC45 INC様
// Website: http://shioneko.sakura.ne.jp
// はてなブログ用 Blog Templates . Varsion 1.0.0
//
// Comments: カテゴリー別に表示できるやつ。
//
------------------------------------------------------------*/
/*-----------------------------------------------------------
// http://tech.tmd45.jp/entry/2012/04/03/170348 様の改変
------------------------------------------------------------*/
$(function() {
//[ 表示させる数 ]----------------------------------------//
var arycase = ["css","about"];
//------------------------------------------------------//
var categories = $(".hatena-module-category ul li a");
$.each(
categories,
function(index, domEle) {
var ele = $(domEle);
var texts = $.trim(ele.text());
ele.text(texts.replace(/\([^\(\s +]+\)/, ''));
// arycaseから文字列処理:matchしたものだけ表示
for (var i = 0; i < arycase.length; i++) {
reg = new RegExp(arycase[i]);
if(texts.match(reg)){
ele.fadeIn('slow').unbind();
break;
}
};
ele.attr("title", texts);
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment