d2jsp
Log InRegister
d2jsp Forums > d2jsp > General Help > Need Few Lines Of Code (js) Offer 500 Fg
Add Reply New Topic
Member
Posts: 11,269
Joined: Jul 12 2019
Gold: 0.02
Warn: 80%
Jan 23 2022 05:05pm
the "section class" always got the same name ,
"main class" too , not sure if this information is important to you .
the thing i marked blue on my screen is the object / pic i like to open up .
so when i visit that page , i want the code to click on this blue marked object (which is a picture on a site) .
the code needs to work for different pics, not just this one .

i hope my description is clear ? if you provide me a working js code i pay you 500 fg :)

Member
Posts: 12,424
Joined: Mar 3 2019
Gold: 108,888.43
Jan 23 2022 05:13pm
I would suggest trying the programmers section of jsp. I’m sure you could get some help there.

https://forums.d2jsp.org/forum.php?f=120
Member
Posts: 15,303
Joined: Mar 22 2008
Gold: 1,219.28
Trader: Trusted
Jan 23 2022 05:53pm
If the class name is static, maybe try jQuery if already loaded?

$('.v1Nh3...').click();

To make it for whatever class name you manually enter. This might not be good for different user-agents however.

JS with 5,000 ms clicks followed by a 1,000 ms close:

<script>
var a = setInterval(function ({document.getElementByClassName('.v1Nh3...').click();}, 500);
setInterval(function () {clearInterval(a)}, 1000);
</script>


For auto clicking on all elements similar to the object you reference:

var arr = document.getElementsByClassName(".v1Nh3...");
for (var i=0; i<arr.length; i++) arr[eye].click();

Edit: in the above, I had to edit the the for loop to enter "[eye]", because d2jsp auto closes the brackets with the "i" character inside thinking I meant to italicize the ending text. So where you see [eye], it's the "i" enclosed in brackets.

This post was edited by SirRonLionHeart on Jan 23 2022 05:58pm
Member
Posts: 15,801
Joined: Jul 9 2021
Gold: 291.00
Jan 23 2022 06:04pm
Code
var arr = document.getElementsByClassName(".v1Nh3...");
for (var i=0; i<arr.length; i++) arr[i].click();

CODE tag to save the day :P
Member
Posts: 10,287
Joined: Nov 25 2005
Gold: 27,330.00
Trader: Trusted
Jan 25 2022 12:55am
With es6 u can do it by this way

Code
[...document.querySelectorAll('.v1Nh3')] .forEach(div => { div.click(); })


If u want to click on the first index u can just take the index 0
Code
document.getElementsByClassName('.v1Nh3")[0].click();


This post was edited by pimp1123 on Jan 25 2022 01:00am
Member
Posts: 66,666
Joined: Jan 14 2014
Gold: 67.84
Jan 25 2022 08:15am
This post is a violation of the site rules and appropriate action was taken.

Member
Posts: 11,269
Joined: Jul 12 2019
Gold: 0.02
Warn: 80%
Jan 25 2022 08:23am
Quote (pimp1123 @ 25 Jan 2022 07:55)
With es6 u can do it by this way

Code
[...document.querySelectorAll('.v1Nh3')] .forEach(div => { div.click(); })


If u want to click on the first index u can just take the index 0
Code
document.getElementsByClassName('.v1Nh3")[0].click();


ty i was able to solve it that way ( fg sent )

Quote (liskod2 @ 25 Jan 2022 15:15)


ty for the input , i will turn your fg count into the devil number as reward :evil:



problem solved

This post was edited by zetsubl on Jan 25 2022 08:24am
Member
Posts: 10,287
Joined: Nov 25 2005
Gold: 27,330.00
Trader: Trusted
Jan 25 2022 09:53am
Quote (zetsubl @ Jan 25 2022 04:23pm)
ty i was able to solve it that way ( fg sent )



ty for the input , i will turn your fg count into the devil number as reward :evil:



problem solved


Np hf :) ty
Go Back To General Help Topic List
Add Reply New Topic