The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

Problem with injected.js and google reader.

Forums » Dev.Opera » Opera Extensions Development Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

9. November 2011, 01:04:12

pablo2m

Posts: 2

Problem with injected.js and google reader.

After the modification of google reader, I used a user.js to improve their appearance (http://userscripts.org/scripts/show/117006) and the truth is much improved.
I thought I'd make an extension with him. To do this:
Contact the author and got his permission
I followed this guide http://dev.opera.com/articles/view/converting-userjs-to-extensions/
And do not works!
Does anyone have any idea that can happen?, Repeat the steps in the guide twice to discard errors tipi is installed but not working

9. November 2011, 08:58:19

d4n3

Posts: 957

Looking at the source code, i think the userscript assumes it will run when the document is loaded (it starts doing DOM manipulation immediately).

This is true for userscripts in greasemonkey mode (extension .user.js), but is not true for injected scripts - they run before the document starts loading.

You can try putting the code inside the "DOMContentLoaded" (which fires as soon as the document is loaded):

// .. userscript headers

document.addEventListener("DOMContentLoaded", function() {

// your code

}, false);


You could also try using the "load" event which fires when the document and all its resources are loaded.

Forums » Dev.Opera » Opera Extensions Development Discussions