用于执行多项任务的书签
我整天都在摆弄这个应用程序,并且遇到了一些困难。 因此,基本上,书签需要允许用户使用多个 JavaScript 文件中的许多函数,尽管用户将使用的所有函数都是从一个文件调用的。 基本上它包括执行特定功能所需的所有文件。 它使用 jQuery,而且我发现在您的小书签上运行 jQuery 真的很困难。
我的问题是:如何将多个 javascript 代码文件加载到您的 Bookmarklet 中?
此致,
埃米尔·哈吉里克。
I've been tinkering around this application all day long and have had a few difficulties. So basically the bookmarklet needs to allow the user to use a lot of functions from multiple JavaScript files, although all of the functions that the user will use are called from one file. Basically it includes all of the necessary files in order to perform a certain function. It uses jQuery, and I've found that it's really hard to have jQuery running on your bookmarklet.
My question is: How can I load multiple javascript code files into your Bookmarklet?
Yours truly,
Emil Hajric.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您必须使用小书签运行多个 JavaScript 文件,我建议您在小书签中创建一个函数来导入文件。
该函数可以写为:
为了在小书签中实际使用,只需声明该函数,然后为每个必须导入的文件调用它一次。
(注意:要实际将其用作小书签,必须将所有行连接到一行中。)
If you have to run several JavaScript files using a bookmarklet I'd recommend creating a function in the bookmarklet to import files.
That function could be written as
In order to actually use in a bookmarklet, just declare that function, and then call it once for each file you have to import.
(Note: To actually use this as a bookmarklet it is necessary to join all the lines into a single line.)
您可以将脚本嵌入到小书签正在处理的文档中
f.ex 如果您的书签类似于
您可以添加任意数量的脚本元素,请尝试在其中添加 jquery。
you can embed the scripts to the document the bookmarklet is working on
f.ex if your bookmarklet is something like
you can add as many script elements as you wish, try adding jquery in there.