Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Last active September 20, 2018 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuchunyang/0434054957173f9b46c19d9b5ed1f62c to your computer and use it in GitHub Desktop.
Save xuchunyang/0434054957173f9b46c19d9b5ed1f62c to your computer and use it in GitHub Desktop.
My first user script
// ==UserScript==
// @name Hacker News Demo
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 测试 User Script
// @author xuchunyang
// @match https://news.ycombinator.com/
// @grant none
// ==/UserScript==
(function() {
'use strict'
// Idea from https://medium.freecodecamp.org/applying-javascript-user-scripts-2e505643644d
document.querySelectorAll('.athing').forEach((node, i) => {
if (i % 2 !== 0) {
node.style.backgroundColor = '#DDD'
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment