Created
January 31, 2013 18:29
-
-
Save saumya/4685061 to your computer and use it in GitHub Desktop.
A basic implementation of CoffeeScript with jQueryMobile
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 -> | |
# console.log "DOM Ready : 1 : Hello World" | |
#jQuery(document).ready -> | |
# console.log "DOM Ready : 2 : " | |
#jQuery(window).load -> | |
# console.log "DOM Ready : 3 : " | |
#jQuery Mobile | |
jQuery(document).on 'pageinit', -> | |
console.log 'Coffe Script says : Page initialised !' | |
#varibales | |
userSelected='' | |
btn_yes=jQuery('#btn_yes') | |
btn_no=jQuery('#btn_no') | |
btn_maybe=jQuery('#btn_maybe') | |
choiceData=jQuery('#choiceData') | |
#just a log | |
rayTrace 'Hello World !' | |
#event handlers | |
btn_yes.on 'tap', -> | |
rayTrace btn_yes,'YES' | |
userSelected='YES' | |
#console.log choiceData | |
choiceData.html 'OPTIMISTIC <br/> Get Rolling and life is beautiful.' | |
null | |
btn_no.on 'tap', -> | |
rayTrace btn_no,'NO' | |
userSelected='NO' | |
#console.log choiceData | |
choiceData.html 'PESSIMISTIC <br /> Begin thinking you are awesome and you will be.' | |
null | |
btn_maybe.on 'tap', -> | |
rayTrace btn_maybe, 'MAY BE' | |
userSelected='MAY BE' | |
#console.log choiceData | |
choiceData.html 'LOST <br /> Seriously ! Go play a game, if you win, play again. If you loose, play again. Continue, till you think you have to stop playing. There you go, you just made a decession. Now choose either YES or NO. Life is about decissions.' | |
null | |
null | |
rayTrace = (obj,name='Element Name' ) -> | |
console.log "#{name} and #{obj}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment