Forums » Help » User Script from Bookmarklet (Opera)


  • User Script from Bookmarklet (Opera)
  • New posts in this topic

#1 2006-07-21 13:19:03

ILoveJackDaniels
New member
Registered: 2006-02-06
Posts: 9

User Script from Bookmarklet (Opera)

I’m currently experiencing two problems with CoComment (when it works though, the new version rocks). I’m using Opera 9 (and yes, I know you don’t support it fully yet).

The first is that the extension of course won’t work with Opera. I’ve taken the code from the bookmarklet and popped it into a userscript. On pages that support cocomment it’s fine – it just displays the cocomment bar under the textarea, as it should. On every other page, though, it brings up a popup – not ideal. Can you add a flag to the bookmarklet to allow users of the bookmarklet to disable the initial popup?

Something like http://www.cocomment.com/js/handler.js?popup=false etc.

The other problem is that the popup itself simply says “undefined† on any page which doesn’t support cocomment. This won’t be a problem if I can disable the popup for pages that don’t support cocomment.

Offline

 

#2 2006-07-27 15:51:04

Mocha
Senior Member
Registered: 2006-04-22
Posts: 234

Re: User Script from Bookmarklet (Opera)

The handler.js file is not intended for this purpose. I added a special file that should make coComment work with any browser that supports user scripts. Try and see what happens when you point the user script to http://www.cocomment.com/js/injector.js instead.

I might still need to make some changes to it, but with this file we should be able to get any userscript environment including Opera and greasemonkey, but also using Reify Turnabout for Internet Explorer to behave like the Firefox extension in auto-matic mode.

Let me know how that goes.

Offline

 

#3 2006-07-27 16:21:19

ILoveJackDaniels
New member
Registered: 2006-02-06
Posts: 9

Re: User Script from Bookmarklet (Opera)

Hi Mocha.

Thanks for getting back to me. I wasn't exactly sure how you'd set your script up, so I tried it as a userscript in its own right first, and then tried calling it through a user script as I would the handler script.

Neither of these had any effect. It didn't tie anything to coComment. No errors were reported in my JavaScript console. Nothing happened at all ...

Dave

Offline

 

#4 2006-07-27 16:54:17

Mocha
Senior Member
Registered: 2006-04-22
Posts: 234

Re: User Script from Bookmarklet (Opera)

It's the second approach you mentioned. The user script basically needs to insert a script tag into the document, that points to the injector.js file. I didn't look at the code right now, but you might have to add an "id" attribute to that script element, basically equivalent to this:

<script id="cocomment-fetchlet" src="http://www.cocomment.com/js/injector.js"></script>

Sorry, I really didn't test this myself yet, but maybe it's just the missing attribute that makes the difference.

Offline

 

#5 2006-07-27 17:01:14

ILoveJackDaniels
New member
Registered: 2006-02-06
Posts: 9

Re: User Script from Bookmarklet (Opera)

Nice. It works.

Here's the user script I'm using in case anyone else would find it useful. Does the job on Opera 9, and untested elsewhere smile

// ==UserScript==
// @name          coComment
// @description      coComment
// ==/UserScript==

(function() {

    function cocomment() {

        var element=document.createElement('script');
        element.setAttribute('id','cocomment-fetchlet');
        element.setAttribute('src','http://www.cocomment.com/js/injector.js');
        document.body.appendChild(element);

    }
   
    window.addEventListener("load", cocomment(), false);

})();

Offline

 

#6 2006-07-27 17:08:55

Mocha
Senior Member
Registered: 2006-04-22
Posts: 234

Re: User Script from Bookmarklet (Opera)

Great :-)

Offline

 

#7 2006-08-08 06:47:30

peteremcc
New member
Registered: 2006-02-10
Posts: 2

Re: User Script from Bookmarklet (Opera)

i haven't been able to get this to work. any ideas?
i'm also not quite sure what I would need to tell you for you to know whats going on so please feel free to ask if you need certain details.

thanks,
peter

Offline

 

#8 2006-09-24 23:29:23

RichardCooper
New member
Registered: 2006-09-10
Posts: 2
Website

Re: User Script from Bookmarklet (Opera)

Does not seam to Work on Opera 9.02 sad

Offline

 

#9 2006-09-25 17:56:11

peteremcc
New member
Registered: 2006-02-10
Posts: 2

Re: User Script from Bookmarklet (Opera)

i'm actually having trouble with both the userjs and the bookmarklet at the moment.

sometimes they work sometimes they don't, and its not just different websites, this is happening on the same websites.

Offline

 

#10 2006-11-22 00:44:31

RichardCooper
New member
Registered: 2006-09-10
Posts: 2
Website

Re: User Script from Bookmarklet (Opera)

sad  Not working

Offline

 
  • User Script from Bookmarklet (Opera)
  • New posts in this topic