Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Using the API

Maximilian Bandle edited this page Mar 26, 2016 · 6 revisions

Modal

##Show the modal This method launches a bootstrap modal. Internally this function is used when clicking on a character or city.

mymap.showModal(callback, information, cssclass)

###callback This function is invoked after launching the modal.

function (modal, information) {
  var body = modal.find(".modal-body"); // Body Element
}

###information This object is passed as second object to the callback function. Should have the property name, which is used to display he modal title.

###cssclass This string is added to the className of the modal. Internally used to display icons in front of the modal title.

##Hide the modal This function hides the modal. When the modal is hidden nothing will happen.

mymap.hideModal()

Characters

##Search for a character Returns character objects which matches the given string

mymap.searchCharacter(searchString.toLowerCase())

###searchString This is used to search through the character DB. At the moment, only name is searched and it has to be written in lowercase.

###maxResults This is the maximum amount of returned characters.

##Add a character

This adds the character to the list and displays the information on the map. Also focusOnCharacter is performed. The ID of the new character is returned.

mymap.addCharacter(character[0])

###character The character information returned by searchCharacter.

##Zoom in on character

Zooms in on the selected character. Sets the zoom level and bounds to show all the assigned information.

mymap.focusOnCharacter(id)

###id

Id of the character (usually the name). When the id isn't found, no action is performed.

##Remove a character

This function removes the character from the list and all pins from the map.

mymap.removeCharacter(id)

###id

Id of the character (usually the name). When the id isn't found, no action is performed.

##Show a character

Shows the character in the list and information on the map.

mymap.showCharacter(id)

###id

Id of the character (usually the name). When the id isn't found, no action is performed.

##Hide a character

Hide the character in the sidebar and all associated map information.

mymap.hideCharacter(id)

###id

Id of the character (usually the name). When the id isn't found, no action is performed.

##Toggle a character Invokes showCharacter or hideCharacter depending on the characters state.

mymap.toggleCharacter(id)

###id

Id of the character (usually the name). When the id isn't found, no action is performed.

##Remove all characters

Loops through all characters and invokes removeCharacter

mymap.removeAllCharacters()

##Show all Characters

Loops through all characters and invokes showCharacter

mymap.showAllCharacters()

##Hide all Characters

Loops through all characters and invokes hideCharacter

mymap.hideAllCharacters()

Refresh map display

##Updates the map Invoked by nearly every character function and timeline slider.

> mymap.updateMap([1,10]);
< Shows information about the first season on the map.

##episodeRange Array indicating the episode range which should be displayed. The first episode is #1

When episodeRange isn't passed, the current range is used.

Realms

##Show realms

Shows the realms of Westeros, Easteros and Southeryous. Like a political map.

mymap.showRealms(color)

Color

Depending on this Boolean argument, the realms are colored or just border lines.

##Hide realms

Hides all the displayed realms. No matter whether they are colored or not

mymap.hideRealms()

##Toggle realms Rotates through all realm modes:

  • No Realms Shown
  • Colored Realms shown
  • Border Lines shown
mymap.toggleRealms()

#Internals Get the leaflet map to directly work on it.

mymap.getMap();

Credits:

Displays Information about us 👍

> mymap.getCredits()
< "GoT Map by Maximilian Bandle, Alexander Beischl und Tobias Piffrader"
Clone this wiki locally