Thứ Tư, 23 tháng 12, 2015

Tiện ích Recent Video Youtube cho Blogspot



1. Chèn code bên dưới vào sau thẻ <head>

<script type="text/javascript" src="http://data-traidatmui.appspot.com/scripts/recent_video_youtube.js"></script>
<style type='text/css'>
.recentvideo {
padding:5px 2px 2px 0px;
font-size:12px;
line-height:1.2em;
display:block;
background:#eee;
width:100%;
min-height:59px;
border:1px solid #ddd;
margin-bottom:5px;}
.recentvideo a{
font-weight:bold;
text-decoration:none;
color:#333;}
.recentvideo a:hover{
color:#666;
text-decoration:underline;}
.datetextcm {
font-size:11px;
color:#333;
}
.recent_thumb {
border:1px solid #fff;
margin-right:5px;
margin-top:-5px;
float:left;
width:60px;
height:60px;
padding:2px;
float:left;
}
.recent_thumb:hover {
filter: alpha(opacity:0.7);
KHTMLOpacity: 0.7;
MozOpacity: 0.7;
-khtml-opacity:.70;
-ms-filter:&quot;alpha(opacity=70)&quot;;
-moz-opacity:.70;
filter:alpha(opacity=70);
opacity:.70;
}
</style>

2. Thêm 1 HTML/Javascript và thêm vào code bên dưới

<script type="text/javascript">
var numposts = 5; //số bài viết hiển thị trong tiện ích
var showpostthumbnails = true;
var displaymore = true;
var displayseparator = true;
var showcommentnum = true;
var showpostdate = true;
var showpostsummary = true;
var numchars = 50;
</script>
<script src="http://www.traidatmui.com/feeds/posts/default/-/LabelName?orderby=published&alt=json-in-script&callback=showrecentpostswiththumbs"></script>


3. CODE: THAY THẾ

<script src="http://www.traidatmui.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=showrecentpostswiththumbs"></script>

- Tuy nhiên, nếu link trong mã nhúng của Youtube có dạng http://www.youtube-nocookie.com/v/xPIbuTx7ENU?fs=1&hl=en_US
thì các bạn cứ sử dụng file JS cũ ở trên.

- Còn nếu link có dạng http://www.youtube.com/v/2ZZRtzCl6Gg?version=3&hl=en_US&rel=0
 thì bạn sẽ dùng file JS bên dưới thay cho file JS (recent_video.js) ở trên.
http://data-traidatmui.appspot.com/scripts/recent_video_youtube.js



Không có nhận xét nào: