Skip to content

Instantly share code, notes, and snippets.

@Lepozepo
Created February 29, 2016 03:36
Show Gist options
  • Save Lepozepo/d1ae307775d99bb53df9 to your computer and use it in GitHub Desktop.
Save Lepozepo/d1ae307775d99bb53df9 to your computer and use it in GitHub Desktop.
has_not_run = true
Template.rendered ->
if Router.current()
destination = "Template.#{Router.current().route.options.template or Router.current().route.name}"
current = @view.name
if destination is current and has_not_run
has_not_run = false
document.addEventListener "deviceready", ->
Session.set "cordova.deviceready",true
#Set device data
Session.set "cordova.device_data",device
#Keyboard Settings
cordova.plugins.Keyboard.hideKeyboardAccessoryBar true
#Status Bar Init (just in case, you can disable on app init via info.plist)
if StatusBar.isVisible
StatusBar.hide()
#Notifications bootstrap (didn't do the rest because these are async)
window.alert = navigator.notification.alert
#Remove splash screen (this happens after the first page renders fully)
navigator.splashscreen.hide()
,false
# Keyboard accesory bar control
accesory_bar_enabled = ->
cordova.plugins.Keyboard.hideKeyboardAccessoryBar true
accesory_bar_disabled = ->
cordova.plugins.Keyboard.hideKeyboardAccessoryBar false
Template.rendered ->
if Router.current() and Session.get "cordova.deviceready"
destination = "Template.#{Router.current().route.options.template or Router.current().route.name}"
current = @view.name
if destination is current
cordova.plugins.Keyboard.hideKeyboardAccessoryBar true
$("select").each ->
$(this).off "focus.accesory_bar", accesory_bar_disabled
$(this).on "focus.accesory_bar", accesory_bar_disabled
$(this).off "blur.accesory_bar", accesory_bar_enabled
$(this).on "blur.accesory_bar", accesory_bar_enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment