need help with greasemonkey scripts

Mineer

Expert Member
Joined
Apr 30, 2008
Messages
3,190
Reaction score
4
Location
/\/¯¯¯¯¯\/\
Hi guys

Need some help with a little pet project of mine. The goal is make my work life slightly easier.

https://work-internal-tools.com/links.html
Is just a bunch of links to other tools. One of the links do not work because it needs information in other website.
Getting the required information has been solved, with a greasemonkey script.

currently the link that does not work looks like this

Code:
SQS: {
          link: 'https://simple_que_system.work.com:8443/search',
            
        },

What I am looking for is a way to replace the link to call to first call my function GetcustomerID() then use the customerID to create the link
i.e.
Code:
https://simple_que_system.work.com:8443/search?query=customerID,

Current greasemonkey that's working creating that returns the customerID.

Code:
// ==UserScript==
// @name          sQS monkeyscript
// @description   Creates SQS link
// @include https://work-internal-tools/links.html*
// ==/UserScript==

function GetcustomerID() {
    var id = getQuerystring('asid');
    //alert(id);
    var customerID;
        GM_xmlhttpRequest({
            method: "GET",
            url: 'https://work-tools.com/servicetools/search.aws?searchType=ACCOUNT&query='+asid,
            onload: function(response) {
                var n = response.responseText.search("Customer ID:");
                customerID = response.responseText.substr(n+62,14);
                //alert(customerID);
                }
            });
        return customerID;
      }

also if there is way to only download the first 10000 characters and not the entire site, because the customer ID is always with in this section?

let me know if I am being clear enough. I change the links cos not sure if my boss would like internal links on public website so dont worry to much about the links.
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X