JavaScript

Nutty Hack - Dojo Javascript Front End to OpenOffice.org through Servlets

This is weird. The authors turn OpenOffice.org into a spreadsheet server -- and then create a front end in Dojo with Javascript, and tunnel events from the front end to the OOo spreadsheet via a Tomcat servlet.

TinyMCE, Firefox, IE 8, Adblock Plus Total Weirdness

At work I run Firefox without the (great) Adblock Plus plug-in. Adblock Plus mangles the HTML code to insert its own code that displays the "Block Ad" tabs, and this interferes with our CMS. Whenever I insert some code to embed video, Adblock Plus sees it and then adds its own code, ruining the code.

I forgot this, and installed ABP and then had to uninstall it.

Then, I started noticing that TinyMCE was altering URLs in links, so a url like http://example.com/go.php?id=100&start=344 would get mangled, so the ampersand (&) was replaced with & the HTML entity. I'd see: http://example.com/go.php?id=100&start=344

It turns out this is correct behavior, because xml doesn't allow & to be in an attribute. It needs to be escaped. The only problem is that IE6 won't handle these links correctly.

Hello, World in Javascript Encoded as a Data URI

This is the Hello, World program, written in Javascript and encoded as a data URI.

<script src='data:application/javascript;base64,ZG9jdW1lbnQud3JpdGUoIkhlbGxvLCB3b3JsZCEiKQ=='></script>

Dusting Off Coroutines

Coroutines are back! They never really left, but, it looks like different languages are adding native support for coroutines.

Javascript Functions and Closures for Private Properties

A JavaScript Module Pattern is a fantastic example of how to use closures.

Javascript Closures has more detailed information.

Douglas Crockford brought the style over to JS, and his site has a lot of important articles about Javascript hacking (as a functional language).

Resize YouTube Video (works with Vimeo and most sites)

This is a script to resize youtube video embed codes. It also works with other site. The youtube video is scaled proportionately. It should work with other video sites like Revver, Vimeo, LiveLeak, and even non-video embed codes.

Javascript Calculator: Split Up Your Reciepts

Here's a Javascript calculator that was put together to deal with situations where you have to split up a grocery receipt with a friend. You can type in the prices, one per line. Check the box if it's a taxable item. (Set the tax rate if it's not 8.25%.) Then, click the "+" button to add it up.

Hispanic Surname Extraction with Regular Expressions

The challenge with these names is twofold. For one, they follow a European convention of using "of" to denote the family, e.g. De La Cruz. This is like the Irish O'Connor or Italian del Vecchio.

Terse Javascript Alternations, and the Frameworks' Problem with SQL

Cool

Here's a snippet of javascript that breaks up a phone number into its parts, if it's formatted in the common formats.


	var cell = namesArray[rownum]['Cell'];

Sarah Palin Pork Barrel Calculator

Vice Presidential candidate Sarah Palin has recently been criticized for her pork-barrel spending. This web-calculator helps you figure out how extreme she is. (Calculator is on the full story.)

How Much Money Can You Save on Gas by Riding the Bus?

This is a javascript calculator that will estimate if taking a bus will cost less than what you pay in gasoline. Surprisingly, for short commutes, commuting by car is cheaper than getting a bus pass. (Calculator is on the full article.)

Future Web App Development

Things to read and research:

Adobe Flex
qooxdoo
Silverlight
OpenMocha
Backbase
Google Web Toolkit
Authenteo
WebKit

More info - Ajaxian

Not a framework - Scriptaculous which uses Prototype. (That and JQuery are in another post.)

Email Obfuscation and Shielding Script

Here's a perl script that takes email addresses as arguments, and returns javascript code that hides your email address from web spiders. The email address is also linked so it's clickable.

#! /usr/bin/perl

foreach my $email (@ARGV) {

        $email =~ s/@/ @ /;
        $email =~ s/\./ . /;

        @parts = split( ' ', $email );

        print "\n";
        print "document.write('');";
        foreach my $word (@parts) {
                print "document.write('".$word."');\n";
        }
        print "document.write('');\n";
        print "\n\n";
}

Hiding Email Addresses from Spiders and Spammers

Here's a bit of PHP code that emits javascript. The javascript emits an email link, but coded in Javascript, so that most spiders won't be able to get your email address for spamming.


<?php
function printEmailAddress( $email )
{
$parts = explode( '@', $email );
echo ' var d = document;';
echo 'd.write("");';
echo 'd.write("'.$parts[0].'");';
echo 'd.write("@");';
echo 'd.write("'.$parts[1].'");';
echo 'd.write("
");';
}

printEmailAddress("fake@mail.com");
?>

Syndicate content