<div id="earningsPopup" class="just-made">
    <div class="float-left">
        <p class="name">Jay M Made</p>
        <span class="blue">$ 1093.20</span>
    </div>
    <div class="float-right">
        <div class="avatar">
            <span class="flag f1t-geo-country-flag-icon flag-2 flag-icon"></span>
        </div>
    </div>
    <div class="clearfix"></div>
</div>

<script src="js/vendor.bundle.min.js"></script>
<script src="js/main.bundle.min.js"></script>

<script type="text/javascript" src="js/main.minae15.js"></script>

<!-- BEGIN intgrtn -->
<script>
    window.intgrtnInit = function () {
        var path = "/";
        if (window.location.pathname.split("/")[1]) {
            path = "/" + window.location.pathname.split("/")[1] + "/";
        }
        window.intgrtn.setOptions({
            cookies: {
                path: path
            },
        });

        window.intgrtn.events.on("get.project.details.success", function (response) {
            initUiFlags(response);

            let language;
            let videoLanguage;

            if (!window.intgrtn.lookup("language")) {
                language = response.data.client.location.countryIsoCode ? response.data.client.location.countryIsoCode.toLowerCase() : null;
            } else {
                language = window.intgrtn.lookup("language");
            }

            switch (language) {
                case "pl":
                    videoLanguage = "video-pl.mp4";
                    break;
                case "en":
                    videoLanguage = "video-en.mp4";
                    break;
                case "de":
                    videoLanguage = "video-de.mp4";
                    break;
                case "it":
                    videoLanguage = "video-it.mp4";
                    break;
                default:
                    videoLanguage = "video-en.mp4";
                    break;
            }
            videojs('my-video', {"controls": true, "autoplay": "any", "controlBar": true, "preload": "metadata", "fluid": true}).src({type: 'video/mp4', src: "media/" + videoLanguage});
        });

        function initUiFlags(projectDetailsResponse) {
            var currencySymbol = projectDetailsResponse.data.client.location.currency.symbol ? projectDetailsResponse.data.client.location.currency.symbol : "$";
            var countryIso = projectDetailsResponse.data.client.location.countryIsoCode ? projectDetailsResponse.data.client.location.countryIsoCode.toLowerCase() : null;
            var country = projectDetailsResponse.data.client.location.country ? projectDetailsResponse.data.client.location.country : null;
            var countryColors = {
                "AT": ['#ed2939', '#ed2939'],
                "AU": ['#00008b', '#ff0000'],
                "BE": ['#000000', '#fdda24'],
                "BG": ['#10ea2fff', '#fd1322'],
                "CA": ['#ff0000', '#ff0000'],
                "CH": ['#ff0000', '#ff0000'],
                "CL": ['#0036a7', '#d62718'],
                "CZ": ['#d7141a', '#11457e'],
                "DE": ['#000000', '#dd0000'],
                "DK": ['#c60c30', '#c60c30'],
                "FI": ['#003580', '#003580'],
                "FR": ['#0050a4', '#ef4135'],
                "GA": ['#4997d0', '#4997d0'],
                "GB": ['#ff0000', '#00008b'],
                "GR": ['#001489', '#001489'],
                "IE": ['#169b62', '#ff883e'],
                "IT": ['#009246', '#ce2b37'],
                "MY": ['#1534cb', '#59292e'],
                "MX": ['#006847', '#ce1126'],
                "NL": ['#ae1c28', '#21468b'],
                "NO": ['#ef2b2d', '#002868'],
                "NZ": ['#00247d', '#cc142b'],
                "PH": ['#0038a8', '#ce1126'],
                "PK": ['#01411c', '#01411c'],
                "PL": ['#ff0000', '#ff0000'],
                "SE": ['#006aa7', '#fecc00'],
                "SG": ['#ee2536', '#ee2536'],
                "SK": ['#034da3', '#ef1620'],
                "ZA": ['#FFB612', '#007A4D']
            };

            $("[data-visitor-currency-symbol]").text(currencySymbol);
            $(".flag").addClass('flag-icon-' + countryIso);

            $('.country-name-custom, .f1t-geo-country-name').each(function () {
                var obj = $(this);
                var countryIsoUpper = countryIso.toUpperCase();
                if (countryColors.hasOwnProperty(countryIsoUpper)) {
                    var words = country.split(/ (.+)/);
                    if (words.length < 2) {
                        words[0] = country.substring(0, country.length / 2);
                        words[1] = country.substring(country.length / 2);
                    } else {
                        words[0] += ' ';
                    }
                    $('<span/>').css('color', countryColors[countryIsoUpper][0]).text(words[0].toUpperCase()).appendTo(obj);
                    $('<span/>').css('color', countryColors[countryIsoUpper][1]).text(words[1].toUpperCase()).appendTo(obj);
                } else {
                    obj.text(country);
                }
                $('.flag-wrapper').removeClass('hidden');
            });

            var date = new Date();
            var day = date.getDate();
            var month = date.getMonth() + 1;
            var year = date.getFullYear();
            $('.f1t-date-current-day').text(day + " / ");
            $('.f1t-date-current-month').text(month + " / ");
            $('.f1t-date-current-year').text(year);
        }

        $('.scroll-to-form').on("click", function (e) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $("#find-out-how").offset().top - 100
            }, 1000);
        });

    };
    (function (d) {
        if (window.intgrtn) {
            return;
        }
        var s = d.createElement("script");
        var date = new Date();
        s.async = true;
        s.src = "<?php echo $trackingUrl?>/api/v2/integration/app.js?v=1" + date.getFullYear().toString() + date.getMonth().toString() + date.getDate().toString() + date.getHours().toString() + Math.round(date.getMinutes() / 10).toString();
        d.getElementsByTagName("head")[0].appendChild(s);
    }(document));
</script>
<!-- END intgrtn -->
