// marquee_placeholder.js // RJM Programming // November, 2021 var inpomp=null; var origmpv=''; var bigorigmpv=''; var cbrmpr=null; var mpsubis=0; var textwis=0.0; var elewdth=0.0; var dnsa=false; function getWidthOfText(txt, fontname, fontsize) { // thanks to https://stackoverflow.com/questions/2057682/determine-pixel-length-of-string-in-javascript-jquery/25467363#25467363 if(getWidthOfText.c === undefined){ getWidthOfText.c=document.createElement('canvas'); getWidthOfText.ctx=getWidthOfText.c.getContext('2d'); } var fontspec = fontsize + ' ' + fontname; if(getWidthOfText.ctx.font !== fontspec) getWidthOfText.ctx.font = fontspec; return getWidthOfText.ctx.measureText(txt).width; } function lookforinpomp() { if (!dnsa) { if (document.body.innerHTML.indexOf('don' + 'otstickaroun' + 'd=') != -1) { dnsa=true; } else if (document.head.innerHTML.indexOf('don' + 'otstickaroun' + 'd=') != -1) { dnsa=true; } } if (document.getElementById('s') && !inpomp) { if (('' + document.getElementById('s').placeholder) != '') { inpomp=document.getElementById('s'); origmpv=inpomp.placeholder; cbrmpr=inpomp.getBoundingClientRect(); elewdth=eval(-5 + eval('' + cbrmpr.width)); textwis=eval('' + getWidthOfText(origmpv, 'Arial', '12px')); if (inpomp && textwis > elewdth) { inpomp.placeholder+=' ' + origmpv + ' '; bigorigmpv=inpomp.placeholder; mpsubis=1; } } } if (!inpomp) { var inpqs=document.getElementsByTagName('input'); for (var jnpqs=0; jnpqs elewdth) { inpomp.placeholder+=' ' + origmpv + ' '; bigorigmpv=inpomp.placeholder; mpsubis=1; } } } } } if (inpomp && inpomp.value != '') { mpsubis=0; bigorigmpv=origmpv + ' ' + origmpv + ' '; inpomp.placeholder=bigorigmpv.substring(mpsubis); cbrmpr=inpomp.getBoundingClientRect(); elewdth=eval(-5 + eval('' + cbrmpr.width)); textwis=eval('' + getWidthOfText(origmpv, 'Arial', '12px')); //document.title='' + elewdth + ' vs ' + textwis; if (!dnsa) { setTimeout(lookforinpomp, 100); } } else if (inpomp && textwis > elewdth) { //alert('here1 textwis=' + textwis + ' elewdth=' + elewdth); inpomp.placeholder=bigorigmpv.substring(mpsubis); mpsubis++; if (eval(mpsubis % origmpv.length) == 0) { bigorigmpv+=' ' + origmpv + ' '; } cbrmpr=inpomp.getBoundingClientRect(); elewdth=eval(-5 + eval('' + cbrmpr.width)); textwis=eval('' + getWidthOfText(origmpv, 'Arial', '12px')); //document.title='' + elewdth + ' vs ' + textwis; setTimeout(lookforinpomp, 200); } else if (inpomp) { //alert('Here2 textwis=' + textwis + ' elewdth=' + elewdth); cbrmpr=inpomp.getBoundingClientRect(); elewdth=eval(-5 + eval('' + cbrmpr.width)); textwis=eval('' + getWidthOfText(origmpv, 'Arial', '12px')); if (textwis <= elewdth) { mpsubis=0; bigorigmpv=origmpv + ' ' + origmpv + ' '; inpomp.placeholder=bigorigmpv.substring(mpsubis); } else { inpomp.placeholder=bigorigmpv.substring(mpsubis); mpsubis++; if (eval(mpsubis % origmpv.length) == 0) { bigorigmpv+=' ' + origmpv + ' '; } } //document.title='' + elewdth + ' Vs ' + textwis; setTimeout(lookforinpomp, 200); } } setTimeout(lookforinpomp, 3000);