Imacros, FireFox and & Jquery

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Trax
Posts: 43
Joined: Thu Sep 13, 2012 4:07 pm
Contact:

Imacros, FireFox and & Jquery

Post by Trax » Mon Mar 21, 2016 8:28 am

I needed jquery for a script, google shows many solutions that don't work, took me a while to find a good one. I thought I should post it here in case anyone else ever needs it.

Code: Select all

function loadScriptFromURL(url) {
    var request = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1'].createInstance(Components.interfaces.nsIXMLHttpRequest),
        async = false;
    request.open('GET', url, async);
    request.send();
    if (request.status !== 200) {
        var message = 'an error occurred while loading script at url: ' + url + ', status: ' + request.status;
        iimDisplay(message);
        return false;
    }
    eval(request.response);
    return true;
}

loadScriptFromURL('http://devbattles.com/js/jq.for.im.js');	// You can replace link with this one for latest version https://www.dropbox.com/s/47cj0fqxnsijm2n/jquery-2.2.2.min.js?raw=1	
$ = window.$,
JQuery = window.JQuery;
Source https://www.devbattles.com/en/sand/post ... in_iMacros

Tested on :
FF 45.0.1
iMacros 8.9.6
Windows 7
jQuery 2.2.2.min.js / official dl http://code.jquery.com/jquery-2.2.2.min.js
Last edited by Trax on Mon Mar 21, 2016 12:29 pm, edited 1 time in total.
chivracq
Posts: 9245
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros, FireFox and & Jquery

Post by chivracq » Mon Mar 21, 2016 10:55 am

Trax wrote:I needed jquery for a script, google shows many solutions that don't work, took me a while to find a good one. I thought I should post it here in case anyone else ever needs it.

Code: Select all

function loadScriptFromURL(url) {
    var request = Components.classes['@mozilla.org/xmlextras/xmlhttprequest;1'].createInstance(Components.interfaces.nsIXMLHttpRequest),
        async = false;
    request.open('GET', url, async);
    request.send();
    if (request.status !== 200) {
        var message = 'an error occurred while loading script at url: ' + url + ', status: ' + request.status;
        iimDisplay(message);
        return false;
    }
    eval(request.response);
    return true;
}

loadScriptFromURL('http://devbattles.com/js/jq.for.im.js');	// You can replace link with this one for latest version https://www.dropbox.com/s/47cj0fqxnsijm2n/jquery-2.2.2.min.js?raw=1	
$ = window.$,
JQuery = window.JQuery;
Source https://www.devbattles.com/en/sand/post ... in_iMacros

Works great no issues.
Oh...!, I remember you, you were the "Process Lasso" User who gave that Idea in some Thread 2 or 3 years ago about preventing a PC to enter Sleep Mode..., and you participated in a few JavaScript Threads... Pity we don't see you a bit more often on the Forum, there are not many Users with (good...!) JavaScript Skills active on the Forum...

Thanks for sharing, that's always useful, the Question comes back regularly about using jQuerry with iMacros, but Solutions work and then don't work anymore from some specific iMacros or FF Version(s) and that's probably what happened to the different "Solutions" that you found on Google so you should mention your FCI for other Users to know in which Config your Script will work...
=> Probable FCI (March 2016): iMacros for FF v8.9.6, FF44/45, Win7/8.1/10, jQuerry v2.2.2.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Trax
Posts: 43
Joined: Thu Sep 13, 2012 4:07 pm
Contact:

Re: Imacros, FireFox and & Jquery

Post by Trax » Mon Mar 21, 2016 12:34 pm

Fixed .. also you have great memory I was 100% sure you had me confused until I checked my older posts :)
chivracq
Posts: 9245
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros, FireFox and & Jquery

Post by chivracq » Mon Mar 21, 2016 1:06 pm

Trax wrote:Fixed .. also you have great memory I was 100% sure you had me confused until I checked my older posts :)
Yep, I saw that, perfect...! And I was correct about your "probable FCI"...

Well, "great memory", that was easy for me to remember as it had been an interesting (= challenging...!) Thread, and I had done quite some Digging in it, I don't remember all the... pfffff...!, I see that I am approaching the 4000 Posts on the Forum, so roughly, I must have participated in 1500-2000 Threads, and I luckily don't remember them all, especially that in at least 50% of them, it's to kind of bash Users to mention their FCI and give more Info, but I do remember the maybe 200 or 300 very interesting ones, yep...!, from the about 3 years that I've been a bit active on the Forum...

Hope to see you back soon on the Forum... (with Problems or Solutions, ah-ah...!). 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply