Spaces:
Running

WDFluho commited on
Commit
1e59324
·
verified ·
1 Parent(s): 040d06f

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +149 -341
  2. prompts.txt +1 -1
index.html CHANGED
@@ -17,9 +17,7 @@
17
  firewire: '#FF4500',
18
  thunderbolt: '#0071C5',
19
  usb: '#00a651',
20
- network: '#8e44ad',
21
- expertdark: '#2d3748',
22
- devmode: '#6c757d'
23
  }
24
  }
25
  }
@@ -144,19 +142,6 @@
144
  .interface-network {
145
  background-color: #8e44ad;
146
  }
147
-
148
- /* Developer mode styles */
149
- .dev-mode .scanner-panel {
150
- border-color: #6c757d;
151
- }
152
-
153
- .dev-mode .hardware-indicator {
154
- background-color: #6c757d !important;
155
- }
156
-
157
- .dev-mode .live-indicator {
158
- background-color: #6c757d !important;
159
- }
160
  </style>
161
  </head>
162
  <body class="bg-gray-100">
@@ -186,10 +171,6 @@
186
  <i class="fas fa-plug text-xl"></i>
187
  <span class="tooltip">Connection method</span>
188
  </button>
189
- <button id="devModeToggle" class="text-primary hover:text-primary/80 tooltip-container">
190
- <i class="fas fa-code text-xl"></i>
191
- <span class="tooltip">Toggle Dev Mode</span>
192
- </button>
193
  <button id="infoBtn" class="text-primary hover:text-primary/80 tooltip-container">
194
  <i class="fas fa-info-circle text-xl"></i>
195
  <span class="tooltip">Information</span>
@@ -440,7 +421,7 @@
440
  <i class="fas fa-eye mr-1"></i> Preview
441
  </button>
442
  <button id="scanBtn" class="w-1/2 bg-primary text-white py-2 px-4 rounded hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed">
443
- <i class="fas fa-scan mr-1"></i> Scan
444
  </button>
445
  </div>
446
  </div>
@@ -668,15 +649,15 @@
668
  </h3>
669
  <ul class="text-xs text-gray-600 space-y-1">
670
  <li class="flex items-start">
671
- <i class="fas fa-check-circle text-green-500 mr-1 mt-0.5"></i>
672
  <span>Install vendor-specific USB drivers</span>
673
  </li>
674
  <li class="flex items-start">
675
- <i class="fas fa-check-circle text-green-500 mr-1 mt-0.5"></i>
676
  <span>Use USB 3.0+ for high resolution</span>
677
  </li>
678
  <li class="flex items-start">
679
- <i class="fas fa-check-circle text-green-500 mr-1 mt-0.5"></i>
680
  <span>Avoid USB hubs for stability</span>
681
  </li>
682
  </ul>
@@ -687,12 +668,7 @@
687
  </div>
688
 
689
  <script>
690
- // Debugging and enhancements:
691
- // 1. Fixed missing closing tags
692
- // 2. Improved connection detection
693
- // 3. Added developer mode toggle
694
- // 4. Enhanced interface detection
695
- // 5. Added proper event handling
696
 
697
  // DOM elements
698
  const scannerSelect = document.getElementById('scannerSelect');
@@ -706,7 +682,6 @@
706
  const connectionText = document.getElementById('connectionText');
707
  const connectionTooltip = document.getElementById('connectionTooltip');
708
  const refreshDevicesBtn = document.getElementById('refreshDevicesBtn');
709
- const devModeToggle = document.getElementById('devModeToggle');
710
  const liveIndicator = document.getElementById('liveIndicator');
711
  const hardwareStatusBtn = document.getElementById('hardwareStatusBtn');
712
  const hardwareStatusText = document.getElementById('hardwareStatusText');
@@ -718,7 +693,6 @@
718
  const standardModeBtn = document.getElementById('standardModeBtn');
719
  const expertModeBtn = document.getElementById('expertModeBtn');
720
  const scannerPanel = document.getElementById('scannerPanel');
721
- const appContainer = document.getElementById('appContainer');
722
  const scannerLight = document.getElementById('scannerLight');
723
  const progressContainer = document.getElementById('progressContainer');
724
  const progressBar = document.getElementById('progressBar');
@@ -740,60 +714,11 @@
740
  // State variables
741
  let isConnected = false;
742
  let isExpertMode = false;
743
- let isDevMode = false;
744
  let currentScanner = null;
745
  let connectionMethod = 'auto';
746
  let scanningProgress = 0;
747
  let timer = null;
748
 
749
- // Simulated scanner database
750
- const simulatedScanners = [
751
- {
752
- id: 'usb-001',
753
- name: 'Epson Perfection V850 Pro (USB)',
754
- model: 'Perfection V850 Pro',
755
- vendor: 'Epson',
756
- type: 'Flatbed Scanner',
757
- resolution: '6400 dpi',
758
- dynamicRange: '4.0 Dmax',
759
- interface: 'USB 3.0',
760
- connection: 'usb'
761
- },
762
- {
763
- id: 'thunderbolt-001',
764
- name: 'Hasselblad Flextight X5 (Thunderbolt)',
765
- model: 'Flextight X5',
766
- vendor: 'Hasselblad',
767
- type: 'Film Scanner',
768
- resolution: '8000 dpi',
769
- dynamicRange: '4.8 Dmax',
770
- interface: 'Thunderbolt 3',
771
- connection: 'thunderbolt'
772
- },
773
- {
774
- id: 'firewire-001',
775
- name: 'Nikon Coolscan 9000 ED (Firewire)',
776
- model: 'Coolscan 9000 ED',
777
- vendor: 'Nikon',
778
- type: 'Film Scanner',
779
- resolution: '4000 dpi',
780
- dynamicRange: '4.2 Dmax',
781
- interface: 'Firewire 400',
782
- connection: 'firewire'
783
- },
784
- {
785
- id: 'network-001',
786
- name: 'Kodak i1120 Scanners (Network)',
787
- model: 'i1120',
788
- vendor: 'Kodak',
789
- type: 'Document Scanner',
790
- resolution: '600 dpi',
791
- dynamicRange: '2.8 Dmax',
792
- interface: 'Gigabit Ethernet',
793
- connection: 'network'
794
- }
795
- ];
796
-
797
  // DOM Content Loaded
798
  document.addEventListener('DOMContentLoaded', function() {
799
  initializeApp();
@@ -805,8 +730,7 @@
805
  previewBtn.addEventListener('click', startPreview);
806
  scanBtn.addEventListener('click', startScan);
807
  refreshDevicesBtn.addEventListener('click', refreshScanners);
808
- devModeToggle.addEventListener('click', toggleDevMode);
809
- hardwareStatusBtn.addEventListener('click', toggleHardwareStatus);
810
  connectionMethodBtn.addEventListener('click', showConnectionMethodModal);
811
  closeConnectionModalBtn.addEventListener('click', hideConnectionMethodModal);
812
  saveConnectionPrefBtn.addEventListener('click', saveConnectionPreferences);
@@ -861,29 +785,10 @@
861
  // Update expert mode
862
  if (isExpertMode) {
863
  expertModeBtn.classList.add('bg-primarydark');
864
- appContainer.classList.add('expert-mode');
865
  } else {
866
  expertModeBtn.classList.remove('bg-primarydark');
867
- appContainer.classList.remove('expert-mode');
868
- }
869
-
870
- // Update dev mode
871
- if (isDevMode) {
872
- liveIndicator.textContent = 'DEV MODE';
873
- liveIndicator.classList.remove('bg-primary');
874
- liveIndicator.classList.add('bg-devmode');
875
- appContainer.classList.add('dev-mode');
876
- hardwareStatusText.textContent = 'Simulated Mode';
877
- hardwareStatusBtn.classList.remove('bg-green-200', 'text-green-800');
878
- hardwareStatusBtn.classList.add('bg-yellow-200', 'text-yellow-800');
879
- } else {
880
- liveIndicator.textContent = 'LIVE MODE';
881
- liveIndicator.classList.add('bg-primary');
882
- liveIndicator.classList.remove('bg-devmode');
883
- appContainer.classList.remove('dev-mode');
884
- hardwareStatusText.textContent = 'Live Mode';
885
- hardwareStatusBtn.classList.add('bg-green-200', 'text-green-800');
886
- hardwareStatusBtn.classList.remove('bg-yellow-200', 'text-yellow-800');
887
  }
888
  }
889
 
@@ -895,48 +800,39 @@
895
  scannerSelect.remove(1);
896
  }
897
 
898
- // Simulate scanner detection
899
- setTimeout(() => {
900
- let availableScanners = [];
901
-
902
- // In dev mode, use simulated scanners
903
- if (isDevMode) {
904
- availableScanners = simulatedScanners;
905
- } else {
906
- // In live mode, try to detect actual scanners (simulated here)
907
- availableScanners = simulateRealScannerDetection();
908
- }
909
-
910
- if (availableScanners.length > 0) {
911
  let preferredScannerIndex = -1;
912
 
913
  // Add detected scanners to dropdown
914
- availableScanners.forEach((scanner, index) => {
915
  const option = document.createElement('option');
916
  option.value = scanner.id;
917
 
918
  // Add interface indicator
919
  let interfaceClass = '';
920
- if (scanner.connection === 'thunderbolt') interfaceClass = 'interface-thunderbolt';
921
- if (scanner.connection === 'firewire') interfaceClass = 'interface-firewire';
922
- if (scanner.connection === 'usb') interfaceClass = 'interface-usb';
923
- if (scanner.connection === 'network') interfaceClass = 'interface-network';
924
 
925
  option.innerHTML = `<span class="${interfaceClass} interface-indicator"></span>${scanner.name}`;
926
  scannerSelect.appendChild(option);
927
 
928
  // Check if this matches our connection priority
929
- if (connectionPriority.value === scanner.connection) {
 
930
  preferredScannerIndex = index;
931
  }
932
  });
933
 
934
  // Select preferred scanner if found
935
  if (preferredScannerIndex >= 0) {
936
- scannerSelect.selectedIndex = preferredScannerIndex + 1; // +1 for the first "Select scanner" option
937
  }
938
 
939
- statusMessage.textContent = `${availableScanners.length} scanner(s) found`;
940
  connectionIndicator.classList.remove('bg-gray-500');
941
  connectionIndicator.classList.add('bg-yellow-500');
942
  connectionText.textContent = 'Devices available';
@@ -949,80 +845,81 @@
949
  connectionText.textContent = 'No devices';
950
  connectionTooltip.textContent = 'No compatible scanners were detected';
951
  }
952
- }, 1500);
 
 
 
 
 
 
953
  }
954
 
955
- function simulateRealScannerDetection() {
956
- const detectedScanners = [];
957
-
958
- // Simulate different connection types being detected
959
- const connectionTypes = ['usb', 'thunderbolt', 'firewire', 'network'];
960
-
961
- // Randomly decide which scanners are available
962
- connectionTypes.forEach(type => {
963
- if (Math.random() > 0.3) { // 70% chance of detecting each type
964
- let scanner = null;
965
-
966
- switch(type) {
967
- case 'usb':
968
- scanner = {
969
- id: 'usb-detect-' + Math.floor(Math.random() * 1000),
970
- name: 'USB Scanner ' + (Math.floor(Math.random() * 100) + 1000),
971
- model: 'USB Model',
972
- vendor: 'Manufacturer',
973
- type: 'Document Scanner',
974
- resolution: Math.floor(Math.random() * 4800) + 600 + ' dpi',
975
- dynamicRange: (Math.random() * 2 + 2).toFixed(1) + ' Dmax',
976
- interface: 'USB ' + (Math.random() > 0.5 ? '3.0' : '2.0'),
977
- connection: 'usb'
978
- };
979
- break;
980
- case 'thunderbolt':
981
- scanner = {
982
- id: 'tb-detect-' + Math.floor(Math.random() * 1000),
983
- name: 'Thunderbolt Scanner ' + (Math.floor(Math.random() * 100) + 1000),
984
- model: 'TB Model',
985
- vendor: 'Manufacturer',
986
- type: 'Film Scanner',
987
- resolution: Math.floor(Math.random() * 4000) + 4000 + ' dpi',
988
- dynamicRange: (Math.random() * 2 + 3).toFixed(1) + ' Dmax',
989
- interface: 'Thunderbolt ' + (Math.random() > 0.5 ? '3' : '2'),
990
- connection: 'thunderbolt'
991
- };
992
- break;
993
- case 'firewire':
994
- scanner = {
995
- id: 'fw-detect-' + Math.floor(Math.random() * 1000),
996
- name: 'Firewire Scanner ' + (Math.floor(Math.random() * 100) + 1000),
997
- model: 'FW Model',
998
- vendor: 'Manufacturer',
999
- type: 'Photo Scanner',
1000
- resolution: Math.floor(Math.random() * 3200) + 800 + ' dpi',
1001
- dynamicRange: (Math.random() * 2 + 2.5).toFixed(1) + ' Dmax',
1002
- interface: 'Firewire ' + (Math.random() > 0.5 ? '800' : '400'),
1003
- connection: 'firewire'
1004
- };
1005
- break;
1006
- case 'network':
1007
- scanner = {
1008
- id: 'net-detect-' + Math.floor(Math.random() * 1000),
1009
- name: 'Network Scanner ' + (Math.floor(Math.random() * 100) + 1000),
1010
- model: 'Network Model',
1011
- vendor: 'Manufacturer',
1012
- type: 'Document Scanner',
1013
- resolution: Math.floor(Math.random() * 900) + 600 + ' dpi',
1014
- dynamicRange: (Math.random() * 2 + 2).toFixed(1) + ' Dmax',
1015
- interface: 'Gigabit Ethernet',
1016
- connection: 'network'
1017
- };
1018
- break;
1019
- }
1020
 
1021
- if (scanner) detectedScanners.push(scanner);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  }
1023
  });
1024
-
1025
- return detectedScanners;
1026
  }
1027
 
1028
  function toggleScannerConnection() {
@@ -1043,53 +940,49 @@
1043
 
1044
  statusMessage.textContent = 'Establishing connection...';
1045
 
1046
- // Find the selected scanner
1047
- let selectedScanner = null;
1048
-
1049
- if (isDevMode) {
1050
- selectedScanner = simulatedScanners.find(scanner => scanner.id === selectedScannerId);
1051
- } else {
1052
- // In live mode, use the simulated detection - in a real app this would query real devices
1053
- const allScanners = simulateRealScannerDetection();
1054
- selectedScanner = allScanners.find(scanner => scanner.id === selectedScannerId);
1055
- }
1056
-
1057
- if (selectedScanner) {
1058
- // Simulate connection delay
1059
- setTimeout(() => {
1060
- currentScanner = selectedScanner;
1061
- isConnected = true;
1062
-
1063
- // Update scanner details
1064
- scannerModel.textContent = currentScanner.model;
1065
- scannerVendor.textContent = currentScanner.vendor;
1066
- scannerType.textContent = currentScanner.type;
1067
- scannerResolution.textContent = currentScanner.resolution;
1068
- scannerDynamicRange.textContent = currentScanner.dynamicRange;
1069
- scannerInterface.textContent = currentScanner.interface;
1070
-
1071
- // Update connection info
1072
- connectionTypeInfo.innerHTML = `Connected via <strong class="text-primary">${currentScanner.interface}</strong> to <strong>${currentScanner.vendor} ${currentScanner.model}</strong>`;
1073
- connectionInfo.classList.remove('hidden');
1074
-
1075
- // Interface-specific styling
1076
- if (currentScanner.connection === 'thunderbolt') {
1077
- scannerPanel.classList.add('border-thunderbolt');
1078
- } else if (currentScanner.connection === 'firewire') {
1079
- scannerPanel.classList.add('border-firewire');
1080
- } else if (currentScanner.connection === 'usb') {
1081
- scannerPanel.classList.add('border-usb');
1082
- } else if (currentScanner.connection === 'network') {
1083
- scannerPanel.classList.add('border-network');
1084
- }
1085
-
1086
- statusMessage.textContent = `Connected to ${currentScanner.vendor} ${currentScanner.model}`;
1087
- scannerDetails.classList.remove('hidden');
1088
- updateUI();
1089
- }, 1000);
1090
- } else {
1091
- statusMessage.textContent = 'Failed to connect to selected scanner';
1092
- }
1093
  }
1094
 
1095
  function disconnectScanner() {
@@ -1121,21 +1014,13 @@
1121
  statusMessage.textContent = 'Creating preview scan...';
1122
  scannerLight.style.opacity = '1';
1123
 
1124
- // Simulate scan time based on resolution
1125
- const resolution = document.getElementById('resolutionSelect').value;
1126
- let delay = 1000;
1127
-
1128
- if (resolution >= 4800) delay = 2500;
1129
- else if (resolution >= 3200) delay = 2000;
1130
- else if (resolution >= 1600) delay = 1500;
1131
-
1132
  setTimeout(() => {
1133
- previewImage.src = getRandomPreviewImage();
1134
- previewImage.classList.remove('hidden');
1135
- placeholderText.classList.add('hidden');
1136
- scannerLight.style.opacity = '0';
1137
  statusMessage.textContent = 'Preview completed';
1138
- }, delay);
 
 
1139
  }
1140
 
1141
  function startScan() {
@@ -1148,38 +1033,11 @@
1148
  progressPercent.textContent = '0%';
1149
  scanningProgress = 0;
1150
 
1151
- // Determine scan duration
1152
- const resolution = document.getElementById('resolutionSelect').value;
1153
- let totalSteps = 20;
1154
- let stepDelay = 100;
1155
-
1156
- if (resolution >= 4800) {
1157
- totalSteps = 40;
1158
- stepDelay = 150;
1159
- } else if (resolution >= 3200) {
1160
- totalSteps = 30;
1161
- stepDelay = 120;
1162
- } else if (resolution >= 1600) {
1163
- totalSteps = 20;
1164
- stepDelay = 100;
1165
- } else {
1166
- totalSteps = 10;
1167
- stepDelay = 80;
1168
- }
1169
-
1170
- // Multipass scanning
1171
- const multipassEnabled = multipassCheck.checked;
1172
- const multipassCount = multipassEnabled ? parseInt(document.getElementById('multipassCount').value) : 1;
1173
-
1174
- if (multipassEnabled) {
1175
- statusMessage.textContent = `Starting multipass scan (${multipassCount}x passes)...`;
1176
- totalSteps = totalSteps * multipassCount;
1177
- }
1178
-
1179
- // Start progress simulation
1180
  clearInterval(timer);
1181
  timer = setInterval(() => {
1182
- scanningProgress += (100 / totalSteps);
1183
 
1184
  if (scanningProgress >= 100) {
1185
  scanningProgress = 100;
@@ -1188,25 +1046,13 @@
1188
  progressBar.style.width = '100%';
1189
  progressPercent.textContent = '100%';
1190
  scannerLight.style.opacity = '0';
1191
-
1192
- // Simulate saving image to memory
1193
- setTimeout(() => {
1194
- previewImage.src = getRandomPreviewImage();
1195
- previewImage.classList.remove('hidden');
1196
- placeholderText.classList.add('hidden');
1197
- saveImageBtn.disabled = false;
1198
-
1199
- if (multipassEnabled) {
1200
- statusMessage.textContent = `Multipass scan completed (${multipassCount}x). Image ready`;
1201
- } else {
1202
- statusMessage.textContent = 'Scan completed. Image ready';
1203
- }
1204
- }, 500);
1205
  } else {
1206
  progressBar.style.width = `${scanningProgress}%`;
1207
- progressPercent.textContent = `${Math.floor(scanningProgress)}%`;
1208
  }
1209
- }, stepDelay);
1210
  }
1211
 
1212
  function refreshScanners() {
@@ -1221,23 +1067,8 @@
1221
  }, 500);
1222
  }
1223
 
1224
- function toggleDevMode() {
1225
- isDevMode = !isDevMode;
1226
-
1227
- if (isConnected) {
1228
- disconnectScanner();
1229
- }
1230
-
1231
- detectScanners();
1232
- updateUI();
1233
- }
1234
-
1235
- function toggleHardwareStatus() {
1236
- if (isDevMode) {
1237
- alert('In Developer Mode, hardware status is simulated.\nSwitch to Live Mode for real hardware detection.');
1238
- } else {
1239
- alert('In Live Mode, the app will attempt to detect actual connected hardware.');
1240
- }
1241
  }
1242
 
1243
  function showConnectionMethodModal() {
@@ -1270,15 +1101,7 @@
1270
  }
1271
 
1272
  function saveImage() {
1273
- if (!previewImage.src) {
1274
- alert('No scan result to save');
1275
- return;
1276
- }
1277
-
1278
- // In a real app, this would trigger a file save dialog
1279
- // Here we simulate it with a success message
1280
- statusMessage.textContent = 'Image saved successfully';
1281
- saveImageBtn.disabled = true;
1282
  }
1283
 
1284
  function resetSettings() {
@@ -1318,21 +1141,6 @@
1318
  const valueElement = document.getElementById(sliderId.replace('Slider', 'Value'));
1319
  valueElement.textContent = e.target.value;
1320
  }
1321
-
1322
- function getRandomPreviewImage() {
1323
- // This would be a real image URL in a live app
1324
- // For demonstration, we use placeholder images
1325
- const randomImages = [
1326
- 'https://source.unsplash.com/random/600x400/?photograph,film',
1327
- 'https://source.unsplash.com/random/600x400/?document,scan',
1328
- 'https://source.unsplash.com/random/600x400/?negative,film',
1329
- 'https://source.unsplash.com/random/600x400/?photo,slide',
1330
- 'https://source.unsplash.com/random/600x400/?picture,archive'
1331
- ];
1332
-
1333
- // Add a cache-busting parameter to force image reload
1334
- return randomImages[Math.floor(Math.random() * randomImages.length)] + '&t=' + new Date().getTime();
1335
- }
1336
  </script>
1337
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=WDFluho/flextight-control1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1338
  </html>
 
17
  firewire: '#FF4500',
18
  thunderbolt: '#0071C5',
19
  usb: '#00a651',
20
+ network: '#8e44ad'
 
 
21
  }
22
  }
23
  }
 
142
  .interface-network {
143
  background-color: #8e44ad;
144
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  </style>
146
  </head>
147
  <body class="bg-gray-100">
 
171
  <i class="fas fa-plug text-xl"></i>
172
  <span class="tooltip">Connection method</span>
173
  </button>
 
 
 
 
174
  <button id="infoBtn" class="text-primary hover:text-primary/80 tooltip-container">
175
  <i class="fas fa-info-circle text-xl"></i>
176
  <span class="tooltip">Information</span>
 
421
  <i class="fas fa-eye mr-1"></i> Preview
422
  </button>
423
  <button id="scanBtn" class="w-1/2 bg-primary text-white py-2 px-4 rounded hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed">
424
+ <i class="fas fa-sscan mr-1"></i> Scan
425
  </button>
426
  </div>
427
  </div>
 
649
  </h3>
650
  <ul class="text-xs text-gray-600 space-y-1">
651
  <li class="flex items-start">
652
+ <i class="fas fa-check-circle text-green-500 mr-1 mt=0.5"></i>
653
  <span>Install vendor-specific USB drivers</span>
654
  </li>
655
  <li class="flex items-start">
656
+ <i class="fas fa-check-circle text-green-500 mr-1 mt=0.5"></i>
657
  <span>Use USB 3.0+ for high resolution</span>
658
  </li>
659
  <li class="flex items-start">
660
+ <i class="fas fa-check-circle text-green-500 mr-1 mt=0.5"></i>
661
  <span>Avoid USB hubs for stability</span>
662
  </li>
663
  </ul>
 
668
  </div>
669
 
670
  <script>
671
+ // Scanner detection implementation for Live Mode
 
 
 
 
 
672
 
673
  // DOM elements
674
  const scannerSelect = document.getElementById('scannerSelect');
 
682
  const connectionText = document.getElementById('connectionText');
683
  const connectionTooltip = document.getElementById('connectionTooltip');
684
  const refreshDevicesBtn = document.getElementById('refreshDevicesBtn');
 
685
  const liveIndicator = document.getElementById('liveIndicator');
686
  const hardwareStatusBtn = document.getElementById('hardwareStatusBtn');
687
  const hardwareStatusText = document.getElementById('hardwareStatusText');
 
693
  const standardModeBtn = document.getElementById('standardModeBtn');
694
  const expertModeBtn = document.getElementById('expertModeBtn');
695
  const scannerPanel = document.getElementById('scannerPanel');
 
696
  const scannerLight = document.getElementById('scannerLight');
697
  const progressContainer = document.getElementById('progressContainer');
698
  const progressBar = document.getElementById('progressBar');
 
714
  // State variables
715
  let isConnected = false;
716
  let isExpertMode = false;
 
717
  let currentScanner = null;
718
  let connectionMethod = 'auto';
719
  let scanningProgress = 0;
720
  let timer = null;
721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
  // DOM Content Loaded
723
  document.addEventListener('DOMContentLoaded', function() {
724
  initializeApp();
 
730
  previewBtn.addEventListener('click', startPreview);
731
  scanBtn.addEventListener('click', startScan);
732
  refreshDevicesBtn.addEventListener('click', refreshScanners);
733
+ hardwareStatusBtn.addEventListener('click', showHardwareInfo);
 
734
  connectionMethodBtn.addEventListener('click', showConnectionMethodModal);
735
  closeConnectionModalBtn.addEventListener('click', hideConnectionMethodModal);
736
  saveConnectionPrefBtn.addEventListener('click', saveConnectionPreferences);
 
785
  // Update expert mode
786
  if (isExpertMode) {
787
  expertModeBtn.classList.add('bg-primarydark');
788
+ document.getElementById('appContainer').classList.add('expert-mode');
789
  } else {
790
  expertModeBtn.classList.remove('bg-primarydark');
791
+ document.getElementById('appContainer').classList.remove('expert-mode');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  }
793
  }
794
 
 
800
  scannerSelect.remove(1);
801
  }
802
 
803
+ // Attempt to detect real scanners
804
+ detectRealScanners().then(scanners => {
805
+ if (scanners.length > 0) {
 
 
 
 
 
 
 
 
 
 
806
  let preferredScannerIndex = -1;
807
 
808
  // Add detected scanners to dropdown
809
+ scanners.forEach((scanner, index) => {
810
  const option = document.createElement('option');
811
  option.value = scanner.id;
812
 
813
  // Add interface indicator
814
  let interfaceClass = '';
815
+ if (scanner.interface === 'Thunderbolt') interfaceClass = 'interface-thunderbolt';
816
+ if (scanner.interface === 'Firewire') interfaceClass = 'interface-firewire';
817
+ if (scanner.interface === 'USB') interfaceClass = 'interface-usb';
818
+ if (scanner.interface === 'Network') interfaceClass = 'interface-network';
819
 
820
  option.innerHTML = `<span class="${interfaceClass} interface-indicator"></span>${scanner.name}`;
821
  scannerSelect.appendChild(option);
822
 
823
  // Check if this matches our connection priority
824
+ if (connectionPriority.value.toLowerCase() === scanner.interface.toLowerCase() ||
825
+ (connectionPriority.value === 'any' && preferredScannerIndex === -1)) {
826
  preferredScannerIndex = index;
827
  }
828
  });
829
 
830
  // Select preferred scanner if found
831
  if (preferredScannerIndex >= 0) {
832
+ scannerSelect.selectedIndex = preferredScannerIndex + 1;
833
  }
834
 
835
+ statusMessage.textContent = `${scanners.length} scanner(s) found`;
836
  connectionIndicator.classList.remove('bg-gray-500');
837
  connectionIndicator.classList.add('bg-yellow-500');
838
  connectionText.textContent = 'Devices available';
 
845
  connectionText.textContent = 'No devices';
846
  connectionTooltip.textContent = 'No compatible scanners were detected';
847
  }
848
+ }).catch(error => {
849
+ console.error('Scanner detection error:', error);
850
+ statusMessage.textContent = 'Error detecting scanners';
851
+ connectionIndicator.classList.add('bg-gray-500');
852
+ connectionText.textContent = 'Detection failed';
853
+ connectionTooltip.textContent = 'Error scanning for devices: ' + error.message;
854
+ });
855
  }
856
 
857
+ function detectRealScanners() {
858
+ return new Promise((resolve, reject) => {
859
+ try {
860
+ // In a real application, this would interface with:
861
+ // 1. SANE backend (Linux)
862
+ // 2. TWAIN drivers (Windows)
863
+ // 3. Image Capture Framework (Mac)
864
+ //
865
+ // This is a simulation of what that API might look like
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
866
 
867
+ // Simulate detection delay
868
+ setTimeout(() => {
869
+ // Check if the browser has TWAIN or WIA access (not possible in real web apps)
870
+ const hasTwainAccess = false;
871
+ const hasWiaAccess = false;
872
+
873
+ if (hasTwainAccess) {
874
+ // In a real native app, we would enumerate TWAIN devices
875
+ resolve([
876
+ {
877
+ id: 'usb-real-001',
878
+ name: 'Epson Perfection V600 (USB)',
879
+ model: 'Perfection V600',
880
+ vendor: 'Epson',
881
+ type: 'Flatbed Scanner',
882
+ resolution: '6400 dpi',
883
+ dynamicRange: '3.4 Dmax',
884
+ interface: 'USB'
885
+ }
886
+ ]);
887
+ } else if (hasWiaAccess) {
888
+ // In a real native app, we would enumerate WIA devices
889
+ resolve([
890
+ {
891
+ id: 'usb-real-002',
892
+ name: 'Canon CanoScan 9000F (USB)',
893
+ model: 'CanoScan 9000F',
894
+ vendor: 'Canon',
895
+ type: 'Film Scanner',
896
+ resolution: '9600 dpi',
897
+ dynamicRange: '3.6 Dmax',
898
+ interface: 'USB'
899
+ }
900
+ ]);
901
+ } else {
902
+ // In a real web application, we would need a:
903
+ // 1. Browser extension that provides scanner access
904
+ // 2. Localhost server that interfaces with SANE/TWAIN
905
+ // 3. Electron/NW.js app with native bindings
906
+
907
+ // For this demo, we'll just return an empty array
908
+ resolve([]);
909
+
910
+ // If this were a real native app, we would:
911
+ // try {
912
+ // const devices = window.scannerAPI.getDevices();
913
+ // resolve(devices);
914
+ // } catch (error) {
915
+ // reject(error);
916
+ // }
917
+ }
918
+ }, 1500);
919
+ } catch (error) {
920
+ reject(error);
921
  }
922
  });
 
 
923
  }
924
 
925
  function toggleScannerConnection() {
 
940
 
941
  statusMessage.textContent = 'Establishing connection...';
942
 
943
+ // In a real app, we would call the scanner API to connect
944
+ // For this demo, we'll just simulate connecting to a generic scanner
945
+ setTimeout(() => {
946
+ currentScanner = {
947
+ id: selectedScannerId,
948
+ name: scannerSelect.options[scannerSelect.selectedIndex].text.replace(/<[^>]*>/g, '').trim(),
949
+ model: 'Connected Scanner',
950
+ vendor: 'Manufacturer',
951
+ type: 'Flatbed Scanner',
952
+ resolution: '1200 dpi',
953
+ dynamicRange: '3.0 Dmax',
954
+ interface: 'USB'
955
+ };
956
+
957
+ isConnected = true;
958
+
959
+ // Update scanner details
960
+ scannerModel.textContent = currentScanner.model;
961
+ scannerVendor.textContent = currentScanner.vendor;
962
+ scannerType.textContent = currentScanner.type;
963
+ scannerResolution.textContent = currentScanner.resolution;
964
+ scannerDynamicRange.textContent = currentScanner.dynamicRange;
965
+ scannerInterface.textContent = currentScanner.interface;
966
+
967
+ // Update connection info
968
+ connectionTypeInfo.innerHTML = `Connected via <strong class="text-primary">${currentScanner.interface}</strong> to <strong>${currentScanner.vendor} ${currentScanner.model}</strong>`;
969
+ connectionInfo.classList.remove('hidden');
970
+
971
+ // Interface-specific styling
972
+ if (currentScanner.interface === 'Thunderbolt') {
973
+ scannerPanel.classList.add('border-thunderbolt');
974
+ } else if (currentScanner.interface === 'Firewire') {
975
+ scannerPanel.classList.add('border-firewire');
976
+ } else if (currentScanner.interface === 'USB') {
977
+ scannerPanel.classList.add('border-usb');
978
+ } else if (currentScanner.interface === 'Network') {
979
+ scannerPanel.classList.add('border-network');
980
+ }
981
+
982
+ statusMessage.textContent = `Connected to ${currentScanner.vendor} ${currentScanner.model}`;
983
+ scannerDetails.classList.remove('hidden');
984
+ updateUI();
985
+ }, 1000);
 
 
 
 
986
  }
987
 
988
  function disconnectScanner() {
 
1014
  statusMessage.textContent = 'Creating preview scan...';
1015
  scannerLight.style.opacity = '1';
1016
 
1017
+ // In a real app, we would call the scanner API to do a preview scan
1018
+ // This is just a simulation
 
 
 
 
 
 
1019
  setTimeout(() => {
 
 
 
 
1020
  statusMessage.textContent = 'Preview completed';
1021
+ scannerLight.style.opacity = '0';
1022
+ alert("In a real application, this would show a preview from the connected scanner.");
1023
+ }, 1500);
1024
  }
1025
 
1026
  function startScan() {
 
1033
  progressPercent.textContent = '0%';
1034
  scanningProgress = 0;
1035
 
1036
+ // In a real app, we would call the scanner API to do a full scan
1037
+ // This is just a simulation of progress
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1038
  clearInterval(timer);
1039
  timer = setInterval(() => {
1040
+ scanningProgress += 5;
1041
 
1042
  if (scanningProgress >= 100) {
1043
  scanningProgress = 100;
 
1046
  progressBar.style.width = '100%';
1047
  progressPercent.textContent = '100%';
1048
  scannerLight.style.opacity = '0';
1049
+ statusMessage.textContent = 'Scan completed';
1050
+ alert("In a real application, this would show the scanned image.");
 
 
 
 
 
 
 
 
 
 
 
 
1051
  } else {
1052
  progressBar.style.width = `${scanningProgress}%`;
1053
+ progressPercent.textContent = `${scanningProgress}%`;
1054
  }
1055
+ }, 100);
1056
  }
1057
 
1058
  function refreshScanners() {
 
1067
  }, 500);
1068
  }
1069
 
1070
+ function showHardwareInfo() {
1071
+ alert("Live Mode: The application will attempt to detect actual connected hardware. For full functionality, this should be run as a native application with proper scanner drivers installed.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1072
  }
1073
 
1074
  function showConnectionMethodModal() {
 
1101
  }
1102
 
1103
  function saveImage() {
1104
+ alert("In a real application, this would save the scanned image to disk.");
 
 
 
 
 
 
 
 
1105
  }
1106
 
1107
  function resetSettings() {
 
1141
  const valueElement = document.getElementById(sliderId.replace('Slider', 'Value'));
1142
  valueElement.textContent = e.target.value;
1143
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1144
  </script>
1145
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=WDFluho/flextight-control1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1146
  </html>
prompts.txt CHANGED
@@ -1 +1 @@
1
- find errors and debug the site, set all settings to live mode and search for real connections (USB, Thunderbolt, Firewire, Network), Live Mode should change between Live and Developer Mode with fake data
 
1
+ turn off demonstration mode and check for real devices in Live Mode