Members
appButton :HTMLElement
App button
Type:
- HTMLElement
- Source:
- See:
-
- Used in: click
appContent :HTMLElement
App content
Type:
- HTMLElement
- Source:
- See:
-
- Used in: setAction, appContentAdd, filterRemoveContent, searchCreate, searchRemove, paginationCreate, paginationRemove, click
(constant) urlAPI :String
API route 'Rick and morty'
Type:
- String
- Source:
- See:
-
- Used in: ajaxHandler
Methods
adblockDetected()
Callback executed if adblock is installed
- Source:
- See:
-
- Used inside messageAlert
- Used in: checkAdblock
adblockDisabled()
Callback executed if adblock is disabled
- Source:
- See:
-
- Used in: checkAdblock
adblockVerify()
Verify if the user has installed the Adblock browser extension
- Source:
- See:
-
- Used inside: adblockDetected adblockDisabled
- Used in: functionAnonimAutoExecuted
addCurrentYear()
Add the current year to the copyright
- Source:
- See:
-
- Used inside: getCurrentYear
- Used in: functionAnonimAutoExecuted
ajaxHandler(url, action) → {object}
API request
Parameters:
Name | Type | Description |
---|---|---|
url |
String | root of the API |
action |
String | name of the action to excute |
- Source:
- See:
-
- Used inside: loaderAdd, loaderRemove, setAction
- Used in: searchAdd, paginationAdd, click
Returns:
- Type
- object
appContentAdd(url)
Add link of the API to the app content
Parameters:
Name | Type | Description |
---|---|---|
url |
String | root of the API |
- Source:
- See:
-
- Used in: click
cardCreate(listCardsInner, responseData)
Create card with the data response
Parameters:
Name | Type | Description |
---|---|---|
listCardsInner |
Element | DOM element that wraps up the card list |
responseData |
object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used inside: firstUpperCase
- Used in: filterAddContentResults
cardMoveImage()
Move the card image up.
- Source:
- See:
-
- Used in: filterAddContentResults
cardToggleView(item, thisView)
See more card info
Parameters:
Name | Type | Description |
---|---|---|
item |
HTMLCollectionOf | list of cards |
thisView |
Element | card selected |
- Source:
- See:
-
- Used in: cardWhenClicked
cardWhenClicked()
Event click in the card
- Source:
- See:
-
- Used inside: cardToggleView
- Used in: click
delay(fn, ms)
Executes a function after a given time
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | function to execute |
ms |
Number | delay time in miliseconds |
- Source:
- See:
-
- Used in: searchAdd
filterActive(item, thisActive)
Add class 'is-active' to the item of the navigation clicked.
Parameters:
Name | Type | Description |
---|---|---|
item |
HTMLCollectionOf | filter list |
thisActive |
Element | filter selected |
- Source:
- See:
-
- Used in: functionAnonimAutoExecuted
filterAdd(elementDom, responseData)
Add navigation menu filtering through the 3 types of data (characters, locations and episodes) to the app content.
Parameters:
Name | Type | Description |
---|---|---|
elementDom |
HTMLElement | DOM element where the filter is inserted |
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used in: setAction
filterAddAllContent()
Insert the content
- Source:
- See:
filterAddContent(elementDom, responseData)
Add the filter content application
Parameters:
Name | Type | Description |
---|---|---|
elementDom |
HTMLElement | DOM element where the filter content is inserted |
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used inside: filterAddContentInfo, filterAddContentResults...
- Used in: setAction
filterAddContentInfo(responseData) → {Element}
Insert information to the content with the number of results of the request
Parameters:
Name | Type | Description |
---|---|---|
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used in: filterAddContent
Returns:
- Type
- Element
filterAddContentResults(responseData) → {Element}
Insert results to the content of the request
Parameters:
Name | Type | Description |
---|---|---|
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used inside: cardCreate, cardMoveImage, cardWhenClicked
- Used in: filterAddContent
Returns:
- Type
- Element
filterFoundContent()
Check if the contents of one filter are shown and before loading another one, delete it
- Source:
- See:
-
- Used inside: filterAddAllContent, filterRemoveContent, paginationRemove, paginationAdd
filterRemoveContent()
Remove the selected filter content of the application content
- Source:
- See:
firstUpperCase(string) → {String}
Converts the first letter of a string to uppercase
Parameters:
Name | Type | Description |
---|---|---|
string |
String | string with the this letter in lowercase |
- Source:
- See:
-
- Used in: cardCreate
Returns:
returns the same modified string
- Type
- String
functionAnonimAutoExecuted()
Anonymous auto executed function
- Source:
- See:
-
- Used inside: svgMe...
getCurrentYear() → {Number}
Get the current year
- Source:
- See:
-
- Used in: addCurrentYear
Returns:
- Type
- Number
loaderAdd()
Add loading animation
- Source:
- See:
-
- Used in: ajaxHandler
loaderCreate() → {HTMLElement}
Creation of a loading animation
- Source:
- See:
-
- Used in: loaderAdd
Returns:
- Type
- HTMLElement
loaderRemove()
Remove loading animation
- Source:
- See:
-
- Used in: ajaxHandler
messageAdd(messageId, messageClass, messageText)
Create the message component
Parameters:
Name | Type | Description |
---|---|---|
messageId |
String | Id for events js |
messageClass |
String | Class css with modifier BEM of the message |
messageText |
String | Text of the message |
- Source:
- See:
-
- Used inside: messageCloseAdd
- Used in: messageError404Add, messageAlertAdd
messageAlertAdd(messageName, messageText)
Create a alert personalized
Parameters:
Name | Type | Description |
---|---|---|
messageName |
String | Name of message in camellCase |
messageText |
String | Text of message |
- Source:
- See:
-
- Used inside: messageAdd, messageRemove
messageCloseAdd()
Create a button for remove the message
- Source:
- See:
-
- Used in: messageAlertAdd
messageError404Add()
Add message error 404 (search not found)
- Source:
- See:
-
- Used inside: messageAdd
- Used in: ajaxHandler
messageRemove(messageId)
Remove the message component
Parameters:
Name | Type | Description |
---|---|---|
messageId |
String | id of the message to remove |
- Source:
- See:
-
- Used in: ajaxHandler
paginationAdd(responseData)
Add pagination
Parameters:
Name | Type | Description |
---|---|---|
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used inside: paginationCreate, paginationSetCounter...
- Used in: filterFoundContent
paginationCreate(responseData)
Create pagination
Parameters:
Name | Type | Description |
---|---|---|
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used in: paginationAdd
paginationRemove()
Remove pagination
- Source:
- See:
paginationSetCounter(responseData)
Create counter pagination
Parameters:
Name | Type | Description |
---|---|---|
responseData |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used in: paginationAdd
searchAdd(filterActive)
Add searcher
Parameters:
Name | Type | Description |
---|---|---|
filterActive |
Element | filter selected |
- Source:
- See:
-
- Used inside: searchCreate, searchGet...
- Used in: functionAnonimAutoExecuted
searchCreate()
Create searcher
- Source:
- See:
-
- Used in: searchAdd
searchGet(filterActive)
Get the active filter to find it.
Parameters:
Name | Type | Description |
---|---|---|
filterActive |
Element | filter selected |
- Source:
- See:
-
- Used in: searchAdd
searchRemove()
Remove searcher
- Source:
- See:
-
- Used in: functionAnonimAutoExecuted
setAction(action, elementDom, dataResponse)
List of functions to choose from
Parameters:
Name | Type | Description |
---|---|---|
action |
String | name of the action to excute |
elementDom |
HTMLElement | DOM element where the response data is inserted |
dataResponse |
Object | response data of the ajax handler (json) |
- Source:
- See:
-
- Used inside: filterAdd, filterAddContent
- Used in: ajaxHandler
svgMe() → {Object}
Converts an <img>
tag, with a .svg
extention and a class svgMe
, into a <svg>
tag.
- Source:
- See:
-
- Used in: functionAnonimAutoExecuted
Returns:
Return the file svg
- Type
- Object
Events
click
View more card info when click it.
Type:
- object
- Source:
- See:
-
- Used inside: cardToggleView
click
Remove/Add content and pagination by selecting the filter from the navigation menu.
Type:
- object
- Source:
- See:
-
- Used inside: filterRemoveContent, paginationRemove, ajaxHandler
click
Get API data
Type:
- Object
- Source:
- See:
-
- Used inside: appContentAdd, ajaxHandler
click
Remove / Add content and pagination when selecting the filter of the navigation menu.
Type:
- object
- Source:
- See:
-
- Used inside: filterRemoveContent, paginationRemove, searchRemove, filterActive, searchAdd, ajaxHandler
keyup
Search by selected filter name when typing in the search engine input.
Type:
- Object
- Source:
- See:
-
- Used inside: delay, filterRemoveContent, paginationRemove, ajaxHandler