0% found this document useful (0 votes)
11 views2 pages

Change Balance Unit on Freebitco.in

The document is a userscript that changes the unit of displayed balances on the website freebitco.in from BTC to alternative units like mBTC, satoshis and microBTC. It gets the current balance element, converts the displayed value to the new unit, and replaces the HTML to display the updated balance and unit name.

Uploaded by

jozef gold
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Change Balance Unit on Freebitco.in

The document is a userscript that changes the unit of displayed balances on the website freebitco.in from BTC to alternative units like mBTC, satoshis and microBTC. It gets the current balance element, converts the displayed value to the new unit, and replaces the HTML to display the updated balance and unit name.

Uploaded by

jozef gold
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// ==UserScript==

// @name change unit of balance on [Link]


// @namespace [Link]
// @version 0.5
// @description change unit of balance on [Link]
// @author @koma5
// @match [Link]
// @grant none
// @downloadURL
[Link]
raw/change_unit_of_balance_freebitco.[Link]
// @updateURL
[Link]
raw/change_unit_of_balance_freebitco.[Link]
// ==/UserScript==

(function() {
'use strict';
function changeDOM() {

var unitMap = {mBTC : { unit : 'mBTC', factor : 1e3 },


satoshi : { unit : 'satoshi', factor : 1e8 },
microBTC : { unit : 'μBTC', factor : 1e6 }
};

var unitChoice = [Link];

var balanceLi = [Link]("balance").parentNode;

//remove eventListener otherwise we run into a loop


[Link]('DOMNodeInserted', changeDOM);

var balance = [Link]("balance").innerHTML;


balance *= [Link];

//remove balance and textnode


while ([Link]()) {
[Link]([Link]);
}

//recreate balance span


var balanceSpan = [Link]("span");
[Link]('id', 'balance');

var balanceSpanText = [Link](balance);


[Link](balanceSpanText);

//recreate textnode
var balanceLiUnitText = [Link](' ' +
[Link]);

//insert balance and textnode into existing and empty blanaceli


[Link](balanceSpan);
[Link](balanceLiUnitText);

//readd removed eventListener


[Link]('DOMNodeInserted', changeDOM, false);
[Link]('changed to ' + balance + ' ' + [Link]);
}

changeDOM();

var balanceLi = [Link]("balance").parentNode;


[Link]('DOMNodeInserted', changeDOM, false);

})();

You might also like