I love to pimp my Chrome/Chromium experience with JavaScript/Bookmarklets, but now i am facing the following problem:
The code
javascript:/*img2float*/ var str=prompt("src of img to float",document.querySelector("img").getAttribute('src'));str.length>0?content=str:content="Alap/Alap00.gif",document.querySelector("img[src*='"+content+"']").style.cssText="position:fixed;left:0;top:0;max-height:200px;box-shadow: 1px 1px 46px -21px;opacity:0.9";
Explained
var src=prompt("src of <img> to float",document.querySelector("img").getAttribute('src'));
src attribute of first <img>scr.length>0?
if NOT NULLvar ThisDOM=src:
ThisDOM = prompted value, elseThisDOM="Alap/Alap00.gif",
default, most used settingsdocument.querySelector("img[src*='"+ThisDOM+"']").
select the desired <img>style.cssText=
add desired css style"position:fixed;left:0;top:0;max-height:200px;box-shadow: 1px 1px 46px -21px;opacity:0.9";
css style settings
The problem
- [✔] Running the code from DevTools>Console apply the css style settings to the image properly,
- [ø] but running from the Bookmarklet just printing out the css style settings (Explained at 7.)