<commit_before>
<!--

Starting from project root dir:

C:\Users\rstaudi\Devel\twoinone-extension\demo-posture>..\..\crosswalk64-19.48.502.0\xwalk.exe
    --external-extensions-path=C:\Users\rstaudi\Devel\twoinone-extension\demo-posture\twoinone-extension
    app\manifest.json

-->

<html>
    <head>
        <style>
            .element {
              position: relative;
              top: 50%;
              transform: translateY(-50%);
              text-align: center;
            }
        </style>
        <script>
            var _icons = ["icon-laptop.png", "icon-tablet.png"];
            var _i = 0;
            function fade(img, sign, callback) {

                sign = sign > 0 ? 1 : -1;
                var period = 1000 / 60; // 60 Hz
                var step = 1 / (250 / period);

                function fadeCb() {
                    console.log(img.style.opacity);
                    if (sign > 0 && img.style.opacity === "1" ||
                        sign < 0 && img.style.opacity === "0") {
                        if (callback)
                            callback();
                        return;
                    } else if (sign > 0) {
                        if (img.style.opacity + step > 1) {
                            img.style.opacity = 1;
                        } else {
                            img.style.opacity = parseFloat(img.style.opacity) + step;
                        }
                    } else if (sign < 0) {
                        if (img.style.opacity - step < 0) {
                            img.style.opacity = 0;
                        } else {
                            img.style.opacity = parseFloat(img.style.opacity) - step;
                        }
                    }
                    window.setTimeout(fadeCb, period);
                }
                window.setTimeout(fadeCb, period);
            }

            function test() {
                _i++;
                var img = document.getElementById("icon");
                fade(img, -1, function() {
                    img.src = _icons[_i % 2];
                    fade(img, 1, function() {});
                });
            }
            function init() {
                var img = document.getElementById("icon");
                img.src = _icons[_i];
                img.style.opacity = 1.0;
            }
        </script>
    </head>
    <body onload="init()" style="background-color: #0071c5"><commit_msg>demo-posture: Hook up tablet monitor<commit_after>
<!--

Starting from project root dir:

C:\Users\rstaudi\Devel\twoinone-extension\demo-posture>..\..\crosswalk64-19.48.502.0\xwalk.exe
    --external-extensions-path=C:\Users\rstaudi\Devel\twoinone-extension\demo-posture\twoinone-extension
    app\manifest.json

-->

<html>
    <head>
        <style>
            .element {
              position: relative;
              top: 50%;
              transform: translateY(-50%);
              text-align: center;
            }
        </style>
        <script>

            function fade(img, sign, callback) {

                sign = sign > 0 ? 1 : -1;
                var period = 1000 / 60; // 60 Hz
                var step = 1 / (250 / period);

                function fadeCb() {
                    console.log(img.style.opacity);
                    if (sign > 0 && img.style.opacity === "1" ||
                        sign < 0 && img.style.opacity === "0") {
                        if (callback)
                            callback();
                        return;
                    } else if (sign > 0) {
                        if (img.style.opacity + step > 1) {
                            img.style.opacity = 1;
                        } else {
                            img.style.opacity = parseFloat(img.style.opacity) + step;
                        }
                    } else if (sign < 0) {
                        if (img.style.opacity - step < 0) {
                            img.style.opacity = 0;
                        } else {
                            img.style.opacity = parseFloat(img.style.opacity) - step;
                        }
                    }
                    window.setTimeout(fadeCb, period);
                }
                window.setTimeout(fadeCb, period);
            }

            var _icons = ["icon-laptop.png", "icon-tablet.png"];
            var _i = 0;
            function test() {
                _i++;
                var img = document.getElementById("icon");
                fade(img, -1, function() {
                    img.src = _icons[_i % 2];
                    fade(img, 1, function() {});
                });
            }
            
            function main() {
                
                var img = document.getElementById("icon");
                img.src = _icons[_i];
                img.style.opacity = 1.0;
                
                if (twoinone) {
                    twoinone.monitorTablet(function (isTablet) {
                        
                        var img = document.getElementById("icon");
                        fade(img, -1, function() {
                            img.src = isTablet ? "icon-tablet.png" : "icon-laptop.png";
                            fade(img, 1, function() {});
                        });
                    });
                }
            }
        </script>
    </head>
    <body onload="main()" style="background-color: #0071c5">
{'fraction_non_alphanumeric': 0.12086092715231789, 'fraction_numerical': 0.018763796909492272, 'mean_word_length': 0.9424794569489103, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4198100', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1352, 'n_words': 276}