mirror of
https://github.com/luc-github/ESP3D-WEBUI.git
synced 2025-10-31 11:56:46 -07:00
Fix Temperatures Panel crash due to missing code definition for ContainerHelper Add missing help entry for tooltip for select en boolean controls Refactorize exportPreferencesSection to handle more cases Remove usage of encodeURIComponent/decodeURIComponent for getting icon in extension Update extensions sample code for capabilities, icons, extension_settings and modal Update code for saving extensions data to rely on InterfaceSetting object instead of separate object Finalize implementation for fields_modal Update extension API documentation Rewrite importPreferences to importPreferencesSection for more flexibility Rewrite exportPreferences to exportPreferencesSection for more flexibility Bump version Build packages
49 lines
1.5 KiB
HTML
49 lines
1.5 KiB
HTML
<script type="text/javascript">
|
|
function sendMessage(msg) {
|
|
window.parent.postMessage(msg, '*');
|
|
}
|
|
|
|
function saveSettings() {
|
|
const extensionName = document.getElementById('extension_name').value;
|
|
const xmax = document.getElementById('xmax').value;
|
|
const xmin = document.getElementById('xmin').value;
|
|
|
|
const settings = {
|
|
xmax: xmax,
|
|
xmin: xmin
|
|
};
|
|
|
|
const contentTxt = JSON.stringify(settings);
|
|
sendMessage({ type: 'extensionsData', target: 'webui', id: extensionName, content: contentTxt });
|
|
}
|
|
|
|
function processMessage(eventMsg) {
|
|
if (eventMsg.data.type === "extensionsData") {
|
|
const response = eventMsg.data.content.response;
|
|
const resultPanel = document.getElementById("output");
|
|
const formattedResponse = JSON.stringify(response, null, 2);
|
|
resultPanel.textContent = formattedResponse;
|
|
}
|
|
}
|
|
|
|
window.onload = (event) => {
|
|
window.addEventListener("message", processMessage, false);
|
|
};
|
|
</script>
|
|
|
|
<div class="container">
|
|
<div class="form-group">
|
|
<label class="form-label" for="extension_name">Extension Name:</label>
|
|
<input class="form-input" id="extension_name" type="text" value="myextension">
|
|
|
|
<label class="form-label" for="xmax">xmax:</label>
|
|
<input class="form-input" id="xmax" type="text" value="100">
|
|
|
|
<label class="form-label" for="xmin">xmin:</label>
|
|
<input class="form-input" id="xmin" type="text" value="0">
|
|
|
|
<button class="btn m-1" onclick="saveSettings()">Save Settings</button>
|
|
</div>
|
|
|
|
<pre id="output"></pre>
|
|
</div> |