mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 20:57:09 +02:00
cleanup prints
This commit is contained in:
parent
4b61cc9f5f
commit
e2a6c08f19
1 changed files with 10 additions and 32 deletions
|
@ -141,7 +141,6 @@ function createEmitTextPropertyUpdateFunction(propertyName) {
|
||||||
return function() {
|
return function() {
|
||||||
var properties = {};
|
var properties = {};
|
||||||
properties[propertyName] = this.value;
|
properties[propertyName] = this.value;
|
||||||
console.log('properties at set thingo yo')
|
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: "update",
|
type: "update",
|
||||||
|
@ -283,16 +282,13 @@ function setUserDataFromEditor() {
|
||||||
var json = null;
|
var json = null;
|
||||||
try {
|
try {
|
||||||
json = editor.get();
|
json = editor.get();
|
||||||
console.log('its good json')
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('failed to parse json', e)
|
|
||||||
alert('Invalid JSON code - look for red X in your code ', +e)
|
alert('Invalid JSON code - look for red X in your code ', +e)
|
||||||
}
|
}
|
||||||
if (json === null) {
|
if (json === null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var text = editor.getText()
|
var text = editor.getText()
|
||||||
console.log('editor text at send:', text)
|
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: "update",
|
type: "update",
|
||||||
|
@ -312,12 +308,9 @@ function userDataChanger(groupName, keyName, checkBoxElement, userDataElement, d
|
||||||
var parsedData = {};
|
var parsedData = {};
|
||||||
try {
|
try {
|
||||||
if ($('#userdata-editor').css('height') === "0px") {
|
if ($('#userdata-editor').css('height') === "0px") {
|
||||||
console.log('GET JSON FROM EDITOR')
|
|
||||||
parsedData = editor.getJSON();
|
parsedData = editor.getJSON();
|
||||||
} else {
|
} else {
|
||||||
console.log('GET JSON FROM TEXT AREA');
|
|
||||||
parsedData = JSON.parse(userDataElement.value);
|
parsedData = JSON.parse(userDataElement.value);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
@ -367,9 +360,6 @@ function createJSONEditor() {
|
||||||
},
|
},
|
||||||
onError: function(e) {
|
onError: function(e) {
|
||||||
alert('JSON editor:' + e)
|
alert('JSON editor:' + e)
|
||||||
},
|
|
||||||
onChange: function() {
|
|
||||||
console.log('editor did change')
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
editor = new JSONEditor(container, options);
|
editor = new JSONEditor(container, options);
|
||||||
|
@ -412,14 +402,12 @@ function hideUserDataTextArea() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function showStaticUserData() {
|
function showStaticUserData() {
|
||||||
console.log('showing static userdata')
|
|
||||||
$('#static-userdata').show();
|
$('#static-userdata').show();
|
||||||
$('#static-userdata').css('height', $('#userdata-editor').height())
|
$('#static-userdata').css('height', $('#userdata-editor').height())
|
||||||
$('#static-userdata').text(editor.getText());
|
$('#static-userdata').text(editor.getText());
|
||||||
};
|
};
|
||||||
|
|
||||||
function removeStaticUserData() {
|
function removeStaticUserData() {
|
||||||
console.log('hiding static userdata')
|
|
||||||
$('#static-userdata').hide();
|
$('#static-userdata').hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -432,9 +420,7 @@ function getEditorJSON() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function deleteJSONEditor() {
|
function deleteJSONEditor() {
|
||||||
console.log('should delete editor')
|
|
||||||
if (editor !== null) {
|
if (editor !== null) {
|
||||||
console.log('has one so do it')
|
|
||||||
editor.destroy();
|
editor.destroy();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -769,20 +755,18 @@ function loaded() {
|
||||||
//its json
|
//its json
|
||||||
if (Object.keys(json).length === 0 && json.constructor === Object) {
|
if (Object.keys(json).length === 0 && json.constructor === Object) {
|
||||||
//it's an empty object
|
//it's an empty object
|
||||||
console.log('empty object')
|
|
||||||
}
|
}
|
||||||
createJSONEditor();
|
createJSONEditor();
|
||||||
setEditorJSON(json)
|
setEditorJSON(json)
|
||||||
showSaveUserDataButton();
|
showSaveUserDataButton();
|
||||||
hideNewJSONEditorButton();
|
hideNewJSONEditorButton();
|
||||||
console.log('did parse json successfully')
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('error parsing json')
|
//normal text
|
||||||
|
|
||||||
elUserData.value = properties.userData;
|
elUserData.value = properties.userData;
|
||||||
showUserDataTextArea();
|
showUserDataTextArea();
|
||||||
hideSaveUserDataButton();
|
hideSaveUserDataButton();
|
||||||
//normal text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elHyperlinkHref.value = properties.href;
|
elHyperlinkHref.value = properties.href;
|
||||||
|
@ -1063,29 +1047,23 @@ function loaded() {
|
||||||
|
|
||||||
elClearUserData.addEventListener("click", function() {
|
elClearUserData.addEventListener("click", function() {
|
||||||
deleteJSONEditor();
|
deleteJSONEditor();
|
||||||
console.log('CLEAR USER DATA WAS CLICKED w')
|
|
||||||
elUserData.value = "";
|
elUserData.value = "";
|
||||||
showUserDataTextArea();
|
showUserDataTextArea();
|
||||||
console.log('CLEAR USER DATA WAS CLICKED x')
|
|
||||||
showNewJSONEditorButton();
|
showNewJSONEditorButton();
|
||||||
console.log('CLEAR USER DATA WAS CLICKED y')
|
|
||||||
hideSaveUserDataButton();
|
hideSaveUserDataButton();
|
||||||
console.log('CLEAR USER DATA WAS CLICKED z')
|
var properties = {};
|
||||||
var properties = {};
|
properties['userData'] = elUserData.value;
|
||||||
properties['userData'] = elUserData.value;
|
EventBridge.emitWebEvent(
|
||||||
console.log('properties at set thingo yo', elUserData.value)
|
JSON.stringify({
|
||||||
EventBridge.emitWebEvent(
|
type: "update",
|
||||||
JSON.stringify({
|
properties: properties,
|
||||||
type: "update",
|
})
|
||||||
properties: properties,
|
);
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
elSaveUserData.addEventListener("click", function() {
|
elSaveUserData.addEventListener("click", function() {
|
||||||
console.log('click on save json button')
|
|
||||||
setUserDataFromEditor();
|
setUserDataFromEditor();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue