Refactoring ToDo plugin code

Hi!

I did a refactoring of the code of the todo plugin.

Also added some features:
 - now the plugin checks for modification dates so it should not overwrite a newer version of a page
 - a lock mechanism in the javascript so it submit the next update request only when the previous is finished.

I hope you appreciate these changes. A part that needs a double check is the use of indexes in the searchpattern results. I check the output of the search pattern and so far i have seen the founded todos has the same order as they appear in the original page. So my assumption is that the order of indexes is the same as at the original page. Therefore i have introduced in the searchpattern the usage of indexes too.

I try to split code changes from code formatting changes. 

Feedback welcome of course!

Kind regards