W3C home > Mailing lists > Public > public-rww@w3.org > August 2012

doodle jump -- an html5 app -- webized

From: Melvin Carvalho <melvincarvalho@gmail.com>
Date: Sat, 25 Aug 2012 09:06:44 +0200
Message-ID: <CAKaEYh+YhUO6YahJ1B6ZY2jbOWiDn+cBxrJ4dH6BvZyFpFrNYg@mail.gmail.com>
To: public-rww <public-rww@w3.org>
I came across a cute html5 app called doodle jump:

 http://cssdeck.com/labs/full/dlvkjwcn/63

Since the code was open, I thought I'd add WebID authentication (at this
point I just added WebID, but OAuth, OpenID Connect, Facebook Connect are
possible too).

It only took a few minutes and you can go into more detail, if you are so
inclined, but the simple technique was to add:

var script = document.createElement('script');
script.src = 'https://data.fm/user.js' + '?callback=displayUser';
document.body.appendChild(script);

function displayUser(val) {
    webIDText = document.getElementById('webid');
    webIDText.innerHTML = val;
}

And a little <span> element in the HTML next to score.

The app lets you post your high score to twitter, but perhaps it would be a
cool exercise, for the RWW, to post to MyProfile, ODS or bergnet ...
Received on Saturday, 25 August 2012 07:07:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 25 August 2012 07:07:16 GMT