       $(document).on 'click', '[data-toggle="tooltip"]', (event) ->
         $(@).tooltip('hide')
 
+    visibilitychange: ->
+      $(document).on 'visibilitychange', (event) ->
+        if feedbin.native && document.hidden == false
+          setTimeout ( ->
+            feedbin.setNativeTheme()
+          ), 300
+          feedbin.refresh()
+
     copy: ->
       $(document).on 'click', '[data-behavior~=copy]', (event) ->
         button = $(@)


  setNativeTheme: (calculateOverlay = false, timeout = 1) ->
    if feedbin.native && feedbin.data && feedbin.theme
      statusBar = if $("body").hasClass("theme-dusk") || $("body").hasClass("theme-midnight") then "lightContent" else "default"
      message = {
        action: "titleColor",
        statusBar: statusBar

      $(document).on 'feedbin:native:statusbartouched', (event, xCoordinate) ->
        feedbin.scrollToTop(xCoordinate)

    disableSubmit: ->
      $(document).on 'submit', '[data-behavior~=disable_on_submit]', (event) ->
        $('[type=submit]', @).attr('disabled', 'disabled')
