Chia sẽ mẹo nhỏ mà nhiều bạn đang tìm kiếm cho mục bình luận trông hấp dẫn hơn. Đó là việc chèn được hình ảnh trực tiếp vào khung bình luận một cách dễ dàng
Cách làm khá đơn giản và nhanh chóng như sau. Các bạn chép hết đoạn code bên dưới rồi chèn trước thẻ đóng </body>
Lưu lại thế là xong
Đến đây mỗi khi muốn chèn hình ảnh vào khung bình luận chỉ việc chép link và đặt như sau
![]() |
Hình ảnh chèn vào khung bình luận blogger |
Cách làm khá đơn giản và nhanh chóng như sau. Các bạn chép hết đoạn code bên dưới rồi chèn trước thẻ đóng </body>
<!-- chen anh video comment -->
<b:if cond='data:view.isPost'>
<!-- chỉ áp dụng cho trang bài viết -->
<script type='text/javascript'>
//<![CDATA[
function replaceText(){if(!document.getElementById){return;}
bodyText = document.getElementById("comments");
theText = bodyText.innerHTML;
theText = theText.replace(/\[img\].*?'.*?\[\/img\]/gi, "");
theText = theText.replace(/\[youtube\].*?'.*?\[\/youtube\]/gi, "");
theText = theText.replace(/\[img\]/gi, "<div style='clear:both'></div><img class='bsw-imgs' src='");
theText = theText.replace(/\[\/img\]/gi, "'/><div style='clear:both'></div>");
theText = theText.replace(/\[youtube\]http:\/\/youtu.be/gi, "<iframe width='100%' height='400' src='http://www.youtube.com/embed");
theText = theText.replace(/\[youtube\]http:\/\/www.youtube.com\/watch\?v=/gi, "<iframe width='480' height='390' src='http://www.youtube.com/embed/");
theText = theText.replace(/&feature=/gi, "?rel=0' '");
theText = theText.replace(/\[\/youtube\]/gi, "?rel=0' frameborder='0' allowfullscreen></iframe>");
bodyText.innerHTML = theText;
}replaceText();
//]]>
</script>
<!-- bietko.com -->
</b:if>
<b:if cond='data:view.isPost'>
<!-- chỉ áp dụng cho trang bài viết -->
<script type='text/javascript'>
//<![CDATA[
function replaceText(){if(!document.getElementById){return;}
bodyText = document.getElementById("comments");
theText = bodyText.innerHTML;
theText = theText.replace(/\[img\].*?'.*?\[\/img\]/gi, "");
theText = theText.replace(/\[youtube\].*?'.*?\[\/youtube\]/gi, "");
theText = theText.replace(/\[img\]/gi, "<div style='clear:both'></div><img class='bsw-imgs' src='");
theText = theText.replace(/\[\/img\]/gi, "'/><div style='clear:both'></div>");
theText = theText.replace(/\[youtube\]http:\/\/youtu.be/gi, "<iframe width='100%' height='400' src='http://www.youtube.com/embed");
theText = theText.replace(/\[youtube\]http:\/\/www.youtube.com\/watch\?v=/gi, "<iframe width='480' height='390' src='http://www.youtube.com/embed/");
theText = theText.replace(/&feature=/gi, "?rel=0' '");
theText = theText.replace(/\[\/youtube\]/gi, "?rel=0' frameborder='0' allowfullscreen></iframe>");
bodyText.innerHTML = theText;
}replaceText();
//]]>
</script>
<!-- bietko.com -->
</b:if>
Lưu lại thế là xong
Đến đây mỗi khi muốn chèn hình ảnh vào khung bình luận chỉ việc chép link và đặt như sau
[img]Link-ảnh-chèn[/img]
![]() |
Video chèn trực tiếp vào khung comment blogger |
[img]https://1.bp.blogspot.com/-o4YfyQmXm8k/W0Rxi3Szq6I/AAAAAAAAAfs/vRWakW3csIcPlE4TzxOhOHlePbo36SXeQCK4BGAYYCw/s1600/town-archi-0522.png[/img]
Trả lờiXóaTest thử mục bình luận bằng hình ảnh xem sao
Nhận xét này đã bị tác giả xóa.
Trả lờiXóaNhận xét này đã bị tác giả xóa.
Trả lờiXóa