[Greasemonkey] Rich Text Editor

Matt Labrum darktempler at gmail.com
Sun Aug 21 02:53:32 EDT 2005

> ---------- Forwarded message ----------
> From: "WHITEMARE2" <whitemare2 at delphiforums.com>
> To: greasemonkey at mozdev.org
> Date: Sat, 20 Aug 2005 12:13:38 +0000
> Subject: Re: [Greasemonkey] Rich Text Editor
> Your editor looks very nice. Here is a screenshot of mine:
> http://people.delphiforums.com/whitemare2/editor/editor1.jpg
> "why dont you use addEventListener and listen for clicks on each of your
> buttons insted of binding the functions to the window?"
> I still have a lot to learn about Javascript and the DOM. I started my 
> script by using someone else's, and they were binding the buttons to 
> windows. I will see if I can convert those to eventListener's instead.

:D try to because its alot better if you dont depend on the click attribute.

"also i notice you wait untill the load of the window before activating
> design mode , you can just wait till the iframe itself has loaded iframe."
> This is where I was unsure how events were handled. DelphiForums has two 
> pages that the editor can be used on, and they have different HTML 
> structures. Depending on who is using the editor, they may or may not be 
> able to post HTML. So I need to detect whether there is a certain checkbox 
> or button on the page before I display the editor, so that I don't display 
> it if they can't post HTML. That is why I waited for the onload of the 
> window. Is it possible to do that checking before the onload event?
> thanks!
> White

if it has two pages could you use something like below to match the url?

var url = window.location.href;
//run the rich text editor
else if(url.match('other.php')){
//run normal


greasemonkey loads your script when the dom is availible so most likley you 
can do those checks beforehand.

also using my editor people cant post html , most forums have it disabled so 
i use xPaths to replace html into bbcode. maby you could do something like 
that on those pages?

my wysiwyg editor code is here.. 
http://blog.thedt.net/wp-content/upload/msgplusforumwysiwyg.user.js incase 
you want to use it as a refence but the code is kinda messy...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050821/80b4234e/attachment.htm

More information about the Greasemonkey mailing list