My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

marlin.js 684B

123456789101112131415161718192021222324
  1. document.addEventListener('DOMContentLoaded', () => {
  2. const ws = new WebSocket(`ws://${location.host}/ws`);
  3. ws.onmessage = (e) => {
  4. if (typeof e.data === 'string') {
  5. let node = document.createElement('li');
  6. let text = document.createTextNode(e.data);
  7. node.appendChild(text);
  8. document.getElementById('serial-output').appendChild(node);
  9. }
  10. };
  11. document.getElementById('serial-command-form').addEventListener('submit', (e) => {
  12. e.preventDefault();
  13. let value = document.getElementById('serial-command').value.trim();
  14. if (!value) return;
  15. ws.send(`${value}\n`);
  16. document.getElementById('serial-command').value = '';
  17. });
  18. });