Уважаемые, если не трудно, помогите советом.
Скрипт был написан года 3 назад, Opera работала как надо, IE не работал (да и бог с ним). Но вот обновил Оперу до 9 версии, и вместо пробелов в ссалках стали подставляться %20, что повлияло как на отображение текста, так и на функцию сравнения, и на понимание Windows Media Player'ом локальных адресов. Может дело всетаки в скрипте.
Скрипт был написан года 3 назад, Opera работала как надо, IE не работал (да и бог с ним). Но вот обновил Оперу до 9 версии, и вместо пробелов в ссалках стали подставляться %20, что повлияло как на отображение текста, так и на функцию сравнения, и на понимание Windows Media Player'ом локальных адресов. Может дело всетаки в скрипте.
Код:
<html>
<head><meta http-equiv="content-type" content="text/html; charset=windows-1251"></head>
<script language="JavaScript">
<!-- hide
iPath = 0;
iArtist = 1;
iYear = 2;
iAlbum = 3;
iBitRate = 4;
iStyle = 5;
myArray = new Array(
// path, name, year, work, rate, style
// new Array("", "", "", "", " kbps", ""),
// new Array("Jazz/", "", "", "", " kbps", ""),
// new Array("Metal/", "", "", "", " kbps", ""),
// new Array("Rock/", "", "", "", " kbps", ""),
// new Array("misc/", "", "", "", " kbps", ""),
new Array("Rock/", "AC DC", "1980", "Back In Black", "256 kbps", ";All;Rock;Hard Rock;"),
new Array("Rock/", "AC DC", "1990", "The Razors Edge", "160 kbps", ";All;Rock;Hard Rock;"),
new Array("Metal/", "Accept", "1979", "Accept", "160 kbps", ";All;Metal;Heavy Metal;"),
new Array("Metal/", "Accept", "1980", "I`m A Rebel", "160 kbps", ";All;Metal;Heavy Metal;"),
new Array("Metal/", "Accept", "1981", "Breaker", "160 kbps", ";All;Metal;Heavy Metal;"),
new Array("", "", "", "", "", "")
);
function IndexNext (sStyle, iIndex) {
var i, iSize, iReturn
if (iIndex > 0) {iIndex = iIndex;} else {iIndex = 0;}
iSize = myArray.length;
iReturn = -1;
for (i = iIndex; i < iSize; i++) {
if (myArray[i][iStyle].indexOf(sStyle) > -1) {
iReturn = i;
break;
}
}
return(iReturn);
} // end function IndexNext
function Main() {
var i, iArraySize, iCount, iIndex, iResult, sLocation, sPath, sStyle;
i = location.href.indexOf("?", 0);
iArraySize = myArray.length - 1;
iCount = 1;
iIndex = 0;
if (i > 0) {
sLocation = location.href.substring(0, i);
} else {
sLocation = location.href;
}
sStyle = location.search.substring(7, location.search.length);
document.write("<table width=100%><tr><td>");
document.write("<a href = '" + sLocation + "?style=All'>All</a></td> <td></td></tr><tr valign=top><td>");
document.write(" <a href = '" + sLocation + "?style=Jazz'>Jazz</a></td><td>(");
document.write("<a href = '" + sLocation + "?style=Ambient Jazz'>Ambient</a>, ");
document.write("<a href = '" + sLocation + "?style=Vocal Jazz'>Vocal Jazz</a>)</td></tr><tr valign=top><td>");
document.write(" <a href = '" + sLocation + "?style=Metal'>Metal</a></td><td>(");
document.write("<a href = '" + sLocation + "?style=Alternative Metal'>Alternative</a>, ");
document.write("<a href = '" + sLocation + "?style=Heavy Metal'>Heavy</a>, ");
document.write("<a href = '" + sLocation + "?style=Viking Metal'>Viking</a>)</td></tr><tr valign=top><td>");
document.write(" <a href = '" + sLocation + "?style=Rock'>Rock</a></td><td>(");
document.write("<a href = '" + sLocation + "?style=Alternative Rock'>Alternative</a>, ");
document.write("<a href = '" + sLocation + "?style=Hard Rock'>Hard</a>, ");
document.write("<a href = '" + sLocation + "?style=Russian Rock'>Russian</a>)</td></tr><tr valign=top><td>");
document.write(" <a href = '" + sLocation + "?style=misc'>misc</a></td><td>(");
document.write("<a href = '" + sLocation + "?style=Various Styles'>Various Styles</a>, ");
document.write("<a href = '" + sLocation + "?style=Vocal Blues'>Vocal Blues</a>)</td></tr></table>");
if (sStyle != "") { // if 1
document.write("<center><b>" + sStyle + "</b>");
iResult = sLocation.indexOf("index.html");
if (iResult != -1) { //if 2
document.write(" (<a href = '" + sLocation.substring(0, iResult) + "index by date.html?style=" + sStyle + "'>sort by Year</a>)");
} // end if 2
document.write("</center>");
sStyle = ";" + sStyle + ";";
iResult = IndexNext (sStyle, iIndex);
if (iResult != -1) { // if 3
iIndex = iResult;
document.write("<table border=1 width=100%>");
while (iIndex < iArraySize) { // while 1
iResult = IndexNext (sStyle, iIndex);
if (iResult == -1) { // if 4
iIndex = iArraySize;
} else {
iIndex = iResult;
document.write("<tr>")
document.write("<td align=left width=100%>")
document.write(" " + iCount + " - " + (iCount + 3) )
document.write("</td>")
document.write("</tr>")
document.write("<tr><td align=left width=100%><table border=0 width=100%><tr>")
for (i = 0; i < 4; i++) { // for 1
document.write("<td align=center width=25%>");
iResult = IndexNext (sStyle, iIndex);
if (iResult == -1) { // if 5
document.write(" ");
} else {
iIndex = iResult;
sPath = myArray[iIndex][iPath] + myArray[iIndex][iArtist] + "/" + myArray[iIndex][iArtist] + " - " + myArray[iIndex][iYear] + " - " + myArray[iIndex][iAlbum] + " (" + myArray[iIndex][iBitRate] + ")/";
document.write("<a href='" + sPath + "playlist.m3u'>");
document.write(" <table border=0 width=100%>");
document.write(" <tr>");
document.write(" <td bgcolor = #000000 align=center width=100%>");
document.write(" <img src='" + sPath + "cover.jpg' width=100%>");
document.write(" </td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td align=center width=100%>");
document.write(" " + myArray[iIndex][iArtist]);
document.write(" </td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td align=center width=100%>");
document.write(" <font color=#555555>" + myArray[iIndex][iYear] + "</font>");
document.write(" </td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td align=center width=100%>");
document.write(" " + myArray[iIndex][iAlbum]);
document.write(" </td>");
document.write(" </tr>");
document.write(" <tr>");
document.write(" <td align=center width=100%>");
document.write(" <font color=#AAAAAA>" + myArray[iIndex][iBitRate] + "</font>");
document.write(" </td>");
document.write(" </tr>");
document.write(" </table>");
document.write("</a>");
iCount++;
iIndex++;
} // end if 5
document.write("</td>");
} // end for 1
document.write("</tr></table></td></tr>")
} // end if 4
} // end while 1
document.write("</table");
} // end if 3
} // end if 1
} // end function Main
Main();
// -->
</script>
</html>