messiejessica / imgmap

Automatically exported from code.google.com/p/imgmap
GNU General Public License v2.0
0 stars 0 forks source link

Automatically generate map Id and Name #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently the imgmap.prototype.getMapInnerHTML function takes care to
create the id and name for the map if they are empty, but if that function
isn't called then they will be empty by default.

The solution is to move the existing code to the getMapId and getMapName
functions:

imgmap.prototype.getMapInnerHTML = function() {
    var html = '';
    //foreach area properties
    for (var i=0; i<this.props.length; i++) {
        if (this.props[i]) {
            if (this.props[i].getElementsByTagName('input')[2].value != '') {
                html+= '<area shape="' + 
                    this.props[i].getElementsByTagName('select')[0].value + '" alt="' +
                    this.props[i].getElementsByTagName('input')[4].value + '" coords="' +
                    this.props[i].getElementsByTagName('input')[2].value + '" href="' +
                    this.props[i].getElementsByTagName('input')[3].value + '" target="' +
                    this.props[i].getElementsByTagName('select')[1].value + '" />';
            }
        }
    }
    //alert(html);
    return(html);
}

imgmap.prototype.getMapName = function() {
    if (this.mapname == '') {
        var now = new Date();
        this.mapname = 'imgmap' + now.getFullYear() + (now.getMonth()+1) +
now.getDate() + now.getHours() + now.getMinutes() + now.getSeconds();
    }

    return this.mapname;
}

imgmap.prototype.getMapId = function() {
    if (this.mapid == '') {
        this.mapid = this.getMapName() ;
    }
    return this.mapid;
}

Original issue reported on code.google.com by aml...@gmail.com on 9 Oct 2007 at 8:49

GoogleCodeExporter commented 8 years ago
It's fixed in SVN

Original comment by aml...@gmail.com on 3 Nov 2007 at 9:28