diff --git a/main.js b/main.js index 55052dd..f6cd4ff 100755 --- a/main.js +++ b/main.js @@ -287,36 +287,36 @@ function startOfflineFeatures(items, user, account) chrome.runtime.sendMessage({ token:token, to: 'rewards_tab', order: 'start',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS,base:steemPriceLS}}); if(author_popup_info&&steemit) chrome.runtime.sendMessage({ token:token, to: 'author_popup_info', order: 'start',data:{user:user}}); - if(add_signature&&steemit) + if(add_signature&&(steemit||busy)) chrome.runtime.sendMessage({ token:token, to: 'add_signature', order: 'start',data:{user:user, steemit:steemit, busy:busy, utopian:utopian}}); - if(add_signature&&steemit) + if(resteem_indicator&&steemit) chrome.runtime.sendMessage({ token:token, to: 'resteem_indicator', order: 'start',data:{}}); - if (steemit&&steemit_more_info) { - if(post_votes_list) + if (steemit_more_info) { + if(steemit&&post_votes_list) chrome.runtime.sendMessage({ token:token, to: 'post_votes_list', order: 'start',data:{rewardBalance:rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS}}); - if(vote_tab) + if(steemit&&vote_tab) chrome.runtime.sendMessage({ token:token, to: 'vote_tab', order: 'start',data:{rewardBalance:rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS}}); - if(external_link_tab) + if(steemit&&external_link_tab) chrome.runtime.sendMessage({ token:token, to: 'external_link_tab', order: 'start',data:{}}); - if(search_bar) + if(steemit&&search_bar) chrome.runtime.sendMessage({ token:token, to: 'search_bar', order: 'start',data:{}}); - if(mentions_tab) + if(steemit&&mentions_tab) chrome.runtime.sendMessage({ token:token, to: 'mentions_tab', order: 'start',data:{rewardBalance:rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS}}); - if(vote_weight_slider) + if(steemit&&vote_weight_slider) chrome.runtime.sendMessage({ token:token, to: 'vote_weight_slider', order: 'start',data:{rewardBalance:rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS, votePowerReserveRate:votePowerReserveRateLS, account:account}}); - if(boost_button) - chrome.runtime.sendMessage({ token:token, to: 'boost_button', order: 'start',data:{}}); - if(gif_picker) + if((steemit||busy)&&boost_button) + chrome.runtime.sendMessage({ token:token, to: 'boost_button', order: 'start',data:{user:user, steemit:steemit, busy:busy}}); + if(steemit&&gif_picker) chrome.runtime.sendMessage({ token:token, to: 'gif_picker', order: 'start',data:{}}); - if(user_info_popover) + if(steemit&&user_info_popover) chrome.runtime.sendMessage({ token:token, to: 'user_info_popover', order: 'start',data:{rewardBalance:rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS, votePowerReserveRate:votePowerReserveRateLS}}); - if(blog_histogram) + if(steemit&&blog_histogram) chrome.runtime.sendMessage({ token:token, to: 'blog_histogram', order: 'start',data:{rewardBalance: rewardBalanceLS, recentClaims:recentClaimsLS, steemPrice:steemPriceLS}}); - if(md_editor_beautifier) + if(steemit&&md_editor_beautifier) chrome.runtime.sendMessage({ token:token, to: 'md_editor_beautifier', order: 'start',data:{}}); - if(post_floating_bottom_bar) + if(steemit&&post_floating_bottom_bar) chrome.runtime.sendMessage({ token:token, to: 'post_floating_bottom_bar', order: 'start',data:{}}); } @@ -337,8 +337,8 @@ function startOfflineFeatures(items, user, account) chrome.runtime.sendMessage({ token:token, to: 'acc_v', order: 'click',data:{steemit:steemit,busy:busy,global:{totalSteem:totalSteemLS,totalVests:totalVestsLS},market:market} }); if(rank&&steemit) chrome.runtime.sendMessage({ badge:items.badge,token:token, to: 'rank', order: 'click',data:{totalSteem:totalSteemLS,totalVests:totalVestsLS}}); - if(steemit&&boost_button&&steemit_more_info) - chrome.runtime.sendMessage({ token:token, to: 'boost_button', order: 'click', data:{user:user}}); + if((steemit||busy)&&boost_button&&steemit_more_info) + chrome.runtime.sendMessage({ token:token, to: 'boost_button', order: 'click', data:{user:user, steemit:steemit, busy:busy}}); 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&&steemit_more_info) @@ -371,7 +371,7 @@ function startOfflineFeatures(items, user, account) chrome.runtime.sendMessage({ token:token, to: 'gif_picker', order: 'click',data:{}}); if(author_popup_info&&steemit) chrome.runtime.sendMessage({ token:token, to: 'author_popup_info', order: 'click',data:{user:user}}); - if(add_signature&&steemit) + if(add_signature&&(steemit||busy)) chrome.runtime.sendMessage({ token:token, to: 'add_signature', order: 'click',data:{user:user, steemit:steemit, busy:busy, utopian:utopian}}); if(resteem_indicator&&steemit) chrome.runtime.sendMessage({ token:token, to: 'resteem_indicator', order: 'click',data:{}}); diff --git a/manifest.json b/manifest.json index 36b277f..19ab7a7 100755 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "SteemPlus", "description": "Lightweight toolbox for Steemit", - "version": "2.16", + "version": "2.16.1", "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "browser_action": { "default_icon": "src/img/logo.png", @@ -111,6 +111,7 @@ "src/css/transferTo.css", "src/css/oneup.css", "src/css/favorite_section.css", + "src/css/boost_button.css", "src/css/steemit_more_info.css", "src/css/board_reward.css", "src/css/classification_user.css", diff --git a/src/css/boost_button.css b/src/css/boost_button.css new file mode 100644 index 0000000..977b1c6 --- /dev/null +++ b/src/css/boost_button.css @@ -0,0 +1,45 @@ +/* The Modal (background) */ +.modal-busy { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +} + +/* Modal Content/Box */ +.modal-content-busy { + background-color: #fefefe; + margin: 15% auto; /* 15% from the top and centered */ + padding: 20px; + border: 1px solid #888; + width: 80%; /* Could be more or less, depending on screen size */ +} + +/* The Close Button */ +.close-busy { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close-busy:hover, +.close-busy:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + +.input-busy, .select-busy +{ + width: 50% !important; + border: 1px solid #0068DE !important; + border-radius: 3px !important; + padding-left: 0.50em !important; +} \ No newline at end of file diff --git a/src/css/loginSteemPlus.css b/src/css/loginSteemPlus.css index c77b970..23528c6 100755 --- a/src/css/loginSteemPlus.css +++ b/src/css/loginSteemPlus.css @@ -9,7 +9,7 @@ width:36px; height:36px; display: inline-block; - margin-left: 0.5em; + margin-right: 0.4em; margin-bottom: 0.5em; vertical-align: middle; } diff --git a/src/js/add_signature.js b/src/js/add_signature.js index a9e7f43..5ba2b58 100644 --- a/src/js/add_signature.js +++ b/src/js/add_signature.js @@ -62,10 +62,8 @@ function startAddSignature() $('.Comment__footer__controls > a').click(function(){ setTimeout(function(){ - console.log('Comment__footer__controls'); $('.ReplyEditor__body textarea').each(function() { var textarea = $(this); - console.log(textarea); setupAddCommentSignature(textarea); }); },1000); @@ -90,6 +88,53 @@ function startAddSignature() }); } } + else if(isBusy) + { + if(regexCreatePostBusy.test(window.location.href)) + { + if($('textarea.ant-input').length===0) + { + retryCountAddSignature++; + setTimeout(startAddSignature, 1000); + } + else + { + setupAddPostSignature($('textarea.ant-input')); + } + } + else if(regexSettingsBusySignature.test(window.location.href)) + { + if(window.location.href.match(regexSettingsBusySignature)[1]===myUsernameSignature) + { + $('.content').children().remove(); + displayCreateSignature(); + } + } + else if(regexPostBusy.test(window.location.href)) + { + console.log('post busy'); + + setTimeout(function(){ + console.log($('textarea.ant-input')); + $('textarea.ant-input').each(function() { + console.log($(this)); + var textarea = $(this); + setupAddCommentSignature(textarea); + }); + },2000); + + + $('a.CommentFooter__link').click(function(){ + console.log('click'); + setTimeout(function(){ + $('textarea.ant-input').each(function() { + var textarea = $(this); + setupAddCommentSignature(textarea); + }); + },1000); + }); + } + } } // Function used to display the panel to create the signature @@ -101,11 +146,16 @@ function displayCreateSignature() var userSignatureComments = (item.user_signature_comments===undefined ? '' : item.user_signature_comments ); var userSignaturePosts = (item.user_signature_posts===undefined ? '' : item.user_signature_posts ); + var classButtonSaveSignature = ''; + if(isBusy) classButtonSaveSignature = 'ant-btn Action--primary'; + else if(isSteemit) classButtonSaveSignature = 'button'; + + var divSignature = $('
\
\ -

Signature

\
\
\ +

Signature

\ \
\ - \ + \
\
\
\
'); - + // Add panel to setting page - $('.Settings').append(divSignature); + if(isSteemit) + $('.Settings').append(divSignature); + else if(isBusy) + { + document.title = 'Edit signature'; + $('.content').children().remove(); + $('.content').append(divSignature); + + } // Listener on change dropdown lists $('#select-type-signature').on('change', function(){ @@ -263,6 +321,7 @@ function setupAddCommentSignature(textarea) // Get signature from local storage // We use local storage again and not parameter cause if user updated his signature in another tab, we still use the newest one chrome.storage.local.get(['user_signature_comments'], function(item){ + console.log(item.user_signature_comments); if(item.user_signature_comments!==undefined&&item.user_signature_comments!=='') { $(textarea).after('Add Signature'); diff --git a/src/js/beneficiaries.js b/src/js/beneficiaries.js index 004a49b..9b1977d 100755 --- a/src/js/beneficiaries.js +++ b/src/js/beneficiaries.js @@ -2,16 +2,16 @@ * Created by quent on 10/27/2017. */ -var created_benef=false; -var beneficiaries; -const STEEM_PLUS_FEED=5; -var autb=null; -var token_benef=null; -var communities=['minnowsupport', - 'utopian-io', - 'adsactly' - ]; -chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { + var created_benef=false; + var beneficiaries; + const STEEM_PLUS_FEED=5; + var autb=null; + var token_benef=null; + var communities=['minnowsupport', + 'utopian-io', + 'adsactly' + ]; + chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if(request.to=='ben'){ autb=request.data.user; if(request.order==='start'&&token_benef==null) @@ -23,7 +23,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { onClickB(); } }); -function startBeneficiaries(){ + function startBeneficiaries(){ if(regexCreatePostSteemit.test(window.location.href)) addBeneficiariesButton(); } @@ -39,159 +39,183 @@ function onClickB(){ function addBeneficiariesButton(){ - var benef_div = document.createElement('div'); - benef_div.style.width = '100%'; - benef_div.style.marginBottom = '2em;'; - var benef_button = document.createElement('input'); - benef_button.value = 'Add beneficiaries'; - benef_button.type='button'; - benef_button.className = 'UserWallet__buysp button benef'; - - benef_div.appendChild(benef_button); - $('.vframe__section--shrink')[$('.vframe__section--shrink').length-1].after(benef_div); - $('.benef').click(function(){ - - $('.benef').parent().after('
  • By using the beneficiaries feature, you accept that @steem-plus will be set as a 5% beneficiary.

    @
    %
  • '); - if($('.close').length===1) { - var buttonPost = $('.vframe__section--shrink button')[2]; - $(buttonPost).hide(); - if($('.post').length===0) { - $('.beneficiaries').after('
  • '); - $('.postbutton').click(function (){if(isEverythingFilled()) postBeneficiaries();}); - } - else - $('h5,.post').show(); - } + var benef_div = document.createElement('div'); + benef_div.style.width = '100%'; + benef_div.style.marginBottom = '2em;'; + var benef_button = document.createElement('input'); + benef_button.value = 'Add beneficiaries'; + benef_button.type='button'; + benef_button.className = 'UserWallet__buysp button benef'; + + benef_div.appendChild(benef_button); + $('.vframe__section--shrink')[$('.vframe__section--shrink').length-1].after(benef_div); + $('.benef').click(function(){ + + if($('.beneficiaries-warning-message').length === 0 ) $('.benef').after('

    By using the beneficiaries feature, you accept that @steem-plus will be set as a 5% beneficiary.

    '); + + $('.beneficiaries-warning-message').parent().after('
  • @
    %
  • '); + if($('.close').length===1) { + var buttonPost = $('.vframe__section--shrink button')[2]; + $(buttonPost).hide(); + if($('.post').length===0) { + $('.beneficiaries').after('
  • '); + $('.postbutton').click(function (){if(isEverythingFilled()) postBeneficiaries();}); + } + else + $('h5,.post').show(); + } - setCloseListener(); + setCloseListener(); - }); - created_benef=true; + }); + created_benef=true; } function setCloseListener(){ - $('.close').each(function(i){ - $(this).off("click"); - $(this).on("click",function() { - $('.beneficiaries')[i].remove(); - if($('.close').length===0) { - $('.vframe__section--shrink button').show(); - $('h5,.post').hide(); - } - setCloseListener(); - }); + $('.close').each(function(i){ + $(this).off("click"); + $(this).on("click",function() { + $('.beneficiaries')[i].remove(); + if($('.close').length===0) { + $('.vframe__section--shrink button').show(); + $('h5,.post').hide(); + } + setCloseListener(); }); + }); } function isEverythingFilled() { - beneficiaries=[]; - if($('.vframe__section--shrink button').is(":disabled")) - { - alert("Please enter a title, body and tags to your post!"); - return false; - } + beneficiaries=[]; + if($('.vframe__section--shrink button').is(":disabled")) + { + alert("Please enter a title, body and tags to your post!"); + return false; + } - var total_percent=0; - var hasEmpty=0; - var hasWrongPercent=0; - $('.beneficiaries').each(function(i,e){ - hasEmpty+=$(e).find('input').eq(0).val()===''?1:0; - hasEmpty+=$(e).find('input').eq(1).val()===''?1:0; - hasWrongPercent+=($(e).find('input').eq(1).val()<=0||isNaN($(e).find('input').eq(1).val())||$(e).find('input').eq(1).val()>100)?1:0; - total_percent+=parseInt($(e).find('input').eq(1).val()); - beneficiaries.push({ - account: $(e).find('input').eq(0).val(), - weight: 100*parseInt($(e).find('input').eq(1).val()) - }); + var total_percent=0; + var hasEmpty=0; + var hasWrongPercent=0; + $('.beneficiaries').each(function(i,e){ + hasEmpty+=$(e).find('input').eq(0).val()===''?1:0; + hasEmpty+=$(e).find('input').eq(1).val()===''?1:0; + hasWrongPercent+=($(e).find('input').eq(1).val()<=0||isNaN($(e).find('input').eq(1).val())||$(e).find('input').eq(1).val()>100)?1:0; + total_percent+=parseInt($(e).find('input').eq(1).val()); + beneficiaries.push({ + account: $(e).find('input').eq(0).val(), + weight: 100*parseInt($(e).find('input').eq(1).val()) }); + }); - if(hasEmpty!==0) - { - alert("Please enter the name and percentage for each beneficiary!"); - return false; - } - if(hasWrongPercent!==0) - { - alert("Percentage should be greater than 0 and smaller or equal to 100! (Including 5% SteemPlus fee)"); - return false; - } - if(total_percent>95) - { - alert("Total beneficiary rewards must be smaller or equal to 95%!"); - return false; - } - return true; + if(hasEmpty!==0) + { + alert("Please enter the name and percentage for each beneficiary!"); + return false; + } + if(hasWrongPercent!==0) + { + alert("Percentage should be greater than 0 and smaller or equal to 100! (Including 5% SteemPlus fee)"); + return false; + } + if(total_percent>95) + { + alert("Total beneficiary rewards must be smaller or equal to 95%!"); + return false; + } + return true; } function postBeneficiaries() { - console.log(autb); - var tags=$(' input[tabindex=3]').eq(0).val().split(' '); - var author=autb; - var title=$('.vframe input').eq(0).val(); - var permlink=$('.vframe input').eq(0).val().toLowerCase() - .replace(/ /g,'-') - .replace(/[^\w-]+/g,''); - var body=$('.vframe textarea').eq(0).val(); - var sbd_percent=$(".vframe select").eq(1).find(':selected').index()==0?0:10000; - if(communities.includes(autb)) - console.log('no fee'); - else - beneficiaries.push({ - account: 'steem-plus', - weight: 100*STEEM_PLUS_FEED - }); - if(beneficiaries.length>6) - { - alert("You have set up too many beneficiaries (max number=5, 6 for registered communities)"); - } + console.log(autb); + var tags=$(' input[tabindex=3]').eq(0).val().split(' '); + var author=autb; + var title=$('.vframe input').eq(0).val(); + var permlink=$('.vframe input').eq(0).val().toLowerCase() + .replace(/ /g,'-') + .replace(/[^\w-]+/g,''); + var body=$('.vframe textarea').eq(0).val(); + var sbd_percent=$(".vframe select").eq(1).find(':selected').index()==0?0:10000; + if(communities.includes(autb)) + console.log('no fee'); + else + beneficiaries.push({ + account: 'steem-plus', + weight: 100*STEEM_PLUS_FEED + }); + if(beneficiaries.length>6) + { + alert("You have set up too many beneficiaries (max number=5, 6 for registered communities)"); + } - var operations = [ - ['comment', - { - parent_author: '', - parent_permlink: tags[0], - author: author, - permlink: permlink, - title: title, - body: body, - json_metadata : JSON.stringify({ - tags: tags, - app: 'steem-plus-app' - }) - } - ], - ['comment_options', { - author: author, - permlink: permlink, - max_accepted_payout: '100000.000 SBD', - percent_steem_dollars: sbd_percent, - allow_votes: true, - allow_curation_rewards: true, - extensions: [ - [0, { - beneficiaries: beneficiaries - }] - ] - }] - ]; + var operations = [ + ['comment', + { + parent_author: '', + parent_permlink: tags[0], + author: author, + permlink: permlink, + title: title, + body: body, + json_metadata : JSON.stringify({ + tags: tags, + app: 'steem-plus-app' + }) + } + ], + ['comment_options', { + author: author, + permlink: permlink, + max_accepted_payout: '100000.000 SBD', + percent_steem_dollars: sbd_percent, + allow_votes: true, + allow_curation_rewards: true, + extensions: [ + [0, { + beneficiaries: beneficiaries + }] + ] + }] + ]; console.log(operations); - sc2.broadcast( - operations, - function(e, r) { - if (e) { - console.log(e.error,r); - if(e.error!==undefined) - { - alert('The request was not succesfull. Please make sure that you logged in to SteemPlus via SteemConnect, that all the beneficiaries accounts are correct and than you didn\'t post within the last 5 minutes. If the problem persists please contact @stoodkev on Discord. Error code:'+e.error); - } - } else { - window.location.replace('https://steemit.com'); - } - }); + sc2.broadcast( + operations, + function(e, r) + { + if (e) + { + console.log(e.error,r); + if(e.error!==undefined) + { + // If there is an error, we check usernames to make sure all of them are correct + var usernamesBenef = []; + beneficiaries.forEach(function(item){ + usernamesBenef.push(item.account); + }); + + // Trying to retrieve account with given usernames + steem.api.getAccounts(usernamesBenef, function(err, result) { + var errorUsernames = []; + usernamesBenef.forEach(function(item){ + // Account not in result are not correct. + if(result.find(function(e){return e.name===item})===undefined) + errorUsernames.push(item); + }); + // Display an error message for those accounts + if(errorUsernames.length > 0) alert('The following usernames are not correct : ' + errorUsernames.join(', ')); + // If all the accounts name are correct then display error message. Problem might come from steemConnect. + else + alert('The request was not succesfull. Please make sure that you logged in to SteemPlus via SteemConnect, that all the beneficiaries accounts are correct and than you didn\'t post within the last 5 minutes. If the problem persists please contact @stoodkev on Discord. Error code:'+e.error); + }); + } + } + else { + window.location.replace('https://steemit.com'); + } + }); } diff --git a/src/js/boost_button.js b/src/js/boost_button.js index e1c44e1..6bc78c9 100644 --- a/src/js/boost_button.js +++ b/src/js/boost_button.js @@ -11,6 +11,9 @@ var loading=null; var normalList=1; + var isSteemit=null; + var isBusy=null; + var retryCountBoostButton=0; chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { @@ -18,6 +21,8 @@ if(request.to=='boost_button'){ aut=request.data.user; retryCountBoostButton=0; + isSteemit=request.data.steemit; + isBusy=request.data.busy; if(request.order==='start'&&token_boost_button==null) { token_boost_button=request.token; @@ -34,17 +39,47 @@ function createMinnowBoosterTransferUI() { - var link = window.location.origin + '/' + categoryBooster + '/@' + authorBooster + '/' + permlinkBooster; + var link = ''; + if(isSteemit) link = window.location.origin + '/' + categoryBooster + '/@' + authorBooster + '/' + permlinkBooster; + else if(isBusy) link = window.location.origin + '/@' + authorBooster + '/' + permlinkBooster; + if(modal === null) { - modal = $('
    \ -
    \ -
    \ - \ + if(isSteemit) + { + modal = $('
    \ +
    \ +
    \ + \ +
    \ +
    '); + + modal.find('.close-button').on('click', function() { + modal.remove(); + }); + modal.find('.reveal-overlay').on('click', function() { + modal.remove(); + }); + } + else if(isBusy) + { + modal = $(''); + + modal.find('.close-busy').on('click', function() { + modal.remove(); + }); + window.onclick = function(event) { + if (event.target == modal[0]) { + modal.remove(); + } + } + } } @@ -53,13 +88,6 @@ })); modal.find('.reveal').append(loading); - modal.find('.close-button').on('click', function() { - modal.remove(); - }); - modal.find('.reveal-overlay').on('click', function() { - modal.remove(); - }); - var missingAsync = 4; var alreadyBoosted = false; var accountInfo = null; @@ -238,7 +266,7 @@
    \
    \ \ - \ + \ \
    \
    \ @@ -291,7 +319,6 @@ parseFloat(maxVote) ); - console.log("success"+maxAvailableAmount); $('.maxAvailableAmount').append(maxAvailableAmount); var ctx = transferUI.find('.boost-button-chart')[0].getContext('2d'); @@ -369,7 +396,6 @@ ticks: { maxRotation: 75, callback: function(tick, index, ticks) { - console.log(ticks.length); if(index%2===1||index===ticks.length-1||index===0) return tick.toLocaleString() } @@ -431,24 +457,58 @@ } loading.remove(); - modal.find('.reveal').append(transferUI); - $('#modalTitle').after($('
    \ -
    To
    \ -
    \ -
    \ - @\ - \ + if(isSteemit) + { + modal.find('.reveal').append(transferUI); + $('#modalTitle').after($('
    \ +
    To
    \ +
    \ +
    \ + @\ + \ +
    \ +

    \
    \ -

    \ -
    \ -
    ')); +
    ')); + } + else if(isBusy) + { + modal.find('.modal-content-busy').append(transferUI); + $('#modalTitle').after($('
    \ +
    To
    \ +
    \ +
    \ + @\ + \ +
    \ +

    \ +
    \ +
    ')); + } + $('#selectBooster').unbind('change').on('change', function(){ changeUIBooster(this.value); }); + + if(isBusy) + { + $('input').each(function(){ + $(this).eq(0).addClass('input-busy'); + }); + + $('#selectBooster').each(function(){ + $(this).eq(0).addClass('select-busy'); + }); + + + } }; $('body').append(modal); @@ -482,7 +542,6 @@ success: function(json) { accountInfo = json; normalList=json.whitelisted?0:1; - console.log(normalList); asyncDone(); }, error: function(msg) { @@ -523,40 +582,98 @@ -function addPostBoostButton() { - - if(regexPostSteemit.test(window.location.href)&&retryCountBoostButton<20) +function addPostBoostButton() +{ + if(isSteemit) { - var promoteButton = $('.Promote__button'); - var boostButton = $('.smi-boost-button'); + console.log('steemit'); + if(regexPostSteemit.test(window.location.href)&&retryCountBoostButton<20) + { + var promoteButton = $('.Promote__button'); + var boostButton = $('.smi-boost-button'); - if(promoteButton.length && !boostButton.length) { + if(promoteButton.length && !boostButton.length) { - boostButton = $(''); + boostButton = $(''); - promoteButton.before(boostButton); - promoteButton.addClass('smi-promote-button'); + promoteButton.before(boostButton); + promoteButton.addClass('smi-promote-button'); - boostButton.on('click', function() { - modal=null; - urlBooster = window.location.pathname; - matchBooster = urlBooster.match(/^\/([^\/]*)\/@([^\/]*)\/(.*)$/); - categoryBooster = matchBooster[1]; - authorBooster = matchBooster[2]; - permlinkBooster = matchBooster[3]; - createMinnowBoosterTransferUI(); - }); + boostButton.on('click', function() { + modal=null; + urlBooster = window.location.pathname; + matchBooster = urlBooster.match(/^\/([^\/]*)\/@([^\/]*)\/(.*)$/); + categoryBooster = matchBooster[1]; + authorBooster = matchBooster[2]; + permlinkBooster = matchBooster[3]; + createMinnowBoosterTransferUI(); + }); + } + else + { + retryCountBoostButton++; + timeoutBoostButton = setTimeout(function(){ + addPostBoostButton(); + },1000); + } } - else + } + else if(isBusy) + { + if(regexPostBusy.test(window.location.href)&&retryCountBoostButton<20) { - retryCountBoostButton++; - timeoutBoostButton = setTimeout(function(){ - addPostBoostButton(); - },1000); + var boostButton = $('.boost-link'); + if(!boostButton.length) { + + + boostButton = $(''); + + boostButton.on('click', function() { + $(boostButton).parent().parent().parent().parent().parent().parent().parent().addClass('ant-popover-hidden'); + modal=null; + urlBooster = window.location.href; + matchBooster = urlBooster.match(/^.*\/@([^\/]*)\/(.*)$/); + authorBooster = matchBooster[1]; + permlinkBooster = matchBooster[2]; + createMinnowBoosterTransferUI(); + $('#myModal').show(); + + }); + + $('.Buttons__post-menu').click(function(){ + setTimeout(function(){ + $('.PopoverMenu').each(function(){ + if($(this).find('.boost-link').length === 0) { + $('.PopoverMenu').append(boostButton); + } + }); + },500); + }); + + $('.StoryFull__header__more').click(function(){ + setTimeout(function(){ + $('.PopoverMenu').each(function(){ + if($(this).find('.boost-link').length === 0) { + $('.PopoverMenu').append(boostButton); + } + }); + },500); + }); + + + } + else + { + retryCountBoostButton++; + timeoutBoostButton = setTimeout(function(){ + addPostBoostButton(); + },1000); + } } } -}; + +} function changeUIBooster(value){ $('#modalContent').remove(); @@ -569,7 +686,12 @@ function createSmartSteemTransferUI(){ loading = $(window.SteemPlus.Utils.getLoadingHtml({ center: true })); - modal.find('.reveal').append(loading); + + var classModalLocation = ''; + if(isSteemit) classModalLocation = '.reveal'; + else if(isBusy) classModalLocation = '.modal-content-busy'; + + modal.find(classModalLocation).append(loading); var transferUI = $('\
    \ @@ -587,7 +709,8 @@ function createSmartSteemTransferUI(){ url: 'https://smartsteem.com/api/general', success: function(result) { loading.remove(); - modal.find('.reveal').append(transferUI); + + modal.find(classModalLocation).append(transferUI); $('#modalTitle').after($('\
    \
    To
    \ @@ -615,7 +738,7 @@ function createSmartSteemTransferUI(){
    \
    \
    \ - \ + \ \ \ \
    \ - \ + \
    ')); $('#selectBooster').unbind('change').on('change', function(){ @@ -660,7 +783,18 @@ function createSmartSteemTransferUI(){ $('#smartSteemInformation').append('
    1 star vote value :
    ' + parseInt(result.total_one).toFixed(2) + ' $
    '); $('#smartSteemInformation').append('
    2 stars vote value :
    ' + parseInt(result.total_two).toFixed(2) + ' $
    '); $('#smartSteemInformation').append('
    3 stars vote value :
    ' + parseInt(result.total_three).toFixed(2) + ' $
    '); + + if(isBusy) + { + $('input').each(function(){ + $(this).eq(0).addClass('input-busy'); + }); + $('#selectBooster').each(function(){ + $(this).eq(0).addClass('select-busy'); + }); + } + }, error: function(msg) { $('#smartSteemInformation').append('' + msg.responseJSON.error + ''); diff --git a/src/js/loginSteemPlus.js b/src/js/loginSteemPlus.js index 222df96..9f0b855 100755 --- a/src/js/loginSteemPlus.js +++ b/src/js/loginSteemPlus.js @@ -59,7 +59,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { if(request.data.steemit) showButtonOnSteemit(loginIcon); else if(request.data.busy) - $('.Topnav__version').after(loginIcon); + $('.Topnav__item-user').prepend(loginIcon); else if(request.data.utopian) $('.Topnav__version').eq(0).after(loginIcon); } diff --git a/src/js/resteem_indicator.js b/src/js/resteem_indicator.js index 8c422ba..1a11844 100644 --- a/src/js/resteem_indicator.js +++ b/src/js/resteem_indicator.js @@ -2,7 +2,6 @@ var token_resteem_indicator=null; var retryCountResteemIndicator=0; -var scrollBottomReachedRI = false; var nbElementPageAuthorRI=0; // Listener on message coming from main.js @@ -31,26 +30,7 @@ function startResteemIndicator() { if(retryCountResteemIndicator < 20) { - if(window.location.href.includes('#mentions')) - { - if($('.MentionsTab').find('.PostSummary').length > 0) - { - var paramsQuery = []; - $('article.PostSummary').each(function(){ - var usernameResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[2].replace('@', ''); - var permlinkResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[3]; - $(this).attr('name', usernameResteemIndicator + '_' + permlinkResteemIndicator); - paramsQuery.push({'author':usernameResteemIndicator, 'permlink':permlinkResteemIndicator}); - }); - displayResteemIndicatorListPost($('article.PostSummary'), '.PostSummary__time_author_category', paramsQuery); - } - else - { - retryCountResteemIndicator++; - setTimeout(startResteemIndicator, 1000); - } - } - else if(regexPostSteemit.test(window.location.href)) + if(regexPostSteemit.test(window.location.href)) { var matches = window.location.href.match(regexPostSteemitParameters); var usernameResteemIndicator = matches[1]; @@ -58,47 +38,6 @@ function startResteemIndicator() if($('.resteem-list').length===0) displayResteemIndicatorInPost(usernameResteemIndicator, permlinkResteemIndicator); } - else if(regexBlogSteemit.test(window.location.href)||regexFeedSteemit.test(window.location.href)) - { - if($('article').length > 0) - { - var paramsQuery = []; - $('.articles__summary').each(function(){ - if($(this).find('.count-resteem-label').length === 0) - { - var usernameResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[2].replace('@', ''); - var permlinkResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[3]; - $(this).attr('name', usernameResteemIndicator + '_' + permlinkResteemIndicator); - paramsQuery.push({'author':usernameResteemIndicator, 'permlink':permlinkResteemIndicator}); - } - }); - displayResteemIndicatorListPost($('.articles__summary'), '.PostSummary__time_author_category', paramsQuery); - } - else - { - retryCountResteemIndicator++; - setTimeout(startResteemIndicator, 1000); - } - } - else if(regexFeedPlusSteemit.test(window.location.href)) - { - if($('article.PostSummary').length > 0) - { - var paramsQuery = []; - $('article.PostSummary').each(function(){ - var usernameResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[2].replace('@', ''); - var permlinkResteemIndicator = $(this).children().find('.entry-title > a').eq(0).attr('href').split('/')[3]; - $(this).attr('name', usernameResteemIndicator + '_' + permlinkResteemIndicator); - paramsQuery.push({'author':usernameResteemIndicator, 'permlink':permlinkResteemIndicator}); - }); - displayResteemIndicatorListPost($('article.PostSummary'), '.PostSummary__time_author_category', paramsQuery); - } - else - { - retryCountResteemIndicator++; - setTimeout(startResteemIndicator, 1000); - } - } } } @@ -108,13 +47,14 @@ function startResteemIndicator() // @parameter permlinkResteemIndicator : permlink of the post function displayResteemIndicatorInPost(usernameResteemIndicator, permlinkResteemIndicator) { + console.log('ici'); $.ajax({ type: "POST", beforeSend: function(xhttp) { xhttp.setRequestHeader("Content-type", "application/json"); xhttp.setRequestHeader("X-Parse-Application-Id", chrome.runtime.id); }, - url: 'https://steemplus-api.herokuapp.com/api/get-reblogs-per-post/', + url: 'https://steemplus-api.herokuapp.com/api/get-reblogs/', data: JSON.stringify({"data" : [{"author":usernameResteemIndicator, "permlink":permlinkResteemIndicator}]}), success: function(result) { $('.Reblog__button').before('