Know of any way to make this js code better?

Know of any way to make this js code better?
0

#1

// ==UserScript==
// @name yt filter always show
// @grant none
// @include https://www.youtube.com/results?*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
// ==/UserScript==
$( document ).ready(function() {
$("[aria-label=Search filters]").click();
});

someone made it

what it does: keeps filters open like it was before youtube changed site

using: https://chrome.google.com/webstore/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag

seems to slow site down? dunno if this code is causing it


Why should I learn Python if I already know Javascript?
Give me something to build
#3

I sense Kyle Simpson is near… I am too afraid to go and even think of saying “YES!”… So yeah, Kyle and I going to just bump this post up for you.


#4

anyone… ? :confused:


#5

Someone told me yesterday that linux is built with python. That was a good enough answer for me i guess


#6

That is just using some jquery and using it poorly.

I have no idea what // @include https://www.youtube.com/results?* is trying to do. $( document ).ready(function() { is standard JQ boilerplate to tell it to wait until the page loads, and $("[aria-label=Search filters]").click(); is firing all the click events that match that selector, I think all of them where the aria-lable is Search filters. Though, I would have expected the label to have quotes, something like $('[aria-label="Search filters"]').click();.