Files
BeWoPlaner/BeWoPlanerMobil/Scripts/utils.js

59 lines
1.2 KiB
JavaScript

function makeAjaxCall(pType, pUrl, pSuccess, pData, pComplete) {
$.ajax({
type: pType,
url: pUrl,
data: pData,
success: pSuccess,
error: showAjaxError,
complete: pComplete
});
}
function removeElementFromArray(pArray, pKey) {
const newArray = {};
for(let key in pArray) {
const keyAsNumber = Number(key);
if(keyAsNumber !== pKey) {
newArray[keyAsNumber] = pArray[keyAsNumber];
}
}
return newArray;
}
function toggleLabel(inputId) {
const label = $(`label[for="${inputId}"]`);
var topValue;
if($(`#${inputId}`).is(":focus")) {
$(label).animate({ top: "-6px" }, 100);
return;
}
topValue = "12px";
if($(`#${inputId}`).val()) {
topValue = "-6px";
}
$(label).animate({ top: topValue }, 75);
}
function adjustLabel(inputId) {
const label = $(`label[for="${inputId}"]`);
var topValue;
topValue = "12px";
if($(`#${inputId}`).val()) {
topValue = "-6px";
}
$(label).animate({ top: topValue }, 75);
}
function isInEditingMode() {
return $("#isInEditModeIndicator").val() == "true";
}