GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (3063)

archive/2.8.x/js/directive.range.js (10 issues)

1
2
app.directive('range', ['$rootScope',
3
    '$timeout',
4
    'Core',
5
    'Security',
6
    'MessageService', function($rootScope, $timeout, Core, Security, MessageService) {
7
    function RangeConstructor($scope, $element, $attrs) {
8
		if(Core.GetConfig().debugLog.DirectiveFlow)
9
			console.log("1 Range - RangeConstructor()");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
10
        var constructor = this;
0 ignored issues
show
The variable constructor seems to be never used. Consider removing it.
Loading history...
11
        var $ctrl = $scope.rangeCtrl;
12
        var tagName = $element[0].tagName.toLowerCase();
13
14 View Code Duplication
        var DirectiveProperties = (function () {
15
            var multi;
16
17
            function findMultiable(){
18
                var object = $attrs.multi;
19
                if(typeof(object) != "undefined")
20
                    return true;
21
                else
22
                    return false;
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
23
            }
24
25
            return {
26
                getMultiable: function () {
27
                    if (!multi) {
28
                        multi = findMultiable();
29
                    }
30
                    $scope.multi = multi;
31
                    return multi;
32
                }
33
            };
34
        })();
35
36
        function TryToCallInitDirective(){
37
            if(typeof $scope.InitDirective == "function"){
38
                $scope.InitDirective($scope, $element, $attrs, $ctrl);
39
            }else{
40
                $scope.DefaultInitDirective();
41
            }
42
        }
43
        $scope.DefaultInitDirective = function(){
44
            if(Core.GetConfig().debugLog.DirectiveFlow)
45
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
46
        }
47
48
		// this getter only for editbox
49
        $scope.IsRange = function()
50
        {
51
            return true;
52
        }
53
54
        $scope.GetInitRange = function(){
55
            var range = {start: "ALL", end: ""};
56
57
            return range;
58
        }
59
60
        function InitializeRange() {
61
            DirectiveProperties.getMultiable();
62
            var range = {start: "ALL", end: "", isAll: true};
63
            $ctrl.ngModel = jQuery.extend(true, {}, range);
64
			
65
			$scope.isStartBound = false;
66
			$scope.isEndBound = false;
67
			$scope.isActivatedByEditbox = false;
68
        }
69
        $scope.Initialize = function(){
70
            $scope.InitScope();
71
            if(typeof $scope.EventListener == "function"){
72
                $scope.EventListener($scope, $element, $attrs, $ctrl);
73
            }else{
74
                EventListener();
75
            }
76
            TryToCallInitDirective();
77
        }
78
        $scope.InitScope = function(){
79
            InitializeRange();
80
        }
81
82
        function InitDirective(){
83
            if(Core.GetConfig().debugLog.DirectiveFlow)
84
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
85
        }
86
        function EventListener(){
87
            if(Core.GetConfig().debugLog.DirectiveFlow)
88
            console.log("scope.$id:"+$scope.$id+", may implement $scope.EventListener() function in webapge");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
89
        }
90
91
        // chagneRagne = [start | end]
92 View Code Duplication
        function RangeStringChange(changeRange, ctrlModel){
93
            var isLocaleCompareSupport = localeCompareSupportsLocales();
94
95
            var strStart = ctrlModel.start;
96
            var strEnd = ctrlModel.end;
97
            var stringDifference = 0;
98
99
            // if user change the start value
100
            if(strStart != "ALL"){
101
                $ctrl.ngModel.isAll = false;
102
            }
103
104
            // string comparison, find the strStart position of strEnd
105
            if(isLocaleCompareSupport){
106
                 stringDifference = strStart.localeCompare(strEnd);
107
            }else{
108
                if(strStart < strEnd)
109
                    stringDifference = -1;
110
                if(strEnd < strStart)
111
                    stringDifference = 1;
112
                if(strStart == strEnd)
113
                    stringDifference = 0;
114
            }
115
116
            if(changeRange == "start"){
117
118
                if(stringDifference > 0)
119
                {
120
                    strEnd = strStart
121
                }
122
                if(stringDifference < 0)
123
                {
0 ignored issues
show
Comprehensibility Documentation Best Practice introduced by
This code block is empty. Consider removing it or adding a comment to explain.
Loading history...
124
125
                }
126
            }else if(changeRange == "end"){
127
                if(stringDifference > 0)
128
                {
129
                    strStart = strEnd
130
                }
131
                if(stringDifference < 0)
132
                {
133
                    if(strStart == "")
134
                        strStart = strEnd
135
                }
136
            }
137
138
            ctrlModel.start = strStart;
139
            ctrlModel.end = strEnd;
140
        }
141
142
        function localeCompareSupportsLocales() {
143
          try {
144
            'foo'.localeCompare('bar', 'i');
145
          } catch (e) {
146
            return e.name === 'RangeError';
147
          }
148
          return false;
149
        }
150
		
151
		$scope.ToggleRangeInAll = function(){
152
			$scope.SetInAllRange($ctrl.ngModel.isAll);
153
		}
154
		
155
		$scope.SetStartOrEndBound = function(setRange){
156
            if(setRange == "start"){
157
				$scope.isStartBound = true;
158
			}else if(setRange == "end"){
159
				$scope.isEndBound = true;
160
			}
161
		}
162
		
163
		$scope.GetIsStartEndBound = function(){
164
			return $scope.GetIsStartBound() && $scope.GetIsEndBound();
165
		}
166
		
167
		$scope.GetIsStartBound = function(){
168
			return $scope.isStartBound;
169
		}
170
		
171
		$scope.GetIsEndBound = function(){
172
			return $scope.isEndBound;
173
		}
174
		
175
		$scope.GetIsActivate = function(){
176
			return $scope.isActivatedByEditbox;
177
		}
178
		
179
		$scope.SetIsActivate = function(){
180
			$scope.isActivatedByEditbox = true;
181
		}
182
		
183
		$scope.SetInAllRange = function(isCheckAll){
184
			$ctrl.ngModel.isAll = isCheckAll;
185
		}
186
		
187
		// this setter only for editbox
188
        $scope.SetRange = function(rangeType, value){
189
            console.dir("rangeType:"+rangeType)
190
            console.dir("value:"+value)
191
            if(rangeType == "start"){
192
                $ctrl.ngModel.start = value;
193
            }else if(rangeType == "end"){
194
                $ctrl.ngModel.end = value;
195
            }
196
            RangeStringChange(rangeType, $ctrl.ngModel)
197
        }
198
199
        $scope.GetRange = function(){
200
            var rangeList = [];
201
            var range = rangeList[0] = {start: "", end: ""};
202
203
            range.start = $ctrl.ngModel.start;
204
            range.end = $ctrl.ngModel.end;
205
206
            return range;
207
        }
208
        $scope.IsLockEndControl = function(){
209
            var isLock = false;
210
            var range = $scope.GetRange();
211
            if(range.start == "ALL"){
212
                isLock = true;
213
            }
214
            return isLock;
215
        }
216
217
        $scope.CheckAllRange = function(test){
218
            console.dir("CheckAllRange() function")
219
        }
220
        
221
        $scope.$watch(
222
          function() { return $ctrl.ngModel.isAll; },
223
          function(newValue, oldValue) {
224
              var isCheckAll = newValue;
225
			  console.trace()
226
              console.dir($ctrl.ngModel)
227
              console.dir("newValue:"+newValue)
228
              console.dir("oldValue:"+oldValue)
229
            if(isCheckAll){
230
                $ctrl.ngModel.start = "ALL"
231
                $ctrl.ngModel.end = ""
232
233
                var editBtn = $element.find('button[ng-click="OpenPageView()"]').last();
234
                editBtn.prop('disabled', true);
235
            }
236
            else{
237
                if($ctrl.ngModel.start == "ALL")
238
                    $ctrl.ngModel.start = ""
239
240
                var editBtn = $element.find('button[ng-click="OpenPageView()"]').last();
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable editBtn already seems to be declared on line 233. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
241
                editBtn.prop('disabled', false);
242
            }
243
          },
244
          true
245
        );
246
		
247
		//$scope.Initialize();
248
    }
249
    function templateFunction(tElement, tAttrs) {
250
        var globalCriteria = $rootScope.globalCriteria;
251
252
        var template = '' +
253
          '<div class="custom-transclude"></div>';
254
        return template;
255
    }
256
257
    return {
258
        require: ['ngModel'],
259
        restrict: 'E', //'EA', //Default in 1.3+
260
        transclude: true,
261
        scope: true,
262
263
        controller: RangeConstructor,
264
        controllerAs: 'rangeCtrl',
265
266
        //If both bindToController and scope are defined and have object hashes, bindToController overrides scope.
267
        bindToController: {
268
            ngModel: '=',
269
        },
270
        template: templateFunction,
271
        compile: function compile(tElement, tAttrs, transclude) {
272
            return {
273
                pre: function preLink(scope, iElement, iAttrs, controller) {
274
					if(Core.GetConfig().debugLog.DirectiveFlow)
275
						console.log("3 Range - compile preLink()");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
276
                },
277
                post: function postLink(scope, iElement, iAttrs, controller) {
278
					if(Core.GetConfig().debugLog.DirectiveFlow)
279
						console.log("4 Range - compile postLink()");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
280
281
                    transclude(scope, function (clone, scope) {
282
                        iElement.find('.custom-transclude').append(clone);
283
                    })
284
                    
285
                    scope.Initialize();
286
                    iElement.ready(function() {
287
						scope.SetInAllRange(true);
288
                        scope.rangeCtrl.ngModel.start = "ALL";
289
                        scope.rangeCtrl.ngModel.isAll = true;
290
                    })
291
                }
292
            }
293
        },
294
    };
295
}]);