The project was working manually due to async function problem in Steem.js API.
3 buttons to be used simultaneously visualy confirming data is loaded to div.
Async. function problem solved with call to external function.
var flagger = document.getElementById("input_flagger").value
steem.api.getAccounts([flagger], function(err, response) {
The result is sent to an external function.
No promise or callback used.
calc(result,flagger);
});
This way the manual operation is cancelled and the DIV is loaded automatically.
We have the complete RESULT array in CALC function to operate.
Additionally, a "SPINNER" to the upper left corner is added to inform the user he has to wait.
There was no date selection, the data was analysed as from the beginning.
Hence, there exists a limitation for 10 000 data.
Date selector is added to the project.
With selected date, the data is seperated in FOR loop with IF statement.
for (let i = 0; i < result.length; i++) {
if ((result[i][1].op[0] == 'vote') && (result[i][1].op[1].voter = flagger) && (result[i][1].op[1].weight < 0) && (result[i][1].op[1].author != flagger)&&(result[i][1].timestamp>selectedDate)) {
With above code, the downvotes "after the selected date" is filtered.
Hyperlinks of the downvoted posts didn't exist.
Hyperlinks are added, so user can see the downvoted posts and comments.
var str ="https://steemit.com/@"+result[i][1].op[1].author+"/"+result[i][1].op[1].permlink;
var lin=(result[i][1].op[1].permlink).substring(0,70)+".......";
Hyperlinks are limited with 70 characters to fit the DIV.
Analysis were limited.
Analysis is shown in a seperate modal window, full sorted from maximum times downvoted user to minimum.
The sorting code :
GitHub : https://github.com/firedreamgames/steemflag
WebPage : https://steemflag.neocities.org
@FireDream - Steemit
@firedream#3528 - Discord