|
Here is a javascript to display the images scripts that are not displayed in a page. I have sceen forums of some sites
where print view or printview diesnot display images its just shown as links. this code works with firefox to display
the pages in printview where the images are not displayed. in thread view there images are genearlly displayed.
Ideally a script to display images that are not displayed . wordpress or blogs u see the problem .
// ==UserScript==
// @name Show Image
// @namespace Pics
// @include *
// ==/UserScript==
String.prototype.contains = function (it) { return this.indexOf(it) != -1; };
File = new Object();
File.Exist = function (fileToCheck) {
var tmp = new Image;
tmp.src = fileToCheck;
if (tmp.complete) {
return true;
}
else {
window.setTimeout('File.Exist(fileToCheck)', 5000);
return false;
}
}
var taga = document.getElementsByTagName("a");
var odi = new Array();
for (var i = 0; i <= taga.length="" -="" 1;="" i++)="" {="" if="" ((taga[i]).innerhtml.tostring().contains(".jp"))="" {="" (taga[i]).innerhtml="taga[i].innerHTML" +="">=>";
taga[i].removeAttribute("target");
taga[i].removeAttribute("href");
}
}
var Images = document.getElementsByTagName('img');
var i = 0;
for (i = 0; i < images.length;="" i++)="" {="" images[i].addeventlistener("dblclick",="" downloadimages,="" true);="" }="" function="" downloadimages()="" {="" var="" to="300;" var="" img1="this;" var="" imgstring="img1.src;" var="" numstring="getlastintstring(imgstring);" var="" nozerostring="numstring+" .";"="" var="" zerostring="" ;="" var="" zerostringminus="zerostring;" while="" (nozerostring.contains("0"))="" {="" nozerostring="nozerostring.replace(" 0","="" '');="" zerostring="zerostring" +="" "0"="" }="" imgstring="imgstring.replace(zerostring,"><--zeros-->");
imgstring = imgstring.replace(nozerostring, "<--number-->.");
var i = 0;
var retval = "";
var exit1 = 0;
for (i = 1; i < to;="" i++)="" {="" var="" im=""><--zeros-->", zerostring).replace("<--number-->", i.toString());
if (i==1 || i == 10 || i == 100) {
if (File.Exist(im) == false) {
alert(im);
zerostring = zerostring + "0"
im = imgstring.replace("<--zeros-->", zerostring).replace("<--number-->", i.toString());
if (File.Exist(im) == false) {
zerostring = zerostring.replace("0", "");
zerostring = zerostring.replace("0", "");
im = imgstring.replace("<--zeros-->", zerostring).replace("<--number-->", i.toString());
}
}
}
retval = retval + ("");
}
newwindow = window.open();
newdocument = newwindow.document;
newdocument.write(retval);
newdocument.close();
//this.parentNode.innerHTML = imgstring;
}
function getlastintstring(str) {
var bnumeric = 0;
var strlength = str.length;
var numstr = "";
for (strlength = strlength; strlength > 0; strlength--) {
if (IsNumeric(str.substring(strlength, strlength + 1))) {
numstr = str.substring(strlength, strlength + 1) + numstr;
bnumeric = 1;
} else {
if (bnumeric > 0) {
return numstr;
}
}
}
return numstr;
}
function IsNumeric(val) {
if (isNaN(parseFloat(val))) {
return false;
}
return true
}
function outerHTML(node) {
// if IE, Chrome take the internal method otherwise build one
return node.outerHTML || (
function (n) {
var div = document.createElement('div'), h;
div.appendChild(n.cloneNode(true));
h = div.innerHTML;
div = null;
return h;
})(node);
}
--number-->--zeros-->--number-->--zeros-->--number-->--zeros-->--number-->--zeros-->
|