1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
| <html>
<head>
<title>Meteo Consorzio Lamma</title>
<SCRIPT LANGUAGE=javascript>
<!--
// ---------------------------------------------------------------------------
// -- Scriptname : Javascript Fusker --
// -- Author : Bas de Reuver --
// -- Date : 8-may-2004 --
// -- Description : Sometimes someone put up lots of pictures (Pic001.jpg, --
// -- Pic002.jpg etc.) without a proper overview or index --
// -- page. This script takes an URL and dumps all pictures --
// -- in the HTML document so you can view them more easily. --
// -- Idea sort of taken from http://fusker.lewww.com --
// -- fusker: [Danish], n. cheater, hacker --
// -- 14-jul-2004 Johann Zacharee sent in some updates and ideas --
// -- added nested number ranges and removed hardcoded "fusker.html" name. --
// ---------------------------------------------------------------------------
// script modified by webmaster@fuckingright.com to clear text box when clicked on
// ---------------------------------------------------------------------------
function GenerateContent()
{
var strParameter = window.location.search;
// if (strParameter.charAt (0) != '?')
// return(1);
strParameter = strParameter.substring(1, strParameter.length);
//next link has info on 'command-line' arguments
//http://sharkysoft.com/tutorials/jsa/content/043.html
if (strParameter == '')
{
}
else
{
// must contain 'http://' or 'ftp://' or something
if (strParameter.indexOf('://') < 0)
{strParameter = 'http://' + strParameter}
strParameter = strParameter.replace(/%5B/g, '['); // g=global, replace all
strParameter = strParameter.replace(/%5D/g, ']');
ProcessURL('', strParameter); // start recursion
}
}
function RemoveLeadingZeros(strInput)
{
// remove zero's because else parseInt('0123') interprets as octal number and returns 83
i = 0
while (strInput.substr(i, 1) == '0') {i++}
// incase all zero's then the string is empty now
if (strInput.length == i)
// put one '0' character in string
{strInput = '0'}
else
// removeonly keep valid digits '00123' -> '123'
{strInput = strInput.substr(i)}
return strInput;
}
function WriteURLtoDocument(strURL)
{
document.writeln('<p><img src="' + strURL + '"><br>');
document.writeln('<a href="' + strURL + '">' + strURL + '</a></p>');
}
// ExamineURL(strFirst, strLast) takes an URL and determines where the number-part is located.
// example: strFirst='http://www.bla.com/user/test[01-10].jpg'
// will show pictures test01.jpg through test10.jpg
function ProcessURL(strFirstPart, strLastPart)
{
var strBegin = '';
var strEnd = '';
var iStartNr = -1;
var iEndNr = -1;
var iDigits = 0 // number of digits, example 3 digits, then 1 becomes '001'
var strTemp;
var strNumberPart = '';
var i;
//force typecast to string
strFirstPart = strFirstPart + '';
strLastPart = strLastPart + '';
// check for '[01-10]' part
var iBegin = strLastPart.indexOf('[');
var iEnd = strLastPart.indexOf(']');
if (iBegin < 0 || iEnd < 0)
{
// no more number parts, print to HTML document
WriteURLtoDocument(strFirstPart + strLastPart);
return -1;
};
// there are more number parts, process it
strBegin = strFirstPart + strLastPart.substr(0, iBegin);
strEnd = strLastPart.substr(iEnd+1, strLastPart.length-iEnd);
var strTemp = strLastPart.substr(iBegin+1, (iEnd-iBegin-1));
var iDash = strTemp.indexOf('-');
if (iDash < 0)
{
WriteURLtoDocument(strFirstPart + strLastPart);
return -1;
};
var strStartNr = strTemp.substr(0, iDash);
iDigits = strStartNr.length;
strStartNr = RemoveLeadingZeros(strStartNr);
var strEndNr = strTemp.substr(iDash+1, strTemp.length-iDash-1);
strEndNr = RemoveLeadingZeros(strEndNr);
if (isNaN(strStartNr) == true || isNaN(strEndNr) == true)
{
WriteURLtoDocument(strFirstPart + strLastPart);
return -1;
}
iStartNr = parseInt(strStartNr);
iEndNr = parseInt(strEndNr);
// call ProcessURL recursively
for (i = iStartNr; i <= iEndNr; i++)
{
strNr = i + ''; // typecast to string
while (strNr.length < iDigits)
{strNr = '0' + strNr}
// recursive call
strTemp = strBegin + strNr;
ProcessURL(strTemp, strEnd);
}
}
function DisplayHelp()
{
document.formulaire.URL.value = '';
HandleSubmit();
}
function HandleSubmit()
{
// when user types in textbox and presses enter, this function is called
var strParameter = document.formulaire.affichage.value;
// replace again, easier to copy into UBB codes ([url=..]) because that also uses '[' and ']'
strParameter = strParameter.replace(/\[/g, '%5B'); // g=global, replace all
strParameter = strParameter.replace(/\]/g, '%5D');
top.location = window.location.pathname + '?' + strParameter;
// next lines causes form not to reload (like pressing F5)
return false;
}
//-->
function initInput()
{
var url = "http://www.lamma.rete.toscana.it/models/ventoemare/%TYPE%_%REGION%_web_[1-3].png";
var type = formulaire.type.value;
url = url.replace("%TYPE%", type);
var region = formulaire.region.value;
url = url.replace("%REGION%", region);
document.formulaire.affichage.value = url;
}
</script>
</head>
<body onLoad="initInput()">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="220">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Arial" size="5"><span style="text-decoration: none">
Exemple</span></font></b></td>
<form name='formulaire'>
<td>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<select size="1" name="region" onChange="initInput()">
<option value="AA">Méditerranée</option>
<option value="K">Baléares</option>
<option value="R">Valencia</option>
</select></td>
<td>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<select size="1" name="type" onChange="initInput()">
<option value="wind10m">Vent</option>
<option value="mwp">Houle</option>
</select></td>
<td width="5">
<p style="margin-top: 0; margin-bottom: 0"> </td>
<td align="left">
<p style="margin-top: 0; margin-bottom: 0">
<INPUT TYPE="button" NAME="RefreshButton" value="GO" style="cursor:pointer; color:red; font-weight:bold;" onClick="HandleSubmit()"></td>
<td width="500" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<INPUT NAME="affichage"; value="" id="affichage"; color:red;" size="66"></td>
</FORM>
</table>
<hr>
<!-- insert pictures here -->
<SCRIPT LANGUAGE="JavaScript">
GenerateContent();
</SCRIPT>
</body>
</html> |
Partager