2016-01-22 42 views
-1

所以,我曾試圖讓痘痘的Chrome擴展程序只是爲了改變使用的manifest.json我曾試圖讓Chrome擴展,但我有麻煩

{ 
    "name": "Top Questions redder", 
    "description": "Make the world red", 
    "version": "1.0", 
    "content_scripts": [ 
    { 
    "matches": ["https://csgosquad.com/ranks"], 
    "css": ["sheet.css"], 
    } 
    ], 
    "manifest_version": 2 
} 

和板材csgosquad.com/ranks color of thoose orange bars to red

顏色的.css

`.row-rank .progress.bar-rank .progress-bar 
{ 
    background-color: #ff0b00; 
}` 

,但我仍然需要manualy更改like this

那麼該怎麼做才能讓它自動變化?

回答

0

3個點,

  1. content_scripts內刪除最後一個 「」
  2. 刪除 「`」 sheet.css內
  3. 添加 「!重要」,以確保你的CSS有更高的特異性

manifest.json的:

{ 
    "name": "Top Questions redder", 
    "description": "Make the world red", 
    "version": "1.0", 
    "content_scripts": [ 
     { 
      "matches": [ 
       "https://csgosquad.com/ranks" 
      ], 
      "css": [ 
       "sheet.css" 
      ] 
     } 
    ], 
    "manifest_version": 2 
} 

sheet.css

.row-rank .progress.bar-rank .progress-bar 
{ 
    background-color: #ff0b00 !important; 
} 
+0

非常感謝!!!! –

0

嗯...似乎代碼幾乎沒問題,但我發現了一個問題。

"content_scripts": [ 
    { 
    "matches": ["https://csgosquad.com/ranks"], 
    "css": ["sheet.css"], 
    } 
], 

逗號把上線「CSS」 的末尾:[ 「sheet.css」],。這個manifest.json文件可能是無效的。您應該確認您的擴展程序是否在chrome:// extensions頁面上成功註冊。