阅读:980回复:1
求助:将jetpack方式扩展改为传统chrome注册方式(XUL)
各位达人:
新手有个问题想请教一下各位。 现在一个firefox的jetpack扩展,其中的main.js的代码为: var Widget = require("widget").Widget; var tabs = require('tabs'); exports.main = function() { var tabs = require("tabs"); var ss = require("simple-storage"); tabs.on('ready', function(tab) { var contentScript = 'void((function(w) {if (w.parent != w &&!w.location.href.match(/^http/) &&!w.document.getElementsByTagName("head").length &&w.DEISHUO_LOADED){return;}var n = 0;function b () {w.DEISHUO_LOADED = true;var h = w.document.getElementsByTagName("head")[0];var s = w.document.createElement("script");s.id="DeiShuoScript";s.setAttribute("charset","utf-8");s.src="http://www.deishuo.com/main.js?" + w.encodeURIComponent(w.location.href);h.appendChild(s);}function d () {return w.document.getElementsByTagName("head").length;}function c(){n++;if (n > 100) {return ;};setTimeout(function() {h();},600)}function h () {var doc = w.document;if (navigator.userAgent.indexOf("MSIE")){b();}else if (doc.doctype && doc.doctype.name && doc.doctype.name == "html"){b();}else{c();}}h();})(window));'; tab.attach({ contentScript:contentScript }); }); }; 谁能帮我生成一个chrome注册方式的扩展,或者是指点一下如何生成。 先谢谢各位了。 附件是完整的xpi扩展包 |
|
|
1楼#
发布于:2013-06-24 08:43
这个没必要改成 XUL 扩展,相对来说,改成 GM 脚本或小书签(bookmarklet)来说更好些。
|
|
|