[英]Chrome extension not injecting css
我已經閱讀了很多關於堆棧溢出的類似問題,但還沒有發現任何人有與我類似的問題。 我不確定我做錯了什么。 (如果我做錯了什么)我希望你能幫忙。
我想要做的是使用 chrome 擴展將 css 注入網站 minds.com。 問題是它沒有注入。 我不認為它只是那個網站,因為我已經嘗試過另一個。
清單文件:
{
"manifest_version": 2,
"name": "My Style",
"description": "None",
"version": "0.3",
"content_scripts": [{
"matches": ["http://www.minds.com/*"],
"css": ["my-style.css"],
"run_at": "document_start"
}]
}
css
html{
color: #cacaca;
}
.mdl-card{
background: rgba(0,0,0,0.64) !important;
color: #fff !important;
}
/*header*/
.mdl-color--white{
background: linear-gradient(#000, #333) !important;
}
.mdl-color--blue-grey-800 {
background-color: #121212 !important;
}
/*text*/
.mdl-color-text--blue-grey-500 {
color: #cacaca !important;
}
minds-activity.mdl-card .mdl-card__supporting-text, minds-activity .mdl-card__supporting-text {
color: #aaa !important;
}
.minds-avatar {
background: rgba(0,0,0,0.0) !important;
}
.mdl-card .m-owner-block {
background: rgba(0,0,0,0.6) !important;
}
.m-owner-block a{
color: #cacaca !important;
}
.minds-dropdown-menu{
background: rgba(0,0,0,0.5) !important; /*
box-shadow: 0px 9px 0px !important;*/
}
.mdl-menu__item{
color: #fff !important;
box-shadow: 0px 0px 9px !important;
}
.mdl-color--blue-grey-50 {
background: rgba(0,0,0,0.6) !important;
}
.mdl-color-text--blue-grey-900 {
color: #78ad56 !important;
}
/*BG*/
.mdl-color--grey-100 {
background: url("http://powerpictures.crystalgraphics.com/photo/seamless_black_circuit_board_pattern_cg5p0977241c_th2.jpg") !important;
}
/*Blogs*/
.m-title-block, .m-title-block-fixed {
background: rgba(0,0,0,0.9) !important;
}
/*usercard*/
.m-discovery-suggested .mdl-cell minds-card-user .m-usercard-bio {
color: #aaa !important;
}
/*active tab*/
.mdl-color--blue-grey-600 {
background-color: #333 !important;
}
.mdl-card__title{
color: #fff !important;
}
.mdl-button{
color: #acacac !important;
}
minds-gatherings .minds-gatherings-search{
background: rgba(0,0,0,0.6) !important;
color: #aaa !important;
}
h1{
color: #fff !important;
}
.mdl-tabs__tab{
color: #fff !important;
text-shadow: 0px 0px 9px #000 !important;
}
.mdl-menu__outline {
background: rgba(0,0,0,0.7) !important;
}
.mdl-menu__item:hover{
background: rgba(20,20,20,0.6) !important;
color: #fff !important;
}
.mdl-card__supporting-text textarea{
color: #aaa !important;
}
body a{
color: #21CE54 !important;
}
minds-blog-view{
background: url("http://powerpictures.crystalgraphics.com/photo/seamless_black_circuit_board_pattern_cg5p0977241c_th2.jpg") !important;
}
minds-comments form textarea{
color: #aaa !important;
}
.mdl-grid {
background: rgba(0,0,0,0.6);
}
.minds-blog-body p{
color: #fff !important;
}
.m-h1-input {
color: #cacaca !important;
}
您應該將“ http://www.minds.com/* ”替換為“ https://www.minds.com/* ”
其他可以絆倒你的東西(我在這個上面花了幾個小時):
在清單中content_scripts
下matches
的 json 中,協議是否正確很重要,即http
或https
。 如果您使用https
訪問站點,並且清單顯示http
,則擴展程序將不會注入腳本/css(反之亦然)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.