Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add votes tab to steemplus, updated popup with steemit-more-info sett… #10

Merged
merged 1 commit into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steem.api.getDynamicGlobalProperties( function(err,globalProp)
const totalSteem = Number(globalProp.total_vesting_fund_steem.split(' ')[0]);
const totalVests = Number(globalProp.total_vesting_shares.split(' ')[0]);
updateSteemPrice();
chrome.storage.local.get(['steemit_more_info','post_votes_list', 'oneup','weight','del','transfers','acc_v','ben','drop','badge','username', 'nb_posts','resteem','sort','tag','list_tags','voted_check', 'rep_feed', 'rep_feed_check', 'whitelist', 'blacklist','feedp','sessionToken','tokenExpire'], function (items) {
chrome.storage.local.get(['vote_tab','steemit_more_info','post_votes_list', 'oneup','weight','del','transfers','acc_v','ben','drop','badge','username', 'nb_posts','resteem','sort','tag','list_tags','voted_check', 'rep_feed', 'rep_feed_check', 'whitelist', 'blacklist','feedp','sessionToken','tokenExpire'], function (items) {
const token=makeToken();
var steemConnect=(items.sessionToken===undefined||items.tokenExpire===undefined)?{connect:false}:{connect:true,sessionToken:items.sessionToken,tokenExpire:items.tokenExpire};
chrome.runtime.sendMessage({ token:token, to: 'steemConnect', order: 'start',data:{steemConnect:steemConnect,steemit:steemit,busy:busy,utopian:utopian}} );
Expand All @@ -52,6 +52,7 @@ steem.api.getDynamicGlobalProperties( function(err,globalProp)

const steemit_more_info=(items.steemit_more_info == undefined || items.steemit_more_info=='show');
const post_votes_list=(items.post_votes_list == undefined || items.post_votes_list=='show');
const vote_tab=(items.vote_tab == undefined || items.vote_tab=='show');

var whitelist=(items.whitelist !== undefined)?items.whitelist:"";
var blacklist=(items.blacklist !== undefined)?items.blacklist:"";
Expand Down Expand Up @@ -83,7 +84,11 @@ steem.api.getDynamicGlobalProperties( function(err,globalProp)
if (steemit_more_info) {
if(steem&&post_votes_list)
chrome.runtime.sendMessage({ token:token, to: 'post_votes_list', order: 'start',data:{rewardBalance:rewardBalance, recentClaims:recentClaims, steemPrice:steemPrice}});
if(steem&&vote_tab)
chrome.runtime.sendMessage({ token:token, to: 'vote_tab', order: 'start',data:{rewardBalance:rewardBalance, recentClaims:recentClaims, steemPrice:steemPrice}});
}


$(document).click(function(){
setTimeout(function(){
if(url!==window.location.href)
Expand Down
6 changes: 4 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"content_scripts": [
{
"matches": ["https://steemit.com/*","https://busy.org/*","https://mspsteem.com/*","https://utopian.io/*"],
"js": ["vendor/jquery.js","vendor/sc2.min.js","vendor/timeago.js","vendor/steemjs.js","vendor/bootstrap.js", "vendor/underscore-min.js",
"js": ["vendor/jquery.js","vendor/sc2.min.js","vendor/timeago.js","vendor/steemjs.js","vendor/bootstrap.js", "vendor/underscore-min.js", "vendor/remarkable.min.js", "vendor/sanitize-html.min.js", "vendor/chrome_addons.js", "vendor/moment.min.js",
"vendor/smi/base_tab.js","vendor/smi/sanitize.js","vendor/smi/utils.js",
"main.js",
"src/js/loginSteemPlus.js",
"src/js/delegate.js",
Expand All @@ -71,7 +72,8 @@
"src/js/feedplus.js",
"src/js/transferTo.js",
"src/js/oneup.js",
"src/js/postVoteList.js"],
"src/js/postVoteList.js",
"src/js/vote_tab.js"],

"css":["vendor/bootstrap.css",
"src/css/delegate.css",
Expand Down
13 changes: 11 additions & 2 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,27 @@ <h3>Login</h3>
<span class="slider2 round"></span>
</label>
<p class="option-title">Steemit More Info</p>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"></div>

<div class="sp_option_list">
<label class="switch">
<input type="checkbox" name="post_votes_list" id="post_votes_list">
<span class="slider2 round"></span>
</label>
<p class="option-title">Post Votes List</p>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"><img class="platform-indicator-logo" src="src/img/platform-logos/busy.png"></div>
<p class="option-description">Adds the amount in dollars of the votes a post has received, so that you can see how much each account's vote affected the rewards</p>
</div>

</div>
<div class="sp_option_list">
<label class="switch">
<input type="checkbox" name="vote_tab" id="vote_tab">
<span class="slider2 round"></span>
</label>
<p class="option-title">Vote Tab</p>
<p class="option-description">Adds a tab where you can see the incoming and outgoing votes of an account</p>
</div>

</div>

</div>
</div>
Expand Down
11 changes: 10 additions & 1 deletion popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var back=document.getElementsByClassName("back_menu");

$('#shortcuts, .switch-text').hide();
// Get local parameters stored using Chrome Storage API
chrome.storage.local.get(['steemit_more_info','post_votes_list','onboarding','oneup','sessionToken','tokenExpire','weight','resteem','blacklist','whitelist','reputation','rep','badge','del','ben','feedp','drop','acc_v','transfers'], function (items) {
chrome.storage.local.get(['vote_tab','steemit_more_info','post_votes_list','onboarding','oneup','sessionToken','tokenExpire','weight','resteem','blacklist','whitelist','reputation','rep','badge','del','ben','feedp','drop','acc_v','transfers'], function (items) {
var steemConnect=(items.sessionToken===undefined||items.tokenExpire===undefined||items.tokenExpire<Date.now())?{connect:false}:{connect:true,sessionToken:items.sessionToken,tokenExpire:items.tokenExpire};

if(steemConnect.connect===true)
Expand Down Expand Up @@ -74,6 +74,7 @@ chrome.storage.local.get(['steemit_more_info','post_votes_list','onboarding','on

steemit_more_info=items.steemit_more_info==undefined?'show':items.steemit_more_info;
post_votes_list=items.post_votes_list==undefined?'show':items.post_votes_list;
vote_tab=items.vote_tab==undefined?'show':items.vote_tab;

//console.log(items.resteem);
if(weight!==undefined)
Expand All @@ -93,6 +94,7 @@ chrome.storage.local.get(['steemit_more_info','post_votes_list','onboarding','on

$('input[name=steemit_more_info]').prop('checked',steemit_more_info=='show');
$('input[name=post_votes_list]').prop('checked',post_votes_list=='show');
$('input[name=vote_tab]').prop('checked',vote_tab=='show');

if(steemit_more_info=='hide')
{
Expand Down Expand Up @@ -258,6 +260,13 @@ $(document).on("change","input[name=post_votes_list]",function(){
});
});

$(document).on("change","input[name=vote_tab]",function(){

chrome.storage.local.set({
vote_tab:$("input[name=vote_tab]").prop('checked')?'show':'hide'
});
});

$(document).on("change","input[name=steemit_more_info]",function(){

chrome.storage.local.set({
Expand Down
137 changes: 132 additions & 5 deletions src/css/steemit_more_info.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,137 @@
.vote-weight, .vote-dollar{
padding: 0px !important;
padding-top: 2px !important;
padding-left: 5px !important;
color:#376FA7 !important;
.Voting__voters_list ul.VerticalMenu li span.vote-weight,
.Voting__voters_list ul.VerticalMenu li span.vote-dollar {
padding: 0px;
padding-top: 2px;
padding-left: 5px;
color:#376FA7 !important;
}

.Voting__voters_list ul.VerticalMenu li {
display: flex;
}

.votes-history-type {
margin-right: 0px !important;
margin-left: 0px !important;
}

.switch-field {
display: inline-block;
overflow: hidden;
}
.switch-title {
margin-bottom: 6px;
}
.switch-field input {
position: absolute !important;
clip: rect(0, 0, 0, 0);
height: 1px;
width: 1px;
border: 0;
overflow: hidden;
}
.switch-field label {
float: left;
display: inline-block;
background-color: white;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: normal;
text-align: center;
text-shadow: none;
padding: 0px 14px;
margin: 0px;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-ms-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.switch-field label:hover {
cursor: pointer;
}
.switch-field input:checked + label {
background-color: #1a5099;
color: white;
-webkit-box-shadow: none;
box-shadow: none;
}
.switch-field label:first-of-type {
border-radius: 4px 0 0 4px;
}
.switch-field label:last-of-type {
border-radius: 0 4px 4px 0;
}
.UserProfile__tab_content_VotesTab {
padding-bottom: 60px;
}
.UserProfile__tab_content_VotesTab .VotesTab {
padding-bottom: 20px;
}
.UserProfile__tab_content_VotesTab .VotesTabLoadMore button {
background-color: transparent;
border-radius: 6px;
border: 1px solid rgb(220, 220, 220);
display: inline-block;
cursor: pointer;
color: rgb(119, 119, 119);
font-size: 17px;
padding: 10px 24px;
text-decoration: none;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote {
display: flex;
align-items: center;
}
.UserProfile__tab_content_VotesTab .VotesTab .votes-container:not(.show-incoming) .vote.vote-incoming {
display: none;
}
.UserProfile__tab_content_VotesTab .VotesTab .votes-container:not(.show-outgoing) .vote.vote-outgoing {
display: none;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .Userpic {
margin: 5px;
border: solid 1px #cacaca;
min-width: 48px;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .vote-info {
flex-shrink: 10;
max-width: calc(100% - 55px);
display: inline-block;
padding: 0px 10px;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .action {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
max-width: 100%;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .timeago {
white-space: nowrap;
padding: 0px;
color: #888;
display: inline-block;
font-size: 0.9em;
vertical-align: top;
margin-top: -5px;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .vote-weight {
white-space: nowrap;
padding-left: 20px;
color: #888;
display: inline-block;
font-size: 0.9em;
vertical-align: top;
margin-top: -5px;
}
.UserProfile__tab_content_VotesTab .VotesTab .vote .vote-dollar {
}

@media screen and (max-width: 500px) {
.UserProfile__tab_content_VotesTab .VotesTab .vote .smi-vote-permlink {
display: block;
margin-top: -7px;
}
}
6 changes: 3 additions & 3 deletions src/js/postVoteList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{
token_post_vote_list=request.token;
rewardBalance=request.data.rewardBalance;
recentClaims=request.data.recentClaims;
steemPrice=request.data.steemPrice;
recentClaims=request.data.recentClaims;
steemPrice=request.data.steemPrice;

startPostVoteList();
}
Expand Down Expand Up @@ -129,7 +129,7 @@ function addPostVoteList(votersList)
newElCount++;
voteEls.push(newEl);
}
else
//else
_.each(voteEls, function(voteEl) {
voteEl.find('.vote-weight').text(votePercent + '%');
voteEl.find('.vote-dollar').text('≈ ' + voteDollar.toFixed(2) + '$');
Expand Down
12 changes: 8 additions & 4 deletions src/js/rank.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function displayBadges(badge)
{
if($('.UserProfile__banner ').length!==0)
{
getAccountData(getUsernameFromProfile()).then(function (result){
getAccountData(getUsernameFromProfile()).then(function (result){
if (result.length > 0)
{
const vesting_shares=parseFloat(result["0"].vesting_shares.split(' '));
const rank=getUserRank(vesting_shares);
const badge_serie=badge==undefined?2:(badge=='show'?2:badge);
Expand All @@ -36,12 +38,14 @@ function displayBadges(badge)
$('.wrapper ').first().children().first().insertBefore($('.wrapper'));
}
$('.UserProfile__banner ')[0].childNodes[0].prepend(div);
});
}
}

});
}
}

function getUserRank (vests) {
console.log('User vests: ',vests);
//console.log('User vests: ',vests);
var rank = 'Plankton';
if (vests >= 1000000000) {
rank = 'Whale';
Expand Down
Loading