<!--
[Thủ Thuật Blog] Chia sẻ code Sitemap cực đẹp cho Blogspot
https://choiblogs.blogspot.com/2018/11/chia-se-code-sitemap-cuc-ep-cho-blogspot.html
-->
<style type="text/css">
#table-outer td{min-width:150px;color:#fff;}
#table-outer select,
#table-outer select,
#table-outer input{width:250px;border:1px solid #766469;color:#000;font-size:11px;padding:4px;}
#feedContainer li{border-top:#fff;border-bottom:1px solid #DADADA;margin-bottom:10px;float:left;width:100%;padding:5px 0;}
#feedContainer,
#feedContainer li{list-style:none;overflow:hidden;margin:0;}
#feedNav{text-align:center;line-height:30px;background-color:#fff;border-radius:3px;border:1px solid #fff;margin:10px 0 0;}
</style>
<div class="archiver"><div id="box_left" style="padding: 10px;"><div id="table-outer"><table border="0"><tbody>
<tr><td><label><span class="text">Sắp xếp:</span></label></td><td><select class="input" id="orderFeedBy"><option selected="" value="published">Phim Mới</option><option value="updated">Phim Cũ</option></select></td></tr>
<tr><td><label><span class="text">Danh sách nhãn:</span></label></td><td><span id="labelSorter"><select class="input" disabled=""><option selected="">Đợi Xíu...</option></select></span></td></tr>
<tr><td><label><span class="text">Từ khóa tìm kiếm (gõ có dấu):</span></label></td><td><form id="postSearcher"><input class="input" type="text" /></form></td></tr>
</tbody></table></div><header id="resultDesc"></header><br />
<ul id="feedContainer"></ul><div id="feedNav">Loading...</div>
<script type="text/javascript">
//<![CDATA[
var tocConfig = {
url: 'http://choiblogs.blogspot.com',
feedNum: 30,
labelName: (window['location']['hash'] && window['location']['hash'] != '#0' && window['location']['hash'] != '#search') ? encodeURIComponent(window['location']['hash']['substr'](1)) : false,
numChars: 300,
thumbWidth: 80,
navText: 'Xem thêm',
frontText: 'Bay lên đầu',
noImage: 'http://1.bp.blogspot.com/-htG7vy9vIAA/Tp0KrMUdoWI/AAAAAAAABAU/e7XkFtErqsU/s1600/grey.gif',
loading: '<span>Loading...</span>',
searching: '<span>Đang Tìm Kiếm...</span>',
MonthNames: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
noResult: 'No Result'
};
function getID(_0x444ex3) {
return document['getElementById'](_0x444ex3);
};
var head = document['getElementsByTagName']('head')[0],
tocContainer = getID('feedContainer'),
feedNav = getID('feedNav'),
orderByer = getID('orderFeedBy'),
labelSorter = getID('labelSorter'),
input = getID('postSearcher')['getElementsByTagName']('input')[0],
resultDesc = getID('resultDesc'),
nextPage, feedArchive, startPage = 0;
function cropFeed(_0x444exf, _0x444ex10) {
var _0x444ex11 = _0x444exf['split']('<');
for (var _0x444ex12 = 0; _0x444ex12 < _0x444ex11['length']; _0x444ex12++) {
if (_0x444ex11[_0x444ex12]['indexOf']('>') != -1) {
_0x444ex11[_0x444ex12] = _0x444ex11[_0x444ex12]['substring'](_0x444ex11[_0x444ex12]['indexOf']('>') + 1, _0x444ex11[_0x444ex12]['length']);
};
};
_0x444ex11 = _0x444ex11['join'](' ');
_0x444ex11 = _0x444ex11['substring'](0, _0x444ex10 - 1);
return _0x444ex11;
};
function showLabels(_0x444ex10) {
var _0x444ex14 = _0x444ex10['feed']['category'],
_0x444exf = '';
_0x444exf = '<select id=\'labelSorter\' onchange=\'changeSort(this.value);\'>';
_0x444exf += '<option value=\'\' selected>Thể Loại</option>';
for (var _0x444ex3 = 0; _0x444ex3 < _0x444ex14['length']; _0x444ex3++) {
_0x444exf += '<option value=\'' + decodeURIComponent(_0x444ex14[_0x444ex3]['term']) + '\'>' + _0x444ex14[_0x444ex3]['term']['toUpperCase']() + '</option>';
};
_0x444exf += '</select>';
labelSorter['innerHTML'] = _0x444exf;
};
function showFeedList(_0x444ex16) {
var _0x444ex17 = _0x444ex16['feed']['entry'],
_0x444ex18, _0x444ex19, _0x444ex1a, _0x444ex1b, _0x444ex12, _0x444ex1c, _0x444ex1d, _0x444ex1e, _0x444ex1f, _0x444ex20, _0x444ex10 = '';
if (typeof (_0x444ex16['feed']['entry']) !== 'undefined') {
for (var _0x444ex11 = 0; _0x444ex11 < tocConfig['feedNum']; _0x444ex11++) {
_0x444ex18 = (_0x444ex17) ? _0x444ex17[_0x444ex11] : '';
nextPage = '';
if (_0x444ex11 == _0x444ex16['feed']['entry']['length']) {
break;
};
_0x444ex19 = _0x444ex18['title']['$t'];
for (var _0x444exf = 0; _0x444exf < _0x444ex18['link']['length']; _0x444exf++) {
if (_0x444ex18['link'][_0x444exf]['rel'] == 'alternate') {
_0x444ex1a = _0x444ex18['link'][_0x444exf]['href'];
break;
};
};
for (var _0x444ex3 = 0; _0x444ex3 < _0x444ex16['feed']['link']['length']; _0x444ex3++) {
if (_0x444ex16['feed']['link'][_0x444ex3]['rel'] == 'next') {
nextPage = _0x444ex16['feed']['link'][_0x444ex3]['href'];
};
};
for (var _0x444ex14 = 0; _0x444ex14 < _0x444ex18['link']['length']; _0x444ex14++) {
if (_0x444ex18['link'][_0x444ex14]['rel'] == 'replies' && _0x444ex18['link'][_0x444ex14]['type'] == 'text/html') {
_0x444ex20 = _0x444ex18['link'][_0x444ex14]['title'];
break;
};
};
if ('content' in _0x444ex18) {
_0x444ex12 = _0x444ex18['content']['$t'];
} else {
if ('summary' in _0x444ex18) {
_0x444ex12 = _0x444ex18['summary']['$t'];
} else {
_0x444ex12 = '';
};
}; if ('media$thumbnail' in _0x444ex18) {
_0x444ex1b = _0x444ex18['media$thumbnail']['url']['replace'](/\/s[0-9]+\-c/, '/s' + tocConfig['thumbWidth'] + '-c');
} else {
_0x444ex1b = tocConfig['noImage']['replace'](/\/s[0-9]+\-c/, '/s' + tocConfig['thumbWidth'] + '-c');
};
postdate = _0x444ex18['published']['$t']['substring'](0, 10);
_0x444ex1c = postdate['substring'](0, 4);
_0x444ex1d = postdate['substring'](5, 7);
_0x444ex1e = postdate['substring'](8, 10);
_0x444ex1f = tocConfig['MonthNames'][parseInt(_0x444ex1d, 10) - 1];
_0x444ex10 += '<li><div>';
_0x444ex10 += '<a href=\'' + _0x444ex1a + '\' target=\'_blank\'><img style=\'float:left;width:' + tocConfig['thumbWidth'] + 'px;height:' + tocConfig['thumbWidth'] + 'px;margin-right:10px;\' src=\'' + _0x444ex1b + '\' alt=\'' + _0x444ex19 + '\' /></a>';
_0x444ex10 += '<h2 style=\'font-size:14px;\'><a href=\'' + _0x444ex1a + '\' target=\'_blank\'>' + _0x444ex19 + '</a></div>';
_0x444ex10 += '<div style=\'margin-top:5px;\'>' + cropFeed(_0x444ex12, tocConfig['numChars']) + '…<br style=\'clear:both;\'/></h2>';
_0x444ex10 += 'on: <span>' + _0x444ex1e + '</span>/<span>' + _0x444ex1f + '</span>/<span>' + _0x444ex1c + '</span></div></div></li>';
};
if (input['value'] !== '' && window['location']['hash'] == '#search') {
resultDesc['innerHTML'] = '<span>Search Result for Keyword <strong>"' + input['value'] + '"</strong></span>';
} else {
resultDesc['innerHTML'] = '';
};
feedContainer['innerHTML'] += _0x444ex10;
if (nextPage) {
if (window['location']['hash'] && window['location']['hash'] !== '#0') {
_0x444ex10 = '<a href=\'javascript:initResult(2);\' class=\'next\'>' + tocConfig['navText'] + '</a>';
} else {
_0x444ex10 = '<a href=\'javascript:initResult(1);\' class=\'next\'>' + tocConfig['navText'] + '</a>';
};
} else {
_0x444ex10 = '<a href=\'#table-outer\' onclick=\'jQuery('html, body').animate({scrollTop: jQuery('#table-outer').offset().top}, 1500); return false\' class=\'front\'>' + tocConfig['frontText'] + '</a>';
};
feedNav['innerHTML'] = _0x444ex10;
input['value'] = '';
labelSorter['getElementsByTagName']('select')[0]['removeAttribute']('disabled');
orderByer['removeAttribute']('disabled');
} else {
feedContainer['innerHTML'] = '';
alert(tocConfig['noResult']);
feedNav['innerHTML'] = '<a href=\'?reload=true\'>' + tocConfig['frontText'] + '</a>';
searchDesc['innerHTML'] = '';
};
};
function initResult(_0x444ex14) {
var _0x444ex3, _0x444ex10;
if (_0x444ex14 == 1) {
_0x444ex3 = nextPage['indexOf']('?');
_0x444ex10 = nextPage['substring'](_0x444ex3);
} else {
if (_0x444ex14 == 2) {
_0x444ex3 = nextPage['indexOf']('?');
_0x444ex10 = nextPage['substring'](_0x444ex3)['replace'](/\?/, '/-/' + window['location']['hash']['substr'](1) + '?');
} else {
_0x444ex10 = '?start-index=1&max-results=' + tocConfig['feedNum'] + '&orderby=' + orderByer['value'] + '&alt=json-in-script';
};
};
_0x444ex10 += '&callback=showFeedList';
updateScript(_0x444ex10);
};
function removeScript() {
var _0x444ex14 = getID('temporer-script');
_0x444ex14['parentNode']['removeChild'](_0x444ex14);
};
function buildLabels() {
var _0x444ex14 = document['createElement']('script');
_0x444ex14['type'] = 'text/javascript';
_0x444ex14['src'] = (tocConfig['url'] === '' ? window['location']['protocol'] + '//' + window['location']['host'] : tocConfig['url']) + '/feeds/posts/summary?max-results=0&alt=json-in-script&callback=showLabels';
head['appendChild'](_0x444ex14);
};
function updateScript(_0x444ex3) {
if (startPage == 1) {
removeScript();
};
feedNav['innerHTML'] = tocConfig['loading'];
if (tocConfig['labelName'] !== false) {
feedArchive = (tocConfig['url'] === '' ? window['location']['protocol'] + '//' + window['location']['host'] : tocConfig['url']) + '/feeds/posts/summary/-/' + tocConfig['labelName'] + _0x444ex3;
} else {
feedArchive = (tocConfig['url'] === '' ? window['location']['protocol'] + '//' + window['location']['host'] : tocConfig['url']) + '/feeds/posts/summary' + _0x444ex3;
};
var _0x444ex14 = document['createElement']('script');
_0x444ex14['type'] = 'text/javascript';
_0x444ex14['src'] = feedArchive;
_0x444ex14['id'] = 'temporer-script';
head['appendChild'](_0x444ex14);
startPage = 1;
};
function changeSort(_0x444ex10) {
removeScript();
tocContainer['innerHTML'] = '';
feedNav['innerHTML'] = tocConfig['loading'];
var _0x444ex3 = document['createElement']('script'),
_0x444exf = labelSorter['getElementsByTagName']('select')[0],
_0x444ex14 = (_0x444ex10 !== 0) ? '/-/' + _0x444ex10 : '';
_0x444ex3['type'] = 'text/javascript';
_0x444ex3['id'] = 'temporer-script';
_0x444ex3['src'] = (tocConfig['url'] === '' ? window['location']['protocol'] + '//' + window['location']['host'] : tocConfig['url']) + '/feeds/posts/summary' + _0x444ex14 + '?alt=json-in-script&max-results=' + tocConfig['feedNum'] + '&orderby=' + orderByer['value'] + '&callback=showFeedList';
head['appendChild'](_0x444ex3);
_0x444exf['disabled'] = true;
orderByer['disabled'] = true;
window['location']['hash'] = _0x444ex10;
};
function searchPost() {
removeScript();
tocContainer['innerHTML'] = '';
resultDesc['innerHTML'] = '';
feedNav['innerHTML'] = tocConfig['searching'];
var _0x444ex14 = document['createElement']('script');
_0x444ex14['type'] = 'text/javascript';
_0x444ex14['id'] = 'temporer-script';
_0x444ex14['src'] = (tocConfig['url'] === '' ? window['location']['protocol'] + '//' + window['location']['host'] : tocConfig['url']) + '/feeds/posts/summary?alt=json-in-script&orderby=published&q=' + input['value'] + '&max-results=9999&callback=showFeedList';
head['appendChild'](_0x444ex14);
window['location']['hash'] = '#search';
return false;
};
getID('postSearcher')['onsubmit'] = function () {
return searchPost();
};
orderByer['onchange'] = function () {
changeSort(0);
};
labelSorter['getElementsByTagName']('select')[0]['onchange'] = function () {
changeSort(this['value']);
};
window['onload'] = function () {
initResult(0);
buildLabels();
window['location']['hash'] = '#0';
};
//]]>
</script>
<div class="clear"></div></div></div>
feedNum: 30, : Số ký tự tối đa tiêu đề sẽ hiển thị.
numChars: 300, : Số ký tự mô tả bài viết sẽ hiển thị ( 0 là không hiển thị mô tả thay vào đó sẽ là dấu '...')
thumbWidth: 80, : Độ rộng của ảnh thumbnails bài viết, hãy thay đổi cho phù hợp với Blogspot của bạn.
https://forum.vietdesigner.net/threads/chia-se-code-sitemap-cuc-dep-cho-blogspot.104485/
0 comments