upfdated to ptint plugin
This commit is contained in:
29
py_app/chrome_extension/popup.js
Normal file
29
py_app/chrome_extension/popup.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// Popup script for Quality Recticel Print Helper
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('Popup loaded');
|
||||
|
||||
// Test print button
|
||||
document.getElementById('test-print').addEventListener('click', function() {
|
||||
chrome.runtime.sendMessage({action: 'get_printers'}, function(response) {
|
||||
if (response && response.success) {
|
||||
if (response.printers.length > 0) {
|
||||
alert(`✅ Found ${response.printers.length} printer(s):\n${response.printers.map(p => p.displayName).join('\n')}`);
|
||||
} else {
|
||||
alert('⚠️ No printers found. Please ensure a printer is installed and set as default.');
|
||||
}
|
||||
} else {
|
||||
const error = response?.error || 'Unknown error';
|
||||
if (error.includes('Chrome printing API not available')) {
|
||||
alert('⚠️ Chrome Printing API not available.\n\nThis may be due to:\n• Chrome version too old (need 85+)\n• Extension permissions not granted\n• Corporate/managed Chrome installation\n\nThe extension will use browser print dialog as fallback.');
|
||||
} else {
|
||||
alert('❌ Error getting printers: ' + error);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Settings button
|
||||
document.getElementById('open-settings').addEventListener('click', function() {
|
||||
chrome.tabs.create({url: 'chrome://settings/printing'});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user