DrogoNevets / Available balance for SJD Accountancy

// ==UserScript==
// @name         Available balance for SJD Accountancy
// @namespace    http://archronos.com
// @version      1.2
// @description  Adds an extra field for available profit
// @author       Steve Coleman-Williams
// @require      https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @match        https://online.sjdaccountancy.com/*
// ==/UserScript==

/* jshint ignore:start */
var inline_src = ( < > < ![CDATA[
            /* jshint ignore:end */
            /* jshint esnext: false */
            /* jshint esversion: 6 */

            // Your code here...
            function fromCurrency(val) {
                return val.replace(/(£)|(,)/gmi, '');
            }

            function toCurrency(x) {
                return x;
            }

            let retProfit = $($('.overview span').get(1)).text(),
                assets = [{
                    name: 'Motorcycle HG59 GFY',
                    value: 3900.00, // motorbike
                }];

            retProfit = fromCurrency(retProfit);

            // remove salary?
            // assets.push(fromCurrency($($('.overview span').get(2)).text()));

            for (var i = 0; i < assets.length; i++) {
                retProfit -= assets[i].value;
            }

            let html = `
        <style>
            .archronos {
                color: #f39200;
                cusror: pointer;
            }

            h5.archronos:before {
                content: ' ';
                display: block;
                float: left;
                height: 24px;
                width: 24px;
                background: url(http://archronos.com/@@site-logo/Untitled-2.png);
                background-size: 136px;
                background-repeat: no-repeat;
            }

            .ui-dialog {
                border-radius: 0;
                padding: 0;
            }

            .ui-dialog-titlebar {
                background: #f39200;
                border-radius: 0;
                border: none;
                color: #fff;
            }

            .ui-dialog table {
                width: 100%;
            }

            .currency {
                text-align: right;
            }
        </style>
        <h5 class="archronos retProfit">Available Profit</h5>
        <span class="archronos retProfit">&pound;${retProfit.toFixed(2)}</span>

        <div id="asset-dialog" title="Company assets">
            <table>
                <tbody>`

            for (var i = 0; i < assets.length; i++) {
                let dec = assets[i].value.toFixed(2);



                html += `
            <tr>
                <td>${assets[i].name}</td>
                <td class="currency">&pound;${parseFloat(assets[i].value).toLocaleString('en-gb').replace(/\.[0-9]{2}$/gmi, '')}.${dec.substr(-2)}</td>
            </tr>`
            }

            html += `</tbody>
            </table>
        </div>
    `;

            $('.overview h5:first').before(html);

            $("#asset-dialog").dialog({
                autoOpen: false
            });

            $('.archronos.retProfit').click(() => {
                $("#asset-dialog").dialog("open");
            });
            /* jshint ignore:start */
        ]] > < />).toString();
        var c = Babel.transform(inline_src, {
            presets: ["es2015", "es2016"]
        }); eval(c.code);
        /* jshint ignore:end */