<script type="text/javascript">
(function($){
$(window).load(function() {
// 顶部固顶菜单高度
affix_topmenu = 35;
// 可见窗口的高度
window_height = $(window).height();

// 右侧固顶区的顶部固顶条件，当滚动至此时，本区域以顶部固顶
affix_rtop = $("#right_affix").offset().top - affix_topmenu;
// 右侧固顶区的底部固顶条件，当滚动至此时，本区域以底部固顶
if ($('#comment').length) {
affix_rbottom = $('body').height() - $('#comment').offset().top - $('#comment').height() - 2;
} else {
affix_rbottom = $('body').height() - 2;
}
// 右侧固顶区的高度
affix_rheight = $("#right_affix").height();
if (window_height >= affix_topmenu + affix_rheight) {
// 可见窗口可以见到全部的右侧固顶区域时，使用顶部和底部固顶条件
affix_roffset = {top : affix_rtop, bottom: affix_rbottom};
} else {
// 否则，只使用顶部固顶条件（如果也设置了底部固顶条件，或导致闪烁）
affix_roffset = {top : affix_rtop};
}

$("#right_affix").affix({offset : affix_roffset});

// 左侧固顶区的顶部固顶条件，当滚动至此时，本区域以顶部固顶
//affix_ltop = $("#add_comment").offset().top - affix_topmenu;
//affix_loffset = {top : affix_ltop};

//$("#add_comment").affix({offset : affix_loffset});

// 文章内插图及注释

var max_width = $("#article_content").width() - 60;
var imgp = $("#article_content P IMG").parents("P");
imgp.each(function(){
$(this).addClass("article_img");
var img = $(this).find("IMG");
// 如果有图片描述
var desc = null;
if ((desc = $(this).next("P")) && desc && desc.contents() && desc.contents().first().is("EM") ) {
  					desc.addClass("article_img_desc");
  					desc_txt = desc.contents().first().text();
  					img.attr({"title":desc_txt,"alt":desc_txt});
  				} else if ((desc = img.next("BR").next("EM")) && desc.text()) {
  					var desc_txt = desc.text();
  					img.next("BR").remove();
  					img.next("EM").remove();
  					$(this).after("<p class='article_img_desc'><em>" + desc_txt + "</em></p>");
} else {
var desc_txt = img.attr("title") || img.attr("alt");
if (desc_txt != '') {
$(this).after("<p class='article_img_desc'><em>" + desc_txt + "</em></p>");
}
}
if (img.attr("width") > max_width) {
img.attr("width",'');
img.attr("height",'');
if (! img.parent("A").is("A")) {
img.css("cursor","pointer");
    img.click(function(){window.open(img.attr("src"));});
}
} else if (img.width() > max_width) {
img.css("height",parseInt(img.height() * (max_width / img.attr("width"))));
img.css("width",max_width);
if (! img.parent("A").is("A")) {
img.css("cursor","pointer");
img.click(function(){window.open(img.attr("src"));});
}
}
});

// 链接
var re_sitelink = /^https?:\/\/(www.)?linux(.net)?.cn\//i;
$("#article_content a").map(function(){
if (re_sitelink.test($(this).attr('href'))) {
if ($(this).text() == 'Linux中国') $(this).attr('href',$(location).attr('href'));
} else {
$(this).addClass("ext").attr({"rel":"external nofollow","target":"_blank"});
}
});

// 视频
$("video").map(function() {
width = $(this).attr("width");
height = $(this).attr("height");
$(this).wrap("<div class='videoContainer'></div>").parent()
.css({width: width,height : height});
});
})
})(jQuery);
</script>
<div class="drag">
<!--[diy=diy2]--><div id="diy2" class="area"></div><!--[/diy]-->
</div>


</div>
</div>


<div class="wp mtn">
<!--[diy=diy3]--><div id="diy3" class="area"></div><!--[/diy]-->
</div>
<input type="hidden" id="portalview" value="1">

<link rel="stylesheet" href="https://dn-linuxcn.qbox.me/static/js/prettify/prettify.css?NsD" type="text/css" />
<script src="https://dn-linuxcn.qbox.me/static/js/prettify/prettify.min.js?NsD" type="text/javascript"></script>
<script type="text/javascript">
var sourceBaseUrl = "https://dn-linuxcn.qbox.me/static/js/tinymce/plugins/prettify";
prettyPrint();
</script>
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'https://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>	</div>