Welcome To Steem Compare
diff --git a/js/main.js b/js/main.js
index e0f39c9..05e7976 100644
--- a/js/main.js
+++ b/js/main.js
@@ -18,13 +18,29 @@ $(document).ready(() => {
},
animation: {
queue : true,
- duration: 200,
- queueLimit: 50
+ duration: 0,
+ queueLimit: 500
}
});
})
//setups
+if ($('body').hasClass('user-compare')){
+ steemActions.getGlobalProps(STEEM_SERVER)
+ .then(steemActions.checkForUsersAndSearch())
+}
-steemActions.getGlobalProps(STEEM_SERVER)
- .then(steemActions.checkForUsersAndSearch())
+if ($('body').hasClass('follower-compare')){
+ steem.api.getFollowers('sambillingham', '', 'blog', 1000, function(err, result) {
+ // let followers = result.reduce( (a,b) => a + ', ' + b.follower )
+ let followers = result.map( (user) => user.follower )
+
+ console.log(followers)
+ steemActions.getGlobalProps(STEEM_SERVER)
+ .then( () => {
+ steemActions.addUsers(followers, true)
+ })
+
+ });
+
+}
diff --git a/js/modules/steemActions.js b/js/modules/steemActions.js
index c63ee1c..e672476 100644
--- a/js/modules/steemActions.js
+++ b/js/modules/steemActions.js
@@ -30,7 +30,7 @@ export function checkForUsersAndSearch(){
}
}
-export function addUsers(users){
+export function addUsers(users, sortType){
var sort = ($('.mixitup-control-active').length) ? $('.mixitup-control-active').data('btn-sort') : false
getAccounts(users)
.then(data => proccessData(data) )
@@ -38,7 +38,7 @@ export function addUsers(users){
}
export function displayAccounts(newAccounts, sortValue ){
-
+ console.log(newAccounts)
let allAccounts = displayedAccounts.concat(newAccounts);
let allAccountsNoDup = util.removeDuplicates(allAccounts, 'name');
displayedAccounts = allAccountsNoDup
@@ -56,7 +56,7 @@ export function displayAccounts(newAccounts, sortValue ){
data-followers="${user.followerCount}"
data-accountage="${user.accountAgeMilliseconds}" >
-
+
${user.name} ${user.rep}
EFFECTIVE SP: ${ (user.effectiveSp).toLocaleString() }
STEEMPOWER: ${user.sp}
(+ ${user.delegatedSpIn} - ${user.delegatedSpOut})
@@ -76,9 +76,13 @@ export function displayAccounts(newAccounts, sortValue ){
Age: ${ (user.accountAge) }
+
+
+
+
💵 $${(user.usdValue).toLocaleString()}
-
+
`;
mixer.append(template);
@@ -93,6 +97,9 @@ export function displayAccounts(newAccounts, sortValue ){
mixer.sort(reSort)
mixer.forceRefresh();
} else {
+ mixer.sort('reputation:desc')
+ mixer.forceRefresh();
+
let accountsNamesForUrl = displayedAccounts.map( user => user.name )
util.setQueryUrl(accountsNamesForUrl)
}
@@ -121,8 +128,7 @@ export function proccessData(accounts){
let processAllData = new Promise((resolve, reject) => {
accounts.forEach( user => {
- // store meta Data
- let jsonData = user.json_metadata ? JSON.parse(user.json_metadata).profile : {}
+
// steem power calc
let vestingShares = user.vesting_shares;
let delegatedVestingShares = user.delegated_vesting_shares;
@@ -136,9 +142,25 @@ export function proccessData(accounts){
let votePower = user.voting_power += (10000 * lastVoteTime / 432000);
votePower = Math.min(votePower / 100, 100).toFixed(2);
+ let profileImage = 'img/default-user.jpg';
+
+ if (user.json_metadata == '' ||
+ user === undefined ||
+ user.json_metadata == 'undefined' ||
+ user.json_metadata === undefined ) {
+ user.json_metadata = { profile_image : ''}
+ } else {
+ user.json_metadata = user.json_metadata ? JSON.parse(user.json_metadata).profile : {};
+ }
+
+ if (user.json_metadata === undefined){
+ user.json_metadata = { profile_image : ''}
+ }
+ profileImage = user.json_metadata.profile_image ? 'https://steemitimages.com/2048x512/' + user.json_metadata.profile_image : '';
+
accountsData.push({
name: user.name,
- image: jsonData.profile_image ? 'https://steemitimages.com/2048x512/' + jsonData.profile_image : '',
+ image: profileImage,
rep: steem.formatter.reputation(user.reputation),
effectiveSp: parseInt(steemPower + delegatedSteemPower - -outgoingSteemPower),
sp: parseInt(steemPower).toLocaleString(),
@@ -167,6 +189,7 @@ export function proccessData(accounts){
}
})
+
let usdValues = accounts.map( user => steem.formatter.estimateAccountValue(user) )
Promise.all(usdValues)
@@ -174,19 +197,20 @@ export function proccessData(accounts){
for (let i = 0; i < data.length; i++) {
accountsData[i].usdValue = parseInt(data[i])
}
+ resolve(accountsData);
})
- let extraStats = accounts.map( user => getStats(user.name))
-
- Promise.all(extraStats)
- .then(data => {
- for (let i = 0; i < data.length; i++) {
- accountsData[i].averageVotes = data[i].averageVotes
- accountsData[i].averageReplies = data[i].averageReplies
- accountsData[i].wordCount = data[i].wordCount
- }
- resolve(accountsData);
- })
+ // let extraStats = accounts.map( user => getStats(user.name))
+ //
+ // Promise.all(extraStats)
+ // .then(data => {
+ // for (let i = 0; i < data.length; i++) {
+ // accountsData[i].averageVotes = data[i].averageVotes
+ // accountsData[i].averageReplies = data[i].averageReplies
+ // accountsData[i].wordCount = data[i].wordCount
+ // }
+ // resolve(accountsData);
+ // })
});