@0xecho/button
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -16,3 +16,4 @@ export const AUTO_UPDATE_INTERVAL = 1 * 60 * 1000 | ||
numberType: 'power', // or count | ||
zIndex: 999 | ||
zIndex: 999, | ||
defaultAvatars: [] | ||
} | ||
@@ -19,0 +20,0 @@ |
35
index.js
@@ -34,14 +34,2 @@ import Axios from 'axios' | ||
function pickAvatar(address) { | ||
address = address.split('.')[0].split('') | ||
const lastLetter = address[address.length - 1] | ||
if (/[0-5]$/.test(lastLetter)) { | ||
return defaultAvatar1 | ||
} else if (/[6-9a]/.test(lastLetter)) { | ||
return defaultAvatar2 | ||
} else { | ||
return defaultAvatar3 | ||
} | ||
} | ||
export default class EchoButton { | ||
@@ -60,2 +48,10 @@ constructor(options = {}) { | ||
this.options.defaultAvatars = [ | ||
this.options.defaultAvatars[0] || defaultAvatar1, | ||
this.options.defaultAvatars[1] || defaultAvatar2, | ||
this.options.defaultAvatars[2] || defaultAvatar3, | ||
] | ||
console.log('default', this.options) | ||
// @todo get all data in a request and cache them | ||
@@ -126,2 +122,15 @@ this.batchTargetUris = options.batch_target_uris || [] | ||
pickAvatar(address) { | ||
address = address.split('.')[0].split('') | ||
const lastLetter = address[address.length - 1] | ||
if (/[0-5]$/.test(lastLetter)) { | ||
return this.options.defaultAvatars[0] | ||
} else if (/[6-9a]/.test(lastLetter)) { | ||
return this.options.defaultAvatars[1] | ||
} else { | ||
return this.options.defaultAvatars[2] | ||
} | ||
} | ||
showMessage(type, text) { | ||
@@ -393,3 +402,3 @@ this.$message.className = '' | ||
if (!one.author.avatar) { | ||
one.author.avatar = pickAvatar(one.author.address) | ||
one.author.avatar = this.pickAvatar(one.author.address) | ||
} | ||
@@ -396,0 +405,0 @@ return one |
{ | ||
"name": "@0xecho/button", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@ethersproject/bytes": "^5.7.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
533793
2986