okay, Well I wasn't really in a Turkish prison or some other valid reason for not bloging, I've just been too lazy.
But, I've got one now. It might actually be a show n tell thursday, I suspect that its Thursday in Asia?
When using domino, I often, long for the "control E" functionality in the notes client, I want to be able to open a document directly in edit mode.
The un-mucked with behaviour is to open a document in read mode, wait for it to fully load, then after its loaded, click the edit button. (or change the default behaviour to edit mode)
Not a big deal on an ultra small doc, but, when the doc is big or over a slow pipe, it becomes a bigger deal.
I often add little back door short cuts, that I don't publicize or tell people about, just for me, so that it speeds up my development and testing time.
In this case, I added a the ability to ALT-Click a link to open a document in edit mode instead of read mode.
Make these 2 changes to the $$View Template form
HTML Body Attributes
"onclick='bodyonclick(this)'"
JS Header Script
function bodyonclick(){
if( event.altKey && (event.srcElement.nodeName = "A") )
event.srcElement.href = event.srcElement.href.replace( "OpenDocument", "EditDocument")
}
oh, yeah it only works in IE
I started out with Control Click, but, I found that IE 7 uses control to open the link in a new tab and I like that functionality.
It does not work in Firefox, I suspect for more than one reason, I know firefox does not handle events the same, and alt click does a "save target as". When I've needed to do cross browser features, I usually go to create lengths to attach events, bla, bla, bla, but, I can't do that in 2 actual lines of code and Im sure my time is better spent waiting for the read only document to keep loading.
Im sure that per the arbitrary standards, the Firefox way is correct and the IE way is wrong, so, I chose to implement this wrong, so that it would work.
Can anybody come up with a solution that works in both browsers?
When I was playing with it, I though about other options,
Shift clicking opens in a new window, I thought about an on keydown that looks for a secret key that toggles a mode flag or something like that?
In that way of doing things I would press cntr-e then click the link normally and it would know to open in edit mode. Thats a little clunky. Oh, well.
BlogSphere
Join The WebLog Revolution at BlogSphere.net