/MalAnywhere

A Javascript Library that can be used to get a users information for a specific anime a tech demo can be found at https://github.com/WanderingBrooks/MalOnTheGo

Primary LanguageJavaScriptMIT LicenseMIT

MalAnywhere

jQuery is necessary to use this library it can be downloaded here

A library that returns a users myanimelist information for a given show. It will return information about the specific show and the users information for that show. This is done using the myanimelist api jQuery and JavaScript.

A tech demo and working example can be found at https://github.com/WanderingBrooks/MalOnTheGo

There are different versions of the API malanywhere.js is the readable version malanywhere-min.js is the minified version

##Interfacing with the Library There are 3 pieces of functionality that can be accesed with the MALAnywhere object

verifyCredentials

MALAnywhere.verifyCredentials(username, password, error, success)

Verifys the given credentials and calls the success parameter if the credentials are correct and the error parameter if they are incorrect.

Type Name Description
String username The Username to be verified
String password The Password to be verified
Function error Callback function if the the credentials are not valid. The function is passed a jqXHR, a String textStatus, and a String errorThrown(refer here in the error parameter for more info)
Function success Callback function if the ajax is succesful its passed a String data, a String textStatus, and a jqXHR (refer here in the success parameter for more info)

getAnimeInfo

MALAnywhere.getAnimeInfo(titles, username, password, callback)

Function to get information about one show and the users values stored for that show. This will return the users myanimelist values and information about the show specified. Unless the show is not on Myanimelist, is stored under a different name, the user has no values stored for the specific show, the given credentials are not valid, or some other error occurs.

Type Name Description
String[] titles Titles or variations of titles for an anime does not need to be more than 1
String username The users list that should be checked
String password password for the users list to be checked
Function callback callback function thats passed a JavaScript Object refer to the Code table to see the possible fields of that object and a desciption of the codes

Code table

Possible codes a description of them and their repsective values. These are all wrapped in an object where the code is a field as well. Refer to the return object below to see an example return object from MALAnywhere.getAnimeInfo().

Code Description and fields in object
AJAX_ERROR Some other error besides invalid crednetials went wrong when performing an ajax.
Fields:
code: AJAX_ERROR
jqXHR: refer to the jQuery documentation here
textStatus: Http error reports example "error", "abort"
errorThrown: textual portion of the HTTP status
INVALID_CREDENTIALS The given credentials were not valid.
Fields:
code: INVALID_CREDENTIALS
jqXHR: refer to the jQuery documentation here
textStatus: the String "Invalid Credentials"
errorThrown:textual portion of the HTTP status
NO_SEARCH_RESULTS The given titles did not match any listing on myanimelist.
Fields:
code: NO_SEARCH_RESULTS
FOUND_BUT_NOT_ON_USER_LIST The anime is on myanimelist but the show is not on the users list.
Fields:
code: FOUND_BUT_NOT_ON_USER_LIST
animeInfo (object all fields strings):
  • id: myanimelist show id
  • title: Title of the show
  • english: English title
  • synonyms: Other titles
  • matched_title: Title that matched on MAL search
  • type: TV, Special, OVA, Movie, ONA
  • episodes: number of episodes
  • score: Total myanimelist score out
  • status: Currently Airing, Not Yet Aired, or Finished Airing
  • start_date: year-mt-day
  • end_date: year-mt-day
  • synopsis: description of show
  • image: link to image for anime
FOUND_AND_ON_USER_LIST The anime is on myanimelist and the show is on the users list.
Fields:
code: FOUND_AND_ON_USER_LIST
animeInfo (object all fields strings):
  • id: myanimelist show id
  • title: Title of the show
  • english: English title
  • synonyms: Other titles
  • matched_title: Title that matched on MAL search
  • type: TV, Special, OVA, Movie, ONA
  • episodes: number of episodes
  • score: Total myanimelist score out
  • status: Currently Airing, Not Yet Aired, or Finished Airing
  • start_date: year-mt-day
  • end_date: year-mt-day
  • synopsis: description of show
  • image: link to image for anime
userValues (object all fields strings):
  • watched_episodes: number of watched episodes
  • start_date: formatted year-month-date
  • finish_date: formatted year-month-day
  • score: users score from 1- 10
  • status: 1/watching, 2/completed, 3/onhold, 4/dropped, 6/plantowatch
  • rewatching: is user rewatching?
  • rewatching_episodes: number of episodes rewatched
  • tags: user defined tags

Example Object