<commit_before>define(['app', 'underscore', 'joyRide'], function (app, _) {
        app.directive('help', function ($http) {
                return {
                        restrict: 'EAC',
                        replace: true,
                        transclude: true,
                        templateUrl: '/app/views/directives/help-directive.html',
                        scope: {
                                schema: '@',
                                //showHelp: '=',
                                repalceGlossaryTerms: '@'
                        },
                        link: ['$scope', '$q', '$element', function ($scope, $q, $element) {

                        }]
                        , controller: ['$scope', '$q', '$element', '$timeout', '$compile', '$http', '$filter',
                                function ($scope, $q, $element, $timeout, $compile, $http, $filter) {

                                        var joyride = false;
                                        var help = {};
                                        $scope.showHelp = {'show':true, showTour:false, hasTour:false};

                                        var buttonTemplate = '<div class="md-toolbar-tools"> <i class="material-icons">help_outline</i>   <a  ng-href="#" ng-click="showHelp.showTour=!showHelp.showTour" ng-if="!showHelp.showTour && showHelo.hasTour">' +
                                                             '   <i class="material-icons" >live_help</i>Tour</a><md-switch class="pull-right"' +
                                                             '   ng-model="showHelp.show"  aria-label="show help">' +
                                                             '   <h5>Help: <strong>{{showHelp.show ? "on" : "off"}}</strong></h5></md-switch></div>';
                                        var formTemplate = '<div class="help-section" style="margin-bottom:20px;">' +
                                                '   <div class="help-title">' +
                                                '    {{control}}' +
                                                '   </div>' +
                                                ' <div class="help-content help-contentwhite" ng-if="showHelp.show" >{{content}}<div>'

                                        var sectionTemplate = '<div class="help-section" ng-if="showHelp.show" style="margin-bottom:20px;">' +
                                                '   <div class="help-title">' +
                                                '    <i class="material-icons">help_outline</i>' +
                                                '   </div>' +
                                                ' <div class="help-content" >{{content}}<div>'
                                        var controlTemplate = sectionTemplate;//'<span class="help-inline" ng-if="showHelp.show"><i class="material-icons">help_outline</i> {{content}}</span>'

                                        if (!$scope.schema) {
                                                console.error('help schema name not provided')
                                                return
                                        }

                                         $scope.$watch('schema', function (newVal) {

                                              if (newVal)
                                                 loadSchemaHelp();
                                        });

                                        $scope.$watch('showHelp.showTour', function (newVal, oldValue) {
                                                if (oldValue === undefined)
                                                        return;

                                                if (newVal)
                                                        addJoyRideSteps();
                                        });

                                        function loadSchemaHelp(){
                                                //
                                                var query = '';
                                                if($scope.schema.indexOf('/')>=0){
                                                        query = '?q={"formPath":"' + $scope.schema + '"}';
                                                }
                                                else{<commit_msg>add delay in adding help<commit_after>define(['app', 'underscore', 'joyRide'], function (app, _) {
        app.directive('help', function ($http) {
                return {
                        restrict: 'EAC',
                        replace: true,
                        transclude: true,
                        templateUrl: '/app/views/directives/help-directive.html',
                        scope: {
                                schema: '@',
                                //showHelp: '=',
                                repalceGlossaryTerms: '@'
                        },
                        link: ['$scope', '$q', '$element', function ($scope, $q, $element) {

                        }]
                        , controller: ['$scope', '$q', '$element', '$timeout', '$compile', '$http', '$filter',
                                function ($scope, $q, $element, $timeout, $compile, $http, $filter) {

                                        var joyride = false;
                                        var help = {};
                                        $scope.showHelp = {'show':true, showTour:false, hasTour:false};

                                        var buttonTemplate = '<div class="md-toolbar-tools"> <i class="material-icons">help_outline</i>   <a  ng-href="#" ng-click="showHelp.showTour=!showHelp.showTour" ng-if="!showHelp.showTour && showHelo.hasTour">' +
                                                             '   <i class="material-icons" >live_help</i>Tour</a><md-switch class="pull-right"' +
                                                             '   ng-model="showHelp.show"  aria-label="show help">' +
                                                             '   <h5>Help: <strong>{{showHelp.show ? "on" : "off"}}</strong></h5></md-switch></div>';
                                        var formTemplate = '<div class="help-section" style="margin-bottom:20px;">' +
                                                '   <div class="help-title">' +
                                                '    {{control}}' +
                                                '   </div>' +
                                                ' <div class="help-content help-contentwhite" ng-if="showHelp.show" >{{content}}<div>'

                                        var sectionTemplate = '<div class="help-section" ng-if="showHelp.show" style="margin-bottom:20px;">' +
                                                '   <div class="help-title">' +
                                                '    <i class="material-icons">help_outline</i>' +
                                                '   </div>' +
                                                ' <div class="help-content" >{{content}}<div>'
                                        var controlTemplate = sectionTemplate;//'<span class="help-inline" ng-if="showHelp.show"><i class="material-icons">help_outline</i> {{content}}</span>'

                                        if (!$scope.schema) {
                                                console.error('help schema name not provided')
                                                return
                                        }

                                         $scope.$watch('schema', function (newVal) {

                                              if (newVal){
                                                  $timeout(function(){
                                                      loadSchemaHelp();
                                                  }, 3000);
                                            }
                                        });

                                        $scope.$watch('showHelp.showTour', function (newVal, oldValue) {
                                                if (oldValue === undefined)
                                                        return;

                                                if (newVal)
                                                        addJoyRideSteps();
                                        });

                                        function loadSchemaHelp(){
                                                //
                                                var query = '';
                                                if($scope.schema.indexOf('/')>=0){
                                                        query = '?q={"formPath":"' + $scope.schema + '"}';
                                                }
                                                else{
{'fraction_non_alphanumeric': 0.11797121007647324, 'fraction_numerical': 0.0020242914979757085, 'mean_word_length': 0.7234496124031008, 'pattern_counts': {'":': 2, '<': 63, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 150, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '122242', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1566, 'n_words': 295}