I want to make a Greasemonkey script that auto-clicks the “Empty trash” link every second if the value “Energy left” is bigger than 20%.
The page’s code is below. Thanks and sorry for my bad English.
<div class="btn-group">
<a class="btn btn-mini" href="#" data-toggle="dropdown"><i class="icon-wrench"></i> Chores</a>
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/pet/100000113715357/chore/1">Poke your owner (5%)</a></li>
<li><a href="/pet/100000113715357/chore/2">Pinch your owner (10%)</a></li>
<li><a href="/pet/100000113715357/chore/3">Serve strawberries (15%)</a></li>
<li><a href="/pet/100000113715357/chore/4">Empty trash (20%)</a></li>
<li><a href="/pet/100000113715357/chore/5">Iron clothes (40%)</a></li>
<li><a href="/pet/100000113715357/chore/6">Clean the pet store (60%)</a></li>
<li><a href="/pet/100000113715357/chore/7">Spank your owner (80%)</a></li>
<li><a href="/pet/100000113715357/chore/8">Dance with your owner (100%)</a></li>
<li class="divider"></li>
<li><a href="#">Energy left: 15%</a></li>
</ul>
</div>
Use jQuery’s contains selector, and
setInterval.Here’s a complete script that should be close: