(function(){
"use strict";
// Styling properties to apply
var styleProps = {
position: 'fixed',
left: '20px',
bottom: '20px',
zIndex: '99999',
width: '160px',
height: '130px',
pointerEvents: 'auto' // allow clicks
};
function applyStyle(el) {
if (!el) return false;
try {
Object.keys(styleProps).forEach(function(k){
el.style.setProperty(k, styleProps[k], 'important');
});
// ensure container doesn't block pointer if overlay
el.style.pointerEvents = 'auto';
return true;
} catch(e) {
return false;
}
}
function findSeal() {
var selectors = [
'#DunsRegisteredSeal', // common id
'iframe#TpTpmsSealIFrm', // iframe id from docs
'iframe[src*="TpTpmsSeal.aspx"]', // iframe src
'iframe[src*="dunsregistered"]', // any dunsregistered iframe
'.DunsRegisteredSeal', // possible class
'[id*="Duns"]' // any id containing Duns
];
for (var i = 0; i < selectors.length; i++) {
var el = document.querySelector(selectors[i]);
if (el) return el;
}
// fallback: check all iframes for dunsregistered in src
var ifr = document.getElementsByTagName('iframe');
for (var j = 0; j < ifr.length; j++) {
try {
var src = ifr[j].getAttribute('src') || '';
if (src.indexOf('dunsregistered') !== -1 || src.indexOf('profiles.dunsregistered.com') !== -1) {
return ifr[j];
}
} catch(e){}
}
return null;
}
// Try immediately, then repeatedly until found or attempts exhausted
function initPositioning() {
var found = findSeal();
if (found) {
applyStyle(found);
return true;
}
return false;
}
// Try immediately
if ( ! initPositioning() ) {
// Try at intervals (in case the script injects later)
var attempts = 0;
var maxAttempts = 40; // 40 * 250ms = 10 seconds
var interval = setInterval(function(){
attempts++;
if ( initPositioning() || attempts >= maxAttempts ) {
clearInterval(interval);
}
}, 250);
// Additionally observe DOM changes to catch insertion
try {
var mo = new MutationObserver(function(mutations){
if ( initPositioning() ) {
mo.disconnect();
}
});
mo.observe(document.documentElement || document.body, { childList: true, subtree: true });
} catch(e) {
// MutationObserver not supported, rely on interval only
}
}
// Extra: ensure the iframe (if any) has no border and is clickable
setTimeout(function(){
var el = findSeal();
if (el && el.tagName && el.tagName.toLowerCase() === 'iframe') {
el.setAttribute('frameborder','0');
el.setAttribute('scrolling','no');
}
}, 1200);
})();