updated to silent print
This commit is contained in:
@@ -3,17 +3,25 @@
|
||||
* Injects print service functionality into web pages
|
||||
*/
|
||||
|
||||
// Only inject on Quality Label Printing domains or localhost
|
||||
const allowedDomains = [
|
||||
'localhost',
|
||||
'127.0.0.1'
|
||||
];
|
||||
|
||||
const currentDomain = window.location.hostname;
|
||||
if (!allowedDomains.includes(currentDomain)) {
|
||||
console.log('Quality Label Printing Service: Not injecting on', currentDomain);
|
||||
// return; // Commented out for development - remove in production
|
||||
// Inject extension ID into the page as a hidden DOM element for detection
|
||||
function injectExtensionId() {
|
||||
try {
|
||||
const existing = document.getElementById('chrome-extension-id');
|
||||
if (existing) return; // Already injected
|
||||
const el = document.createElement('div');
|
||||
el.id = 'chrome-extension-id';
|
||||
el.setAttribute('data-extension-id', chrome.runtime.id);
|
||||
el.style.display = 'none';
|
||||
document.documentElement.appendChild(el);
|
||||
// Optionally, also set a global variable
|
||||
window.CHROME_EXTENSION_ID = chrome.runtime.id;
|
||||
console.log('Injected extension ID:', chrome.runtime.id);
|
||||
} catch (e) {
|
||||
console.warn('Failed to inject extension ID:', e);
|
||||
}
|
||||
}
|
||||
injectExtensionId();
|
||||
|
||||
console.log('Quality Label Printing Service: Content script loaded');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user