Skip to content

Commit

Permalink
Handle onClicks
Browse files Browse the repository at this point in the history
  • Loading branch information
stoodkev committed Mar 14, 2018
1 parent d1b001b commit 6cd1aff
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 43 deletions.
18 changes: 13 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,24 @@ Promise.all([steem.api.getDynamicGlobalPropertiesAsync(), steem.api.getCurrentMe
chrome.runtime.sendMessage({ token:token, to: 'ben', order: 'click',data:{user:user}});
if(rank&&steemit)
chrome.runtime.sendMessage({ badge:items.badge,token:token, to: 'rank', order: 'click'});
if(steemit&&followers_table)
if(steemit&&followers_table&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'followers_table', order: 'click', data:{user:user}});
if(steemit&&boost_button)
if(steemit&&boost_button&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'boost_button', order: 'click', data:{user:user}});
if(steemit&&md_editor_beautifier)
if(steemit&&md_editor_beautifier&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'md_editor_beautifier', order: 'click', data:{}});
if(steemit&&user_info_popover)
if(steemit&&user_info_popover&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'user_info_popover', order: 'click',data:{rewardBalance:rewardBalance, recentClaims:recentClaims, steemPrice:steemPrice, votePowerReserveRate:votePowerReserveRate}});
if(steemit&&blog_histogram)
if(steemit&&blog_histogram&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'blog_histogram', order: 'click',data:{}});
if(post_floating_bottom_bar&&steemit&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'post_floating_bottom_bar', order: 'click',data:{}});
if(external_link_tab&&steemit&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'external_link_tab', order: 'click',data:{}});
if(mentions_tab&&steemit&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'mentions_tab', order: 'click',data:{rewardBalance:rewardBalance, recentClaims:recentClaims, steemPrice:steemPrice}});
if(vote_weight_slider&&steemit&&steemit_more_info)
chrome.runtime.sendMessage({ token:token, to: 'vote_weight_slider', order: 'click',data:{rewardBalance:rewardBalance, recentClaims:recentClaims, steemPrice:steemPrice, votePowerReserveRate:votePowerReserveRate, account:account}});

url=window.location.href;
}
Expand Down
43 changes: 22 additions & 21 deletions src/js/external_link_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@

var externalLinks = [{
title: 'Steemd.com',
href: function(username) {
return 'https://steemd.com/@' + username;
href: function(username) {
return 'https://steemd.com/@' + username;
}
}, {
title: 'SteemDB.com',
href: function(username) {
return 'https://steemdb.com/@' + username;
href: function(username) {
return 'https://steemdb.com/@' + username;
}
}, {
title: 'SteemTracked',
href: function(username) {
return 'https://steemtracked.com/@' + username;
href: function(username) {
return 'https://steemtracked.com/@' + username;
}
}, {
title: 'Steem Followers',
href: function(username) {
href: function(username) {
return 'https://steem.makerwannabe.com/@' + username + '/followers/4';
}
}, {
title: 'Potential Rewards',
href: function(username) {
href: function(username) {
return 'http://steem.supply/@' + username;
}
}, {
title: 'Mentions',
href: function(username) {
href: function(username) {
return 'http://steemistry.com/steemit-mentions-tool/?mention=@' + username;
}
}, {
Expand All @@ -41,32 +41,32 @@
}
}, {
title: 'Steem Whales',
href: function(username) {
href: function(username) {
return 'http://steemwhales.com/' + username;
}
}, {
title: 'Steemit Board',
href: function(username) {
href: function(username) {
return 'http://steemitboard.com/board.html?user=' + username;
}
}, {
title: 'SteemReports <small style="padding-left: 5px;">Top Voters</small>',
href: function(username) {
href: function(username) {
return 'http://www.steemreports.com/top-voters/@' + username;
}
}, {
title: 'Utopian',
href: function(username) {
href: function(username) {
return 'https://utopian.io/@' + username;
}
}, {
title: 'Steemian Wit',
href: function(username) {
href: function(username) {
return 'https://steemian.info/witnesses';
}
}, {
title: 'Steem Bot Tracker',
href: function(username) {
href: function(username) {
return 'https://steembottracker.com';
}
}];
Expand All @@ -88,9 +88,13 @@
}
});
}
else if(request.order==='click'&&token_external_link_tab==request.token)
{
addExternalLinksMenu();
}
}
});

function createMenuLinks(username) {
return externalLinks.map(function(link){
return '<li>\
Expand Down Expand Up @@ -134,7 +138,7 @@
el = createMenu(menu, name);
el.find('a.smi-open-menu').on('click', function(e) {
e.preventDefault();

if($('.' + menuClass + ' .dropdown-pane').hasClass('is-open'))
{
$('.' + menuClass + ' .dropdown-pane').removeClass('is-open');
Expand All @@ -144,11 +148,8 @@
el.find('.dropdown-pane').addClass('is-open');
}


});
menu.prepend(el);
});
};



21 changes: 14 additions & 7 deletions src/js/mentions_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@
recentClaims=request.data.recentClaims;
steemPrice=request.data.steemPrice;

window.SteemPlus.Tabs.createTab({
id: 'mentions',
title: 'Mentions',
enabled: true,
createTab: createMentionsTab
});
createTab();
}
if(request.order==='click'&&token_mention_tab==request.token)
{
createTab();
}
}
});


function createTab()
{
window.SteemPlus.Tabs.createTab({
id: 'mentions',
title: 'Mentions',
enabled: true,
createTab: createMentionsTab
});
}

function createMentionsTab(mentionsTab) {
mentionsTab.html('<div class="row">\
Expand Down
10 changes: 8 additions & 2 deletions src/js/post_floating_bottom_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
makePostBottomBarFloating();
}

if(request.to==='post_floating_bottom_bar'&&request.order==='click'&&token_post_floating_bottom_bar==request.token)
{
makePostBottomBarFloating();
}


});


Expand All @@ -35,7 +41,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
return;
}

$('#post_overlay').on('scroll', function() {
$('#post_overlay').on('scroll', function() {
update();
});

Expand Down Expand Up @@ -90,7 +96,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
}else{
if(footer.hasClass('smi-post-floating-footer')){
footer.removeClass('smi-post-floating-footer');
if(isOverlay) {
if(isOverlay) {
footerWrapper.removeClass('smi-post-floating-footer-on-body').removeClass('row');
footer.find('.smi-post-footer-wrapper-1').prepend(footerWrapper);
}
Expand Down
23 changes: 15 additions & 8 deletions src/js/vote_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@
rewardBalance=request.data.rewardBalance;
recentClaims=request.data.recentClaims;
steemPrice=request.data.steemPrice;

window.SteemPlus.Tabs.createTab({
id: 'votes',
title: 'Votes',
enabled: true,
createTab: createVotesTab
});

startVotesTab();
}
else if(request.order==='click'&&token_vote_tab==request.token)
{
startVotesTab();
}
}
});

function startVotesTab(){

window.SteemPlus.Tabs.createTab({
id: 'votes',
title: 'Votes',
enabled: true,
createTab: createVotesTab
});
}


function createVotesTab(votesTab) {
votesTab.html('<div class="row">\
Expand Down

0 comments on commit 6cd1aff

Please sign in to comment.