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

SteemPlus 2.12 : Rewards Tab #77

Merged
merged 15 commits into from
May 7, 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
9 changes: 8 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Promise.all([steem.api.getDynamicGlobalPropertiesAsync(), steem.api.getCurrentMe
});
});

chrome.storage.local.get(['wallet_history','wallet_history_memo_key','article_count','witnesses_tab','classification_user','board_reward','favorite_section','votePowerReserveRateLS','totalSteemLS','totalVestsLS','rewardBalanceLS','recentClaimsLS','steemPriceLS','post_floating_bottom_bar','post_floating_bottom_bar_size','last_post_url','smi_installed_remind_me', 'smi_installed_remind_me_time','md_editor_beautifier','blog_histogram','user_info_popover','gif_picker','boost_button','followers_table','vote_weight_slider','mentions_tab','search_bar','external_link_tab','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','market'], function (items) {
chrome.storage.local.get(['rewards_tab','wallet_history','wallet_history_memo_key','article_count','witnesses_tab','classification_user','board_reward','favorite_section','votePowerReserveRateLS','totalSteemLS','totalVestsLS','rewardBalanceLS','recentClaimsLS','steemPriceLS','post_floating_bottom_bar','post_floating_bottom_bar_size','last_post_url','smi_installed_remind_me', 'smi_installed_remind_me_time','md_editor_beautifier','blog_histogram','user_info_popover','gif_picker','boost_button','followers_table','vote_weight_slider','mentions_tab','search_bar','external_link_tab','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','market'], function (items) {
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}} );
market=items.market==undefined?{SBDperSteem:0,priceSteem:0,priceSBD:0}:items.market;
Expand Down Expand Up @@ -244,6 +244,9 @@ function startOfflineFeatures(items, user, account)
const article_count=(items.article_count == undefined || items.article_count=='show');
const wallet_history=(items.wallet_history == undefined || items.wallet_history=='show');
const wallet_history_memo_key=(items.wallet_history_memo_key== undefined ? '' : items.wallet_history_memo_key);
const rewards_tab=(items.rewards_tab == undefined || items.rewards_tab=='show');


const smi_installed_remind_me=(items.smi_installed_remind_me == undefined || items.smi_installed_remind_me);
const smi_installed_remind_me_time=items.smi_installed_remind_me_time;
const last_post_url=items.last_post_url;
Expand Down Expand Up @@ -274,6 +277,8 @@ function startOfflineFeatures(items, user, account)
chrome.runtime.sendMessage({ token:token, to: 'article_count', order: 'start',data:{}});
if(wallet_history&&steemit)
chrome.runtime.sendMessage({ token:token, to: 'wallet_history', order: 'start',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS,walletHistoryMemoKey:wallet_history_memo_key,account:account}});
if(rewards_tab&&steemit)
chrome.runtime.sendMessage({ token:token, to: 'rewards_tab', order: 'start',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS}});

if (steemit&&steemit_more_info) {
if(post_votes_list)
Expand Down Expand Up @@ -347,6 +352,8 @@ function startOfflineFeatures(items, user, account)
chrome.runtime.sendMessage({ token:token, to: 'article_count', order: 'click',data:{}});
if(wallet_history&&steemit)
chrome.runtime.sendMessage({ token:token, to: 'wallet_history', order: 'click',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS,walletHistoryMemoKey:wallet_history_memo_key,account:account}});
if(rewards_tab&&steemit)
chrome.runtime.sendMessage({ token:token, to: 'rewards_tab', order: 'click',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS}});

if($('.favorite-star').length > 0){
$('.favorite-star').remove();
Expand Down
8 changes: 5 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "SteemPlus",
"description": "Lightweight toolbox for Steemit",
"version": "2.11.3",
"version": "2.12",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"browser_action": {
"default_icon": "src/img/logo.png",
Expand Down Expand Up @@ -93,7 +93,8 @@
"src/js/classification_user.js",
"src/js/witnesses_tab.js",
"src/js/article_count.js",
"src/js/wallet_history.js"],
"src/js/wallet_history.js",
"src/js/rewards_tab.js"],

"css":["vendor/unslider/unslider.css","vendor/unslider/unslider-dots.css","vendor/bootstrap.css","vendor/bootstrap-grid.css","vendor/btn.css","vendor/datatables.min.css","vendor/justifiedGallery.min.css","vendor/toastr.min.css",
"src/css/delegate.css",
Expand All @@ -111,7 +112,8 @@
"src/css/classification_user.css",
"src/css/dropdown.css",
"src/css/witnesses_tab.css",
"src/css/wallet_history.css"],
"src/css/wallet_history.css",
"src/css/rewards_tab.css"],
"run_at": "document_idle"
}
]
Expand Down
14 changes: 11 additions & 3 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ <h3>Login</h3>
<span class="slider2 round"></span>
</label>
<p class="option-title">Witnesses Tab</p>
<div class="new-indicator"><span>New</span></div>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"></div>
<p class="option-description">Display witnesses an user has voted for. You can also managed your votes.</a></p>
</div>
Expand All @@ -204,7 +203,6 @@ <h3>Login</h3>
<span class="slider2 round"></span>
</label>
<p class="option-title">Number of articles and comments</p>
<div class="new-indicator"><span>New</span></div>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"></div>
<p class="option-description">Change the display of the number of article in the banner.</a></p>
</div>
Expand All @@ -215,11 +213,21 @@ <h3>Login</h3>
<span class="slider2 round"></span>
</label>
<p class="option-title">Wallet History</p>
<div class="new-indicator"><span>New</span></div>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"></div>
<p class="option-description">This feature will allow you to filter your wallet history.</a></p>
</div>

<div class="sp_option">
<label class="switch">
<input type="checkbox" name="rewards_tab" id="rewards_tab">
<span class="slider2 round"></span>
</label>
<p class="option-title">Reward Tab</p>
<div class="new-indicator"><span>New</span></div>
<div class="platform-indicators"><img class="platform-indicator-logo" src="src/img/platform-logos/steemit.png"></div>
<p class="option-description">Get all your rewards! Author rewards, Benefactor Rewards and Curation Rewards.</a></p>
</div>

<div class="sp_option_list_title">
<label class="switch">
<input type="checkbox" name="steemit_more_info" id="steemit_more_info">
Expand Down
10 changes: 9 additions & 1 deletion popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var isConnectedToSteemConnect=null;

$('#shortcuts, .switch-text').hide();
// Get local parameters stored using Chrome Storage API
chrome.storage.local.get(['wallet_history','article_count','witnesses_tab','classification_user','board_reward','favorite_section','post_floating_bottom_bar','md_editor_beautifier','blog_histogram','user_info_popover','gif_picker','boost_button','followers_table','vote_weight_slider','mentions_tab','search_bar','external_link_tab','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) {
chrome.storage.local.get(['rewards_tab','wallet_history','article_count','witnesses_tab','classification_user','board_reward','favorite_section','post_floating_bottom_bar','md_editor_beautifier','blog_histogram','user_info_popover','gif_picker','boost_button','followers_table','vote_weight_slider','mentions_tab','search_bar','external_link_tab','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};
isConnectedToSteemConnect = steemConnect.connect;
// Connected
Expand Down Expand Up @@ -94,6 +94,7 @@ chrome.storage.local.get(['wallet_history','article_count','witnesses_tab','clas
witnesses_tab=items.witnesses_tab==undefined?'show':items.witnesses_tab;
article_count=items.article_count==undefined?'show':items.article_count;
wallet_history=items.wallet_history==undefined?'show':items.wallet_history;
rewards_tab=items.rewards_tab==undefined?'show':items.rewards_tab;

// Steemit more info
steemit_more_info=items.steemit_more_info==undefined?'show':items.steemit_more_info;
Expand Down Expand Up @@ -138,6 +139,7 @@ chrome.storage.local.get(['wallet_history','article_count','witnesses_tab','clas
$('input[name=witnesses_tab]').prop('checked',witnesses_tab=='show');
$('input[name=article_count]').prop('checked',article_count=='show');
$('input[name=wallet_history]').prop('checked',wallet_history=='show');
$('input[name=rewards_tab]').prop('checked',rewards_tab=='show');

// Steemit more info
$('input[name=steemit_more_info]').prop('checked',steemit_more_info=='show');
Expand Down Expand Up @@ -439,6 +441,12 @@ $(document).on("change","input[name=wallet_history]",function(){
});
});

$(document).on("change","input[name=rewards_tab]",function(){
chrome.storage.local.set({
rewards_tab:$("input[name=rewards_tab]").prop('checked')?'show':'hide'
});
});

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

chrome.storage.local.set({
Expand Down
37 changes: 37 additions & 0 deletions src/css/rewards_tab.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

.rewards-type {
margin-right: 0px !important;
margin-left: 0px !important;
text-transform: capitalize;
}

.rewards-odd
{
background-color: #eeeeee;
}

.container-rewards > div > span {
padding-top: 5px;
padding-bottom: 5px;
}

.total-pending-label
{
font-weight: bold;
}

/* Night mode */

.theme-dark .subtypeItem
{
color: white !important;
}
.theme-dark .subtypeItem:hover
{
color: #4ba2f2 !important;
}

.theme-dark .rewards-odd
{
color: black;
}
18 changes: 9 additions & 9 deletions src/js/mentions_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var recentClaimsMentionsTab=null;
var steemPriceMentionsTab=null;
var mentionTabStarted=false;
var mentionsTabPostsComments=null;
var downloadingData=false;
var downloadingDataMentionTab=false;

var indexLastItemDisplayed=0;

Expand Down Expand Up @@ -120,13 +120,13 @@ function createMentionsTab(mentionsTab) {
// @parameter reset : need to reset UI or not
function displayMentions(mentionsTab, type, usernamePageMentions,reset)
{
if(mentionsTabPostsComments===null&&!downloadingData)
if(mentionsTabPostsComments===null&&!downloadingDataMentionTab)
{
// console.log("Start data downloading");
$.ajax({
type: "GET",
beforeSend: function(xhttp) {
downloadingData=true;
downloadingDataMentionTab=true;
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("X-Parse-Application-Id", chrome.runtime.id);
// console.log(xhttp);
Expand All @@ -136,11 +136,11 @@ function displayMentions(mentionsTab, type, usernamePageMentions,reset)
success: function(result) {

mentionsTabPostsComments = result;
createRows(mentionsTab, type, reset);
downloadingData = false;
createRowsMentionTab(mentionsTab, type, reset);
downloadingDataMentionTab = false;
},
error: function(msg) {
downloadingData = false;
downloadingDataMentionTab = false;
if($('.error-mentions-label').length===0){
var errorLabel = document.createElement('h2');
$(errorLabel).addClass('articles__h1');
Expand All @@ -154,7 +154,7 @@ function displayMentions(mentionsTab, type, usernamePageMentions,reset)
}
else
{
if(downloadingData)
if(downloadingDataMentionTab)
{
// console.log("downloading data");
// wait because data already downloading
Expand All @@ -166,13 +166,13 @@ function displayMentions(mentionsTab, type, usernamePageMentions,reset)
{
// console.log("already downloaded");
// display with local data
createRows(mentionsTab, type, reset);
createRowsMentionTab(mentionsTab, type, reset);
}
}

}

function createRows(mentionsTab, type, reset)
function createRowsMentionTab(mentionsTab, type, reset)
{
if(reset)
{
Expand Down
Loading