将jQuery包含到javascript中并在imacros中使用它? [英] include jQuery into javascript and use it in imacros ?

查看:216
本文介绍了将jQuery包含到javascript中并在imacros中使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将jQuery库包含到javascript中并在iMacros中使用它?

I want to know how can I include jQuery library into javascript and use it in iMacros?

它是这样的。进入.js文件我将iMacros代码声明为变量

It goes like this. Into .js file I declare iMacros code as a variable

var someMacro;
someMacro ="CODE:";
someMacro +="TAB T=1 \n";

代码实际上更大,这只是一个小例子。在我声明变量之后,我使用像iimPlay,iimSet等命令来播放宏并在宏内部设置变量。

The code is actually larger and this is just small example. After I declared the variable I use commands like iimPlay, iimSet etc. to play the macro and set the variables inside the macro.

现在我如何将jQuery库包含在此中这样我可以在.js文件中使用jQuery并增强我的脚本吗?

Now how can I include jQuery library into this so that I can use jQuery inside .js file and enhance my scripts ?

PS我在他们的论坛上发现了这个,但由于我不明白如何使用它,它对我帮助不大。这是一个链接链接到iopus关于jQuery的论坛

P.S. I found this on their forum but it didn't help me much since I didn't understand how to use it. Here is the link Link to iopus forum about jQuery

推荐答案

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

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.

这篇关于将jQuery包含到javascript中并在imacros中使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆