Sitemap chọn nhãn tự động cho blogger



Một số đặc điểm nổi bật


- Bạn có thể chọn Nhãn hoặc xem toàn bộ blog theo ý muốn.
- Có khung tìm kiếm từ khóa trực tiếp trên sitemap.
- Có thể tùy biến màu chữ, phần mô tả bài viết, số lượng bài hiển thị, kích thước ảnh thu nhỏ.

Tạo sitemap chọn nhãn tự động


Đăng nhập blogger ~> Vào Trang ~> Trang mới
Tiêu đề đặt là Sitemap. Tại phần bài viết thì chuyển qua thẻ HTML, dán đoạn code sau vào rồi nhấn Xuất bản.

<style type="text/css">
#table-outer td{min-width:150px;color:#f92b60;}
#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">Lần nhập cuối</option><option value="updated">Xuất bản cập nhật</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="">Loading...</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://dxoan.blogspot.com/',
    feedNum: 20,
    labelName: (window['location']['hash'] && window['location']['hash'] != '#0' && window['location']['hash'] != '#search') ? encodeURIComponent(window['location']['hash']['substr'](1)) : false,
    numChars: 300,
    thumbWidth: 70,
    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>Searching...</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>CATEGORY</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']) + '&hellip;<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>&quot;' + input['value'] + '&quot;</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(&apos;html, body&apos;).animate({scrollTop: jQuery(&apos;#table-outer&apos;).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>

url: 'http://dxoan.blogspot.com/', - Thay thành địa chỉ blog của bạn.
feedNum: 20, - Bài viết hiển thị khi load trang lần đầu và cũng là số bài viết hiển thị sau khi tải thêm.
labelName: false, - Tắt lệnh chọn nhãn khi truy cập lần đầu. Tức là khi độc giả truy cập lần đầu vào trang sitemap của bạn chưa chọn nhãn nào thì nó sẽ hiển thị các bài viết mới nhất của blog. Nếu muốn tắt chức năng đó bạn hãy sửa false thành true. Lúc này sẽ có một thông báo chọn nhãn yêu cầu độc giả chọn nhãn họ muốn xem.
numChars: 300,  - Số ký tự mô tả của bài viết sẽ hiển thị.
thumbWidth: 70, - Là chiều cao và chiều rộng của ảnh thu nhỏ.
navText: 'Xem thêm', - Chữ ở cuối bài viết, bấm vào để tải thêm bài viết.
noImage: '', - Ảnh hiển thị khi bài viết không có hình ảnh.

DXOan

Đây chính là tôi với sự bùng nổ của những giấc mơ. Tôi thích khám phá và chia sẻ những điều mới mẻ. Hãy đồng hành cùng tôi nhé ! 😁😘😍 - Con đường tôi đi là con đường tôi chọn - 😎😂✌ facebook twitter pinterest youtube external-link

1 Nhận xét

Vui lòng đưa ra những nhận xét tích cực, mang tính xây dựng.*

  1. thêm cái response thì ngon bạn ạ! thế này ko hay cho lắm! thanks!

    Trả lờiXóa
Mới hơn Cũ hơn

AdBlock Detected!

Phát hiện trình duyệt đang sử dụng AdBlock. Vui lòng tắt AdBlock để có thể xem nội dung cũng như ủng hộ tác giả. DXOan xin cảm ơn. Chúc bạn một ngày vui vẻ !