Last active
September 16, 2019 02:46
-
-
Save mixj93/6ca1a129218fd4f8f380e035bf03de34 to your computer and use it in GitHub Desktop.
Scripts in console
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
let date = document.querySelector('h2[class^="Navigation__Title-"]').querySelector('.hidden-sm').innerText.replace(/\(|\)/g, ''); | |
let res = `Best of JavaScript周报 - ${date}\n`; | |
let cards = document.querySelectorAll('div[class^="ProjectCard__Card-"]'); | |
for (let i = 0; i < cards.length; i++) { | |
let card = cards[i]; | |
let name = card.querySelector('div[class^="ProjectCard__Title-"]').innerText; | |
let url = card.querySelector('a[class^="ProjectCard__Header-"]').href; | |
let stars = card.querySelector('.star-delta').innerText.replace(' ', '').replace('★', ' ⭐'); | |
let description = card.querySelector('div[class^="ProjectCard__Description-"]').innerText; | |
res += `${name} [${stars}]\n${description}\n${url}\n\n`; | |
} | |
let pageInfo = document.location.href; | |
res += `更多信息详见:${pageInfo}`; | |
console.log(res) |
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
// * Season 1 https://www.imdb.com/title/tt0460627/episodes?season=1 | |
let res = [] | |
let lists = document.querySelectorAll('.list_item') | |
for (let i = 0; i < lists.length; i++) { | |
let item = lists[i]; | |
let title = item.querySelector('.info strong a').innerText; | |
let url = item.querySelector('.info strong a').href; | |
res.push({title, url}) | |
} | |
console.log(JSON.stringify(res)) |
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
// * https://www.imdb.com/title/tt0460627/trivia?ref_=tt_ql_2 | |
let res = '' | |
let lists = document.querySelectorAll('.article.listo #trivia_content .list') | |
let triviaList = lists[0].querySelectorAll('.soda.sodavote .sodatext') | |
let spoilerList = lists[1].querySelectorAll('.soda.sodavote .sodatext') | |
const transList = (list) => { | |
for (let i = 0; i < list.length; i++) { | |
res += `${i + 1}\n` | |
let trivia = list[i] | |
let content = trivia.innerText | |
res += `${content}\n` | |
let links = trivia.querySelectorAll('a') | |
if (links.length > 0) { | |
res += `\n` | |
} | |
for (let j = 0; j < links.length; j++) { | |
let linkText = links[j].innerText | |
let linkHref = links[j].href | |
res += `${linkText}: ${linkHref}\n` | |
} | |
res += `\n` | |
} | |
} | |
transList(triviaList) | |
res += `Spoilers\n` | |
transList(spoilerList) | |
console.log(res) |
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
let songs = document.querySelectorAll('table tbody tr'); | |
let res = "" | |
for (let i = 0; i < songs.length; i++) { | |
let song = songs[i]; | |
let name = song.querySelector('td div.f-cb div.tt div.ttc span.txt b').getAttribute("title"); | |
let singer = song.querySelector('td>div.text').getAttribute("title"); | |
res += `${singer} - ${name}\n`; | |
} | |
console.log(res) |
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
document.querySelector(".react-toggle").remove() | |
document.querySelector("aside").remove() | |
document.querySelector("footer").remove() | |
var atls = document.querySelectorAll("article") | |
var main = document.querySelector("main") | |
for (let i = atls.length - 1; i >= 0; i--) { | |
main.appendChild(atls[i]) | |
} | |
var ah = document.querySelectorAll("article h3") | |
for (let i = 0; i < ah.length; i++) { | |
let newSpan = document.createElement("span") | |
let newContent = document.createTextNode("10") | |
newSpan.appendChild(newContent) | |
ah[i].prepend(newSpan) | |
} |
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
document.querySelector(".react-toggle").remove() | |
document.querySelector(".translations").remove() | |
document.querySelector("footer").remove() | |
document.querySelector("aside").remove() |
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
let items = document.querySelectorAll('#dismissable'); | |
let res = "" | |
for (let i = 0; i < items.length; i++) { | |
let item = items[i]; | |
let name = item.querySelector('#video-title').innerText; | |
let link = item.querySelector('#video-title').href; | |
res += `${name} - ${link}\n`; | |
} | |
console.log(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment