我在文章結束新增幾個簡單的分享按鈕,然後想讓它們在"文章頁面"時才出現。
我是要貼在<div class='post-footer'>之前,但 Blogger 一直不讓我存檔。
這段語法我 try & error 了好久,沒轍了,以下語法,請幫忙,謝謝。
<b:if cond='data:blog.pageType == "item"'>
<script>
l = window.location;
t = document.title;
function mailThisUrl(){
window.location = "mailto:"+"?subject=[分享] "+t+"&body=我覺得這篇文章你應該會有興趣: "+l;
}
</script>
<script type="text/javascript">
function fbs_click(width, height) {
var leftPosition, topPosition;
//Allow for borders.
leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
//Allow for title and status bars.
topPosition = (window.screen.height / 2) - ((height / 2) + 50);
var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures);
return false;
}
</script>
<table>
<tr> <td valign="top">分享這篇文章: <a href="http://www.facebook.com/share.php?u=<full page url to share" onClick="return fbs_click(576, 500)" target="_blank" title="到 Facebook 分享"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXQYYS5v4dslL56AAxeInHa-7Rbok4sk_xZFyRYhx-9Ym-lYPcLwSt8v3rHEPoNiVigsVxaj2vEdF0mm_HXx8r4shsDDU4OklXNkfscfJvjYuNxNn7dEI0rx5XYpFyjz8X8_kT7c3s6JBZ/s50-Ic42/facebook%252520%2525282%252529.png" width="25" alt="facebook share"></a> <a class='addthis_button_email' title="用 AddThis 發送"><img alt='Email This' border='0' src='http://www.wavepals.com/_img/_layout/_buttons/addthis.png' width="25"/></a> <a href="javascript:mailThisUrl()" title="用 Outlook 轉寄"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWvWYaueH2cAOCopoUuNcxjELivvvPYyeds3SSgoeVOSmG2wIGRLkY0R7QnSubQFLS1CVbsqNyMxTGGRKp5KBOrp7jJQwfRJVF3Qy0oHC0ul3FQTvcFJ6e4vPd9W33GPIBBGh2mLuBg7qm/s50-Ic42/email.png" width="25"></a> <script>
//<![CDATA[
(function() {
var title = document.title,
url = "http://" + location.hostname + location.pathname,
href = "http://line.naver.jp/R/msg/text/?" + title + " " + url + " ";
document.write("<a href='" + href + "' target='_blank' title='行動裝置上用 Line 傳送'><img src='https://lh3.googleusercontent.com/-C_VLbSbt19s/VeMZAMCYDYI/AAAAAAAABGc/ZJ4vJ1lSivY/s50-Ic42/line_icon.png' width='25'/></a>");
})();
//]]>
</script></td> </tr>
</table>
<script type='text/javascript'>var addthis_config = {"data_track_addressbar":true};</script><script src='//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-511bbe8405a64ebd' type='text/javascript'/></script>
</b:if>
強制轉換了一些字元,再加上不解析語法 ,我的問題解決了,謝謝。
回覆刪除