User javascript for fixing live preview on Opera. October 6, 2007 9:58 PM   Subscribe

I've been fooling around with user javascript for Opera and fixed a few problems with the live preview. The first problem is that it doesn't appear at all for me. The second problem is the sluggish live update performance when viewing longer threads. My solution is available here, but I wouldn't mind if it found another home, like the metafilter code? For instructions on how to install and enable user javascripts, go to Opera's documentation.

Technical details: changing a page by editing innerHTML directly seems to be a big performance problem for Opera because it forces a reflow of the entire page. The recommended method is to create an invisible copy of the DOM node, make the edits on the invisible node, then put it on the screen with replaceChild. cloneNode and replaceChild are portable to Firefox 2.0 and MSIE7 at least, but I can't vouch for MSIE6. It also uses a 200ms timer to limit page updates to about five per second, sacrificing preview speed for keeping the textarea input snappy. I've tested it out on this thread and this one with 250 message count.
posted by KirkJobSluder to Bugs at 9:58 PM (12 comments total)

live preview has always worked fine for me in opera...
posted by milestogo at 10:18 PM on October 6, 2007


Good on ya for taking the initiative. I've never had the problem with FF on this site, but some implementations of it have sucked on other sites, and I know how annoying it can be.
posted by stavrosthewonderchicken at 11:55 PM on October 6, 2007


I always have to turn live preview off entirely if I'm using Firefox on a really old machine, because it makes the text area so laggy. Do you think your Opera fix would also work as a Greasemonkey script for Firefox?
posted by flabdablet at 3:42 AM on October 7, 2007


It might. I'll have to try it with greasemonkey later today.
posted by KirkJobSluder at 7:23 AM on October 7, 2007


Ok, I did a greasemonkey conversion but I couldn't notice a difference because the default live preview works so well on the computer I'm using. You might see a difference on a slower computer.
posted by KirkJobSluder at 10:45 AM on October 7, 2007


Neat, but live preview works fine for me too on Opera 9.23 on Windows 2000. What version and platform are you running? This may be indicative of a specific Opera bug.
posted by spiderskull at 11:13 AM on October 7, 2007


Fails on both OSX and WinXP for me. Don't know why.
posted by KirkJobSluder at 12:45 PM on October 7, 2007


ahh, found the problem in another script.
posted by KirkJobSluder at 12:59 PM on October 7, 2007


I don't think I'd get carried away with Opera problems quite yet; there will soon enough be another release which addresses a whole lot of Javascript issues. I guess they've re-written that part of the core from scratch and have improved its performance by a huge factor.

Live preview is okay for me, although I really despise it sometimes. I find it far too easy to hit "post comment" instead of previewing and actually re-reading what I've written...

More a fault with me than with the Preview, actually...
posted by five fresh fish at 6:38 PM on October 7, 2007


Actually, it doesn't work after I hit Preview -- is this intentional? It works fine when I first enter the comment, but there's no live preview after that.

fff -- God damn do I love the Opera dev team. They are my heroes as far as software engineers go -- on the really rare occasional that Opera crashes, it has been due to either Flash or Java.

It's hard to pull of rewrites of core modules of your code.
posted by spiderskull at 12:31 AM on October 8, 2007


There's no live preview after hitting Preview. Never has been.

I'd really like to be able to selectively enable/disable some MeFi site features.

I've been over to Opera's HQ and toured their facility, visited their engineers. They are, each and every one, great, friendly, smart people. If it weren't for being located in Oslo, where they have a long dark season of depression, I'd work for them in a heartbeat.
posted by five fresh fish at 11:40 AM on October 8, 2007


Latest Opera Public Beta.

I've no idea how stable it is; I did beta testing for Opera for eons and eventually got tired of living on the crash-prone edge. I wait for official releases now.
posted by five fresh fish at 11:44 AM on October 8, 2007


« Older hama7 posting style   |   OMGWTFSETLA Newer »

You are not logged in, either login or create an account to post comments