Typescript

I came across Typescript today from Microsoft.  It’s a superset of Javascript, that allows you to write a bunch of Javascript-like code and have it compile into Javascript.  The main benefit here that I see is intellinsense and getting type checks at compile time.

Wouldn’t you love to write Javascript like this?

image

Nice intellisense!

Visual Studio picture

Preventing Form Resetting

In an application I am creating, I do validation, filtering and ajax saving of values when the user changes something in a textbox.

A problem arrises if the user makes some changes, and then presses the Esc key 2 times.  This causes the form to reset, but it skips all my validation and auto-saving logic.

To prevent this, you can use this little snippet of jQuery javascript:

$(document).ready(
     function() {
         // prevent the esc key from resetting all the textboxes
          $("form").bind("reset", function(e) {
             e.preventDefault();
         });
     }
 );

 

 

Visual Studio type fly out windows in HTML

I’ve been working on a project where I wanted to have a flyout window on the left just like how Visual Studio does their menus.

Maybe “slide out” is more accurate.

I used jQuery, which I am trying to use more in my projects, for the effects.

Anyway, I ended up making it a bit harder than it needed to be by having the tab itself slide out, as well as allow for multiple tabs.

At this point I’m happy enough to move on with a successful proof of concept, but I think if I were doing this from scratch again I wouldn’t bother having the tab slide out as well.  I’d just show the sliding out window.

But, this should be a good starting point.

visualstudioflyoutmenus.htm (17.7 KB)

Update: And of course it completely fails in FF.

I made some changes, removed some things, tweaked others… looks ok in FF now.

visualstudioflyoutmenus2.htm (17.7 KB)