|
This is a GreaseMonkey should i type Grease Monkey javascript for more readbility :)
Any way the monkey script below displays all the images getting in from a loop . better words if there are series of
images ending with a number then it displays all of them on dobule click in pace of the oreginal one
eg if the image ends with
image10.jpg
double click on it.
It will display images image1.jpg image2.jpg image3.jpg etc.
Opps forgot the js. here u go.
// ==UserScript==
// @name Pics
// @namespace Pics
// @include *
// ==/UserScript==
var Images = document.getElementsByTagName('img');
var i = 0;
for (i = 0; i < images.length;="" i++)="" {="" images[i].addeventlistener("dblclick",="" downloadimages="" ,="" true);="" }="" function="" downloadimages()="" {="" var="" img1="this;" var="" imgstring="" ;="" var="" numstring="getlastintstring(img1.src)+" .";"="" var="" i="0;" imgstring="imgstring" +="">");
for (i = 0; i < 120;="" i++)="" {="" var="" im="img1.src.replace(numstring," i+".");="" imgstring="imgstring" +="">");
}
for (i = 0; i < 120;="" i++)="" {="" var="" im="img1.src.replace(numstring," "0"="" +="" i="" +="" ".");="" imgstring="imgstring" +="">");
}
for (i = 0; i < 120;="" i++)="" {="" var="" im="img1.src.replace(numstring," +="" "00"="" +="" i="" +="" ".");="" imgstring="imgstring" +="">");
}
for (i = 0; i < 120;="" i++)="" {="" var="" im="img1.src.replace(numstring," "000"="" +="" i="" +="" ".");="" imgstring="imgstring" +="">");
}
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
}
I have named the js as pic.
Note this works only on firefox with greasemonkey. u can make use of this javascript for other purposes as well.
Thanks!
Murugan
|