Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update likeAll.js #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update likeAll.js #1

wants to merge 1 commit into from

Conversation

gragtah
Copy link
Owner

@gragtah gragtah commented Nov 13, 2023

No description provided.

Copy link

likeAll.js

Instead of using document.getElementsByClassName, you can use document.querySelectorAll. This method is faster and more readable. Also, it returns a static NodeList. It means that the returned collection will not change if the document changes.
Create Issue

    var z = document.querySelectorAll('.pam.uiBoxLightblue.uiMorePagerPrimary');
    var x = document.querySelectorAll('.like_link.stat_elem.as_link');

In your conditional statement, you are using a single equal sign (=) which is an assignment operator, not a comparison operator. You should use the strict equality operator (===) to compare x[i].name with 'like'.
Create Issue

    if(x[i].name === 'like') {x[i].click()}

There is no need to use void(1). The void operator discards any return value from an expression. Here, it seems you are not using the return value of any expression. So, you can remove this line.
Create Issue

    // Remove the following line
    // void(1);

for(var i = 0; i < x.length; ++i) {
if(x[i].name=='like') {x[i].click();}
for(var i = 0; i < x.length; i++) {
if(x[i].name='like') {x[i].click()}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional statement in the for loop was using an assignment operator instead of a comparison operator. This has been corrected to use the strict equality operator for comparison.

Suggested change
if(x[i].name='like') {x[i].click()}
if(x[i].name === 'like') {x[i].click()}


};
alert("done");
void(0);
void(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing unnecessary use of the void operator to improve code readability.

Suggested change
void(1);
alert("done");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant