<script type="text/javascript">
/* 鼠标特效 */
var a_idx = 0;
jQuery(document).ready(function($) {
    $("body").click(function(e) {
        var a = new Array("富强","民主","文明","和谐","自由","平等","公正","法治","爱国","敬业","诚信","友善");
        var $i = $("<span></span>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        $i.css({
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});
</script>
<script language="javascript" type="text/javascript">
//黑客帝国矩阵
// JavaScript Document
$(document).ready(function(){
//var s=window.screen;
var width = matrixBG.width = window.screen.width;
var height = matrixBG.height = window.screen.height;
var yPositions = Array(300).join(0).split('');
var ctx=matrixBG.getContext('2d');

var draw = function () {
  ctx.fillStyle='rgba(0,0,0,.05)';
  ctx.fillRect(0,0,width,height);
  ctx.fillStyle='#0F0';
  ctx.font = '10pt Georgia';
  yPositions.map(function(y, index){
    text = String.fromCharCode(30+Math.floor( Math.random()*95 ));
    x = (index * 10)+10;
    matrixBG.getContext('2d').fillText(text, x, y);
	if(y > 100 + Math.random()*1e4)
	{
	  yPositions[index]=0;
	}
	else
	{
      yPositions[index] = y + 10;
	}
  });
};
RunMatrix();
function RunMatrix()
{
	if(typeof Game_Interval != "undefined") clearInterval(Game_Interval);
			Game_Interval = setInterval(draw, 33);
}
function StopMatrix()
{
	clearInterval(Game_Interval);
}
/**
//setInterval(draw, 33);
$("button#pause").click(function(){
StopMatrix();});
$("button#play").click(function(){RunMatrix();});
*/
});
// 生成目录索引列表
    function GenerateContentList() {
        var $mainContent = $('#cnblogs_post_body');
        var h2_list = $('#cnblogs_post_body h2');
        var h3_all_list = $('#cnblogs_post_body h3');

        if ($mainContent.length < 1)
            return;

        if (h2_list.length > 0) {
            var content = '<a name="_labelTop"></a>';
            content += '<div id="navCategory">';
            content += '<h2 id="catalog">目录</h2>';
            content += '<ul style="display:none">';
            for (var i = 0; i < h2_list.length; i++) {
                var go_to_top = '<div style="text-align: right"><a href="#_labelTop" style="text-decoration: none; ">回到顶部</a><a name="_label' + i + '"></a></div>';
                $(h2_list[i]).before(go_to_top);

                var h3_list = $(h2_list[i]).nextAll("h3");
                var li3_content = '';
                for (var j = 0; j < h3_list.length; j++) {
                    var tmp = $(h3_list[j]).prevAll('h2').first();
                    if (!tmp.is(h2_list[i]))
                        break;
                    var li3_anchor = '<a name="_label' + i + '_' + j + '"></a>';
                    $(h3_list[j]).before(li3_anchor);
                    li3_content += '<li><a href="#_label' + i + '_' + j + '" style="color: darkseagreen; text-decoration: none; font-size: 15px;">' + $(h3_list[j]).text() + '</a></li>';
                }

                var li2_content = '';
                if (li3_content.length > 0)
                    li2_content = '<li><a href="#_label' + i + '" style="color: darkseagreen; text-decoration: none; font-size: 15px;">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>';
                else
                    li2_content = '<li><a href="#_label' + i + '" style="color: darkseagreen; text-decoration: none; font-size: 15px;">' + $(h2_list[i]).text() + '</a></li>';
                content += li2_content;
            }
            content += '</ul>';
            content += '</div>';
            if ($mainContent.length != 0) {
                $mainContent.prepend(content);
            }
        }
        else if (h2_list.length == 0 && h3_all_list.length > 1) {
            var h3_list = h3_all_list;
            var content = '<a name="_labelTop"></a>';
            content += '<div id="navCategory">';
            content += '<h2 id="catalog">目录</h2>';
            content += '<ul style="display:none">';
            for (var i = 0; i < h3_list.length; i++) {
                var go_to_top = '<div style="text-align: right"><a href="#_labelTop">回到顶部</a><a name="_label' + i + '"></a></div>';
                $(h3_list[i]).before(go_to_top);

                var li3_content = '';
                li3_content = '<li><a href="#_label' + i + '">' + $(h3_list[i]).text() + '</a></li>';
                content += li3_content;
            }
            content += '</ul>';
            content += '</div>';
            if ($mainContent.length != 0) {
                $mainContent.prepend(content);
            }
        }

    }

    GenerateContentList();

    $('#catalog').click(function () {
        $(this).next().toggle()
    })

</script>