简体   繁体   English

Firefox无法匹配页面,JPM SDK SDK页面修改包含

[英]can't match a page with firefox jpm sdk page-mod inlclude

i'm writing a firefox addon, from my original greasemonkey userscript, which replaces eztv site's links with ajax ones, so when you click on show's watched/unwatched links it sends an ajax request to eztv and removes the row on success. 我正在用原始的oilmonkey用户脚本编写一个firefox插件,该脚本用ajax替换了eztv网站的链接,因此,当您单击show的观看/未观看链接时,它将向eztv发送ajax请求并成功删除该行。 Everthing is working fine, but Firefox's JPM SDK Page-Mod never matches the site if i specify include to only run on eztv sites. 一切正常,但是如果我指定include仅在eztv网站上运行,则Firefox的JPM SDK Page-Mod永远不会与该网站匹配。

require('sdk/page-mod').PageMod({
include: [/(https?:\/\/eztv\.(it|ch|ag)\/myshows)/, '*.eztv-proxy.net/myshows'],
contentScriptWhen: 'ready',
contentScriptFile: ["./jquery-2.2.3.min.js", './main.js'],
contentStyleFile: "./eztv.css",
attachTo: ["existing", "top"],    
});

if i change to include: "*" , the scripts are loaded fine. 如果我更改为include: "*" ,则脚本加载良好。 i've tested the regexp and it seams to match the https://eztv.ag/myshows without a hich, but some how does not work in addon. 我已经测试过regexp,它可以无缝匹配https://eztv.ag/myshows ,但没有附加功能,但是有些在addon中不起作用。

can someone spot a problem ? 有人可以发现问题吗?

finally found the answer to my problem, the regexp was missing an end slash. 终于找到了我的问题的答案,正则表达式缺少斜杠。 And also if you are using a string with wildcard for example: "*.eztv.it" you cannot specify a path or query to match, it only matches domain names. 另外,如果您使用带通配符的字符串,例如:“ * .eztv.it”,则无法指定要匹配的路径或查询,它仅与域名匹配。 If you need to match a domains specific path you need to use RegExp. 如果需要匹配特定于域的路径,则需要使用RegExp。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM