Skip to content

Instantly share code, notes, and snippets.

@rayboyd
rayboyd / html5.js
Created January 30, 2011 00:22
Rudimentary HTML5 feature support testing.
for (var k in html5)
console.log(k, '...', html5[k]);
(function(window, document, navigator, undefined) {
var html5 = {
appcache: !!(window.applicationCache),
audio: !!(document.createElement('audio').canPlayType),
dragdrop: !!('draggable' in document.createElement('span')),
fileapi: !!(typeof FileReader !== 'undefined'),
geolocate: !!(navigator.geolocation),

HTML5 and friends.

A bigass bulleted list of features.

I commonly need to get a big list of all the stuff people think of when they think new and shiny these days. This list is for that.

I take a very inclusionist approach to it. 1

javascript APIs

  • Web Storage (localStorage, sessionStorage)
  • Web SQL Database
$(document).ready(function() {
// html5 feature support
for (var k in html5)
console.log(k, '...', html5[k]);
});
(function(window, document, navigator, undefined) {
var html5 = {
appcache: !!window.applicationCache,
geolocate: !!navigator.geolocation,
@rayboyd
rayboyd / imdb.js
Created July 19, 2011 23:25
Bookmarklet to send basic IMDb info via GET request to a url.
javascript:(function(){var meta=document.getElementsByTagName('meta');for(var i=0;i<meta.length;i++){switch(meta[i].getAttribute('property')){case'og:title':var title=encodeURIComponent(meta[i].getAttribute('content'));break;case'og:director':var director=encodeURIComponent(meta[i].getAttribute('content'));break;case'og:url':var url=encodeURIComponent(meta[i].getAttribute('content'));break;};};window.open('http://url.co.uk/?title='+title+'&director='+director+'&url='+url);})();
@rayboyd
rayboyd / view.js
Created May 6, 2012 14:18
Viewport dimensions
(function(document) {
var el = (document.compatMode === "CSS1Compat")
? document.documentElement
: document.body;
return {
'height': el.clientHeight,
'width': el.clientWidth
}
}(document);

Keybase proof

I hereby claim:

  • I am rayboyd on github.
  • I am rayboyd (https://keybase.io/rayboyd) on keybase.
  • I have a public key ASBokciSsbWPh0ZBq6c8zfUrNhRq4wwBqkcLRiqwwFMZPQo

To claim this, I am signing this object: