Skip to content

Instantly share code, notes, and snippets.

@pehrlich
Created December 4, 2011 19:23
Show Gist options
  • Save pehrlich/1431055 to your computer and use it in GitHub Desktop.
Save pehrlich/1431055 to your computer and use it in GitHub Desktop.
PhoneGap + jQuery mobile application.js.coffee
# This is a manifest file that'll be compiled into including all the files listed below.
# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
# be included in the compiled file accessible from http:#example.com/assets/application.js
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# the compiled file.
#
#= require jquery
#= require jquery.extensions
#= require jquery_ujs
#= require jquery.mobile-1.0
#= require jquery.validate
#= require uploads
#= require phonegap-1.2.0
#= require routes
#= require assets_version
if window['console'] == undefined
window.console = {
log:() ->
warn:() ->
trace:() ->
}
$.mobile.fixedToolbars.setTouchToggleEnabled false
$(document).live 'pageinit', (event) ->
new_assets_version = $('meta[name=assets_version]').attr('content')
if new_assets_version && window.assets_version != new_assets_version
alert('Software updates are online, reloading.');
window.location.reload()
$('[data-validate=true]', event.target).validate()
$(document).live 'pageshow', (event) ->
if document.cookie.length > 10
localStorage.setItem('cookie', document.cookie);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment