This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javascript testing for empty (undefined) object or array | |
This is the problem, for JS object keys and for array's, not that I like really testing for undefined, I would rather set false or true and test for that, but ...; | |
var obj = { key: undefined }; | |
obj["key"] != undefined // false, but the key exists! | |
and also; | |
if (urlobject[3] == 'undefined') {} // again does not work as expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { | |
$('form[data-async]').live('submit', function(event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<meta name="viewport" content="width=620"> | |
<title>HTML5 Demo: FileReader API thumbnail : div</title> | |
<!-- <link rel="stylesheet" href="css/html5demos.css"> --> | |
<body> | |
<section id="wrapper"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<meta name="viewport" content="width=620"> | |
<title>HTML5 Demo: FileReader API thumbnail : canvas</title> | |
<!-- <link rel="stylesheet" href="css/html5demos.css"> --> | |
<body> | |
<section id="wrapper"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<title>HTML5 Camera Fun</title> | |
</head> | |
<style type="text/css"> | |
.crop-canvas { | |
bottom: -30px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addEvent, removeEvent; | |
if ( window.addEventListener ) { | |
addEvent = function(obj, type, fn ) { | |
obj.addEventListener(type, fn, false ); | |
} | |
removeEvent = function(obj, type, fn ) { | |
obj.removeEventListener(type, fn, false ); | |
} | |
} else if (document.attachEvent) { | |
addEvent = function(obj, type, fn ) { |