﻿/****************
author:zhiyelee
usetage:realize the hover_title effect over image
date:2011-03-19
******************/
$(window).load(function() {
 $(".postText img").each(function() {
	 $("img:not([title])").each(function() {
		var img_src=$(this).attr("src");
			var img_name=img_src.match(/[^/]+\.(jpg|png|jpeg|gif|bmp)/ig);
			if($(this).attr("alt") !='') $(this).attr("title", $(this).attr("alt"))
			else $(this).attr("title", img_name);
			});
		var $img=$(this);
		$(this).wrap("<span class='hover_image' style='width:"+$img.width()+"px'></span>");
		$(this).parent(".hover_image").hover(function(){
		$(this).append("<div class='hover_title ' style='width:"+$img.width()*0.5+"px;left:"
			+($img.offset().left-$img.parent().offset().left)+"px'>"
			+$img.attr("title")+"</div>");
		$img.next().show();},
		function(){$img.next().fadeOut("slow").remove();});
	});
});

/****************
author:zhiyelee
usetage:with DlHighlight,decorate the pre tag
date:2011-04-18
******************/
	/*$(function(){
		$('.postText pre').each(function(){
			var precode=$(this).html();
			var code_type=$(this).attr('class');
			var encode_pre=precode.replace(/</g,'&lt;');
			$(this).replaceWith("<pre name='code' class='"+code_type+"'>"+encode_pre+"</pre>");
			
		})
		
		DlHighlight.HELPERS.highlightByName("code", "pre");
	});
*/

