{"size": 1861, "ext": "js", "max_stars_repo_path": "public/javascripts/fpTest.js", "max_stars_repo_name": "purkart/mediadevices02", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/javascripts/fpTest.js", "max_issues_repo_name": "purkart/mediadevices02", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/javascripts/fpTest.js", "max_forks_repo_name": "purkart/mediadevices02", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.0166666667, "max_line_length": 120, "alphanum_fraction": 0.5814078452}
/**
 * Created by Julian Purkart, Thomas Schoenegger on 25-Jan-16.
 */


angular.module('myApp').controller('ctrlRead', function ($scope, $http, $timeout) {

// Extension for 'Projektarbeit SS2016' - start

    function logArrayElements(element, index, array) {
        console.log('a[' + index + '] = ' + element);
    }

    var options = {excludeAvailableMediaDevices: false};

    var data = {
        fingerprint: {}
    }

    new Fingerprint2(options).get(function (result, components) {
        console.log("Calculated hash of fingerprint2: " + result); //a hash, representing your device fingerprint
        console.log(components);// an array of FP components

        data.fingerprint.hash = result;
        //$http.post('/identify', data);
    });

    new Fingerprint2Extended(options).get(function (result, components) {
        console.log("Calculated hash extended fingerprint2: " + result); //a hash, representing your device fingerprint
        console.log(components);// an array of FP components

        navigator.mediaDevices.enumerateDevices().then(
            // Loggen der Nachricht und des Wertes

            function(devices) {
                console.log("test");
                console.log(devices);

                devices.forEach(logArrayElements);

                data.fingerprint.devices = devices;
            });

        //console.log(navigator.mediaDevices.getSupportedConstraints());
        //console.log(navigator.mediaDevices.getUserMedia());
        //MediaDevices;
        /*var data = {
            fingerprint: {
                'hash': result,
                'extended': result,
            },
        };*/

        data.fingerprint.extended = result;
        $http.post('/identify', data);
    });
// Extension for 'Projektarbeit SS2016' - end
});

