Probably I should either delete it, or hardcode the directory to the SVG graphics.
Update #2: Neither of those two things worked. The only effect of having the javascript in place is that the scroll bar disappears from the piece summary.
The script currently looks like this:
<script type="text/javascript">
function DirList(type) {
var root = '/membergraphics/';
var list = get_url(root + 'MSdealerschess/');
if(list.search('404') >= 0 || list.search('not found') >= 0) list = get_url('/graphics.dir/svg/alfaerie/list.php');
var lines = list.split('<');
var t = ':', total = 0;
for(var i=0; i<lines.length; i++) {
var one = lines[i].split('"');
if(one.length < 3) continue;
if(one[1].search('.png') < 0) continue;
one = one[1].split('.');
if(one.length < 2) continue;
if(one[0].search('w') != 0) continue;
one = one[0].substring(1, 30);
t += one + ':'; total++;
}
var t2 = '' + t, diagLines = original.split('\n');
for(i=0; i<diagLines.length-1; i++) {
if(diagLines[i].search('graphicsDir=') >= 0) diagLines[i] = 'graphicsDir=/membergraphics/MSdealerschess/';
if(diagLines[i].search('99') < 0) continue; // not a piece line
if(diagLines[i].search('--') >= 0) continue; // compound, keep
var fname = diagLines[i].split(':');
if(fname.length < 4) continue; // should not happen
fname = (fname[3] == '' ? fname[0].substring(8, 99) : fname[3]);
if(t2.search(':' + fname + ':') < 0) diagLines[i] = null;
else {
t = t.split(':' + fname + ':');
t = (t.length > 1 ? t[0] + ':' + t[1] : t[0]);
}
}
var tt = '';
for(i=0; i<diagLines.length-1; i++) if(diagLines[i]) tt += diagLines[i] + '\n';
t = t.split(':');
for(i=1; i<t.length-1; i++) tt += t[i] + ':::::99\n'
return tt;
}
I feel like I missed a line, or something similarly important and obvious.
OK, I'll take those parts out and give it a whirl. If this isn't edited with the results in a half hour, something went horribly, horribly wrong....
Update: Well, not horribly wrong. I strongly suspect that the line that's hanging me up is:
if(list.search('404') >= 0 || list.search('not found') >= 0) list = get_url(root + 'svg/alfaerie/list.php');
Probably I should either delete it, or hardcode the directory to the SVG graphics.
Update #2: Neither of those two things worked. The only effect of having the javascript in place is that the scroll bar disappears from the piece summary.
The script currently looks like this:
<script type="text/javascript">
function DirList(type) {
var root = '/membergraphics/';
var list = get_url(root + 'MSdealerschess/');
if(list.search('404') >= 0 || list.search('not found') >= 0) list = get_url('/graphics.dir/svg/alfaerie/list.php');
var lines = list.split('<');
var t = ':', total = 0;
for(var i=0; i<lines.length; i++) {
var one = lines[i].split('"');
if(one.length < 3) continue;
if(one[1].search('.png') < 0) continue;
one = one[1].split('.');
if(one.length < 2) continue;
if(one[0].search('w') != 0) continue;
one = one[0].substring(1, 30);
t += one + ':'; total++;
}
var t2 = '' + t, diagLines = original.split('\n');
for(i=0; i<diagLines.length-1; i++) {
if(diagLines[i].search('graphicsDir=') >= 0) diagLines[i] = 'graphicsDir=/membergraphics/MSdealerschess/';
if(diagLines[i].search('99') < 0) continue; // not a piece line
if(diagLines[i].search('--') >= 0) continue; // compound, keep
var fname = diagLines[i].split(':');
if(fname.length < 4) continue; // should not happen
fname = (fname[3] == '' ? fname[0].substring(8, 99) : fname[3]);
if(t2.search(':' + fname + ':') < 0) diagLines[i] = null;
else {
t = t.split(':' + fname + ':');
t = (t.length > 1 ? t[0] + ':' + t[1] : t[0]);
}
}
var tt = '';
for(i=0; i<diagLines.length-1; i++) if(diagLines[i]) tt += diagLines[i] + '\n';
t = t.split(':');
for(i=1; i<t.length-1; i++) tt += t[i] + ':::::99\n'
return tt;
}
I feel like I missed a line, or something similarly important and obvious.