Skip to content
kod11 edited this page May 24, 2016 · 2 revisions

The base files are included and used in all subpages of the homepage.

base.scss

Not notable

base.js

gui class

showPopup(title, description, content)
Shows a popup with title, description or content.
@parameter title - the string that should be the title.
@parameter description - the string that should be the description.
@parameter content - a jQuery-DOM-element that should be the content of the popup.

closePopup(title, content)
Closes the currently shown popup.
@parameter title - the string that is the title.
@parameter content - the jQuery-DOM-element that is the content of the popup.

showErrorMessage(error)
Displays an error message if problems occur with i18next.
@parameter error - the error message that should be shown in the console.

url class

getParameter(name)
used to get parameter values in the get request url.
@parameter name - key for requested get parameter.
@return - if the parameter is found its value s returned otherwise an empty string.

getAllParameters()
Used to fetch all of the parameters in the URL. Parameters are separated using & signs.
@return - All parameters if some are found, otherwise returns an empty string.

modifyParameterValue(key,newValue)
Takes a specific parameter and changes its value if this parameter exists. If this parameter is not found nothing is changed.
@parameter key - the parameter that is to be changed. @parameter newValue - the new value of the parameter.

addParameter(key,value)
Used to add a new parameter with the specified value to the URL. If this parameter already exists it will be modified.
@parameter key - the key of the new parameter. @parameter value - the value of the new parameter.

removeParameter(name)
Used to remove a parameter from the URL.
@parameter name - the name of the parameter to be removed.

removeHashtagFromUrl()
Used to get the full URL without a possible # as the last char of the URL.
@return - If the # is present at the end of URL return the URL without the #, otherwise returns the URL.

geolocation class

currentPosition(callback)
Used to determine the users current position.
@parameter successCallback - a function that will be called if the position has been determined.
@parameter errorCallback - a function that will be called if no position could be found or was denied by user to use location on the website.
@return - the provided function will be called, in case of succeeded call the callback contains the the found Coordinates object. In case of an error a PositionError object is provided in the callback

api class

used to connect to the backend api

get(format, data, callback)
performs a request to the API which calls the offentligkonst.se API and returns its data combined with data stored in a database of WAKT
@parameter format - formats that can be used for the output are defined at Offentligkonst.se API.
@parameter data - additional data as an object with constraints. Available constraints are defined at Offentligkonst.se API
@parameter callback - a function that will be called when the request has been performed and data has been returned from the API.
@return - the provided callback will be called, associated with the data in the requested format.

getJSON(data, callback)
Convenient method to call the API to retrieve mostly used format JSON.
@parameter data - same as for the get method.
@parameter callback - same as for the get method.
@return - the provided callback will be called, associated with the data in JSON

getGeoJSON(data, callback)
Convenient method to call the API to retrieve data in GeoJSON.
@parameter data - same as for the get method.
@parameter callback - same as for the get method.
@return - the provided callback will be called, associated with the data in GeoJSON.

getImage(title, callback)
underlying backend calls Wikimedia Commons API to retrieve image information.
@parameter title - title for an image.
@parameter callback - a function that will be called when the request has been performed and data has been returned from the API.
@return - the provided callback will be called, associated with the image information available at Commons in JSON

post(list, title, artist, year, latitude, longitude, callback)
Used to make a post request to the API which calls MediaWikis Action API to add a suggestion to a lists wiki talk/discussion page.
@parameter list - id for the list which is to be used for the suggestion.
@parameter title - title of the artwork.
@parameter artist - artists name.
@parameter year - year of creation.
@parameter latitude - suggested locations latitude.
@parameter longitude - suggested locations longitude.
@parameter callback - a function that will be called when the request has been performed.
@return - the provided callback will be called, no data is associated to the callback.

oauth class

login()
Allows the user to login using oauth.

getUserInfo(callback)
Gets the info about the user.
@parameter callback - the function that will receive the info about the user. If no user is found will return an error message.

logout()
Logs the user out. Displays a popup window that confirm what the user wants to do.

post(id,title,list,latitude,longitude)
Post information about an artwork to wikipedia.
@parameter list - id for the list which is to be used for the suggestion.
@parameter title - title of the artwork.
@parameter artist - artists name.
@parameter year - year of creation.
@parameter latitude - suggested locations latitude.
@parameter longitude - suggested locations longitude.

registerLogoutListener(listenerFunction)
Tells oauth that the listener sent in is the used logoutlistener.
@parameter listenerFunction - the listener used to check for the logout.

registerLoginListener(listenerFunction)
Tells oauth that the provided listener is the used loginlistener.
@parameter listenerFunction - the listener used to check for the login.

cookie class

confirmCookieUse()
This function is responsible for showing the popup telling the user that cookies are used on this site.

getCookie(cookie) Gets the information stored in the cookie.
@parameter cookie - the cookie to get information from.

deleteCookie(cookie)
Deletes a specific cookie.
@parameter cookie - the cookie to be deleted.

deleteAllCookies()
Deletes all cookies.

helpFunctions class

hasCoordinates(artwork)
Checks whether an artwork has coordinates or not.
@parameter artwork - an artwork object.
@return true if the artwork has coordinates, false otherwise.

Clone this wiki locally