【问题标题】:Google Chrome Theme with popup after installation安装后弹出的谷歌浏览器主题
【发布时间】:2013-03-09 17:47:26
【问题描述】:

我正在尝试为 google chrome 创建一个主题,但我希望在安装它时出现一个弹出窗口。我不确定这是否可能,因为主题与扩展不同。

所以我想通过这个清单文件,我可以通过扩展来做到这一点:

{
   "background": {
      "persistent": false,
      "scripts": [ "script.js" ]
   },
   "description": "Een test",
   "manifest_version": 2,
   "name": "Test Extension",
   "version": "0.0.2"
}

在 script.js 中我得到了这个代码:

chrome.runtime.onInstalled.addListener(function(){
  window.open('http://www.example.com','','width=800,height=500');
});

这一切都很好。现在困难的部分是将其用于主题。问题是当我将主题对象添加到清单文件中时,事情似乎无法正常工作:脚本将不再执行。所以此时我的清单文件如下所示:

{
   "background": {
      "persistent": false,
      "scripts": [ "script.js" ]
   },
   "description": "Een test",
   "manifest_version": 2,
   "name": "Test Extension",
   "theme": {
      "colors": {
         "bookmark_text": [ 255, 255, 255 ],
         "frame": [ 12, 20, 30 ],
         "ntp_background": [ 11, 21, 35 ],
         "ntp_header": [ 40, 40, 40 ],
         "ntp_link": [ 0, 0, 0 ],
         "ntp_section": [ 255, 255, 255, 0.5 ],
         "ntp_section_link": [ 0, 0, 0 ],
         "ntp_section_text": [ 0, 0, 0 ],
         "ntp_text": [ 255, 255, 255 ],
         "tab_background_text": [ 10, 10, 10 ],
         "tab_text": [ 255, 255, 255 ],
         "toolbar": [ 6, 13, 21 ]
      },
      "images": {
         "theme_frame": "img/frame.jpg",
         "theme_frame_overlay": "img/frame_overlay.png",
         "theme_ntp_attribution": "img/ntp_attribution.png",
         "theme_ntp_background": "img/ntp_background.jpg",
         "theme_tab_background": "img/tab_background.jpg",
         "theme_tab_background_incognito": "img/tab_background.jpg",
         "theme_toolbar": "img/toolbar.jpg"
      },
      "properties": {
         "ntp_background_alignment": "bottom right",
         "ntp_background_repeat": "no-repeat"
      },
      "tints": {
         "buttons": [ 1, 1, 1 ]
      }
   },
   "version": "0.0.2"
}

我猜它不再起作用了,因为该文件现在将被归类为主题。不过,我想我可以在这里发布这个问题。希望大家给点建议。

【问题讨论】:

    标签: javascript google-chrome-extension popup themes google-chrome-theme


    【解决方案1】:

    使用这个 (http://www.themebeta.com/chrome-theme-creator-online.html) 创建您的主题,它也会弹出一个窗口。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-03
      • 2015-08-01
      • 2016-10-25
      • 2014-09-22
      • 1970-01-01
      • 2012-01-21
      • 1970-01-01
      相关资源
      最近更新 更多