I have tested and used these functions extensively in IE, Firefox and Opera. These patched functions work as I described above in IE and Firefox and in other browsers they revert to the current behaviour.
If I submitted these patches along with a link to a HTML version of the exact posting page from this site so that anyone who wished could verify that they work would it at all be possible to incorporate them into the site?
Because the non wrap (especially for the code tags) really throws me mainly because it is fairly standard to have the tags wrap.
Thanks for letting me know. I will post the code here most likely later today once I test my retrofitted code fully.
Just to mention I have tested on IE and Firefox on Windows and it works fine on both. It should support IE and Gecko browsers mainly... however it will not break on other browsers... just revert to the behaviour as it is now.
I also incorporated all the prompts and such exactly as they were before.
All that is needed to make it work is to add the two functions below and then replace the current DoPrompt function with the new one that calls the new functions. So none of the rest of the form code on the page needs to be touched in any way to incorporate the script.
Okay the code was here but whoops that won't work.. since it contains a bunch of UBB tags it gets eaten by the post.
[ December 20, 2005: Message edited by: Maximilian Stocker ]
Originally posted by Pauline McNamara:
Great stuff Max, thank you!
Another little caveat for Mac fans... On OS 10.3.9 using Firefox 1.0.6, the code tags work great with selected text, but the graemlins still get tacked on to the end, not at the cursor insertion point.
Just to note that is not a Mac or Firefox thing. But I did not actually make the emotes/gremlins code. Partially I was concerned that it's behaviour would throw people off... actually I don't know why I did that.
Anyway point being is that only the taggy things work.
Don't worry about buildTag it is a generic function that constructs the text to be inserted. The function that is dependent is doPrompt.
Now it doesn't actually do browser detection per se. Instead there is an if/else if/else statement that attempts to select the range of text selected in the textarea. The critical lines are
which evaluates to true if the browser is IE
which evaluates to true on gecko (Firefox) browsers
then everything else falls through to the else case. So the detection is more one of "Browser do you understand what X means?" And if it doesn't then we can't use it.
So if there is something that Safari understands then certainly it can be added as another else if case. But I don't know what that would be. I do have access to a OSX system with Safari on it so if someone could provide the basics I can put it into the existing code and test it.
Hopefully this helps.