firefoxでリンク先の画像をプレビューしたくなったので

拡張を探したらGreasemonkeyで書いたかんたんなのが見つかった

http://www.grauw.nl/projects/pc/greasemonkey/
Image links inline viewer


要素の下に表示されるのでポインタが下の方にあったら隠れてしまうのと、デカいサイズの時にうざいのと、aの中にIMGが入っててそもそもプレビューされてるやつをもう一回表示しちゃう点を修正してつかうことにした


{
  display: none;
  position: absolute;
  left: 0;
  max-width: 100%;
  margin: 0;
  border: none; }';

{
  display: none;
  position: fixed;
  left: 0;
  top:0;
  max-height:300px;
  max-width: 300px;
  margin: 0;
  border: none; }';
for (i=0; i<aElm.length; i++) {
	if (aElm[i].href.match(/\.(jpg|jpeg|gif|png)$/)) {
		var oImg = document.createElement('img');
		oImg.setAttribute('src',aElm[i].href);
		oImg.setAttribute('class','grauw-imageview');
		aElm[i].appendChild(oImg);
		aElm[i].setAttribute('class','grauw-imageview');
	}
}

for (i=0; i<aElm.length; i++) {
	if (aElm[i].href.match(/\.(jpg|jpeg|gif|png)$/)) {
		aC = aElm[i].childNodes;
		hasIMG = false;
		for (j=0; j<aC.length; j++) 
			 aCC = aC[j].tagName;
		if(aCC == 'img'||aCC == 'IMG') hasIMG = true;
		if(!hasIMG){
			var oImg = document.createElement('img');
			oImg.setAttribute('src',aElm[i].href);
			oImg.setAttribute('class','grauw-imageview');
			aElm[i].appendChild(oImg);
			aElm[i].setAttribute('class','grauw-imageview');
		}
	}
}