var article_content = document.getElementById("article_content"); article_content.removeAttribute("style"); var follow_texts = document.getElementsByClassName('follow-text') var hide_article_boxs = document.getElementsByClassName('hide-article-box') if (follow_texts[0] && hide_article_boxs[0]) { console.log("hide_article_do")
var follow_text = follow_texts[0]; follow_text.parentElement.parentElement.removeChild(follow_text.parentElement);
var hide_article_box = hide_article_boxs[0]; hide_article_box.parentElement.removeChild(hide_article_box); } else { console.log("hide_article_no") }
var p = /<title>.*<\/title>/g function parsePageTitle(s) { var items = s.match(p) if (items) { return items[0].replace("<title>", "").replace("</title>", "") }
return "null" }
function getPageSource(url) { return fetch(url).then(res => res.text()) }
function getPageTitles(urls) { Promise.all( urls.map(url => fetch(url).then(res => res.text()) ) ).then(res => { for (s of res) { console.log(parsePageTitle(s)) } }) }
function testGetPageTitle() { // var url = "https://blog.csdn.net/rikkatheworld/article/details/123040617" var url = "http://localhost:4000/2017/08/01/java/junior/java-2-lang/" getPageTitle(url) }
function testGetPageTitles() { var urls = [] urls.push("http://localhost:4000/2017/08/01/java/junior/java-2-lang/") urls.push("http://localhost:4000/2017/08/01/java/junior/java-3-container/")
getPageTitles(urls) }
function showOutLinks() { var data = []
var urls = document.getElementsByTagName('a') for (url in urls) { if (!urls[url].href || !urls[url].text) { continue }
var href = urls[url].href + "" if (href.includes("localhost")) { continue }
var text = urls[url].text + ""
var row = [] row.push(text) row.push(href)
data.push(row)
// console.log(text + " : " + href) }
// console.table(data)
for (row of data) { console.log(row[0] + " : " + row[1]) } }