Loading, Editing, and Saving a Text File in HTML5 Using Javascript

This Could Be Better

The HTML and JavaScript code below makes use of some features of HTML5 (specifically the “Blob” object, the File API, and the “download” attribute of the “a” tag) to allow the user to load, edit, and save a text file on their local computer.  As of this writing, it works in both Chrome and Firefox browsers, though sadly it requires a little bit of custom code for each.

To see it in action, copy it into an .html file and open that file in a web browser that runs JavaScript.  Or, for an online version, visit http://thiscouldbebetter.neocities.org/texteditor.html.

<html> <body> <table> <tr><td>Text to Save:</td></tr> <tr> <td colspan="3"> <textarea id="inputTextToSave" style="width:512px;height:256px"></textarea> </td> </tr> <tr> <td>Filename to Save As:</td> <td><input id="inputFileNameToSaveAs"></input></td> <td><button onclick="saveTextAsFile()">Save Text to File</button></td> </tr> <tr> <td>Select a File to Load:</td> <td><input type="file" id="fileToLoad"></td> <td><button onclick="loadFileAsText()">Load Selected File</button><td> </tr> </table> <script type='text/javascript'> function saveTextAsFile() { var textToWrite = document.getElementById("inputTextToSave").value; var textFileAsBlob…

View original post 111 more words

Setup Aptana for JQuery Development

Leo is a Hacker.

Aptana is an excellent IDE for writing code for python/ruby/jquery, I don’t / wouldn’t to develop PHP :), mastering the programming languages like ruby/python/javascript and related tools is overhead enough for me.

Now, I will talk about setting up the Aptana 3.05+ for JQuery Development.

AutoComplete and Syntax Reference

We need to install Javascript-JQuery.ruble to support AutoComplete.

How to Install

From the meun Commands > Bundle Development, we can Install Bundle for JQuery, that Javascript-JQuery.ruble from GitHub will be installed. This project ( javascript-jquery.rulbe is ported from Textmate’s jquery bundle).

After that, right-click the project in project explorer, select menu item “Properties”, select the checkbox for correct JQuery version in Project Build Path, Done!

Now we have the inline code-assist and syntax prompt when writing the code.

Since the Aptana 3.0, Ruble (Ruby bundle) is introduced to developers. We can think it as a clone implementation of bundle from TextMate

View original post 210 more words