diff --git a/www/main.d.ts b/www/main.d.ts
index 98ddf4e..6ceaf44 100644
--- a/www/main.d.ts
+++ b/www/main.d.ts
@@ -2,9 +2,6 @@
declare interface ImagePrinter {
noticeElement: HTMLParagraphElement;
thresholdInput: HTMLInputElement;
- bluetoothMACInput: HTMLInputElement;
- deviceSelection: HTMLSelectElement;
- refreshDeviceButton: HTMLButtonElement;
fileSelection: HTMLInputElement;
dummyImage: HTMLImageElement;
imagePreview: HTMLCanvasElement;
diff --git a/www/main.js b/www/main.js
index f99b2d1..63f49be 100644
--- a/www/main.js
+++ b/www/main.js
@@ -1,5 +1,36 @@
///
+let notice_element = document.getElementById('notice');
+function notice(message) {
+ notice_element.innerText = message;
+}
+let device_selection = document.getElementById('device_selection');
+let refresh_device_button = document.getElementById('refresh_device');
+let bluetooth_mac_input = document.getElementById('bt_mac');
+function switchDevice() {
+ bluetooth_mac_input.value = device_selection.selectedOptions[0].value;
+}
+if (device_selection != null && refresh_device_button != null && bluetooth_mac_input != null) {
+ refresh_device_button.addEventListener('click', event => {
+ notice('Searching devices. Please wait for 5 seconds.')
+ device_selection.childNodes.forEach(e => e.remove());
+ let xhr = new XMLHttpRequest();
+ xhr.open('GET', '/~getdevices');
+ xhr.onload = () => {
+ for (let i of xhr.responseText.split('\n')) {
+ let [name, address] = i.split(',');
+ if (address == undefined) continue;
+ let option = document.createElement('option');
+ option.value = address;
+ option.innerText = `${name} - ${address}`;
+ device_selection.appendChild(option);
+ }
+ device_selection.selectedIndex = 0;
+ switchDevice();
+ }
+ xhr.send();
+ });
+}
function imageDataColorToMonoSquare(data, threshold) {
let newdata_horizonal = new Uint8ClampedArray(data.data.length);
let newdata_vertical = new Uint8ClampedArray(data.data.length);
diff --git a/www/print-document.html b/www/print-document.html
index 2d19780..7d5a84f 100644
--- a/www/print-document.html
+++ b/www/print-document.html
@@ -5,13 +5,36 @@
Print Document
+
- WIP
+ Print Document
+
+
+ Select device:
+
+
+ Copy & paste document to box
+
+ Threshold:
+
+
+ From MS Office/WPS/LibreOffice to here, pasted data shall be formatted
+ Preview
+
+
+
+