Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8432843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:13:45+00:00 2026-06-10T06:13:45+00:00

I want to make a Greasemonkey script that auto-clicks the Empty trash link every

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:13:46+00:00Added an answer on June 10, 2026 at 6:13 am

    Use jQuery’s contains selector, and setInterval.

    Here’s a complete script that should be close:

    // ==UserScript==
    // @name    _Auto-click the Empty trash link.
    // @include http://YOUR_SERVER.COM/YOUR_PATH/*
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    // ==/UserScript==
    
    setInterval (EmptyTrashIfWeCan, 1000);  //1000 = 1 second.
    
    function EmptyTrashIfWeCan () {
        var energyDisp  = $("div.btn-group ul.dropdown-menu li a:contains('Energy left')");
        var energyVal   = energyDisp.text ().replace (/^\s*Energy left:\s+(\d+)%\s*$/i, "$1");
        if (parseInt (energyVal, 10)  >  20) {
            var emptyTrashLink  = $("div.btn-group ul.dropdown-menu li a:contains('Empty trash')");
            //--- Click the link in a more robust way...
            var clickEvent      = document.createEvent ('MouseEvents');
            clickEvent.initEvent ('click', true, true);
            emptyTrashLink.dispatchEvent (clickEvent);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I want make a page (HTML + CSS) that fits all the space left
i want make script evry 15min connect to 4 address and get new link
I want make a bash script which returns the position of an element from
I want make the control height as double when the mouse is over that
Want make a mind map like the following: Image link is not available anymore.
I want make a xslt transformation to xsl-fo but I´m not really sure that
i want make function like that function(data){ } i want this data as this
I want make a UI that is semi transparent in WPF VS2008, so I
I want to make some graphical dialogs for my script but don't know how.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.