Skip to content

Instantly share code, notes, and snippets.

@geoffreycrofte
Last active April 30, 2021 13:44
Show Gist options
  • Save geoffreycrofte/f916f5dcf07ee2a02c3616b3061bc7d1 to your computer and use it in GitHub Desktop.
Save geoffreycrofte/f916f5dcf07ee2a02c3616b3061bc7d1 to your computer and use it in GitHub Desktop.
Coinbase Better Tab Title that includes Currency Price and Wallet Amount
// Add value info into title
// Replace thousand_separator and real_currency for your own needs
// Add value info into title
// Replace thousand_separator and real_currency for your own needs
(function(){
let gc_new_title = '';
let sel_asset_amount = '[class*="AssetChartAmount__Wrapper"]';
let sel_wallet_amount = '[class*="BuySellStepper__Containe"] footer span:last-child';
let sel_asset_name = '[class*="styles__Symbol"][data-element-handle="asset-symbol"]';
let thousand_separator = ',';
let real_currency = '€';
const gc_update_title = function(){
let value = document.querySelector(sel_asset_amount).innerText.split('\n');
value = value[1] + '' + value[2];
let wallet = document.querySelector(sel_wallet_amount).innerText.split(real_currency);
wallet = wallet[1].split(".");
wallet = wallet[0];
gc_new_title = value.substring(0, value.length - 2) + real_currency;
gc_new_title = gc_new_title + ' ';
gc_new_title = gc_new_title + document.querySelector(sel_asset_name).innerText;
gc_new_title = gc_new_title + ' (' + wallet.replace(',', thousand_separator) + real_currency + ')';
document.querySelector('title').innerHTML = gc_new_title;
console.log('Title Updated');
};
setInterval(gc_update_title, 5000);
})();
@geoffreycrofte
Copy link
Author

This gist is made for "Code Injector" plugin for Firefox, but you should be able to find one for Chrome.
Result on the tab:
Capture d’écran 2021-04-27 à 19 22 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment