User:Eleazaros/coords.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.
/* Please see documentation at https://lotro-wiki.com/index.php/User:Eleazaros/coords.js/doc */

/*
   MapData: This is the only thing you need to modify when adding a new map.
   Sign convention: Use negative numbers for South and West.
            N
            ^
       -W <   > E
            v
           -S
   Example:
       The "Values of Anduin" map has the following limits:
           left edge of the screen = 81.4W
           right edge of the screen = 40.4W
           top edge of the screen = 18.3N
           bottom edge of the screen = 12.4S
       Therefore the MapData entry should be
           MapData["Vales of Anduin"] = { top:18.3, left:-81.4, bottom:-12.4, right:-40.4 };
           
   Optionally, you can set the color of the location dots.  (Sometimes the default light blue color
   doesn't provide a very good contrast, if there is a lot of blue on the map.)  To set the color,
   add a 'style' field to the MapData entry, referencing one of the color values in the 'Colors' array:
           MapData["Vales of Anduin"] = { top:18.3, left:-81.4, bottom:-12.4, right:-40.4, style:Colors.orange };
*/

Colors = {
    "purple" : "filter:hue-rotate(70deg)  grayscale(0)    brightness(1.0)",
    "pink"   : "filter:hue-rotate(120deg) grayscale(0)    brightness(1.0)",
    "red"    : "filter:hue-rotate(170deg) grayscale(0)    brightness(1.0)",
    "orange" : "filter:hue-rotate(200deg) grayscale(0)    brightness(1.0)",
    "green"  : "filter:hue-rotate(300deg) grayscale(0)    brightness(1.0)",
    "white"  : "filter:hue-rotate(0)      grayscale(100%) brightness(1.5)",
    "grey"   : "filter:hue-rotate(0)      grayscale(100%) brightness(1.0)",
    "blue"   : "filter:hue-rotate(0)      grayscale(0)    brightness(1.0)"
};

MapData = {};
MapData["Abodes of Erebor"] = { top:20.2, left:-144.4, bottom:12.4, right:-134.0 };
MapData["Agarnaith"] = { top:-41.9, left:18.2, bottom:-58.0, right:39.8 };
MapData["Aglarond"] = "Glittering Caves";
MapData["Anfalas"] = { top:-53.9, left:-98.8, bottom:-78.4, right:-66.1 };
MapData["Angle of Mitheithel"] = { top:-32.6, left:-27.6, bottom:-47.5, right:-7.6 };
MapData["Angmar"] = { top:14.7, left:-42.8, bottom:-7.3, right:-13.6 };
MapData["Annuminas"] = "Annúminas";                               
MapData["Annúminas"] = { top:-15.5, left:-73.5, bottom:-21.2, right:-65.9 };
MapData["Archet Dale"] = { top:-24.2, left:-50.7, bottom:-28.3, right:-45.2 };
MapData["Archet"] = "Archet Dale";
MapData["Azanulbizar"] = { top:72.4, left:-143.6, bottom:61.3, right:-128.7 };
MapData["Azanulbizar, T.A. 2799"] = "Azanulbizar";
MapData["Battle of Morannon"] = "Battle of the Morannon";
MapData["Battle of the Morannon"] = { top:-32.4, left:-11.4, bottom:-40.9, right:0.0 };
MapData["Bay of Belfalas"] = "Cape of Belfalas";
MapData["Beacon Hills"] = { top:-31.8, left:-51.3, bottom:-50.4, right:-26.5 };
MapData["Belfalas"] = "Belfalas (King's Gondor)";
MapData["Belfalas (King's Gondor)"] = { top:-69.2, left:-84.1, bottom:-94.8, right:-50.0 };
MapData["Blackroot Vale"] = { top:-51.0, left:-83.3, bottom:-71.4, right:-56.0 };
MapData["Blackroot Vale (King's Gondor)"] = { top:-53.3, left:-77.2, bottom:-67.6, right:-58.2 };
MapData["Bree"] = { top:-28.1, left:-54.6, bottom:-33.2, right:-47.8 };
MapData["Bree-land Homestead"] = "Bree-land Homesteads";
MapData["Bree-land Homesteads"] = { top:-33.9, bottom:-38, right:-44.6,left:-49.9 };
MapData["Bree-land"] = { top:-14.8, left:-67.2, bottom:-38, right:-36.4 }; 
MapData["Bree-town"] = "Bree";
MapData["Breeland"] = "Bree-land";
MapData["Broadacres"] = { top:-41.6, left:-78.0, bottom:-53.5, right:-62.1 };
MapData["Cape of Belfalas"] = { top:-76.4, left:-78.9, bottom:-96.6, right:-51.9 };
MapData["Cape of Belfalas Homesteads"] = { top:-80.0, left:-77.6, bottom:-94.6, right:-58.1 };
MapData["Cape of Umbar"] = { top:-8.0, left:-118.0, bottom:-30.7, right:-87.7 };
MapData["Câr Bronach"] = { top:59.0, left:-77.2, bottom:44.8, right:-58.2 };
MapData["Car Bronach"] = "Câr Bronach";
MapData["Caras Galadhon"] = { top:-12.9, left:-70.0, bottom:-17.1, right:-64.4 };
MapData["Cardolan"] = { top:-32.9, left:-58.8, bottom:-59.6, right:-23.2 };
MapData["Central Gondor"] = { top:-66.6, left:-59.7, bottom:-91.1, right:-26.9 };
MapData["Clovengap"] = { top:-32.2, left:-131.2, bottom:-43.6, right:-116.0 };
MapData["Dead Marshes"] = { top:-25.0, left:-19.5, bottom:-32.0, right:-10.2 };
MapData["Deepscrave"] = { top:-46.8, left:-122.8, bottom:-53.2, right:-114.3 };
MapData["Delvings of Gundabad"] = { top:-32.4, left:-133.8, bottom:-53.2, right:-106.0 };
MapData["Dol Amroth"] = { top:-72.4, left:-74.4, bottom:-77.2, right:-68.0 };
MapData["Dol Amroth (King's Gondor)"] = { top:-72.0, left:-76.4, bottom:-78.0, right:-68.4 };
MapData["Dol Guldur (razed)"] = { top:-11.6, left:-20.4, bottom:-17.0, right:-13.2 };
MapData["Dor Amarth"] = { top:-37.1, left:5.9, bottom:-54.6, right:29.3 };
MapData["Dor-en-Ernil"] = { top:-75.3, left:-59.2, bottom:-88.0, right:-42.1 };
MapData["Dor-en-Ernil (King's Gondor)"] = { top:-75.6, left:-57.2, bottom:-88.4, right:-40.2 };
MapData["Dunland"] = { top:-70.8, left:-28.6, bottom:-90.9, right:-1.8 };
MapData["Dunlending"] = { top:-70.5, left:-28.5, bottom:-98.0, right:4.2 };
MapData["Durin's Way"] = { top:2.0, left:-114.0, bottom:-10.0, right:-98.0 };
MapData["East Rohan"] = { top:-33.6, left:-77.5, bottom:-65.6, right:-34.7 };
MapData["East Wall"] = { top:-45.7, left:-61.3, bottom:-63.5, right:-37.5 };
MapData["Eastern Gondor"] = { top:-59.1, left:-36.4, bottom:-87.0, right:-0.8 };
MapData["Eastfold"] = { top:-60.0, left:-71.0, bottom:-77.0, right:-48.4 };
MapData["Eastfold Hills Homesteads"] = { top:-62.0, left:-73.5, bottom:-68.4, right: -65.0 };
MapData["Eaves of Fangorn"] = { top:-34.4, left:-79.4, bottom:-44.3, right:-66.1 };
MapData["Edoras"] = { top:-58.2, left:-76.9, bottom:-64.1, right:-69.0 };
MapData["Eithel Gwaur"] = { top:62.4, left:54.7, bottom:59.4, right:58.7 };
MapData["Elderslade"] = { top:46.6, left:-74.8, bottom:31.6, right:-54.8 };
MapData["Enedwaith"] = { top:-53.9, left:-35.9, bottom:-79.4, right:-1.8 };
MapData["Entwash Vale"] = { top:-38.9, left:-74.3, bottom:-54.6, right:-53.5 };
MapData["Entwood"] = { top:-37.3, left:-86.6, bottom:-44.7, right:-76.7 };
MapData["Ephel Angren"] = { top:76.4, left:-37.5, bottom:67.6, right:-25.8 };
MapData["Erebor"] = { top:16.4, left:-138.0, bottom:12.4, right:-132.7 };
MapData["Ered Luin"] = { top:-12.4, left:-110.0, bottom:-30.0, right:-86.5 };
MapData["Ered Mithrin and Withered Heath"] = "Ered Mithrin";
MapData["Ered Mithrin and the Withered Heath"] = "Ered Mithrin";
MapData["Ered Mithrin"] = { top:46.4, left:-57.2, bottom:27.2, right:-31.6 };
MapData["Eregion"] = { top:-38.0, left:-26.8, bottom:-59.6, right:1.9};
MapData["Eryn Lasgalen and the Dale Lands"] = "Eryn Lasgalen";
MapData["Eryn Lasgalen and the Dale-lands"] = "Eryn Lasgalen";
MapData["Eryn Lasgalen"] = { top:37.4, left:-56.6, bottom:5.3, right:-13.8 };
MapData["Ettenmoors"] = { top:-9.9, left:-24.3, bottom:-21.8, right:-8.2 };
MapData["Evendim"] = { top:-1.7, left:-82.8, bottom:-24.3, right:-52.5 };
MapData["Falathlorn Homestead"] = "Falathlorn Homesteads";
MapData["Falathlorn Homesteads"] = { top:-24.3, left:-93.5, bottom:-28.5, right:-88 };
MapData["Far Anorien"] = "Far Anórien";
MapData["Far Anórien"] = { top:-32.5, left:-50.4, bottom:-58.1, right:-16.3 };
MapData["Felegoth"] = { top:50.0, left:-129.0, bottom:46.0, right:-123.7 };
MapData["Field of Onslaught"] = { top:29.6, left:-27.8, bottom:14.7, right:-7.9 };
MapData["Flaming Deeps"] = { top:-12.3, left:-112.2, bottom:-18.0, right:-104.7 };
MapData["Forlaw"] = { top:-37.4, left:-62.5, bottom:-39.7, right:-59.4 };
MapData["Forochel"] = { top:24.9, left:-92.8, bottom:-5.7, right:-51.9 };
MapData["Foundations of Stone"] = { top:-10.5, left:-102.9, bottom:-16.4, right:-95.0 };
MapData["Frostbluff"] = { top:14.4, left:-96.4, bottom:10.8, right:-91.6 };
MapData["Galtrev"] = { top:-78.8, left:-18.3, bottom:-81.5, right:-14.8 };
MapData["Gap of Rohan"] = { top:-80.3, left:-20.7, bottom:-95.2, right:-0.9 };
MapData["Glimmerdeep"] = { top:33.2, left:-139.0, bottom:29.2, right:-133.7 };
MapData["Glittering Caves"] = { top:-70.2, left:-146.8, bottom:-76.3, right:-138.6 };
MapData["Gloomingtarn"] = { top:-42.8, left:-128.2, bottom: -51.6, right:-116.5 };
MapData["Gorgoroth"] = { top:-35.3, left:-6.0, bottom:-69.4, right:39.5 };
MapData["Grand Stair"] = "The Grand Stair";
MapData["Great Delving"] = { top:-4.9, left:-117.3, bottom:-10.3, right:-110.1 };
MapData["Great River"] = { top:-17.2, left:-73.9, bottom:-37.6, right:-46.7 };
MapData["Grimbeorn's House"] = "Meadhollow";
MapData["Harwick"] = { top:-37.7, left:-54.4, bottom:-40.8, right:-50.3 };
MapData["Havens of Belfalas"] = { top:-66.9, left:-84.4, bottom:-87.4, right:-57.1 };
MapData["Helm's Deep"] = { top:-60.3, left:-93.3, bottom:-66.8, right:-84.7 };
MapData["Hultvís"] = { top:5.97, left:-55.51, bottom:4.29, right:-53.27 };
MapData["Hultvis"] = "Hultvís";
MapData["Imlad Morgul"] = "Morgul Vale";
MapData["Iron Hills"] = { top:33.6, left:-23.6, bottom:16.9, right:-1.3 };
MapData["Isengard (after)"] = { top:-42.5, left:-96.9, bottom:-52.9, right:-83.0 };
MapData["Isengard Depths"] = { top:-76.8, left:31.3, bottom:-81.5, right:37.5 };
MapData["Kings' End"] = { top:29.6, left:-27.8, bottom:14.7, right:-7.9 };
MapData["King's Gondor"] = { top:-47.5, left:-82.8, bottom:-99.5, right:-13.4 };
MapData["Kingstead"] = { top:-50.9, left:-86.6, bottom:-75.6, right:-53.6 };
MapData["Kingstead Meadows Homesteads"] = { top:-54.8, left:-73.3, bottom:-60.4, right:-65.9 };
MapData["Lamedon"] = { top:-58.3, left:-71.0, bottom:-74.6, right:-49.2 };
MapData["Lamedon (King's Gondor)"] = { top:-59.5, left:-67.6, bottom:-73.2, right:-49.4 };
MapData["Lebennin"] = { top:-74.9, left:-48.2, bottom:-88.4, right:-30.2 };
MapData["Lhingris"] = { top:-45.0, left:-6.5, bottom:-66.9, right:22.7 };
MapData["Lone-lands"] = { top:-24.3, left:-43.6, bottom:-40.4, right:-22.1 };
MapData["Lossarnach"] = { top:-69.6, left:-32.8, bottom:-82.4, right:-15.8 };
MapData["Lossarnach (King's Gondor)"] = { top:-69.2, left:-34.1, bottom:-82.0, right:-17.0 };
MapData["Lothlorien"] = "Lothlórien";
MapData["Lothlórien"] = { top:-4.1, left:-82.5, bottom:-21.7, right:-59.1 };
MapData["Lower Lebennin (King's Gondor)"] = { top:-69.3, left:-52.5, bottom:-87.6, right:-28.1 };
MapData["Lyndelby Homesteads"] = { top:28.6, bottom:22, right:-64.4,left:-73.2 };
MapData["March of the King"] = { top:-39.6, left:-34.8, bottom:-71.9, right:8.2 };
MapData["Máttugard"] = { top:-43.6, left:-117.6, bottom:-52.4, right:-105.8 };
MapData["Mattugard"] = "Máttugard";
MapData["Meadhollow"] = { top:15.6, left:-56.7, bottom:11.6, right:-51.3 };
MapData["Minas Morgul"] = { top:-64.6, left:-1.4, bottom:-70.0, right:5.9 };
MapData["Minas Tirith (After-battle)"] = { top:-62.2, left:-24.1, bottom:-69.0, right:-15.0 };
MapData["Minas Tirith (Midsummer)"] = { top:26.9, left:-62.0, bottom:18.8, right:-51.2 };
MapData["Minas Tirith Besieged"] = { top:62.6, left:12.7, bottom:55.8, right:21.8 };
MapData["Minas Tirith"] = { top:-62.2, left:-24.1, bottom:-69.0, right:-15.0 };
MapData["Mirkwood"] = { top:-4.9, left:-63.6, bottom:-23.3, right:-39.0 };
MapData["Misty Mountains"] = { top:-14.6, left:-11.9, bottom:-33.2, right:12.9 };
MapData["Morannon"] = { top:67.0, left:-12.1, bottom:55.4, right:3.4 };
MapData["Mordor Besieged"] = { top:-88.6, left:-134.0, bottom:-105.7, right:-111.3 };
MapData["Morgul Vale"] = { top:-56.4, left:-12.5, bottom:-77.9, right:16.2 };
MapData["Mossward"] = { top:-60.2, left:-35.6, bottom:-61.4, right:-34.0 };
MapData["Mount Gundabad"] = { top:58.0, left:-82.3, bottom:30.8, right:-46.0 };
MapData["Nan Curunir"] = "Nan Curunír";
MapData["Nan Curunír"] = { top:-76.1, left:-9.5, bottom:-86.3, right:4.1 };
MapData["Nargroth"] = { top:19.5, left:11.1, bottom:15.0, right:17.2 };
MapData["Norcrofts"] = { top:-41.8, left:-67.0, bottom:-58.1, right:-45.3  };
MapData["North Downs"] = { top:-1, left:-60.5, bottom:-22.2, right:-32.2 };
MapData["North Ithilien"] = { top:-39.6, left:-28.8, bottom:-67.5, right:8.4  };
MapData["Northern Barrow-downs"] = { top:-29.9, left:-57.3, bottom:-33.5, right:-52.5 };
MapData["Northern Barrows"] = "Northern Barrow-downs";
MapData["Nud-melek"] = { top:-3.9, left:-105.3, bottom:-12.2, right:-94.1 };
MapData["Nud-melek T.A. 1981"] = { top:42.1, left:-143.8, bottom:34.5, right:-133.5 };
MapData["Old Anorien"] = "Old Anórien";
MapData["Old Anórien"] = { top:-44.6, left:-34.0, bottom:-73.8, right:5.0 };
MapData["Old Forest"] = { top:-29.2, left:-65.3, bottom:-38.9, right:-52.3 };
MapData["Orodruin"] = { top:-45.5, left:11.0, bottom:-57.8, right:27.4 };
MapData["Mount Doom"] = "Orodruin";
MapData["Osgiliath (After Battle)"] = { top:-59.6, left:-13.2, bottom:-65.1, right:-5.7  };
MapData["Osgiliath"] = { top:-58.7, left:-13.5, bottom:-66.0, right:-3.9 };
MapData["Outer Gondor"] = { top:-46.8, left:-101.2, bottom:-73.2, right:-66.0 };
MapData["Paths of Dead"] = "Paths of the Dead";
MapData["Paths of the Dead"] = { top:-42.0, left:-78.3, bottom:-46.8, right:-71.9 };
MapData["Pelargir"] = { top:-81.8, left:-37.5, bottom:-87.0, right:-30.6  };
MapData["Pelargir (King's Gondor)"] = { top:-79.6, left:-38.0, bottom:-86.8, right:-28.4  };
MapData["Pelennor Fields (After-battle)"]="Pelennor (After Battle)";
MapData["Pelennor (After Battle)"] = { top:-54.5, left:-28.2, bottom:-72.9, right:-3.6 };
MapData["Pelennor"] = { top:-58.3, left:-27.8, bottom:-73.2, right:-7.9 };
MapData["Pinnath Gelin"] = { top:-46.8, left:-100.4, bottom:-66.7, right:-73.8 };
MapData["Pit of Iron"] = { top:52.3, left:-94.4, bottom:49.3, right:-90.4 };
MapData["Pit of Stonejaws"] = { top:-36.4, left:-117.9, bottom:-45.2, right:-106.1 };
MapData["Plateau of Gorgoroth"] = "Gorgoroth";
MapData["Redhorn Lodes"] = { top:-9.3, left:-109.1, bottom:-16.3, right:-99.8 };
MapData["Riders' Stand"] = { top:29.6, left:-27.8, bottom:14.7, right:-7.9 };
MapData["Ring of Isengard"] = { top:62.9, left:8.1, bottom:57.1, right:15.8 };
MapData["Ringlo Vale"] = "Ringló Vale";
MapData["Ringló Vale"] = { top:-68.5, left:-57.0, bottom:-77.9, right:-44.4 };
MapData["Ringlo Vale (King's Gondor)"] = "Ringló Vale (King's Gondor)";
MapData["Ringló Vale (King's Gondor)"] = { top:-69.2, left:-57.2, bottom:-78.8, right:-44.4 };
MapData["Rivendell Valley"] = "Rivendell";
MapData["Rivendell"] = { top:-26.3, left:-9.4, bottom:-33.5, right:0.3 };
MapData["Ruin of Pel Duven"] = "Ruin of Pel Dúven";
MapData["Ruin of Pel Dúven"] = { top:29.6, left:-27.8, bottom:14.7, right:-7.9 };
MapData["Sammath Naur"] = { top:35.8, left:30.8, bottom:32.2, right:35.6 };
MapData["Shelob's Lair"] = { top:28.9, left:-147.9, bottom:16.4, right:-131.2 };
MapData["Shield Isles"] = "Zîrar Tarka";
MapData["Shield Isles of Umbar"] = "Zîrar Tarka";
MapData["Shire Homestead"] = "Shire Homesteads";
MapData["Shire Homesteads"] = { top:-34.5, left:-77.4, bottom:-38.9, right:-71.8 };
MapData["Shire"] = { top:-23.7, left:-80.3, bottom:-38.0, right:-61.3 };
MapData["Silvertine Lodes"] = { top:-8.5, left:-116.2, bottom:-14.0, right:-108.9 };
MapData["Snowbourn"] = { top:-59.5, left:-63.7, bottom:-62.1, right:-60.3  };
MapData["South Ithilien"] = { top:-60.3, left:-26.5, bottom:-80.1, right:-0.1 };
MapData["Southern Barrow-downs"] = { top:-32.7, left:-57.8, bottom:-37.2, right:-51.9 };
MapData["Southern Barrows"] = "Southern Barrow-downs";
MapData["Stangard"] = { top:-24.9, left:-65.1, bottom:-27.1, right:-62.2 };
MapData["Stonedeans"] = { top:-44.1, left:-89.2, bottom:-59.4, right:-68.7 };
MapData["Stonejaws"] = "Pit of Stonejaws";
MapData["Sundering of Osgiliath"] = { top:66.0, left:-87.1, bottom:58.8, right:-77.5 };
MapData["Sutcrofts"] = { top:-52.4, left:-69.9, bottom:-67.2, right:-50.1  };
MapData["Swanfleet"] = { top:-40.3, left:-45.5, bottom:-67.6, right:-9.1 };
MapData["Tal Methedras"] = "Tâl Methedras";
MapData["Tâl Methedras"] = { top:-72.0, left:-14.5, bottom:-78.8, right:-5.3 };
MapData["Talath Anor"] = { top:-44.9, left:-26.3, bottom:-62.4, right:-2.9 };
MapData["Talath Urui"] = "Talath Úrui"; 
MapData["Talath Úrui"] = { top:-47.9, left:6.7, bottom:-66.0, right:30.8 };
MapData["Taur Druadan"] = "Taur Drúadan";
MapData["Taur Drúadan"] = { top:-42.5, left:-33.9, bottom:-58.2, right:-12.9 };
MapData["The Anvil of Winterstith"] = "Winterstith";
MapData["The Grand Stair"] = { top:73.9, left:-141.5, bottom:69.2, right:-135.2 };
MapData["Thikil-gundu"] = { top:26.0, left:-138.7, bottom:22.0, right:-133.4 };
MapData["Thorin's Gate"] = { top:-11.1, left:-106.8, bottom:-17, right:-98.7 };
MapData["Thorin's Hall Homestead"] = "Thorin's Hall Homesteads";
MapData["Thorin's Hall Homesteads"] = { top:-13.2, left:-110, bottom:-17.3, right:-104.6 };
MapData["Threshold of City"] = "Threshold of the City";
MapData["Threshold of the City"] = { top:29.6, left:-27.8, bottom:14.7, right:-7.9 };
MapData["Throne of Dread Terror"] = "Throne of the Dread Terror";
MapData["Throne of the Dread Terror"] = { top:26.1, left:-54.6, bottom:21.3, right:-48.1 };
MapData["Torech Ungol"] = { top:36.0, left:9.0, bottom:29.6, right:17.6 };
MapData["Trollshaws"] = { top:-22.8, left:-33.4, bottom:-48.3, right:0.7 };
MapData["Udun"] = "Udûn";
MapData["Udûn"] = { top:-36.7, left:-4.3, bottom:-49.0, right:12.0 };
MapData["Umbar Baharbel"] = "Umbar Baharbêl";
MapData["Umbar Baharbêl"] = { top:-15.6, left:-106.8, bottom:-27.6, right:-90.9 };
MapData["Upper Lebennin"] = { top:-73.9, left:-37.4, bottom:-85.2, right:-22.2 };
MapData["Upper Lebennin (King's Gondor)"] = { top:-75.0, left:-36.4, bottom:-85.2, right:-22.8 };
MapData["Vales of Anduin"] = { top:18.3, left:-81.4, bottom:-12.4, right:-40.4 };
MapData["Walls of Moria"] = { top:-48.3, left:-9.2, bottom:-54.1, right:-1.5 };
MapData["War of Three Peaks"] = { top:-87.0, left:-29.2, bottom:-102.0, right:-9.2 };
MapData["Wastes"] = { top:-26.1, left:-17.0, bottom:-41.5, right:3.4 };
MapData["Water-Works"] = "Waterworks";
MapData["Water-works"] = "Waterworks";
MapData["Waterworks"] = { top:-11.3, left:-120.5, bottom:-21.7, right:-106.6 };
MapData["Welkin-lofts"] = { top: 52.4, left:-85.2, bottom:39.6, right:-68.1 };
MapData["Wells of Langflood"] = { top:34.2, left:-75.2, bottom:13.8, right:-47.9 };
MapData["West Rohan"] = { top:-39.3, left:-97.6, bottom:-78.9, right:-44.8  };
MapData["Western Gondor"] = { top:-50.5, left:-90.3, bottom:-82.8, right:-47.2 };
MapData["Westfold"] = { top:-52.5, left:-95.2, bottom:-69.4, right:-72.5 };
MapData["Wildermore"] = { top:-27.1, left:-77.7, bottom:-46.9, right:-51.3, style:Colors.orange };
MapData["Wildwood"] = { top:-14.0, left:-68.1, bottom:-25.8, right:-52.3 };
MapData["Winterstith"] = { top:38.6, left:-138.0, bottom:35.5, right:-133.9 };
MapData["Wistmead"] = { top:72.31, left:-116.31, bottom:69.24, right:-112.21 };
MapData["Wold"] = { top:-30.1, left:-64.2, bottom:-48.7, right:-39.4 };
MapData["Yondershire"] = { top:-16.4, left:-90.0, bottom:-33.2, right:-67.6 };
MapData["Zelem-melek"] = { top:-3.8, left:-114.0, bottom:-13.8, right:-100.7 };
MapData["Zirakzigil"] = { top:17.3, left:-113.0, bottom:11.6, right:-105.4 };
MapData["Zirar Tarka"] = "Zîrar Tarka";
MapData["Zîrar Tarka"] = { top:8.7, left:-141.7, bottom:-16.4, right:-108.3 };





// Instances or areas which use the same .jpg as an open-world map, but with different coordinates:
MapData["At the Stone of Erech"] = { top:-92.6, left:-106.9, bottom:-113, right:-79.6 };        // [[File:At the Stone of Erech map.jpg]] redirects to [[File:Blackroot Vale map.jpg]]
MapData["Attack at Dawn"] = { top:65.4, left:-104.4, bottom:44.2, right:-76.1 };                // [[File:Attack at Dawn map.jpg]] redirects to [[File:North Downs map.jpg]]
MapData["Bells of Dale"] = { top:65.4, left:-19.0, bottom:33.3, right:23.8 };                   // [[File:Bells of Dale map.jpg]] redirects to [[File:Eryn Lasgalen map.jpg]]
MapData["Defence of Minas Tirith"] = "Hammer of the Underworld";
MapData["Defence of the Prancing Pony"] = { top:67.1, left:-136.2, bottom:62.0, right:-129.4 }; // [[File:Defence of the Prancing Pony map.jpg]] redirects to [[File:Bree map.jpg]]
MapData["EB-Helm's Deep"] = { top:72.5, left:-50.9, bottom:66.0, right:-42.3 };                 // [[File:EB-Helm's Deep map.jpg]] redirects to [[File:Helm's Deep map.jpg]]
MapData["Helm's Deep (before-dawn)"] = { top:72.5, left:-36.5, bottom:66.0, right:-27.9 };      // [[File:Helm's Deep (before-dawn) map.jpg]] redirects to  [[File:Helm's Deep map.jpg]]
MapData["Helm's Deep (sunrise)"] = { top:72.5, left:-22.1, bottom:66.0, right:-13.5 };          // [[File:Helm's Deep (sunrise) map.jpg]] redirects to  [[File:Helm's Deep map.jpg]]
MapData["Icy Crevasse"] = { top:80.1, left:-100.0, bottom:49.5, right:-59.1 };                  // [[File:Icy Crevasse map.jpg]] redirects to [[File:Forochel map.jpg]]
MapData["Isengard"] = { top:-76.3, left:-6.3, bottom:-82.1, right:1.4 };                        // [[File:Isengard map.jpg]] redirects to [[File:Ring of Isengard map.jpg]]
MapData["Isengard Depths (flooded)"] = { top:-69.0, left:31.3, bottom:-73.6, right:37.5 };      // [[File:Isengard Depths (flooded) map.jpg]] redirects to [[File:Isengard Depths map.jpg]]
MapData["Kâm Lagúrz"] = { top:35.5, left:15.7, bottom:13.6, right:44.9 };                       // [[File:Kâm Lagúrz map.jpg]] redirects to [[File:Lhingris map.jpg]]
MapData["Retaking Dol Amroth"] = { top:-32.4, left:-130.4, bottom:-37.2, right:-124.0 };        // [[File:Retaking Dol Amroth map.jpg]] redirects to [[File:Dol Amroth map.jpg]]
MapData["Hammer of the Underworld"] = { top:62.6, left:-24.1, bottom:55.8, right:-15.0 };       // [[File:Hammer of the Underworld map.jpg]] redirects to [[File:Minas Tirith map.jpg]]
MapData["Harrowing of Morgul"] = { top:61.0, left:-139.0, bottom:55.6, right:-131.7 };          // [[File:Harrowing of Morgul map.jpg]] redirects to [[File:Minas Morgul map.jpg]]
MapData["End of All Things"] = { top:-45.5, left:-129.0, bottom:-57.8, right:-112.6 };              // [[File:End of All Things map.jpg]] redirects to [[File:Orodruin map.jpg]]
MapData["Thievery and Mischief"] = "Defence of the Prancing Pony";

// Maps without coordinates (boundaries are chosen so that reasonable coordinates are off the map and the swirly is off the screen):
MapData["Eriador"] = { top:-1000001, left:-1000002, bottom:-1000002, right:-1000001 };
MapData["Middle-earth"] = { top:-1000001, left:-1000002, bottom:-1000002, right:-1000001 };
MapData["Mordor"] = { top:-1000001, left:-1000002, bottom:-1000002, right:-1000001 };
MapData["Rhovanion"] = { top:-1000001, left:-1000002, bottom:-1000002, right:-1000001 };

// global variables
var linkCache = new Object();
var coords_hidden = new Boolean();
var error_str = "";
var mousePos = null;
var winSize = null;

// Set events to catch mouse position and window size
document.onmousemove = mouseMove;
window.onresize = windowResize;

// The mouseMove and mouseCoords function track the mouse position for us
function mouseMove(ev) {
ev = ev || window.event;
mousePos = mouseCoords(ev);
}

function mouseCoords(ev) {
if(ev.pageX || ev.pageY) return {x:ev.pageX, y:ev.pageY};
if (document.documentElement && document.documentElement.scrollTop) {
// IE6 +4.01 and user has scrolled
dbSleft = document.documentElement.scrollLeft;
dbStop = document.documentElement.scrollTop;
dbCleft = document.documentElement.clientLeft;
dbCtop = document.documentElement.clientTop;
} else {
// IE5 or DTD 3.2
dbSleft = document.body.scrollLeft;
dbStop = document.body.scrollTop;
dbCleft = document.body.clientLeft;
dbCtop = document.body.clientTop;
}
return {x:ev.clientX + dbSleft - dbCleft, y:ev.clientY + dbStop  - dbCtop};
}

// The windowResize function keeps track of the window size for us
function windowResize() {
if (document.documentElement && document.documentElement.clientWidth) {
// IE6 +4.01
dbCwidth = document.documentElement.clientWidth;
dbCheight = document.documentElement.clientHeight;
} else {
// IE5 or DTD 3.2
dbCwidth = document.body.clientWidth;
dbCheight = document.body.clientHeight;
}
winSize = {x:(dbCwidth) ? dbCwidth:window.innerWidth, y:(dbCheight) ? dbCheight:window.innerHeight}
}
windowResize();

// map will be no bigger than 40% of browser window height (to prevent clipping)
var h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
mapheight = Math.round(h * .4);

// Collect all errors into a single alert window
function report_error(str) {
    if (error_str == null) {
        alert("Error: " + str);
    } else {
        error_str = error_str + "\n" + str;
    }
}

// Sets the variables span.xPct and span.yPct, based on the supplied zone name and coordinate strings
function convertCoordsToPct(zone, northSouthStr, eastWestStr, span, color) {

    // Convert "1.0N", "2.0S", "3.0E", "4.0W" to 1, -2, 3, -4 respectively
    var lattitude = northSouthStr.substr(0, (northSouthStr.length - 1));
    if (northSouthStr.charAt(northSouthStr.length - 1) == "S") {
        lattitude = -lattitude;
    }
    var longitude = eastWestStr.substr(0, (eastWestStr.length - 1));
    if (eastWestStr.charAt(eastWestStr.length - 1) == "W") {
        longitude = -longitude;
    }        
    
    // Look up the region in the MapData hash, and calculate the pixel position as a percentage
    var limits = MapData[zone];
    if (limits) {
        if (typeof limits == "string") {
            // This is an alias.  Get the data associated with the canonical name.
            zone = limits;            
            limits = MapData[zone];
        }
        span.zone = zone;
        span.xPct = 100 * (longitude - limits.left) / (limits.right - limits.left);
        span.yPct = 100 * (limits.top - lattitude) / (limits.top - limits.bottom);
        span.moreStyles = typeof(limits.style) == "undefined" ? "" : "; " + limits.style;

		if (color) {
            span.moreStyles = "; " + Colors[color];
            span.color = color;
        }
    } else {
        report_error("MapData missing for: " + zone);
    }
}

// Sets the variables span.northSouthStr and span.eastWestStr, based on the supplied zone name and x/y percentages
function convertPctToCoords(zone, xPct, yPct, span) {

    // Look up the region in the MapData hash, and calculate the numeric lattitude / longitude
    var limits = MapData[zone];
    var lattitude;
    var longitude;
    if (limits) {
        if (typeof limits == "string") {
            // This is an alias.  Get the data associated with the canonical name.
            zone = limits;            
            limits = MapData[zone];
        }

        longitude = limits.left + (limits.right - limits.left) * (xPct / 100);
        lattitude = limits.top - (limits.top - limits.bottom) * (yPct / 100);
    } else {
        report_error("MapData missing for: " + zone);
    }

    // Convert 1, -2, 3, -4 to "1.0N", "2.0S", "3.0E", "4.0W",respectively
    var northSouthStr = Math.abs(lattitude);
    northSouthStr = northSouthStr.toFixed(1);
    if (lattitude < 0) {
        span.northSouthStr = northSouthStr + "S";
    } else {
        span.northSouthStr = northSouthStr + "N";
    }
    var eastWestStr = Math.abs(longitude);
    eastWestStr = eastWestStr.toFixed(1);
    if (longitude < 0) {
        span.eastWestStr = eastWestStr + "W";
    } else {
        span.eastWestStr = eastWestStr + "E";
    }
}

// Extract the zone name and coordinates from a span's class string
function getCoords(span) {
    var paramStr = span.className.replace("coordslink ", "");
    if (paramStr) {
        params = paramStr.split("--");
        var zone = params[0].trim();
        //We ignore a leading "The ", "The_", "the ", "the_"
        if( /^[tT]he[ _]/.test(zone) ) {
            zone = zone.replace(/^[tT]he[ _]/,'');
        }
        var northSouthStr = params[1].trim();
        var eastWestStr = params[2].trim();
        convertCoordsToPct(zone, northSouthStr, eastWestStr, span);
        span.coords = northSouthStr + "," + eastWestStr;
        if ((northSouthStr == "") || (eastWestStr == "")) {
            span.xPct = 1000000; // off the screen
            span.yPct = 1000000; // off the screen
            span.coords = "";
        }

        // If marker-color is specified...
        var color = params[3];
        if (color) {
            span.moreStyles = "; " + Colors[color];
            span.color = color;
        }
    }
}

// the core display tooltip function.
function tryCoordsTip() {
    var span = this;
    if (!tooltipsOn) {
        return;
    }
    coords_hidden = false;

    // if our link hasn't been fetched yet, fetch it
    var filename = span.zone;
    if (linkCache[filename] == null) {
        $.getJSON(
            "/api.php?action=query&format=json",
            {
                titles: "File:" + filename + "_map.jpg", 
                prop: "imageinfo", 
                iiprop: "url",
                iiurlheight: "" + mapheight
            },
            function(data) { 
                for (var page in data.query.pages) {
                    //== null means comparing for "undefined" or "null"
                    if (data.query.pages[page].missing == null) {
                        linkCache[filename] = data.query.pages[page].imageinfo[0].thumburl;
                        //if loading took longer than the user's patience, we don't want to disturb him/her with the image
                        if (!coords_hidden) {
                            showCoordsTip(span, linkCache[filename]);
                        }
                    } else {
                        report_error("image "+"File:"+filename+"_map.jpg"+" not found!");
                        break;
                    }
                }
            }
        ).fail(function() { 
            report_error("image "+"File:"+filename+"_map.jpg"+" could not be retrieved!");
        });
    } else {
        showCoordsTip(span, linkCache[filename]);
    }
}

// Returns <img> tag, selecting the appropriate image depending on whether 'swirly' is true or false
function getLocationMarkerImgTag(span, swirly) {
    var url = "/images/b/b7/Coord_mark_static.png";
    var size = 14;
    if (swirly) {
        url = "/images/8/83/Coord_mark_swirly.gif";
        size = 16;
    }
    // Round to a reasonable precision
    var xPct = Math.round(span.xPct * 100) / 100;
    var yPct = Math.round(span.yPct * 100) / 100;
    return '<img style="position:absolute; height:' + size + 'px; width:' + size + 'px; left:'
        + xPct + '%; top:' + yPct + '%; margin:-' + Math.round(size / 2) + 'px' + span.moreStyles + '" src="' + url + '">';
}

function showCoordsTip(span, zoneImage) {
    var xPct = span.xPct;
    var yPct = span.yPct;
    var tip = document.getElementById('coordstfb');
    tooltip = '<div style="font-size:1em; width: auto; background: transparent url(https://lotro-wiki.com/images/8/82/Ttip_Background.png);" class="itemtooltip">'
    tooltip = tooltip + '<div class="ZoneMap" style="position:relative;height:'+mapheight+'px;">';
    tooltip = tooltip + '<img height="'+mapheight+'px" src="' + zoneImage + '" onload="moveCoordsTip();" alt="">';
    if (span.locationList) {
        var spans = span.locationList.getElementsByTagName("span");
        for (var i = 0; i < spans.length; i++) {
            var otherSpan = spans[i];
            if ((span != otherSpan) && (otherSpan.locationList) && (span.zone == otherSpan.zone)) {
                tooltip = tooltip + getLocationMarkerImgTag(otherSpan, false);
            }
        }
    }
    tooltip = tooltip + getLocationMarkerImgTag(span, true);
    tooltip = tooltip + '</div></div>';
    tip.innerHTML = tooltip;
    tip.style.position = "absolute";
    tip.style.visibility = "hidden";
    tip.style.display = "block";
    tip.style.zIndex = "999";
}

// this function hides the tooltip.
function hideCoordsTip() {
    coords_hidden = true;
    var tip = document.getElementById('coordstfb');
    tip.innerHTML = "";
    tip.style.display = "none";
}

// This function moves the tool-tips when our mouse moves
function moveCoordsTip() {
    if (document.documentElement && document.documentElement.scrollTop) {
    // IE6 +4.01 and user has scrolled
        dbSleft = document.documentElement.scrollLeft;
        dbStop = document.documentElement.scrollTop;
    } else {
    // IE5 or DTD 3.2
        dbSleft = document.body.scrollLeft;
        dbStop = document.body.scrollTop;
    }
    var tip = document.getElementById('coordstfb');

    /* (old method of placement was based on mouse position)
    var newTop = mousePos.y - (tip.clientHeight + 40);
    var newLeft = mousePos.x - ( tip.clientWidth / 2 );
    if( newTop < dbStop ) { 
        newTop = mousePos.y + 1;
        if ( newTop + tip.clientHeight > winSize.y ) newTop = dbStop; 
    }
    if( newLeft < dbSleft ) newLeft = dbSleft;
    if( ( mousePos.x + ( tip.clientWidth / 2 ) ) >= winSize.x - 150 ) newLeft = mousePos.x - ( 1.75 * tip.clientWidth );
    */

    // new placement - center of window horizontally and just below or above the mouse cursor vertically
    var newLeft = ((winSize.x - tip.clientWidth) / 2) + dbSleft ;
    var newTop = mousePos.y - (tip.clientHeight + 40); // above the cursor
    if( newTop < dbStop ) { 
        newTop = mousePos.y + 20; // below the cursor
        if ( newTop + tip.clientHeight > (winSize.y + dbStop) ) newTop = (winSize.y + dbStop)- tip.clientHeight - 5; // prevent map from clipping at the bottom
    }
    
    tip.style.top = newTop + "px";
    tip.style.left = newLeft + "px";
    tip.style.visibility = "visible";
}

// This returns a direct URL to the tooltip on its own page
function getCoordsUrl(span) {
    var params = "Blank?showmap=" + span.zone + "&swirly=" + span.coords;
    if (span.locationList) {
        var points = [];
        var spans = span.locationList.getElementsByTagName("span");
        for (var i = 0; i < spans.length; i++) {
            var otherSpan = spans[i];
            if ((span != otherSpan) && (otherSpan.locationList) && (span.zone == otherSpan.zone)) {
                if(otherSpan.color) {
                     points.push(otherSpan.coords + "," + otherSpan.color);
                } else {
                     points.push(otherSpan.coords);
                }
            }
        }
        if (points.length > 0) {
            params = params + "&points=" + points.join(";");
        }
    }
    return params;
}

function quickLoadMap(url) {
    window.addEventListener('popstate', function(e) {
        location.reload();
    });
    window.history.pushState(null, null, url);
    processPageParams();
    return false;
}

// activation function...
function cttMouseOver() {
    ttfdiv = document.createElement("div");
    ttfdiv.setAttribute("id", "coordstfb");
    contentstart = document.getElementById("content");
    contentstart.insertBefore(ttfdiv , contentstart.childNodes[0]);

    // Add mouse-over behaviors to each coordinate link
    var spans = document.getElementsByClassName("coordslink");
    for (var i = 0; i < spans.length; i++) {
        var span = spans[i];
        getCoords(span);
        span.onmouseover = tryCoordsTip.bind(span);
        span.onmouseout = hideCoordsTip;
        span.onmousemove = moveCoordsTip;
    }

    // Link the items in a "LocationList" table together
    var tables = document.getElementsByClassName("locationList");
    for (var i = 0; i < tables.length; i++) {
        var table = tables[i];
        var spans = table.getElementsByTagName("span");
        for (var j = 0; j < spans.length; j++) {
            spans[j].locationList = table;
        }
    }

    // If any element has class "excludeCoords", then all "coordslink" spans within it should not be included in the "locationList" map
    var exclusions = document.getElementsByClassName("excludeCoords");
    for (var i = 0; i < exclusions.length; i++) {
        var spans = exclusions[i].getElementsByTagName("span");
        for (var j = 0; j < spans.length; j++) {
            spans[j].locationList = null;
        }
    }

    // Add mouse-click behavior to each coordinate link
    var spans = document.getElementsByClassName("coordslink");
    for (var i = 0; i < spans.length; i++) {
        var span = spans[i];
        var url = getCoordsUrl(span);
        span.parentNode.setAttribute("href", 'https://lotro-wiki.com/index.php/' + url);
        span.setAttribute("onclick", 'return quickLoadMap("' + url + '");');
    }
}
cttMouseOver();

// Check for page parameters
function processPageParams() {
    if (location.search) {
        
        // Extract parameters from URL
        var params = [];
        for (str of decodeURIComponent(location.search).split("&")) {
            var result = str.match(/\??([^=]+)=(.*)$/);
            if (result) {
                params[result[1]] = result[2];
            }
        }

        // If the user clicked on a "Tooltip Coords" link: Show the map by itself, full-size
        if (params.showmap) {
            $.getJSON(
                "/api.php?action=query&format=json",
                {
                    titles: "File:" + params.showmap + "_map.jpg", 
                    prop: "imageinfo", 
                    iiprop: "url|size",
                },
                function(data) {
                    for (var page in data.query.pages) {
                        if (data.query.pages[page].missing) {
                            report_error("Error, image File:" + params.showmap + "_map.jpg not found!");
                            break;
                        } else {
                            var title = params.showmap;
                            
                            // Add "swirly" icon
                            var swirly = "";
                            if (params.swirly) {
                                var coords = params.swirly.split(",");
                                title = title + ": " + coords[0] + ", " + coords[1];
                                var pos = [];
                                convertCoordsToPct(params.showmap, coords[0], coords[1], pos);
                                swirly = swirly + getLocationMarkerImgTag(pos, true);
                            }
                            
                            // Add standard map-point icons for the other points (if any)
                            var points = "";
                            if (params.points) {
                                for (point of params.points.split(";")) {
                                    var coords = point.split(",");
                                    var pos = [];
									
									if(coords.length > 2) {
										convertCoordsToPct(params.showmap, coords[0], coords[1], pos, coords[2]);
									}
									else {
										convertCoordsToPct(params.showmap, coords[0], coords[1], pos);
									}
									
                                    points = points + getLocationMarkerImgTag(pos, false);
                                }
                            }

                            var imageInfo = data.query.pages[page].imageinfo[0];
                            var html = '<h1>' + title + '</h1><div style="position:relative;display:inline-block" width=' +
                                imageInfo.width + ' height=' + imageInfo.height + '><img src="' + imageInfo.url + '" id="bigmap">' +
                                swirly + points + '</div>';
                            var contentArea = document.getElementsByClassName("mw-body")[0];
                            contentArea.innerHTML = html;
                            bigmap.onclick = function(e) {
                                var xPct = 100 * e.offsetX / imageInfo.width;
                                var yPct = 100 * e.offsetY / imageInfo.height;
                                var span = {};
                                convertPctToCoords(params.showmap, xPct, yPct, span);
                                console.log('Clicked map at ' + span.northSouthStr + '|' + span.eastWestStr);
                            }
                            
                            document.body.onmouseover = null;
                        }
                    }
                }
            );
        }
    }
}
processPageParams();

// Display a single alert window for all errors
if (error_str.length > 0) {
    alert("Error(s):" + error_str);
}
error_str = null;