<commit_before>angular.module('NodeWebBase')
    .controller('detailsController', ['$scope','$rootScope','$window','ngDialog', function ($scope, $rootScope,$window, ngDialog) {
        $scope.scopeName = 'detailsController';
        $scope.data = {"nTotal":0};
        $scope.currentItemIndex = null;
        $scope.displayIndex = 0;
        $scope.displayCaptionHtml = "None";
        $scope.termArray = [];
        $scope.defaultItem = {  "img":"/images/blank.png",
                                "usr":"None Selected",
                                "cap":"",
                                "sco":"",
                                "nTotal":0,
                                "date":""};
        $scope.socialMediaUrl = $scope.defaultItem.img;
        $scope.currentItem = $scope.defaultItem;

        $rootScope.$on('loadItemData', function (event, data) {
            $scope.$apply(function () {
                $scope.data = data;
                $scope.currentItemIndex = 0;
                $scope.displayIndex = 1;
                $scope.currentItem = $scope.data.posts[0];
                $scope.displayCaptionHtml = $scope.highlightText($scope.currentItem.cap);
                $("#caption").html($scope.displayCaptionHtml);
            });

            $scope.getAccount();
        });

        $rootScope.$on("setTermDictionary", function(event,data){
            $scope.$apply(function () {
                    angular.forEach(data,function(entry,idx){
                        $scope.termArray.push(entry[0]);
                    })
                });
        });

        $rootScope.$on('clearResults', function (event) {
            $scope.clearAll();
        });
        $rootScope.$on('clearAll', function () {
            $scope.clearAll();
        });

        $scope.clearAll = function(){
            $scope.data = {"nTotal":0};
            $scope.currentItemIndex = null;
            $scope.displayIndex = 0;
            $scope.displayCaptionHtml = "None";
            $scope.termArray = [];
            $scope.currentItem = $scope.defaultItem;
            $("#caption").html("None");
        };

        $scope.findSocialMediaLink = function(username, socialMediaType, callback){
            $.ajax({
                url:  "app/socialMediaQuery/" + username,
                data : {
                    socialMediaType: socialMediaType
                },
                dataType: "json",
                success: function (response) {
                    callback(response);
                }
            });
        };

        $scope.loadSocialPage = function(url){
            $scope.$apply(function () {
                if(url.responseText === ""){
                    $scope.socialMediaUrl = $scope.currentItem.img;
                    return;
                }

                $scope.socialMediaUrl = url.responseText;
            });
        };

        $scope.getAccount = function(){
            if($scope.currentItem.img != null && $scope.currentItem.img != '\n'){
                $scope.$apply(function () {
                    $scope.socialMediaUrl = "https://instagram.com/" + $scope.currentItem.usr;
                });
                return;
            }

            $scope.$apply(function () {
                $scope.socialMediaUrl = "https://twitter.com/" + $scope.currentItem.usr;
            });

            $scope.findSocialMediaLink($scope.currentItem.usr,"twitter", function(data){
                if(data) {
                    $scope.$apply(function () {
                        $scope.currentItem.img = data.profile_image_url.replace('_normal','');
                    });
                }
            });
        };

        $scope.showImage = function(url){
            ngDialog.openConfirm({
                template: '/views/app/imageView',
                controller: ['$scope', function ($scope) {
                    $scope.url = url;
                    $scope.close = function () {
                        $scope.closeThisDialog(null);
                    }
                }]
            });
        };
<commit_msg>making sure twitter and instagram remain twitter or instagram<commit_after>angular.module('NodeWebBase')
    .controller('detailsController', ['$scope','$rootScope','$window','ngDialog', function ($scope, $rootScope,$window, ngDialog) {
        $scope.scopeName = 'detailsController';
        $scope.data = {"nTotal":0};
        $scope.currentItemIndex = null;
        $scope.displayIndex = 0;
        $scope.displayCaptionHtml = "None";
        $scope.termArray = [];
        $scope.defaultItem = {  "img":"/images/blank.png",
                                "usr":"None Selected",
                                "cap":"",
                                "sco":"",
                                "nTotal":0,
                                "date":""};
        $scope.socialMediaUrl = $scope.defaultItem.img;
        $scope.currentItem = $scope.defaultItem;

        $rootScope.$on('loadItemData', function (event, data) {
            $scope.$apply(function () {
                $scope.data = data;
                $scope.currentItemIndex = 0;
                $scope.displayIndex = 1;
                $scope.currentItem = $scope.data.posts[0];
                $scope.displayCaptionHtml = $scope.highlightText($scope.currentItem.cap);
                $("#caption").html($scope.displayCaptionHtml);
            });

            $scope.getAccount();
        });

        $rootScope.$on("setTermDictionary", function(event,data){
            $scope.$apply(function () {
                    angular.forEach(data,function(entry,idx){
                        $scope.termArray.push(entry[0]);
                    })
                });
        });

        $rootScope.$on('clearResults', function (event) {
            $scope.clearAll();
        });
        $rootScope.$on('clearAll', function () {
            $scope.clearAll();
        });

        $scope.clearAll = function(){
            $scope.data = {"nTotal":0};
            $scope.currentItemIndex = null;
            $scope.displayIndex = 0;
            $scope.displayCaptionHtml = "None";
            $scope.termArray = [];
            $scope.currentItem = $scope.defaultItem;
            $("#caption").html("None");
        };

        $scope.findSocialMediaLink = function(username, socialMediaType, callback){
            $.ajax({
                url:  "app/socialMediaQuery/" + username,
                data : {
                    socialMediaType: socialMediaType
                },
                dataType: "json",
                success: function (response) {
                    callback(response);
                }
            });
        };

        $scope.loadSocialPage = function(url){
            $scope.$apply(function () {
                if(url.responseText === ""){
                    $scope.socialMediaUrl = $scope.currentItem.img;
                    return;
                }

                $scope.socialMediaUrl = url.responseText;
            });
        };

        $scope.getAccount = function(){
            if(!$scope.currentItem['socialMediaType'])
            {
                if($scope.currentItem.img != null && $scope.currentItem.img != '\n'){
                    $scope.currentItem['socialMediaType'] = 'instagram';
                }
                else{
                    $scope.currentItem['socialMediaType'] = 'twitter';
                }

            }

            if($scope.currentItem['socialMediaType'] === 'instagram'){
                $scope.$apply(function () {
                    $scope.socialMediaUrl = "https://instagram.com/" + $scope.currentItem.usr;
                });
                return;
            }

            $scope.$apply(function () {
                $scope.socialMediaUrl = "https://twitter.com/" + $scope.currentItem.usr;
            });

            $scope.findSocialMediaLink($scope.currentItem.usr,"twitter", function(data){
                if(data) {
                    $scope.$apply(function () {
                        $scope.currentItem.img = data.profile_image_url.replace('_normal','');
                    });
                }
            });
        };

        $scope.showImage = function(url){
            ngDialog.openConfirm({
                template: '/views/app/imageView',
                controller: ['$scope', function ($scope) {
                    $scope.url = url;
                    $scope.close = function () {
                        $scope.closeThisDialog(null);
                    }
                }]
            });
        };

{'fraction_non_alphanumeric': 0.14215800512701002, 'fraction_numerical': 0.0020974131903985084, 'mean_word_length': 1.3605610561056105, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '6543264', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2086, 'n_words': 284}