20 decembrie 2012

Simple Book Inventory List with jQuery on my Android Phone

This is the practical part of this story.

Basically, it's just a simple HTML page that I copied to my Android phone, so, because I'm carrying my phone with me all the time, I have access to my book list everywhere I'm going, ready to check if I already have a book in collection, to avoid buying duplicates.



It's easy: I am looping with a for-loop 1500 times (yes, the book collection is huge) and if I find a book number that is previously saved in an array var (already owned books) it changes the color to red. Easy to spot, easy to scroll. Easy to use. Observe the page title: 33/1500. Yes, it's dynamic, adding a number to array will increase automatically the count in the title. Easy to brag yourself with the number of books owned.

This is how it looks on phone:



It's helping me a lot keeping track of my book collection and is very easy to create. However, adding on new book numbers on the phone it doesn't work, I have to manually add in the js file in the number array holding the numbers, but is fine with me. Maybe  in the future, I will invest some time in phonegap, and I will remake this app accordingly for public release.

HTML code (observe it's empty, it contains only the two inputs that actually do not work; and observe the meta tag viewport important for devices):

Style:
JavaScript:
Please ignore the butNr.click event. I have tried to use localStorage for adding from the phone newly bought books, but the click event on button somehow doesn't works on Android and I didn't find any answer for this. I wanted to save new numbers in localStorage and then to use in the below for-loop that checks for owned books, but because of this and the ease of loosing data with localStorage I've quited. So... sorry, but stay tooned for the next version of this library, public release!

Niciun comentariu:

Trimiteți un comentariu