[dokuwiki] Reimplementation of accesskeys in Javascript

  • From: Marek Sacha <sachamar@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 27 Apr 2010 01:10:03 +0200

This is a multi-part message in MIME format.
Hi all,
some time ago I asked for a topic for school project, I am sorry for a
bit of delay, however I was very busy during this semester on many other
projects.

Here is my result: implementation of accesskeys in javascript

Principles
======
My functionality did not changed dokuwiki accesskeys and former
accesskey functionality is preserved just as it was. At first script
"spiders" the page for all anchors and inputs (type="submit") , reads
their accesskeys and registers appropriate events. The implementation
could be also used to register new hotkeys as well.

In the attachment you can find git-patch to current development version.

Implementation details
=======
As I am not very javascript skilled I tried to look up how other
projects solves this. I wanted similar functionality performance as have
Google Docs (ctrl+s and other popular hotkeys) and finally I ended up
with TinyMCE (tinymce.moxiecode.com)[LGLP licence] which implements
similar functionality. I used code blocks from TinyMCE, modified them
for dokuwiki (addEvent,addInitEvent) and add automatic hotkeys
registration (anchors and inputs[type=submit]).

I tried to stay as much consistent with dokuwiki
(http://www.dokuwiki.org/devel:javascript) as I was able to. I added
just one file hotkeys.js, with the implementation and added line to js.php.

Testing
========
I have done tests under IE6,7,8 FF and Chrome - all went well.

TODO
========
It is a question what modifer keys should be default, i used just 'ctrl'
as is common on google docs or in tinymce. I do not know if this schould
be configurable hrough classic tinymce configuration, it is a question
for you as well. To change i just change one line in code:

    this.modifier = 'ctrl';

To  i.e.:
 
   /**
     * Set modifier keys, for instance:
     *  this.modifier = 'ctrl';
     *  this.modifier = 'ctrl+shift';
     *  this.modifier = 'ctrl+alt+shift';
     *  this.modifier = 'alt';
     *  this.modifier = 'alt+shift';
     */

Ask for feedback
========
As my subject is close to an end and our lecturer even shifted deadlines
one week earlier I would be happy if you could give me feedback till
Thursday morning. If it is not possible nothing happens, however it
would help me with the final presentation.

Best regards,
Marek

sachamar@xxxxxxxxxxx












Other related posts: