Last active
August 1, 2019 16:14
-
-
Save namhnz/8622af6a2b24435fcf5498615e728839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code chạy dùng F12 console, vào trang chuyên đề của moon.vn rồi chạy | |
//Kết quả được thẻ <b></b> đến thẻ <table></table> và thêm 2 thẻ <br> | |
//Paste vào VS Code để format lại cho đẹp | |
function makeTitle(){ | |
const tenChuyenDe = document.querySelector("#ContentPlaceHolder1_DataList1 > tbody > tr > td > div:nth-child(1) > h1 > strong").textContent.trim(); | |
const tenChuyenDeFormatted = `<h3 style="color: red; text-align: center">${tenChuyenDe.toUpperCase()}</h3>` | |
return tenChuyenDeFormatted; | |
} | |
function makeBaiHocTable(){ | |
let baiHocArray = []; | |
Array.from(document.querySelectorAll("#ContentPlaceHolder1_Panel1 > table > tbody > tr")) | |
.forEach(tr => { | |
let tenBaiHoc = tr.querySelector("td:nth-child(3) > a").title.trim(); | |
let daXuatBan = tr.querySelector("td:nth-child(4) > div") == null; | |
if(daXuatBan){ | |
baiHocArray.push(`<tr><td>${tenBaiHoc}</td><td><a href="" target="_blank" class="btn btn-primary">Vào học</a></td></tr>`) | |
} else { | |
baiHocArray.push(`<tr><td>${tenBaiHoc}</td><td><a class="btn btn-primary" disabled="" href="https://www.blogger.com/blogger.g?blogID=1212524714822142927#!"><i class="fa fa-spinner fa-spin "></i> Đang xuất bản</a></td></tr>`); | |
} | |
}); | |
return `<table class="table table-hover" id="dev-table"><tbody>${baiHocArray.join("")}</tbody></table>`; | |
} | |
function makeChuyenDePost(){ | |
const post = makeTitle() + makeBaiHocTable() + "<br><br>"; | |
return post; | |
} | |
makeChuyenDePost(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment