zmp-core
Version:
Full featured mobile HTML framework for building iOS & Android apps
100 lines (89 loc) • 3.27 kB
JavaScript
;
exports.__esModule = true;
exports.default = void 0;
var _zmpDom = _interopRequireDefault(require("../../shared/zmp-dom"));
var _utils = require("../../shared/utils");
var _getDevice = require("../../shared/get-device");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-unused-vars */
var Statusbar = {
hide: function hide() {},
show: function show() {},
onClick: function onClick() {
var app = this;
var pageContent;
if ((0, _zmpDom.default)('.popup.modal-in').length > 0) {
// Check for opened popup
pageContent = (0, _zmpDom.default)('.popup.modal-in').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');
} else if ((0, _zmpDom.default)('.panel.panel-in').length > 0) {
// Check for opened panel
pageContent = (0, _zmpDom.default)('.panel.panel-in').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');
} else if ((0, _zmpDom.default)('.views > .view.tab-active').length > 0) {
// View in tab bar app layout
pageContent = (0, _zmpDom.default)('.views > .view.tab-active').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');
} else if ((0, _zmpDom.default)('.views').length > 0) {
pageContent = (0, _zmpDom.default)('.views').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');
} else {
pageContent = app.$el.children('.view').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');
}
if (pageContent && pageContent.length > 0) {
// Check for tab
if (pageContent.hasClass('tab')) {
pageContent = pageContent.parent('.tabs').children('.page-content.tab-active');
}
if (pageContent.length > 0) pageContent.scrollTop(0, 300);
}
},
setTextColor: function setTextColor(color) {},
setBackgroundColor: function setBackgroundColor(color) {},
isVisible: function isVisible() {
return new Promise(function (resolve) {
resolve(false);
});
},
overlaysWebView: function overlaysWebView(overlays) {
if (overlays === void 0) {
overlays = true;
}
},
init: function init() {
var app = this;
var device = (0, _getDevice.getDevice)();
var params = app.params.statusbar;
if (!params.enabled) return;
if (params.iosBackgroundColor && device.ios) {
Statusbar.setBackgroundColor(params.iosBackgroundColor);
}
if (params.androidBackgroundColor && device.android) {
Statusbar.setBackgroundColor(params.androidBackgroundColor);
}
}
};
var _default = {
name: 'statusbar',
params: {
statusbar: {
enabled: true,
scrollTopOnClick: true,
iosOverlaysWebView: true,
iosTextColor: 'black',
iosBackgroundColor: null,
androidOverlaysWebView: false,
androidTextColor: 'black',
androidBackgroundColor: null
}
},
create: function create() {
var app = this;
(0, _utils.bindMethods)(app, {
statusbar: Statusbar
});
},
on: {
init: function init() {
var app = this;
Statusbar.init.call(app);
}
}
};
exports.default = _default;