User:Sethladan/vector.js

From Lotro-Wiki.com
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
var COORDS = {
    
    mapHidden: true,
    
    createMapDiv: function() {
        var mapDiv = document.createElement("div");
        $(mapDiv).attr("id", "mapDiv");
        $(mapDiv).insertBefore($("#content").children()[0]);
    },

    assignMapEvents: function() {
        $(".coords").attr("id", function(index) {
            return "ctt" + index;
        })
        .on("mouseover", this.tryCoordsTip)
        .on("mouseout", this.hideCoordsTip)
        .on("mousemove", this.moveCoordsTip);
    },
    
    tryCoordsTip: function(event) {
        COORDS.mapHidden = false;
        var zoneInfo = this.className.replace("coords ", "");
        var zone = "Universe";
        if (zoneInfo) {
            rawMapInfo = zoneInfo.split("--");
            zone = rawMapInfo[0];
            xPos = rawMapInfo[1];
            yPos = rawMapInfo[2];
            console.log(zone + ", " + xPos + ", " + yPos);
        }
        //zoneImage = getImageAndDisplay(zone);
    },
    
    hideCoordsTip: function(event) {
        
    },
    
    moveCoordsTip: function(event) {
        
    }
}

COORDS.createMapDiv();
COORDS.assignMapEvents();