Skip to content

Instantly share code, notes, and snippets.

@ahuggins
ahuggins / espn-game-focus.js
Last active November 17, 2024 00:59
ESPN.com Game Focus Console command
// This console script allows you to set the `gamesInterestedIn` to be games you want to keep tabs on.
// Just need one team in the game you are interested in (like you don't need both teams listed).
// Then run the whole script, and the games you are not interested in will be filtered away.
// It sets divs to be style "display: none" because if the elements are removed, when ESPN updates
// something and the node is removed, it throws an error. Styling them to display none, means the node
// is still there, and it can do its thing.
// Some definitions for easier reading
const gameIds = new Set;
const q = (selector) => document.querySelectorAll(selector);
7 | const wrap = mount(
8 | <Foo />
> 9 | ).;
| ^
Chrome 71.0.3578 (Mac OS X 10.14.0) ERROR
{
"message": "Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):\nSyntaxError: Unexpected token (9:10)\n\n\u001b[0m \u001b[90m 7 | \u001b[39m \u001b[36mconst\u001b[39m wrap \u001b[33m=\u001b[39m mount(\n \u001b[90m 8 | \u001b[39m \u001b[33m<\u001b[39m\u001b[33mFoo\u001b[39m \u001b[33m/\u001b[39m\u001b[33m>\u001b[39m\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 9 | \u001b[39m )\u001b[33m.\u001b[39m\u001b[33m;\u001b[39m\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 10 | \u001b[39m \u001b[90m// console.log(wrap.find('.someCustomClass').hostNodes().debug());\u001b[39m\n \u001b[90m 11 | \u001b[39m\n \u001b[90m 12 | \u001b[39m expect(wrap\u001b[33m.\u001b[39mfind(\u001b[32m'.someCustomClass'\u001b[39m)\u001b[33m.\u001b[39mhostNodes())\u001b[33m.\u001b[39mto\u001b[33m.\u001b[39mhave\u001b[33m.\u001b[39mlength(\u001b[35m1\u001b[39m)\u001b[33m;
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
<Bar className="someCustomClass">
<div>
<div className="barClass">
<Baz className="someCustomClass">
<div>
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
<Bar className="someCustomClass">
<div>
<div className="barClass">
<Baz className="someCustomClass">
<div>
<div className="someCustomClass">
<h1>
Baz is rendered
</h1>
</div>
describe.only('Something about the tests here', function () {
it('tests one thing', function () {
});
});
describe('Something about the tests here', function () {
it('tests one thing', function () {
});
});
<!-- mount() -->
<Foo>
<div>
<div className="fooClass">
<Bar>
<div>
<div className="barClass">
Something here
</div>
</div>
<!-- shallow() -->
<div>
<div className="fooClass">
<Bar />
</div>
</div>