且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将jQuery包含到javascript中并在imacros中使用它?

更新时间:2021-11-14 01:37:32

我已经有了这个解决方案:

I've come with this this solution:

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;
}

// load JQuery
loadScriptFromURL('http://mysupersecret.blob.core.windows.net/share/jquery-2.0.3.min.js');
$ = window.$,
JQuery = window.JQuery;

试图从它的官方CDN获取jQuery,我遇到了iMacros中的setTimeout is undefined错误。所以我下载了jQuery并将 setTimeout 方法修改为 window.setTimeout 。这对我有用,所以我不得不将jQuery放在我的在线共享位置以便从那里使用它。希望这会有所帮助。

Trying to get jQuery from it's official CDN, I faced with the "setTimeout is undefined" error in iMacros. So I downloaded jQuery and modified setTimeout method to be window.setTimeout. This worked for me and so I had to place jQuery in my online shared location to use it from there. Hope this helps.