LBS增加引用地址和永久地址点击复制功能
http://www.itjxue.com 2015-08-14 20:05 来源:未知 点击次数:
需要的话请参照以下步骤修改:
1.修改文件common.js
在common.js文件的 // Set Article Font Size
function setFontSize(pt){
try{
var t=document.getElementById("textboxContent");
if(t){
t.style.fontSize=pt+"pt";
}
}catch(e){}
} 下面增加 // 复制引用地址
function copyText(obj)
{
var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);
} 2.修改文件article.asp
找到文件 <div class="textbox-urls">
<img src="<%=theCache.settings["imageFolder"]%>/rss_comment.png" class="meta-button" alt="<%=lang["comment_feed"]%>" />
<b><%=lang["comment_feed"]%>:</b> <%=theCache.settings["baseURL"]+"feed.asp?q=comment&id="+theArticle.id%>
<%if(theCache.settings["enableTrackbackIn"]==1&&!theArticle.locked&&theArticle.mode<4){%>
<br />
<img src="<%=theCache.settings["imageFolder"]%>/utf8.png" class="meta-button" alt="UTF-8 Encoding" /> <b><%=lang["trackback_url"]%>:</b> <%=theCache.settings["baseURL"]+"trackback.asp?id="+theArticle.id%>
<%}%>
</div>
部分改成 <div class="textbox-urls">
<img style="CURSOR: hand" onclick=javascript:copyText(document.all.text) src="<%=theCache.settings["imageFolder"]%>/rss_comment.png" class="meta-button" alt="复制<%=lang["comment_feed"]%> 地址" />
<b><%=lang["comment_feed"]%>:</b> <span id=text><%=theCache.settings["baseURL"]+"feed.asp?q=comment&id="+theArticle.id%></span>
<%if(theCache.settings["enableTrackbackIn"]==1&&!theArticle.locked&&theArticle.mode<4){%>
<br />
<img style="CURSOR: hand" onclick=javascript:copyText(document.all.url) src="<%=theCache.settings["imageFolder"]%>/utf8.png" class="meta-button" alt="复制 UTF-8 Encoding 引用地址" /> <b><%=lang["trackback_url"]%>:</b> <span id=url><%=theCache.settings["baseURL"]+"trackback.asp?id="+theArticle.id%></span>
<%}%>
</div>
3.增加复制全文和打印功能!
还是修改文件article.asp
在 <%=lang["font_size"]%>:
<a href="javascript:setFontSize(14)" title="<%=lang["font_size"]%>: <%=lang["large"]%>"><%=lang["large"]%></a> |
<a href="javascript:setFontSize(11)" title="<%=lang["font_size"]%>: <%=lang["medium"]%>"><%=lang["medium"]%></a> |
<a href="javascript:setFontSize(9)" title="<%=lang["font_size"]%>: <%=lang["small"]%>"><%=lang["small"]%></a>
上面增加代码
<a href='javascript:copyText(document.all.art)' title='复制全文到剪切板'>复制</a>
<a href="javascript:window.print()" title='打印本页'>打印</a>
修改以下代码 <div id="textboxContent" class="textbox-content">
<span id=art>
<%if(theArticle.ubbFlags=="html"){%>
<%=(theArticle.content0+theArticle.content1).replace(/\[separator\]/ig,"")%>
<%}else{%>
<%=ubb.toHTML(func.HTMLEncode(theArticle.content0+theArticle.content1),theArticle.ubbFlags)%>
<%}%>
</span> 红色部分为增加部分!