index.html |
resources.html |
resources.js |
workspace.html |
workspace.js |
reset.html |
reset.js |
sql-code.html |
sql-code.js
function updateSqlCodeArea() {
var
frWsp = window.opener.top.frames[0],
res, x, y;
document.frm.sqlCodeArea.value = '';
for (var i = 0; i != frWsp.document.getElementsByTagName('img').length; i++) {
res = frWsp.document.getElementsByTagName('img')[i].getAttribute('src').match(/\d+/).toString();
x = i % frWsp.mapSize.x;
y = Math.floor(i / frWsp.mapSize.x);
document.frm.sqlCodeArea.value +=
'INSERT INTO `MAP_EINS` (`xcord`, `ycord`, `townid`, `type`) VALUES (' + x + ', ' + y + ', 0, ' + res + ');\n';
}
}