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 8536365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:38:46+00:00 2026-06-11T10:38:46+00:00

I need to combine these 2 scripts for GM. One opens new pages from

  • 0

I need to combine these 2 scripts for GM. One opens new pages from a list, and the other clicks on the ‘follow’ button.

Script 1: How to open a list of pages automatically and sequentially?

Script 2: How do I click on this button with Greasemonkey?

I’ve tried to combine them by myself but failed to create a working script that fully reloads pages, even they are put sequentially in the list (if you read the other question you’ll understand what I mean).

This is what I’ve tried but it doesn’t work as expected since it doesn’t reload properly the page and go on with its tasks:

// ==UserScript==
// @name    Follow People on INK361
// @description Follow People from our FB Page's list INK361
// @include     http://ink361.com*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant       GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a major design
    change introduced in GM 1.0.
    It restores the sandbox.
*/

var urlsToLoad  = [
'http://ink361.com/#/users/30742610/photos',
'http://ink361.com/#/users/193869245/photos',
'http://ink361.com/#/users/215062853/photos',
'http://ink361.com/#/users/218295575/photos'
];

/*--- Since many of these sites load large pictures, Chrome's and 
    Firefox's injection may fire a good deal before the image(s) 
    finish loading.
    So, insure script fires after load:
*/

//--- Catch new pages loaded by WELL BEHAVED ajax.
window.addEventListener ("hashchange", FireTimerA,  false);

function FiretimerA () {
    waitForKeyElements ("a.simplebutton:contains('follow')", FireTimer());
}


function FireTimer (jNode) {

    if ( ! /^\s*follow\s*$/i.test () ) {   
        return false;
    }

    var clickEvent  = document.createEvent ('MouseEvents');
    clickEvent.initEvent ('click', true, true);
    jNode[0].dispatchEvent (clickEvent);
    GotoNextURL();
}

function GotoNextURL () {
    var numUrls     = urlsToLoad.length;
    var urlIdx      = urlsToLoad.indexOf (location.href);
    urlIdx++;
    if (urlIdx >= numUrls)
        urlIdx = 0;

    location.href   = urlsToLoad[urlIdx];
}
  • 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-11T10:38:47+00:00Added an answer on June 11, 2026 at 10:38 am

    Merging those scripts should be straightforward: Just standardize the metadata block and paste one script’s javascript after the other’s.

    After determining the true purpose of the merged script, we get:

    // ==UserScript==
    // @name        _Follow People on INK361
    // @description Follow People from our FB Page's list INK361
    // @include     http://ink361.com/#/users/*
    // @exclude     http://ink361.com/#/users/223888036*
    // @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    // @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
    // @grant       GM_addStyle
    // ==/UserScript==
    /*- The @grant directive is needed to work around a major design
        change introduced in GM 1.0.
        It restores the sandbox.
    */
    
    var urlsToLoad  = [
        'http://ink361.com/#/users/14565576/photos'
        , 'http://ink361.com/#/users/218217815/photos'
        , 'http://ink361.com/#/users/202670894/photos'
        , 'http://ink361.com/#/users/201771644/photos'
        , 'http://ink361.com/#/users/217243779/photos'
        , 'http://ink361.com/#/users/218295748/photos'
        , 'http://ink361.com/#/users/218273533/photos'
        , 'http://ink361.com/#/users/30742610/photos'
        , 'http://ink361.com/#/users/193869245/photos'
        , 'http://ink361.com/#/users/215062853/photos'
    ];
    
    /*--- Operation:
        1) If the button is "follow" then it clicks it.
        2) If the button is, or becomes "unfollow", then go to the next page.
        3) If there is no button or the button stops working, it stays on the current page.
    */
    
    //--- Note that contains() is CASE-SENSITIVE.
    waitForKeyElements (
        "#relationship a.simplebutton:contains('follow')",
        clickOnFollowButton
    );
    
    function clickOnFollowButton (jNode) {
    
        if ( /^\s*follow\s*$/i.test (jNode.text() ) ) {
            //--- Button is "follow"; click it.
    
            var clickEvent  = document.createEvent ('MouseEvents');
            clickEvent.initEvent ('click', true, true);
            jNode[0].dispatchEvent (clickEvent);
        }
        else if ( /^\s*unfollow\s*$/i.test (jNode.text() ) ) {
            //--- Unfollow button is already (or now) set.  Go to next page.
            jNode.text ("palate cleanser");
            GotoNextURL ();
        }
    
        return true;    //--- This node is reused, never mark it as found.
    }
    
    
    function GotoNextURL () {
        var numUrls     = urlsToLoad.length;
        var urlIdx      = urlsToLoad.indexOf (location.href);
        urlIdx++;
    
        //-- Don't loop the list of sites.
        if (urlIdx < numUrls) {
            location.assign (urlsToLoad[urlIdx]);
        }
    }
    

    But this assumes that clicking the “Follow” button keeps the screen on the same page. Does it? (Yes)

    I can’t login to that site, so I can’t test the script fully. If it doesn’t work, please list any error messages displayed by the console (Firebug or Firefox), and describe exactly how it behaves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to combine these queries, so i get back a list of months,
I need to combine these queries, so i get back a list of months,
Using C++ I need to combine two distinct IDs into one 16bit integer. Then
I have data from two different sources that I need to combine. Some data
I need to create and combine several expressions for child entity into one to
I need to combine the two queries if possible or make them process one
I think this is a tricky one, How do you combine all of these
I need to combine fields and then trim out extra spaces the middle of
I need to combine to a string column and the result of a row_number()
I need to combine lines in two files, basing in the condition, that in

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.