[Conkeror] Access to page elements from user defined functions - ERROR

Demyan Rogozhin demyan.rogozhin at gmail.com
Tue Apr 8 22:21:51 PDT 2008


Hi,
I'm trying to modify current page from interactive function and got error.

I write in my RC-file:

interactive("my_function", function(I){
	var doc =  I.buffer.document;
	var mycss=doc.createElement('link');
	mycss.id ='mycss';
	mycss.rel='stylesheet';
mycss.href='data:text/css,'+escape("*{background-color:white;color:black;}");
	doc.getElementsByTagName("head")[0].appendChild(mycss);
}

When I make M-x: my_function I got:
TypeError: doc is undefined
file:///home/me/conkerorrc.js:66
([object Object])@file:///home/me/conkerorrc.js:66
call_interactively([object
Object],"my_function")@chrome://conkeror-modules/content/interactive.js:96
meta_x([object ChromeWindow],(void
0),"my_function")@chrome://conkeror-modules/content/commands.js:111

And pointed to "var mycss=doc.createElement('link'); " - string#66 of
my RC file.

I read http://conkeror.jeremyms.com/WritingCommands and I expect that
I.buffer.document point me to current page's DOM object.

Any ideas for this?


More information about the Conkeror mailing list