This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. set Listener for each filter | |
$("#pokemonTypeFilter").on('change', function(){ | |
var filterPokemonType = this.value; | |
var filterPokemonAtk = $("#pokemonAtkFilter").val(); | |
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk); | |
renderPokemonList(filterPokemon); | |
}); | |
$("#pokemonAtkFilter").on('keyup', function(){ | |
var filterPokemonAtk = this.value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2. set render function | |
var renderPokemonList = function(filterPokemon) { | |
$("#filterPokemonCount").html(filterPokemon.length); | |
var liStrings = filterPokemon.map(function (item) { | |
return "<li>" + item.name + " (Atk: " + item.attack + ", Def: " + item.defense + ")</li>"; | |
}); | |
$("#pokemonListUl").html(liStrings); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. set Reducer function to accept store.dispatch() | |
var reducer = function (state, action) { | |
var newState = state; | |
if (typeof state === 'undefined') { | |
return { | |
pokemonType: null, | |
pokemonAtk: null | |
}; | |
} | |
switch (action.type) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3. set render function | |
var render = function() { | |
var filterPokemonType = store.getState().pokemonType; | |
var filterPokemonAtk = store.getState().pokemonAtk; | |
var filterPokemon = filterPokemonByTypeAndMinAtk(allPokemons, filterPokemonType, filterPokemonAtk); | |
ReactDOM.render( | |
<div> | |
<div>--- Total Filter Pokemon: {filterPokemon.length} ---</div> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return <PokemonInfo pokemonDetail={item} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": {}, | |
"data": [ | |
{ | |
"receipt_id": "R012760012", | |
"type": "in_debt", | |
"timestamp": "1485470001375", | |
"cost": 10400 | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getBathText = function (inputNumber) { | |
var getText = function (input) { | |
var toNumber = input.toString(); | |
var numbers = toNumber.split('').reverse(); | |
var numberText = "/หนึ่ง/สอง/สาม/สี่/ห้า/หก/เจ็ด/แปด/เก้า/สิบ".split('/'); | |
var unitText = "/สิบ/ร้อย/พ้น/หมื่น/แสน/ล้าน".split('/'); | |
var output = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-07-24T15:00:50.854Z","extensionVersion":"v3.4.3"} |
OlderNewer