2015-05-24 117 views
-2

這是我的manifest.json裏面:這個擴展不適合我嗎?

{ 
    "manifest_version": 2, 

    "name": "ROBLOX Forum Link Fixer", 
    "description": "Fixes the amp; issue on the ROBLOX forum.", 
    "version": "2.0", 

    "background": { 
    "scripts": [ 
     "jquery.js", 
     "fixer.js" 
    ] 
    }, 
    "permissions": [ 
    "http://*.roblox.com/*", 
    "https://*.roblox.com/*" 
    ] 
} 

,這是fixer.js內(jquery.js和jQuery的剛):

$(document).ready(function(){ 
    $('.rbx-link.user-link').each(function(){ 
     $(this).text($(this).text().replace(/amp;/g, "")); 
     $(this).attr("href",$(this).text()); 
    }); 
}); 

和錯誤是它只是不工作,我不知道爲什麼?!我希望有人能幫幫忙!謝謝。

+0

內容腳本,而不是後臺腳本。 – lifetimes

+0

@dsg只需將背景更改爲內容?我不擅長這個谷歌Chrome擴展的東西呢。這是我的第一個。 –

+0

請花些時間閱讀[體系結構概述](https://developer.chrome.com/extensions/overview#arch)。 – Xan

回答

0

我認爲你必須使用的內容腳本的權限一樣

"content_scripts": [ 
    { 
     "matches": ["http://www.google.co.in/*", 
     "https://www.google.co.in/*"], 
     "js": ["myscript.js"] 
    } 
    ] 
} 

,而不是背景詳見H ttps://developer.chrome.com/extensions/content_scripts

+0

ahhh非常感謝你! –