草庐IT

javascript - 支持内容脚本中的所有谷歌域

coder 2024-05-13 原文

我正在制作一个内容脚本,它对谷歌搜索结果网页做一些事情。

manifest.json 中的以下行无效。

"matches": [ "https://www.google.*/*" ]

由于 manifest.json 中的上述行导致的错误是:

Invalid value for 'content_scripts[0].matches[0]': Invalid host wildcard.

我想在 google.com、google.co.in、google.de 等各种域上运行脚本。我该如何实现?

最佳答案

match pattern 的 TLD 中不允许使用通配符.

Google 已发布 a list of supported domains .每个域都放在单独的行中,看起来像 .google.com。您可以使用此列表生成有效的匹配模式,例如(例如,我使用 www 作为子域):

"matches": [
    "http://www.google.com/*", "https://www.google.com/*",
    "http://www.google.ad/*", "https://www.google.ad/*",
    "http://www.google.ae/*", "https://www.google.ae/*",
    "http://www.google.com.af/*", "https://www.google.com.af/*",
    "http://www.google.com.ag/*", "https://www.google.com.ag/*",
    "http://www.google.com.ai/*", "https://www.google.com.ai/*",
    "http://www.google.am/*", "https://www.google.am/*",
    "http://www.google.co.ao/*", "https://www.google.co.ao/*",
    "http://www.google.com.ar/*", "https://www.google.com.ar/*",
    "http://www.google.as/*", "https://www.google.as/*",
    "http://www.google.at/*", "https://www.google.at/*",
    "http://www.google.com.au/*", "https://www.google.com.au/*",
    "http://www.google.az/*", "https://www.google.az/*",
    "http://www.google.ba/*", "https://www.google.ba/*",
    "http://www.google.com.bd/*", "https://www.google.com.bd/*",
    "http://www.google.be/*", "https://www.google.be/*",
    "http://www.google.bf/*", "https://www.google.bf/*",
    "http://www.google.bg/*", "https://www.google.bg/*",
    "http://www.google.com.bh/*", "https://www.google.com.bh/*",
    "http://www.google.bi/*", "https://www.google.bi/*",
    "http://www.google.bj/*", "https://www.google.bj/*",
    "http://www.google.com.bn/*", "https://www.google.com.bn/*",
    "http://www.google.com.bo/*", "https://www.google.com.bo/*",
    "http://www.google.com.br/*", "https://www.google.com.br/*",
    "http://www.google.bs/*", "https://www.google.bs/*",
    "http://www.google.co.bw/*", "https://www.google.co.bw/*",
    "http://www.google.by/*", "https://www.google.by/*",
    "http://www.google.com.bz/*", "https://www.google.com.bz/*",
    "http://www.google.ca/*", "https://www.google.ca/*",
    "http://www.google.cd/*", "https://www.google.cd/*",
    "http://www.google.cf/*", "https://www.google.cf/*",
    "http://www.google.cg/*", "https://www.google.cg/*",
    "http://www.google.ch/*", "https://www.google.ch/*",
    "http://www.google.ci/*", "https://www.google.ci/*",
    "http://www.google.co.ck/*", "https://www.google.co.ck/*",
    "http://www.google.cl/*", "https://www.google.cl/*",
    "http://www.google.cm/*", "https://www.google.cm/*",
    "http://www.google.cn/*", "https://www.google.cn/*",
    "http://www.google.com.co/*", "https://www.google.com.co/*",
    "http://www.google.co.cr/*", "https://www.google.co.cr/*",
    "http://www.google.com.cu/*", "https://www.google.com.cu/*",
    "http://www.google.cv/*", "https://www.google.cv/*",
    "http://www.google.com.cy/*", "https://www.google.com.cy/*",
    "http://www.google.cz/*", "https://www.google.cz/*",
    "http://www.google.de/*", "https://www.google.de/*",
    "http://www.google.dj/*", "https://www.google.dj/*",
    "http://www.google.dk/*", "https://www.google.dk/*",
    "http://www.google.dm/*", "https://www.google.dm/*",
    "http://www.google.com.do/*", "https://www.google.com.do/*",
    "http://www.google.dz/*", "https://www.google.dz/*",
    "http://www.google.com.ec/*", "https://www.google.com.ec/*",
    "http://www.google.ee/*", "https://www.google.ee/*",
    "http://www.google.com.eg/*", "https://www.google.com.eg/*",
    "http://www.google.es/*", "https://www.google.es/*",
    "http://www.google.com.et/*", "https://www.google.com.et/*",
    "http://www.google.fi/*", "https://www.google.fi/*",
    "http://www.google.com.fj/*", "https://www.google.com.fj/*",
    "http://www.google.fm/*", "https://www.google.fm/*",
    "http://www.google.fr/*", "https://www.google.fr/*",
    "http://www.google.ga/*", "https://www.google.ga/*",
    "http://www.google.ge/*", "https://www.google.ge/*",
    "http://www.google.gg/*", "https://www.google.gg/*",
    "http://www.google.com.gh/*", "https://www.google.com.gh/*",
    "http://www.google.com.gi/*", "https://www.google.com.gi/*",
    "http://www.google.gl/*", "https://www.google.gl/*",
    "http://www.google.gm/*", "https://www.google.gm/*",
    "http://www.google.gp/*", "https://www.google.gp/*",
    "http://www.google.gr/*", "https://www.google.gr/*",
    "http://www.google.com.gt/*", "https://www.google.com.gt/*",
    "http://www.google.gy/*", "https://www.google.gy/*",
    "http://www.google.com.hk/*", "https://www.google.com.hk/*",
    "http://www.google.hn/*", "https://www.google.hn/*",
    "http://www.google.hr/*", "https://www.google.hr/*",
    "http://www.google.ht/*", "https://www.google.ht/*",
    "http://www.google.hu/*", "https://www.google.hu/*",
    "http://www.google.co.id/*", "https://www.google.co.id/*",
    "http://www.google.ie/*", "https://www.google.ie/*",
    "http://www.google.co.il/*", "https://www.google.co.il/*",
    "http://www.google.im/*", "https://www.google.im/*",
    "http://www.google.co.in/*", "https://www.google.co.in/*",
    "http://www.google.iq/*", "https://www.google.iq/*",
    "http://www.google.is/*", "https://www.google.is/*",
    "http://www.google.it/*", "https://www.google.it/*",
    "http://www.google.je/*", "https://www.google.je/*",
    "http://www.google.com.jm/*", "https://www.google.com.jm/*",
    "http://www.google.jo/*", "https://www.google.jo/*",
    "http://www.google.co.jp/*", "https://www.google.co.jp/*",
    "http://www.google.co.ke/*", "https://www.google.co.ke/*",
    "http://www.google.com.kh/*", "https://www.google.com.kh/*",
    "http://www.google.ki/*", "https://www.google.ki/*",
    "http://www.google.kg/*", "https://www.google.kg/*",
    "http://www.google.co.kr/*", "https://www.google.co.kr/*",
    "http://www.google.com.kw/*", "https://www.google.com.kw/*",
    "http://www.google.kz/*", "https://www.google.kz/*",
    "http://www.google.la/*", "https://www.google.la/*",
    "http://www.google.com.lb/*", "https://www.google.com.lb/*",
    "http://www.google.li/*", "https://www.google.li/*",
    "http://www.google.lk/*", "https://www.google.lk/*",
    "http://www.google.co.ls/*", "https://www.google.co.ls/*",
    "http://www.google.lt/*", "https://www.google.lt/*",
    "http://www.google.lu/*", "https://www.google.lu/*",
    "http://www.google.lv/*", "https://www.google.lv/*",
    "http://www.google.com.ly/*", "https://www.google.com.ly/*",
    "http://www.google.co.ma/*", "https://www.google.co.ma/*",
    "http://www.google.md/*", "https://www.google.md/*",
    "http://www.google.me/*", "https://www.google.me/*",
    "http://www.google.mg/*", "https://www.google.mg/*",
    "http://www.google.mk/*", "https://www.google.mk/*",
    "http://www.google.ml/*", "https://www.google.ml/*",
    "http://www.google.mn/*", "https://www.google.mn/*",
    "http://www.google.ms/*", "https://www.google.ms/*",
    "http://www.google.com.mt/*", "https://www.google.com.mt/*",
    "http://www.google.mu/*", "https://www.google.mu/*",
    "http://www.google.mv/*", "https://www.google.mv/*",
    "http://www.google.mw/*", "https://www.google.mw/*",
    "http://www.google.com.mx/*", "https://www.google.com.mx/*",
    "http://www.google.com.my/*", "https://www.google.com.my/*",
    "http://www.google.co.mz/*", "https://www.google.co.mz/*",
    "http://www.google.com.na/*", "https://www.google.com.na/*",
    "http://www.google.com.nf/*", "https://www.google.com.nf/*",
    "http://www.google.com.ng/*", "https://www.google.com.ng/*",
    "http://www.google.com.ni/*", "https://www.google.com.ni/*",
    "http://www.google.ne/*", "https://www.google.ne/*",
    "http://www.google.nl/*", "https://www.google.nl/*",
    "http://www.google.no/*", "https://www.google.no/*",
    "http://www.google.com.np/*", "https://www.google.com.np/*",
    "http://www.google.nr/*", "https://www.google.nr/*",
    "http://www.google.nu/*", "https://www.google.nu/*",
    "http://www.google.co.nz/*", "https://www.google.co.nz/*",
    "http://www.google.com.om/*", "https://www.google.com.om/*",
    "http://www.google.com.pa/*", "https://www.google.com.pa/*",
    "http://www.google.com.pe/*", "https://www.google.com.pe/*",
    "http://www.google.com.ph/*", "https://www.google.com.ph/*",
    "http://www.google.com.pk/*", "https://www.google.com.pk/*",
    "http://www.google.pl/*", "https://www.google.pl/*",
    "http://www.google.pn/*", "https://www.google.pn/*",
    "http://www.google.com.pr/*", "https://www.google.com.pr/*",
    "http://www.google.ps/*", "https://www.google.ps/*",
    "http://www.google.pt/*", "https://www.google.pt/*",
    "http://www.google.com.py/*", "https://www.google.com.py/*",
    "http://www.google.com.qa/*", "https://www.google.com.qa/*",
    "http://www.google.ro/*", "https://www.google.ro/*",
    "http://www.google.ru/*", "https://www.google.ru/*",
    "http://www.google.rw/*", "https://www.google.rw/*",
    "http://www.google.com.sa/*", "https://www.google.com.sa/*",
    "http://www.google.com.sb/*", "https://www.google.com.sb/*",
    "http://www.google.sc/*", "https://www.google.sc/*",
    "http://www.google.se/*", "https://www.google.se/*",
    "http://www.google.com.sg/*", "https://www.google.com.sg/*",
    "http://www.google.sh/*", "https://www.google.sh/*",
    "http://www.google.si/*", "https://www.google.si/*",
    "http://www.google.sk/*", "https://www.google.sk/*",
    "http://www.google.com.sl/*", "https://www.google.com.sl/*",
    "http://www.google.sn/*", "https://www.google.sn/*",
    "http://www.google.so/*", "https://www.google.so/*",
    "http://www.google.sm/*", "https://www.google.sm/*",
    "http://www.google.st/*", "https://www.google.st/*",
    "http://www.google.com.sv/*", "https://www.google.com.sv/*",
    "http://www.google.td/*", "https://www.google.td/*",
    "http://www.google.tg/*", "https://www.google.tg/*",
    "http://www.google.co.th/*", "https://www.google.co.th/*",
    "http://www.google.com.tj/*", "https://www.google.com.tj/*",
    "http://www.google.tk/*", "https://www.google.tk/*",
    "http://www.google.tl/*", "https://www.google.tl/*",
    "http://www.google.tm/*", "https://www.google.tm/*",
    "http://www.google.tn/*", "https://www.google.tn/*",
    "http://www.google.to/*", "https://www.google.to/*",
    "http://www.google.com.tr/*", "https://www.google.com.tr/*",
    "http://www.google.tt/*", "https://www.google.tt/*",
    "http://www.google.com.tw/*", "https://www.google.com.tw/*",
    "http://www.google.co.tz/*", "https://www.google.co.tz/*",
    "http://www.google.com.ua/*", "https://www.google.com.ua/*",
    "http://www.google.co.ug/*", "https://www.google.co.ug/*",
    "http://www.google.co.uk/*", "https://www.google.co.uk/*",
    "http://www.google.com.uy/*", "https://www.google.com.uy/*",
    "http://www.google.co.uz/*", "https://www.google.co.uz/*",
    "http://www.google.com.vc/*", "https://www.google.com.vc/*",
    "http://www.google.co.ve/*", "https://www.google.co.ve/*",
    "http://www.google.vg/*", "https://www.google.vg/*",
    "http://www.google.co.vi/*", "https://www.google.co.vi/*",
    "http://www.google.com.vn/*", "https://www.google.com.vn/*",
    "http://www.google.vu/*", "https://www.google.vu/*",
    "http://www.google.ws/*", "https://www.google.ws/*",
    "http://www.google.rs/*", "https://www.google.rs/*",
    "http://www.google.co.za/*", "https://www.google.co.za/*",
    "http://www.google.co.zm/*", "https://www.google.co.zm/*",
    "http://www.google.co.zw/*", "https://www.google.co.zw/*",
    "http://www.google.cat/*", "https://www.google.cat/*"
]

可以使用*:// 代替http://https://。请注意,存在更多搜索门户:

关于javascript - 支持内容脚本中的所有谷歌域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11069644/

有关javascript - 支持内容脚本中的所有谷歌域的更多相关文章

  1. ruby - 如何从 ruby​​ 中的字符串运行任意对象方法? - 2

    总的来说,我对ruby​​还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用

  2. ruby - 其他文件中的 Rake 任务 - 2

    我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时

  3. ruby-on-rails - Ruby net/ldap 模块中的内存泄漏 - 2

    作为我的Rails应用程序的一部分,我编写了一个小导入程序,它从我们的LDAP系统中吸取数据并将其塞入一个用户表中。不幸的是,与LDAP相关的代码在遍历我们的32K用户时泄漏了大量内存,我一直无法弄清楚如何解决这个问题。这个问题似乎在某种程度上与LDAP库有关,因为当我删除对LDAP内容的调用时,内存使用情况会很好地稳定下来。此外,不断增加的对象是Net::BER::BerIdentifiedString和Net::BER::BerIdentifiedArray,它们都是LDAP库的一部分。当我运行导入时,内存使用量最终达到超过1GB的峰值。如果问题存在,我需要找到一些方法来更正我的代

  4. ruby-on-rails - Rails 3 中的多个路由文件 - 2

    Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题

  5. ruby - 如何将脚本文件的末尾读取为数据文件(Perl 或任何其他语言) - 2

    我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚

  6. ruby - 如何以所有可能的方式将字符串拆分为长度最多为 3 的连续子字符串? - 2

    我试图获取一个长度在1到10之间的字符串,并输出将字符串分解为大小为1、2或3的连续子字符串的所有可能方式。例如:输入:123456将整数分割成单个字符,然后继续查找组合。该代码将返回以下所有数组。[1,2,3,4,5,6][12,3,4,5,6][1,23,4,5,6][1,2,34,5,6][1,2,3,45,6][1,2,3,4,56][12,34,5,6][12,3,45,6][12,3,4,56][1,23,45,6][1,2,34,56][1,23,4,56][12,34,56][123,4,5,6][1,234,5,6][1,2,345,6][1,2,3,456][123

  7. ruby - 将数组的内容转换为 int - 2

    我需要读入一个包含数字列表的文件。此代码读取文件并将其放入二维数组中。现在我需要获取数组中所有数字的平均值,但我需要将数组的内容更改为int。有什么想法可以将to_i方法放在哪里吗?ClassTerraindefinitializefile_name@input=IO.readlines(file_name)#readinfile@size=@input[0].to_i@land=[@size]x=1whilex 最佳答案 只需将数组映射为整数:@land边注如果你想得到一条线的平均值,你可以这样做:values=@input[x]

  8. ruby-on-rails - Rails - 一个 View 中的多个模型 - 2

    我需要从一个View访问多个模型。以前,我的links_controller仅用于提供以不同方式排序的链接资源。现在我想包括一个部分(我假设)显示按分数排序的顶级用户(@users=User.all.sort_by(&:score))我知道我可以将此代码插入每个链接操作并从View访问它,但这似乎不是“ruby方式”,我将需要在不久的将来访问更多模型。这可能会变得很脏,是否有针对这种情况的任何技术?注意事项:我认为我的应用程序正朝着单一格式和动态页面内容的方向发展,本质上是一个典型的网络应用程序。我知道before_filter但考虑到我希望应用程序进入的方向,这似乎很麻烦。最终从任何

  9. ruby-on-rails - Rails 3.2.1 中 ActionMailer 中的未定义方法 'default_content_type=' - 2

    我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer

  10. ruby-on-rails - Rails 应用程序中的 Rails : How are you using application_controller. rb 是新手吗? - 2

    刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr

随机推荐