Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 3cffbd1

Browse files
committed
move use strict declarations to inside functions
1 parent 63d3e2f commit 3cffbd1

File tree

21 files changed

+54
-39
lines changed

21 files changed

+54
-39
lines changed

.jshintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"browser": true,
44
"eqnull": true,
55
"expr": true,
6-
"globalstrict": true,
76
"immed": true,
87
"laxbreak": true,
98
"loopfunc": true,
@@ -13,6 +12,7 @@
1312
"nonew": true,
1413
"quotmark": true,
1514
"smarttabs": true,
15+
"strict": true,
1616
"sub": true,
1717
"trailing": true,
1818
"undef": true,

demo/demo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
'use strict';
2-
31
angular.module('doc.ui-utils', ['ui.utils', 'prettifyDirective' ]);
42

53
angular.module('ui.scroll')
64
.factory('datasource', [
75
'$log', '$timeout', function(console, $timeout) {
6+
'use strict';
7+
88
var get = function(index, count, success) {
99
return $timeout(function() {
1010
var i, result, _i, _ref;

modules/alias/alias.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'use strict';
2-
31
angular.module('ui.alias', []).config(['$compileProvider', 'uiAliasConfig', function($compileProvider, uiAliasConfig){
2+
'use strict';
3+
44
uiAliasConfig = uiAliasConfig || {};
55
angular.forEach(uiAliasConfig, function(config, alias){
66
if (angular.isString(config)) {

modules/event/event.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* General-purpose Event binding. Bind any event not natively supported by Angular
53
* Pass an object with keynames for events to ui-event
@@ -12,6 +10,8 @@
1210
*/
1311
angular.module('ui.event',[]).directive('uiEvent', ['$parse',
1412
function ($parse) {
13+
'use strict';
14+
1515
return function ($scope, elm, attrs) {
1616
var events = $scope.$eval(attrs.uiEvent);
1717
angular.forEach(events, function (uiEvent, eventName) {

modules/format/format.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* A replacement utility for internationalization very similar to sprintf.
53
*
@@ -14,6 +12,8 @@
1412
* @example: '$0 agrees to all mentions $0 makes in the event that $0 hits a tree while $0 is driving drunk'.format('Bob')
1513
*/
1614
angular.module('ui.format',[]).filter('format', function(){
15+
'use strict';
16+
1717
return function(value, replace) {
1818
var target = value;
1919
if (angular.isString(target) && replace !== undefined) {

modules/highlight/highlight.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
'use strict';
2-
31
/**
42
* Wraps the
53
* @param text {string} haystack to search through
64
* @param search {string} needle to search for
75
* @param [caseSensitive] {boolean} optional boolean to use case-sensitive searching
86
*/
97
angular.module('ui.highlight',[]).filter('highlight', function () {
8+
'use strict';
9+
1010
return function (text, search, caseSensitive) {
1111
if (text && (search || angular.isNumber(search))) {
1212
text = text.toString();

modules/include/include.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
'use strict';
2-
31
// modeled after: angular-1.0.7/src/ng/directive/ngInclude.js
42
angular.module('ui.include',[])
53
.directive('uiInclude', ['$http', '$templateCache', '$anchorScroll', '$compile',
64
function($http, $templateCache, $anchorScroll, $compile) {
5+
'use strict';
6+
77
return {
88
restrict: 'ECA',
99
terminal: true,

modules/indeterminate/indeterminate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
'use strict';
2-
31
/**
42
* Provides an easy way to toggle a checkboxes indeterminate property
53
*
64
* @example <input type="checkbox" ui-indeterminate="isUnkown">
75
*/
86
angular.module('ui.indeterminate',[]).directive('uiIndeterminate', [
97
function () {
8+
'use strict';
9+
1010
return {
1111
compile: function(tElm, tAttrs) {
1212
if (!tAttrs.type || tAttrs.type.toLowerCase() !== 'checkbox') {

modules/inflector/inflector.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* Converts variable-esque naming conventions to something presentational, capitalized words separated by space.
53
* @param {String} value The value to be parsed and prettified.
@@ -10,6 +8,7 @@
108
* {{ 'Here Is my_phoneNumber' | inflector:'variable' }} => hereIsMyPhoneNumber
119
*/
1210
angular.module('ui.inflector',[]).filter('inflector', function () {
11+
'use strict';
1312

1413
function tokenize(text) {
1514
text = text.replace(/([A-Z])|([\-|\_])/g, function(_, $1) { return ' ' + ($1 || ''); });

modules/jq/jq.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* General-purpose jQuery wrapper. Simply pass the plugin name as the expression.
53
*
@@ -18,6 +16,8 @@
1816
angular.module('ui.jq',[]).
1917
value('uiJqConfig',{}).
2018
directive('uiJq', ['uiJqConfig', '$timeout', function uiJqInjectingFunction(uiJqConfig, $timeout) {
19+
'use strict';
20+
2121

2222
return {
2323
restrict: 'A',

modules/keypress/keypress.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
'use strict';
2-
31
angular.module('ui.keypress',[]).
42
factory('keypressHelper', ['$parse', function keypress($parse){
3+
'use strict';
4+
55
var keysByCode = {
66
8: 'backspace',
77
9: 'tab',
@@ -92,6 +92,8 @@ factory('keypressHelper', ['$parse', function keypress($parse){
9292
* @example <input ui-keypress="{enter:'x = 1', 'ctrl-shift-space':'foo()', 'shift-13':'bar()'}" /> <input ui-keypress="foo = 2 on ctrl-13 and bar('hello') on shift-esc" />
9393
**/
9494
angular.module('ui.keypress').directive('uiKeydown', ['keypressHelper', function(keypressHelper){
95+
'use strict';
96+
9597
return {
9698
link: function (scope, elm, attrs) {
9799
keypressHelper('keydown', scope, elm, attrs);
@@ -100,6 +102,8 @@ angular.module('ui.keypress').directive('uiKeydown', ['keypressHelper', function
100102
}]);
101103

102104
angular.module('ui.keypress').directive('uiKeypress', ['keypressHelper', function(keypressHelper){
105+
'use strict';
106+
103107
return {
104108
link: function (scope, elm, attrs) {
105109
keypressHelper('keypress', scope, elm, attrs);
@@ -108,6 +112,8 @@ angular.module('ui.keypress').directive('uiKeypress', ['keypressHelper', functio
108112
}]);
109113

110114
angular.module('ui.keypress').directive('uiKeyup', ['keypressHelper', function(keypressHelper){
115+
'use strict';
116+
111117
return {
112118
link: function (scope, elm, attrs) {
113119
keypressHelper('keyup', scope, elm, attrs);

modules/mask/mask.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/*
42
Attaches input mask onto input element
53
*/
@@ -12,6 +10,8 @@ angular.module('ui.mask', [])
1210
}
1311
})
1412
.directive('uiMask', ['uiMaskConfig', '$parse', function (maskConfig, $parse) {
13+
'use strict';
14+
1515
return {
1616
priority: 100,
1717
require: 'ngModel',

modules/reset/reset.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
'use strict';
2-
31
/**
42
* Add a clear button to form inputs to reset their value
53
*/
64
angular.module('ui.reset',[]).value('uiResetConfig',null).directive('uiReset', ['uiResetConfig', function (uiResetConfig) {
5+
'use strict';
6+
77
var resetValue = null;
88
if (uiResetConfig !== undefined){
99
resetValue = uiResetConfig;

modules/route/route.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
'use strict';
2-
31
/**
42
* Set a $uiRoute boolean to see if the current route matches
53
*/
64
angular.module('ui.route', []).directive('uiRoute', ['$location', '$parse', function ($location, $parse) {
5+
'use strict';
6+
77
return {
88
restrict: 'AC',
99
scope: true,

modules/scroll/scroll-jqlite.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
'use strict';
21
angular.module('ui.scroll.jqlite', ['ui.scroll']).service('jqLiteExtras', [
32
'$log', '$window', function(console, window) {
3+
'use strict';
4+
45
return {
56
registerFor: function(element) {
67
var convertToPx, css, getMeasurements, getStyle, getWidthHeight, isWindow, scrollTo;
@@ -217,6 +218,8 @@ angular.module('ui.scroll.jqlite', ['ui.scroll']).service('jqLiteExtras', [
217218
}
218219
]).run([
219220
'$log', '$window', 'jqLiteExtras', function(console, window, jqLiteExtras) {
221+
'use strict';
222+
220223
if (!window.jQuery) {
221224
return jqLiteExtras.registerFor(angular.element);
222225
}

modules/scroll/scroll.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
/*
32
globals: angular, window
43
@@ -14,6 +13,8 @@ globals: angular, window
1413

1514
angular.module('ui.scroll', []).directive('uiScrollViewport', [
1615
'$log', function() {
16+
'use strict';
17+
1718
return {
1819
controller: [
1920
'$scope', '$element', function(scope, element) {
@@ -25,6 +26,8 @@ angular.module('ui.scroll', []).directive('uiScrollViewport', [
2526
}
2627
]).directive('uiScroll', [
2728
'$log', '$injector', '$rootScope', '$timeout', function(console, $injector, $rootScope, $timeout) {
29+
'use strict';
30+
2831
return {
2932
require: ['?^uiScrollViewport'],
3033
transclude: 'element',

modules/scrollfix/scrollfix.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'use strict';
2-
31
/**
42
* Adds a 'ui-scrollfix' class to the element when the page scrolls past it's position.
53
* @param [offset] {int} optional Y-offset to override the detected offset.
64
* Takes 300 (absolute) or -300 or +300 (relative to detected)
75
*/
86
angular.module('ui.scrollfix',[]).directive('uiScrollfix', ['$window', function ($window) {
7+
'use strict';
8+
99
function getWindowScrollTop() {
1010
if (angular.isDefined($window.pageYOffset)) {
1111
return $window.pageYOffset;
@@ -50,6 +50,7 @@ angular.module('ui.scrollfix',[]).directive('uiScrollfix', ['$window', function
5050
}
5151
};
5252
}]).directive('uiScrollfixTarget', [function () {
53+
'use strict';
5354
return {
5455
controller: ['$element', function($element) {
5556
this.$element = $element;

modules/showhide/showhide.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* uiShow Directive
53
*
@@ -10,6 +8,8 @@
108
*/
119
angular.module('ui.showhide',[])
1210
.directive('uiShow', [function () {
11+
'use strict';
12+
1313
return function (scope, elm, attrs) {
1414
scope.$watch(attrs.uiShow, function (newVal) {
1515
if (newVal) {
@@ -30,6 +30,8 @@ angular.module('ui.showhide',[])
3030
* @param expression {boolean} evaluated expression to determine if the class should be added
3131
*/
3232
.directive('uiHide', [function () {
33+
'use strict';
34+
3335
return function (scope, elm, attrs) {
3436
scope.$watch(attrs.uiHide, function (newVal) {
3537
if (newVal) {
@@ -51,6 +53,8 @@ angular.module('ui.showhide',[])
5153
* @param expression {boolean} evaluated expression to determine if the class should be added
5254
*/
5355
.directive('uiToggle', [function () {
56+
'use strict';
57+
5458
return function (scope, elm, attrs) {
5559
scope.$watch(attrs.uiToggle, function (newVal) {
5660
if (newVal) {

modules/unique/unique.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* Filters out all duplicate items from an array by checking the specified key
53
* @param [key] {string} the name of the attribute of each object to compare for uniqueness
@@ -8,6 +6,7 @@
86
* @return {array}
97
*/
108
angular.module('ui.unique',[]).filter('unique', ['$parse', function ($parse) {
9+
'use strict';
1110

1211
return function (items, filterOn) {
1312

modules/uploader/uploader.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
/*
32
* Author: Remy Alain Ticona Carbajal http://realtica.org
43
* Description: The main objective of ng-uploader is to have a user control,
@@ -11,6 +10,8 @@ angular.module('ui.uploader', []).service('uiUploader', uiUploader);
1110
uiUploader.$inject = ['$log'];
1211

1312
function uiUploader($log) {
13+
'use strict';
14+
1415
/*jshint validthis: true */
1516
var self = this;
1617
self.files = [];
@@ -117,4 +118,4 @@ function uiUploader($log) {
117118
return xhr;
118119
}
119120

120-
}
121+
}

modules/validate/validate.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/**
42
* General-purpose validator for ngModel.
53
* angular.js comes with several built-in validation mechanism for input fields (ngRequired, ngPattern etc.) but using
@@ -17,6 +15,7 @@
1715
* In both cases validator function should take a value to validate as its argument and should return true/false indicating a validation result.
1816
*/
1917
angular.module('ui.validate',[]).directive('uiValidate', function () {
18+
'use strict';
2019

2120
return {
2221
restrict: 'A',

0 commit comments

Comments
 (0)