Very nice. I likey.
very nice just one more thing: when following links the font size is reset
could somebody put this script in a place where we can easily run it? maybe even a sticky forum thread?
Thanks; I'm glad everyone likes it.
The viewer now maintains a small cookie to store your preferences so your desired font size should now appear on every page. Except in IE… for some reason the window.onunload event doesn't seem to ever fire and so the preferences are never saved. I have no idea why. If anyone has any ideas, I'd love to hear 'em. Oh, how I passionately loathe Javascript.
Why not set the cookie with PHP instead of doing any client-side scripting to create it?
Well, because the the line number toggling and font size switching is all done client side. This means the script has no knowledge of the final user preferences thus it's the client that must preserve the session state. It's a good idea though!
I've come up with one workaround, though. If I trigger the "save prefs" event every time a preference is changed rather than only on unload I should be able to avoid the strange behaviour I'm seeing with IE. And, just to be certain, is everyone else having the preferences act strangely in IE?
all done client-side? You mean the line numbers exist no matter what and you just hide it when they don't want to see it?
Yep, that's the idea. Actually, the original version of my script used an HTTP request parameter (e.g., showsrc.php?showlines=true) to toggle the line display but I dumped it in favour of a client-side model. Handling the number visibility client side works better now that I'm hitting dev.java.net or a zip archive for the source code because 1. it's exactly ten hojillion times faster and 2. it reduces the load on the server.
It's annoying you still get the line numbers when you copy/paste though (even if they are hidden).
Agreed. I hacked in a quick fix (read: it works for me, but I haven't really tested it much) that hides the lines by setting "display: none" which should remove them completely. Now you should be able to copy-paste code without those pesky line numbers.
are you sure you updated the online script because the lines are still there when pasting (in both IE and firefox)
Works here, in Opera.
well i know it is too much to ask, but it would be nice to be able to browse trough the jme packages (i don't know by heart where the classes are located, so i can't just type in the full class name)
mSo I’ve been thinking for the past couple of days about how to manage this. Am I correct in assuming the functionality you want is to be able to enter something like “src/?BaseGae” and have the script discover you want “src/com.jme.app.BaseGame”? There are two ways I can envision this working. First, the script searches the CVS repository for BaseGame, parses the response to discover the pacakge, then proceeds as normal. I like this method… but for the life of me I can’t find a search function. Second, I could search this Javadoc index which also has the package information, but with the massive caveat that it isn’t in sync with CVS.
I’m not quite satisfied with any of my suggestions, so I’d like to hear what other people think. Show me exceedingly simple solution I’ve likely ignored.
no, i mean something like entering "src/?com.jme.app" and getting the list of packages in com.jme.app and the list of java files then being able to select one (it would open in in the viewer if it would be a java file). i mean just basic directory listing.
EDIT: oh, and make the parameter case insensitive (i.e. com.jme.app.BaseGame.java works while com.jme.app.basegame.java doesn't)
Right, right. I incorrectly assumed you wanted the package listings because you were looking for a specific class.
Creating this kind of directory wouldn't be difficult given good input, but again I'm kind of stuck as to where I can gather the data. The Javadoc pages have what I need but are out of sync with CVS; this could cause trouble when the viewer script attempts to grab a class from the repository. I haven't been able to coax dev.java.net to produce the listings I want. Does anyone have any ideas or suggestions?
As for making the parameter case insensitive, I'm not sure if that's possible (in any half-way efficient or not-totally-insane way).You'd need some way to convert the case to be proper in order to retrieve the file from dev.java.net. Again, suggestions?
Heh, as you can see I'm not much of a web developer. I'm happy to add the features, I just need a nudge in the right direction.
then forget the case insensitive stuff. it was more like a side note
…and sorry i'm not much of a web developer myself