Auto Readmore button

Insert before ]]></b:skin> this code:
/*----- Auto readmore -----*/
.readmore {
float:right;
margin:8px 20px 5px 0px;
padding:3px;}
.readmore a{
color:#fff;
padding:3px 5px 3px 5px;
background:#960100;
}
.readmore a:hover{
color:#fff;

background:#000ff;}
Insert before </head>
<script type='text/javascript'>
var summaryConf = {
showImage: true,
imgFloat: &#39;left&#39;,
imgWidth: 120,
imgHeight: 110,
defaultThumb:&#39;http://1.bp.blogspot.com/-A7K0Ugz3jKc/Uf0leijlp0I/AAAAAAAACsQ/w29f6zRMSbA/s1600/no-thumb.jpg&#39;,
words: 60,
wordsNoImg: 80,
skip: 0,
showHome: true,
showLabel: true
};
</script>
<script type='text/javascript'>
//<![CDATA[
function summary(h) {
    summary.count = summary.count || 0;
    summary.count++;
    var g = location.href.indexOf("/search/label/") == -1 && location.href.indexOf("/search?") == -1,
        c = location.href.indexOf("/search/label/") != -1;
    if (summary.count <= summaryConf.skip) {
        return
    }
    if (g && !summaryConf.showHome) {
        return
    }
    if (c && !summaryConf.showLabel) {
        return
    }
    var e = document.getElementById(h),
        f = e.getElementsByTagName("img"),
        a = "";
    if (summaryConf.showImage) {
        if (summaryConf.defaultThumb != "none") {
            a = '<img width="' + summaryConf.imgWidth + '" height="' + summaryConf.imgHeight + '"';
            if (summaryConf.imgFloat != "no") {
                var b = ' style="float:' + summaryConf.imgFloat + ';margin:0 5px 5px 0;padding:0"';
                a += b
            }
            a += ' src="' + (f.length > 0 ? f[0].src : summaryConf.defaultThumb) + '" />'
        } else {
            if (f.length > 0) {
                a = '<img width="' + summaryConf.imgWidth + '" height="' + summaryConf.imgHeight + '"';
                if (summaryConf.imgFloat != "no") {
                    var b = ' style="float:' + summaryConf.imgFloat + ';margin:0 5px 5px 0;padding:0"';
                    a += b
                }
                a += ' src="' + f[0].src + '" />'
            }
        }
    }
    if (a != "") var d = summary.strip(e.innerHTML, summaryConf.words)
    else var d = summary.strip(e.innerHTML, summaryConf.wordsNoImg);
    e.innerHTML = a + d + "..."
}
summary.strip = function(a, b) {
    return a.replace(/<.*?>/ig, "").split(/\s+/).slice(0, b - 1).join(" ")
};
 //]]>

</script>
Find <data:post.body/> and Replace by this code:
<span expr:id='data:post.id'><data:post.body/></span>
<b:if cond='data:blog.pageType == "index"'>
<div class='readmore'><a expr:href='data:post.url'>Readmore&#187;</a></div>
<script type='text/javascript'>summary("<data:post.id/>")</script>
<b:else/>
<b:if cond='data:blog.pageType == "archive"'>
<script type='text/javascript'>summary("<data:post.id/>")</script>
</b:if>
</b:if> 
Ok, Done


No comments:

Post a Comment