Jquery Chrome 扩展有帮助吗?
我正在制作一个 Chrome 扩展程序,您可以在其中拖放链接,它会在扩展程序中为它添加书签。我从 stackoverflow 线程中找到了 this ,它做了我想要的事情,但唯一的问题是我希望它用链接创建一个新元素而不是替换旧链接。有人能指出我正确的方向吗?我被困住了。
I am making a Chrome extensions where you can drag and drop links and it'll bookmark it in the extension. I found this from a stackoverflow thread, it does what I want it to but the only problem is that I want it to make a new element with the link and not replace the old link. Can someone point me to the right direction. I'm stuck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我修改了那个小提琴以满足您的要求。现在,每个丢弃的链接都会在 UL 内创建一个新的 LI 元素。如果您还没有阅读过,我建议您阅读一下 Chrome Bookmark API,并且我对小提琴进行了评论以显示您将使用 API 函数的位置。如果您想记住用户通过扩展创建了哪些书签,您可能还需要设置 localStorage 来保存创建的书签的 ID。
JSFiddle: http://jsfiddle.net/ArkahnX/jwsdm/5/
本地存储:http://www.kirupa.com/html5/html5_local_storage.htm
Chrome 书签 API:http://code.google.com/chrome/extensions/bookmarks.html
I modified that fiddle to match your request. Each dropped link now creates a new LI element within a UL. I suggest you read up on the Chrome Bookmark API if you haven't already, and I commented the fiddle to show locations where you would use API functions. If you want to remember which bookmarks the user has created through the extension, you may want to set up localStorage as well to save the ID of the created bookmark.
JSFiddle: http://jsfiddle.net/ArkahnX/jwsdm/5/
LocalStorage: http://www.kirupa.com/html5/html5_local_storage.htm
Chrome Bookmarks API:http://code.google.com/chrome/extensions/bookmarks.html