28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
/**
|
|
* Quality Label Printing Service - Content Script
|
|
* Injects print service functionality into web pages
|
|
*/
|
|
|
|
|
|
// 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');
|
|
|
|
// Remove all script injection and messaging. Only inject the extension ID for CSP compatibility.
|