Blog
This is a website designed to share motorsport news and videos. Once logged in, you can view feeds from various websites and have the option to share them on the home page to comment and rate.
There is also a countdown calendar to the next race for sports covered, as well as relevant Twitter feeds. A mobile view allows content to be displayed seamlessly - whenever the screen is detected to be less than a certain width, mobile view is enabled by adding a class to the main container. Items are then selected through CSS based on this new container to switch dynamically between views when required.
The content for the feeds section is dynamically retrieved from public RSS feeds after a fixed period of time, and the first 200 characters of the feed are stored in a local database, so as not to keep pounding external servers each time a page loads. The URL of the original article is also stored, so a link is displayed to view the whole article - the website acting as a kind of advertisement for multiple relevant websites.
This application is all about managing tasks. To begin with, click the 'create new task list' at the bottom. This then opens a panel in which the list can be named, and items inserted into it.
If logged in, changes are saved automatically so when you revisit the page, your previous settings remain, including the name and state of each task.
An interactive motorsport calendar. It contains events for 2011, and displays the status of each event - whether past, present or future - and highlights this in the interface.
For F1 events, there's also the option to view an archive of races from the BBC website's Classic F1 series.
A web-based "instant" messaging system - not quite instant because there's a 1.5 second delay while checking for data, since browsers don't have push facilities to be told to retrieve data from the server.
This app requires registration, and from there you can add friends to talk to (assuming they're already registered). An upload function is available to share photos and files, which are then displayed in the page, as well as recent messages. The option to view the past week or day's worth of chat with one particular friend is available, along with email notifications.
It works by sending a request to the server to detect whether an update to a chat has been posted. If it has, the data is then retrieved and instantly animated into the chat window. It's really much more clever than I can put into words - give it a try!
Click here to useA calendar created in PHP to allow users to add events and appointments easily. Once signed in, clicking on a day will bring up an interface (see image below) to allow an item to be added to that day. Options become available to repeat the event every year, as in a birthday for example, or to make the event visible in the public timeline for everyone to see. The default setting is to not have events publicly visible unless you choose to make it so, and this is why I decided to require users to sign in first, rather than having a free-for-all option as with the chat.

View Calendar
I've made the calendar replace the F1 calendar in the main navigation bar, but you can still view the F1 calendar from the link at the bottom of the page.
The idea is that you move the ball through the gates before the screen closes in on you. Been done many times before, but I wanted to see if I could do it using JavaScript rather than the usual way of creating web browser based games - by using Flash.
Because there's no 'on collision' event that I'm aware of (although I have just discovered gameQuery, which may have helped me, but I haven't looked into it yet), I had to simulate collisions. Each row is the same height and the random row lengths pre-processed by the server and therefore accessible by the JavaScript. This meant that I could calculate an x and a y coordinate of the holes - and so if the ball's current position matches a hole, it starts the drop animation to the next level, and moves on to the next hole.
For motion, it's mostly performed using the animate() jQuery command. To be able to apply separate vertical and horizontal motion to the ball, the image for the ball was placed inside a 'playerX' div, which in turn was placed inside a 'playerY' div. This meant that I could apply a drop animation without losing the horizontal momentum already gathered. Initially, it didn't play well as it stopped its horizontal motion on a fall, which wasn't very smooth.
A detection function to test if the ball is on top of a hole runs every 50 milliseconds, so producing a frame rate of 20fps depending on browser (although the game scroll and player motion should be smoother than this as they're not tied to the hole detection function). Within this function however, I added a jQueryRotate plugin, which was very useful. Depending on whether the ball is moving left or right, it updates the rotation value every 50 milliseconds.
Finally, a scoring system was added along with the ability to post high scores. There are many ways of cheating to log an impossible score, but I wasn't overly concerned about this as it wasn't the main principle of the task.
Anyway, have a play.
For my final (for now) web app I've made recently, I've added an instant chat section to the site, but with image and video uploads integrated within the chat. I could spend hours talking about it, but it's probably best explained in action - feel free to try it out and ask me any questions. I've left a few explanation messages on there for you to read.
Chat here.

The image is how it'll look in the middle of next year, once a few races have taken place. It checks the current date and adjusts the styling depending on whether each race is a future race, a past race or a current race. All events listed are two- or three-day weekend events, so there's a good chance that if you look at the page on a weekend in 2011, there'll be at least one form of motorsport on.
External links to past races are displayed to highlights of past races hosted on the BBC website, as well as to iPlayer if it detects that an F1 race was shown within the last seven days, and so the race will be available on iPlayer. Once a race has completed, a results link appears that takes you to the official F1 website, assuming they don't adjust their link formats in the meantime.
Have a look.
I've been working on this extension to my website for the last few days, and it's ready to be viewed and played around with. It's an online version of Blackjack, created with PHP, Javascript and MySQL, and can be played as single or multiplayer - to test out the multiplayer, just open another browser window and be another player. The aim is to get a hand as close to 21 without going over, and to beat the dealer (not the other players - each individual player just plays against the dealer).
Aces count as one or eleven, whichever is better for you - this is taken account of in the game and adds the higher value as long as it won't make you go over 21. A 2 is worth 2, 3 worth 3, etc, and face cards are worth ten.
It requires cookies and obviously Javascript to be enabled. The Javascript is the main workings of the game, calling a PHP function to check the SQL database when updates have been made, then refreshing section of the screen in an Ajax style way, allowing other sections (such as the chat) to continue independently without interruption. An auto kick function is added, so that if any player leaves without clicking the leave button, the game doesn't just cripple to an indefinite halt - players can then return when they're back.
One of the most difficult challenges was working out how to accommodate new players, and also those that leave without destroying the game. I decided to add a value to the database when a new player joins, and have them wait until the next deal, then update them into the game. A player leaving caused more problems, but I resolved this by first adding the timer so they have to leave if they don't actually click the leave button, then if they do click to leave, it takes the player's cards with them. Initially, it meant that a leaving player transferred their cards onto the next player, which would be a bit harsh if they were a bad hand. So this player is still 'in' the game even after leaving, even though their cards and score aren't visible, a message is noted that a player has left, and they are then removed at the next round.
I then added a chat function, since the server was already calling a PHP script every couple of seconds, it may as well check the file size of the saved chat, then update if it's larger. A javascript function to then force the div to automatically scroll to the bottom (and so the updated messages) is also called when loading new data. The line required, for anyone that may find this useful (it took me quite a bit of Googling, hopefully you'll fare better), was:
Where chat_div is your div ID.
It doesn't include all of the rules of Blackjack just yet - but enough to form a functioning game. Features such as splitting a hand, betting and keeping track of high scores will come in the future.
Try it out, and let me know what you think, and if you find any errors. I'm aware of quite a few ways to cheat, but I left some of the ways I thought of in there as they were handy debuggers - I'll remove them when I come to finish everything off.
www.adamgleeson.co.uk/blackjack
Tags
- jump !animation animation stuff character work in progress php tasks web development ott jQuery css highlights javascript fight fota web f1 balls canada Mobile development reel dragon the box update run unnecessarily extravagant !webapps cycle demo website mysql maps climb head explode looks like the guy from the crystal maze bounce wtf game soldier Interface site chat orange jquery development portfolio 3D july 2011 design superhero 11 second club evil calendar dance webapp mclaren physics robot sentinel PHP assassins creed !character mental case matrix xml 2011 XML lip sync amazing june 2011 rss !animation MySQL feedreader idiot fall silverstone webapps motorsports trailer mask
Archive
- April 2012 [1]
- March 2012 [2]
- September 2011 [6]
- July 2011 [6]
- June 2011 [5]
- May 2011 [4]
- April 2011 [7]
- March 2011 [1]
- January 2011 [7]
- December 2010 [2]
- November 2010 [4]
- October 2010 [12]
- September 2010 [7]
- August 2010 [1]
- July 2010 [5]
- June 2010 [4]
- May 2010 [3]
- April 2010 [6]
- March 2010 [6]
- February 2010 [5]
- January 2010 [1]
- October 2009 [2]
- September 2009 [5]
- August 2009 [4]
- July 2009 [6]
- June 2009 [4]
- May 2009 [2]
- April 2009 [6]
- March 2009 [3]
- February 2009 [4]
- January 2009 [4]
- December 2008 [4]
- November 2008 [1]
- October 2008 [5]
- September 2008 [2]
- July 2008 [1]
