diff options
Diffstat (limited to 'www/js/views/fms.js')
-rw-r--r-- | www/js/views/fms.js | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/www/js/views/fms.js b/www/js/views/fms.js index 6ff569b..ae1174f 100644 --- a/www/js/views/fms.js +++ b/www/js/views/fms.js @@ -2,7 +2,7 @@ _.extend( FMS, { FMSView: Backbone.View.extend({ tag: 'div', - bottomMargin: 20, + bottomMargin: 0, contentSelector: '[data-role="content"]', events: { @@ -45,12 +45,21 @@ return this; }, - fixPageHeight: function() { + fixPageHeight: function(extra) { + extra = extra || 0; var header = this.$("div[data-role='header']:visible"), content = this.$(this.contentSelector), top = content.position().top, viewHeight = $(window).height(), - contentHeight = FMS.windowHeight - header.outerHeight() - this.bottomMargin; + contentHeight = FMS.windowHeight - header.outerHeight() - this.bottomMargin - extra; + + if ($("body").hasClass("iphone-x")) { + var body = $("body").get(0); + var inset = window.getComputedStyle(body).getPropertyValue("--safe-area-inset-bottom"); + // We want the pixel value, not the CSS string + inset = parseInt(inset.replace(/[^\d]*/g, '')); + contentHeight -= inset; + } this.setHeight( content, contentHeight - top ); }, @@ -107,7 +116,20 @@ $('.form-error').removeClass('form-error'); }, - destroy: function() { FMS.printDebug('destory for ' + this.id); this._destroy(); this.remove(); }, + disableScrolling: function() { + if ( typeof cordova !== 'undefined' ) { + cordova.plugins.Keyboard.disableScroll(true); + $('body').scrollTop(0); + } + }, + + enableScrolling: function() { + if ( typeof cordova !== 'undefined' ) { + cordova.plugins.Keyboard.disableScroll(false); + } + }, + + destroy: function() { FMS.printDebug('destroy for ' + this.id); this._destroy(); this.remove(); }, _destroy: function() {} }) |