0px 10px 10px;";
input.spellcheck = autocorrection ? true : false;
input.maxLength = characterLimit > 0 ? characterLimit : 524288;
input.value = text;
input.placeholder = placeholder;
if (!hasExistingMobileInput) {
inputContainer.appendChild(input);
inputContainer.input = input
}
if (!hasExistingMobileInput) {
var okButton = document.createElement("button");
okButton.innerText = "OK";
okButton.style = "border:0; position:absolute; left:calc(100% - 75px); top:0px; width:75px; height:100%; margin:0; padding:0; border-radius: 5px; background-color:#fff";
okButton.addEventListener("touchend", function() {
_JS_MobileKeyboard_Hide(true)
});
inputContainer.appendChild(okButton);
inputContainer.okButton = okButton;
input.addEventListener("keyup", function(e) {
if (input.parentNode.multiline)
return;
if (e.code == "Enter" || e.which == 13 || e.keyCode == 13) {
_JS_MobileKeyboard_Hide(true)
}
});
input.addEventListener("blur", function(e) {
_JS_MobileKeyboard_Hide(true);
e.stopPropagation();
e.preventDefault()
});
input.select();
input.focus()
} else {
input.select()
}
}
var JS_OrientationSensor = null;
var JS_OrientationSensor_callback = 0;
function _JS_OrientationSensor_IsRunning() {
return JS_OrientationSensor && JS_OrientationSensor.activated || JS_OrientationSensor_callback != 0
}
function JS_OrientationSensor_eventHandler() {
if (JS_OrientationSensor_callback != 0)
dynCall_vffff(JS_OrientationSensor_callback, JS_OrientationSensor.quaternion[0], JS_OrientationSensor.quaternion[1], JS_OrientationSensor.quaternion[2], JS_OrientationSensor.quaternion[3])
}
var JS_OrientationSensor_frequencyRequest = 0;
function JS_DeviceOrientation_eventHandler(event) {
if (JS_OrientationSensor_callback) {
var degToRad = Math.PI / 180;
var x = event.beta * degToRad;
var y = event.gamma * degToRad;
var z = event.alpha * degToRad;
var cx = Math.cos(x / 2);
var sx = Math.sin(x / 2);
var cy = Math.cos(y / 2);
var sy = Math.sin(y / 2);
var cz = Math.cos(z / 2);
var sz = Math.sin(z / 2);
var qx = sx * cy * cz - cx * sy * sz;
var qy = cx * sy * cz + sx * cy * sz;
var qz = cx * cy * sz + sx * sy * cz;
var qw = cx * cy * cz - sx * sy * sz;
dynCall_vffff(JS_OrientationSensor_callback, qx, qy, qz, qw)
}
}
function _JS_OrientationSensor_Start(callback, frequency) {
if (typeof RelativeOrientationSensor === "undefined") {
if (JS_OrientationSensor_callback == 0) {
JS_OrientationSensor_callback = callback;
JS_RequestDeviceSensorPermissions(1);
window.addEventListener("deviceorientation", JS_DeviceOrientation_eventHandler)
}
return
}
JS_OrientationSensor_callback = callback;
function InitializeOrientationSensor(frequency) {
JS_OrientationSensor = new RelativeOrientationSensor({
frequency: frequency,
referenceFrame: "device"
});
JS_OrientationSensor.addEventListener("reading", JS_OrientationSensor_eventHandler);
JS_OrientationSensor.addEventListener("error", function(e) {
warnOnce(e.error ? e.error : e)
});
JS_OrientationSensor.start()
}
if (JS_OrientationSensor) {
JS_OrientationSensor.stop();
JS_OrientationSensor.removeEventListener("reading", JS_OrientationSensor_eventHandler);
InitializeOrientationSensor(frequency)
} else if (JS_OrientationSensor_frequencyRequest != 0) {
JS_OrientationSensor_frequencyRequest = frequency
} else {
JS_OrientationSensor_frequencyRequest = frequency;
Promise.all([navigator.permissions.query({
name: "accelerometer"
}), navigator.permissions.query({
name: "gyroscope"
})]).then(function(results) {
if (results.every(function(result) {
return result.state === "granted"
})) {
InitializeOrientationSensor(JS_OrientationSensor_frequencyRequest)
} else {
warnOnce("No permissions to use RelativeOrientationSensor.")
}
JS_OrientationSensor_frequencyRequest = 0
})
}
}
function _JS_OrientationSensor_Stop() {
if (JS_OrientationSensor) {
JS_OrientationSensor.stop();
JS_OrientationSensor.removeEventListener("reading", JS_OrientationSensor_eventHandler);
JS_OrientationSensor = null
} else if (JS_OrientationSensor_callback != 0) {
window.removeEventListener("deviceorientation", JS_DeviceOrientation_eventHandler)
}
JS_OrientationSensor_callback = 0
}
function _JS_RequestDeviceSensorPermissionsOnTouch() {
if (JS_DeviceSensorPermissions == 0)
return;
JS_RequestDeviceSensorPermissions(JS_DeviceSensorPermissions)
}
function _JS_RunQuitCallbacks() {
Module.QuitCleanup()
}
var JS_ScreenOrientation_callback = 0;
function JS_ScreenOrientation_eventHandler() {
if (JS_ScreenOrientation_callback)
dynCall_viii(JS_Scree |