Думаю, это песочница, вам не разрешено выполнять скрипты со страницы, поэтому я думаю, что количество плагинов равно.
Это известно, это просто вопрос игры вне песочницы ....
script.js
var customEvent = document.createEvent('Event');
customEvent.initEvent('JPlayerNotify', true, true);
function notify() {
document.getElementById('communicationDIV').innerText='notify';
document.getElementById('communicationDIV').dispatchEvent(customEvent);
}
// Utitlity function to append some js into the page, so it runs in the context of the page
function appendScript(file) {
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.setAttribute("src", chrome.extension.getURL(file));
document.head.appendChild(script);
}
appendScript("JPlayer.js");
// had to wait for a bit for the page to be ready (dialup and all), you wont need to do the setTimeout
setTimeout("notify()",3500);
JPlayer.js
var notify_node = document.createElement('div');
notify_node.id = 'communicationDIV';
document.documentElement.appendChild(notify_node);
notify_node.addEventListener('JPlayerNotify', function() {
var eventData = notify_node.innerText;
if (eventData=='notify'){
$("#jplayer").jPlayer('play', 0);
}
});
manifest.json
{
"name": "JPlayerNotify",
"version": "0.5.0",
"description": "JPlayerNotify",
"content_scripts" : [
{
"matches": ["http://chat.stackoverflow.com/rooms/*"],
"js" : ["script.js"],
"run_at" : "document_idle",
"all_frames" : false
}
],
"permissions": [
"http://stackoverflow.com/*",
"https://stackoverflow.com/*",
"http://*.stackoverflow.com/*",
"https://*.stackoverflow.com/*"
]
}
Вы можете посмотреть кое-что по связи со страницей здесь ... http://code.google.com/chrome/extensions/content_scripts.html