All pastes #834823 Raw Edit

Zeug

public text v1 · immutable
#834823 ·published 2007-12-28 14:20 UTC
rendered paste body
    <html>
    <head>
    <title>AKAKAK/Krypta-Koordinatenchecker</title>
    </head>
    <body>
    <script>
    function check_coords() {
        var x = document.Coord_Check_Form.Coord_X.value;
        var y = document.Coord_Check_Form.Coord_Y.value;
       
        var ta = document.Coord_Check_Form.res;

        ta.value = ta.value + x + "|" + y + ": " + check(x, y) + "\r\n";
    }

    function check(x, y) {
    var re = /^\s*(-?)\s*(\d+)\s*$/;
    if (!x.match(re) || !y.match(re)) return "keine Koordinaten";


        if (!(x >= -400 && x <= 400)) return "ung&uuml;ltige Koordinaten";

        var Coord = new Array();

        Coord[0] = new Object();
        Coord[0].x = -103;
        Coord[0].y = -155;

        Coord[1] = new Object();
        Coord[1].x = -117;
        Coord[1].y = -174;

        Coord[2] = new Object();
        Coord[2].x = -129;
        Coord[2].y = -180;

        Coord[3] = new Object();
        Coord[3].x = -132;
        Coord[3].y = -401;

        var c = 0;
        var prevy = 401;

        while (c < 6) {
            if (y > Coord[c].y) {
                if (x == Coord[c].x || (y == prevy && x >= Coord[c].x && x <= prevx)) return "Grenzlinie";
                if (x > Coord[c].x) return "AKAKAK";
                return "Krypta";
            }
            prevx = Coord[c].x;
            prevy = Coord[c].y;
            c = c + 1;
        }
    }
    </script>

    <form name="Coord_Check_Form" action="" method="GET" enctype="text/plain">
    <table>
    <tr>
    <td>Koordinaten: </td><td><input name="Coord_X" size="5">|<input name="Coord_Y" size="5"></td>
    </tr>
    <tr>
    <td colspan=2><textarea name="res" rows="12" cols="30"></textarea></td>
    </tr>
    <tr>
    <td><input type="button" value="Koordinaten pr&uuml;fen" onClick="check_coords(this.form);"></td>
    <td><input type="button" value="Ergebnisliste leeren" onClick="this.form.res.value='';"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>