What do you mean by
It didn’t work well?
Did it even work? While onCommand() is being called, I do not see any problems with the code.
Regarding CSS
You may be the one who filed the contentStyleFile error (beat me up on it), but for reference it was put here and they seem to be working on a fix.
I am using javascript / jQuery at the same time.
Main.js
var worker = tabs.activeTab.attach({ contentScriptFile: [data.url('jquery.js'), data.url('annotate.js')] contentScriptOptions: data.url('annotate.css') });
annotate.js
$('head').append("<link href='"+self.options+"' type='text/css' rel='stylesheet' />");
It can also be done in plain javascript, but I also use jQuery elsewhere.
source share