ndreckshage/roughdraft.js — pull request #4 by ultimatedelman (2013-01-31 18:43:57+00:00)
Title: Added option, cached thesaurus, some cleanup

I added a few options, namely the option to change the ajax call method. This was one problem I had getting this to work initially, as my backend does not allow POSTs on .json files, so I had to override my $.ajaxSetup() to get this working. Now it defaults to 'GET' with the option to override (although I can't see anyone overriding a GET).

I also noticed that the thesaurus was being called every time in a loop for getting sentences. This was resulting in an AJAX call every time the loop was run, which was slowing down page load a lot for a large number of blocks. I simply cached the thesaurus and removed the methods that spliced out paragraphs. I felt that the integrity of the randomness of the sentences/paragraphs/etc was less important for prototyping than the performance of this plugin, as it is, after all, just for prototyping.

I tried to conform to your coding conventions as much as I could and only touched things that I played with for my own need, so I didn't get through the whole codebase. I hope you like my changes!