Eval-O-Tron: a little side project
This is something I came up with because @markrmorrisjr suggested some kind of automated poll evaluation for his "UPick the story" series. There he gives a couple of options to the people and asks them which one they would like to read about, then has to go through every comment and count them.
The idea is to filter all comments by a keyword so you will only have relevant comments and provide some additional informations about what users picked.
preparation
For getting all comments on a post there needs to be the author of the post and the permalink. In addition a keyword to search for in the comment is required.
I started creating a basic HTML file providing the input fields needed. Furthermore I added steem-js to access the data on the blockchain and jQuery for convenience with handling events. Finally some basic StyleSheet was added to neatly arrange all elements.
The result can be seen here.
JavaScript
After filling in all neccessary data the script has to
- get all comments to relevant post
- search the body of the comments for the keyword
- display comments where keyword is found
These actions will be triggered by clicking on the search link.
$('.button-search')
.click(function(){
var author = $('#search_author').val();
var permlink = $('#search_permlink').val();
var key = $('#search_key').val();
// get all comments on a post from the api
steem.api.getContentReplies(author, permlink, function(err, results) {
var showResults = results;
// if search key is set, filter resultss
if(key) {
showResults = [];
$(results)
.each(function() {
var comment = this;
var comment_body = comment['body'];
if (comment_body.toLowerCase().indexOf( key.toLowerCase() ) >= 0) {
showResults.push(comment);
}
});
}
var users = [];
var commentListHTML = '';
// iterate through comments to be displayed
// collect data, prepare html
$(showResults)
.each(function(){
// add user to the list
var user = this['author'];
if(!(user in users)) {
users.push(user);
}
// process comment data to html
commentListHTML += commentToHTML(this);
});
// evaluation of processed data
var evaluationHTML = evaluationToHTML(key, users);
var content = evaluationHTML + commentListHTML;
$('#content').html(content);
});
});
See full source on GitHub.
future development
Right now this is something I just wanted to do because I couldn't stop thinking about how it can be done. So to get it out of my system I had to sit down and write it. Feature development and polishing will take a lot more time than the couple of hours I put into this until now. I don't have a use case for this right now so no need for me to develop this any further, spending my time for something no one wants to use. However, if there are people out there which like to use this kind of tool I will happily continue working on it.
Additional features I can think of:
- additional informations about upvoting / resteeming on the post
- add multiple search keys, evaluating all your options in one go
- keyword highlighting
- handle users with multiple options
- charts
If you like to see these please say so. Also let me know which features you come up. What would make your life on steem easier?
graphic design
As you can see this is a really plain design of the page. It works but it could use someone who actually knows how to design a frontend like this. If this is something you can do please contact me. I value a good design so there won't be anything I want for free.
To get in touch please leave a comment or write a direct message on Discord @DerAsmo#9548.
Yes! So much yes! @moneyinfant, you should ask your list if this is a tool that would be helpful. I'd also love to be able to know how many of my posts an account has commented on, among other things. Thanks for working on this! I'll take a look at it, although I'm not very techie, so I may have to wait for a plug n play version. LOL
Might want to give this one a try: http://travianinc.lima-city.de/evalotron/
Cool! I like the upvote tick box. Also, it generates a list. But, what is "unresolved" and "unlocated"?
Unresolved are comments where more than 1 option was found. Was thinking to add an option to assign them manually.
Unlocated are comments where no keywords where found at all or when people didnt upvoted these comments will be there too.
So you can look through this list and and add another keyword. Maybe someone wrote something wrong.
Will put some more work into it tomorrow and write a blogpost about what changed and whats possible.
Cool, thanks for sharing it. I'll be using it tomorrow to decide the winner of my contest. Need to get some cam software so I can do a screen capture video.
I'll definitely be pointing my list towards this. It's something many of the people running contests could use I think. Especially those that end up getting 30, 50 or more entries. Brilliant work, especially since it was just something @derasmo had to get out of his system :D
@keciah is running a little contest that's different, share your biggest parenting fail, she could use the promotion
LOL, well, I think I put a burr under his saddle, as the saying goes.
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @derasmo I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
I really like this, I hope you can get this implemented as you took the poll idea a meshed it with the steem functions which I never even thought about.