安装后弹出的Google Chrome主题

时间:2013-03-20 14:47:52

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

我正在尝试为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"
}

我想它不再起作用,因为该文件现在将被归类为主题。不过,我想我可以在这里发布此事。我希望你们有建议。

1 个答案:

答案 0 :(得分:0)

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