Monday, September 23rd, 2013 11:21 pm
documents in googledocs is almost entering the 21 century
If you use Googledocs for fic, you may already know that they've added javascript functionality so you can create your own scripts for stuff that they don't have in the menus or stuff that you want to do that takes several different menu options (or a select all). You can find the manager and editor under the Tools menu.
There are some odd restrictions with their currently available classes, but below are two simple functions you can add to the custom menu dropdown that you can add to your toolbar (which trust me, was the highlight of my googledocs experience). One controls fixing your entire document's font and size (you can add any of the attributes listed here for the style), and the other fixes a selection of text.
This is a work in progress. These do not run very quickly yet, but I timed how long it takes me to do it manually and it is faster. I assume googledocs will eventually speed this up; their excel scripts run extremely fast, but no matter how much I optimize the code here, it's still noticeable in its lag.
( javascript for practical use in googledocs )
Slowly but surely, googledocs is adding more classes as they go, so hopefully there will be more flexibility soon. It does recognize the most recent version of javascript that I could find and test with, and I haven't found any that doesn't work.
However, the classes available can be confusing in what they do and don't allow, one, and two, they occasionally have secret methods and properties that don't show up in the API or in the autocomplete. I have no idea why, but it's kind of like an easter egg when it happens. Such as, in the first script, in the last line, editAsText does not actually appear as a potential method on the document object, but as it worked, I used it to add some (very small) speed to execution.
Any suggestions or hey, code of your own! Would love to hear about it.
There are some odd restrictions with their currently available classes, but below are two simple functions you can add to the custom menu dropdown that you can add to your toolbar (which trust me, was the highlight of my googledocs experience). One controls fixing your entire document's font and size (you can add any of the attributes listed here for the style), and the other fixes a selection of text.
This is a work in progress. These do not run very quickly yet, but I timed how long it takes me to do it manually and it is faster. I assume googledocs will eventually speed this up; their excel scripts run extremely fast, but no matter how much I optimize the code here, it's still noticeable in its lag.
Slowly but surely, googledocs is adding more classes as they go, so hopefully there will be more flexibility soon. It does recognize the most recent version of javascript that I could find and test with, and I haven't found any that doesn't work.
However, the classes available can be confusing in what they do and don't allow, one, and two, they occasionally have secret methods and properties that don't show up in the API or in the autocomplete. I have no idea why, but it's kind of like an easter egg when it happens. Such as, in the first script, in the last line, editAsText does not actually appear as a potential method on the document object, but as it worked, I used it to add some (very small) speed to execution.
Any suggestions or hey, code of your own! Would love to hear about it.