diff --git a/src/Umbraco.Web.UI.Client/src/app.js b/src/Umbraco.Web.UI.Client/src/app.js index 74a7008901..645296f0e0 100644 --- a/src/Umbraco.Web.UI.Client/src/app.js +++ b/src/Umbraco.Web.UI.Client/src/app.js @@ -91,6 +91,6 @@ angular.module("umbraco.viewcache", []) // be able to configure angular values in the Default.cshtml // view which is much easier to do that configuring values by injecting them in the back office controller // to follow through to the js initialization stuff -if (angular.isFunction(document.angularReady)) { +if (_.isFunction(document.angularReady)) { document.angularReady.apply(this, [app]); } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js index a412f73c5a..e27ae11e6c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js @@ -409,8 +409,8 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use //load the tree loadTree().then(function () { //because angular doesn't return a promise for the resolve method, we need to resort to some hackery, else - //like normal JS promises we could do resolve(...).then() - if (args && args.onLoaded && angular.isFunction(args.onLoaded)) { + //like normal JS promises we could do resolve(...).then() + if (args && args.onLoaded && Utilities.isFunction(args.onLoaded)) { args.onLoaded(); } }); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js index 070ffd4ddd..5e1f2489e6 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js @@ -82,7 +82,7 @@ if (Utilities.isDefined(opts.firstLineNumber)) { if (Utilities.isNumber(opts.firstLineNumber)) { session.setOption('firstLineNumber', opts.firstLineNumber); - } else if (angular.isFunction(opts.firstLineNumber)) { + } else if (Utilities.isFunction(opts.firstLineNumber)) { session.setOption('firstLineNumber', opts.firstLineNumber()); } } @@ -116,7 +116,7 @@ // onLoad callbacks angular.forEach(opts.callbacks, function(cb) { - if (angular.isFunction(cb)) { + if (Utilities.isFunction(cb)) { cb(acee); } }); @@ -208,7 +208,7 @@ if (Utilities.isDefined(callback)) { scope.$evalAsync(function() { - if (angular.isFunction(callback)) { + if (Utilities.isFunction(callback)) { callback(args); } else { throw new Error('ui-ace use a function as callback.'); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js index 3865ffcdae..783cd7f90a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbminilistview.directive.js @@ -92,7 +92,7 @@ // advanced item filtering is handled here if (scope.entityTypeFilter && scope.entityTypeFilter.filter && scope.entityTypeFilter.filterAdvanced) { - var filtered = angular.isFunction(scope.entityTypeFilter.filter) + var filtered = Utilities.isFunction(scope.entityTypeFilter.filter) ? _.filter(miniListView.children, scope.entityTypeFilter.filter) : _.where(miniListView.children, scope.entityTypeFilter.filter); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertyvalidator.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertyvalidator.directive.js index 37303d22ad..d66e4bd2af 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertyvalidator.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertyvalidator.directive.js @@ -28,9 +28,9 @@ function valPropertyValidator(serverValidationManager) { var modelCtrl = ctrls[0]; var propCtrl = ctrls.length > 1 ? ctrls[1] : null; - - // Check whether the scope has a valPropertyValidator method - if (!scope.valPropertyValidator || !angular.isFunction(scope.valPropertyValidator)) { + + // Check whether the scope has a valPropertyValidator method + if (!scope.valPropertyValidator || !Utilities.isFunction(scope.valPropertyValidator)) { throw new Error('val-property-validator directive must specify a function to call'); } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js index 7e7f804656..32d6a0c340 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js @@ -147,12 +147,12 @@ function angularHelper($q) { */ safeApply: function (scope, fn) { if (scope.$$phase || (scope.$root && scope.$root.$$phase)) { - if (angular.isFunction(fn)) { + if (Utilities.isFunction(fn)) { fn(); } } else { - if (angular.isFunction(fn)) { + if (Utilities.isFunction(fn)) { scope.$apply(fn); } else { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index 6d41ea087d..928b8c8714 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -589,7 +589,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt //instead of having a property editor $watch their expression to check if it has // been updated, instead we'll check for the existence of a special method on their model // and just call it. - if (angular.isFunction(origProp.onValueChanged)) { + if (Utilities.isFunction(origProp.onValueChanged)) { //send the newVal + oldVal origProp.onValueChanged(origProp.value, origVal); } @@ -643,7 +643,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt // soft-redirecting which means the URL will change but the route wont (i.e. creating content). // In this case we need to detect what properties have changed and re-bind them with the server data. - if (args.rebindCallback && angular.isFunction(args.rebindCallback)) { + if (args.rebindCallback && Utilities.isFunction(args.rebindCallback)) { args.rebindCallback(); } @@ -690,7 +690,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt // soft-redirecting which means the URL will change but the route wont (i.e. creating content). // In this case we need to detect what properties have changed and re-bind them with the server data. - if (args.rebindCallback && angular.isFunction(args.rebindCallback)) { + if (args.rebindCallback && Utilities.isFunction(args.rebindCallback)) { args.rebindCallback(); } } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/events.service.js b/src/Umbraco.Web.UI.Client/src/common/services/events.service.js index 965ac3d635..c7ef5bd28f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/events.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/events.service.js @@ -34,7 +34,7 @@ function eventsService($q, $rootScope) { /** pass in the result of 'on' to this method, or just call the method returned from 'on' to unsubscribe */ unsubscribe: function(handle) { - if (angular.isFunction(handle)) { + if (Utilities.isFunction(handle)) { handle(); } } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js index 9ba4d2964b..9970995a28 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js @@ -235,7 +235,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS } }); } - else if (args.filter && angular.isFunction(args.filter)) { + else if (args.filter && Utilities.isFunction(args.filter)) { //if a filter is supplied a cacheKey must be supplied as well if (!args.cacheKey) { throw "args.cacheKey is required if args.filter is supplied"; @@ -315,7 +315,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS args.node.hasChildren = true; //Since we've removed the children & reloaded them, we need to refresh the UI now because the tree node UI doesn't operate on normal angular $watch since that will be pretty slow - if (angular.isFunction(args.node.updateNodeData)) { + if (Utilities.isFunction(args.node.updateNodeData)) { args.node.updateNodeData(args.node); } } @@ -349,7 +349,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS * @param {object} treeNode the node to remove */ removeNode: function (treeNode) { - if (!angular.isFunction(treeNode.parent)) { + if (!Utilities.isFunction(treeNode.parent)) { return; } @@ -509,7 +509,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS if (current.metaData && current.metaData["treeAlias"]) { root = current; } - else if (angular.isFunction(current.parent)) { + else if (Utilities.isFunction(current.parent)) { //we can only continue if there is a parent() method which means this // tree node was loaded in as part of a real tree, not just as a single tree // node from the server. @@ -706,7 +706,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS //to fire, instead we're just going to replace all the properties of this node. //there should always be a method assigned but we'll check anyways - if (angular.isFunction(node.parent().children[index].updateNodeData)) { + if (Utilities.isFunction(node.parent().children[index].updateNodeData)) { node.parent().children[index].updateNodeData(found); } else { @@ -741,7 +741,7 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS if (!node) { throw "node cannot be null"; } - if (!angular.isFunction(node.parent)) { + if (!Utilities.isFunction(node.parent)) { throw "node.parent is not a function, the path cannot be resolved"; } diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js index 05c391c3e7..74858d652e 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js @@ -85,12 +85,12 @@ angular.module("umbraco.install").factory('installerService', function ($rootSco /** Have put this here because we are not referencing our other modules */ function safeApply (scope, fn) { if (scope.$$phase || scope.$root.$$phase) { - if (angular.isFunction(fn)) { + if (Utilities.isFunction(fn)) { fn(); } } else { - if (angular.isFunction(fn)) { + if (Utilities.isFunction(fn)) { scope.$apply(fn); } else { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js index c519a1d4fa..0c5fe9af1b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js @@ -173,7 +173,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController", $scope.model.filterAdvanced = false; //used advanced filtering - if (angular.isFunction($scope.model.filter)) { + if (Utilities.isFunction($scope.model.filter)) { $scope.model.filterAdvanced = true; } else if (Utilities.isObject($scope.model.filter)) { @@ -189,9 +189,9 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController", if ($scope.model.filter.startsWith("{")) { $scope.model.filterAdvanced = true; - if ($scope.model.filterByMetadata && !angular.isFunction($scope.model.filter)) + if ($scope.model.filterByMetadata && !Utilities.isFunction($scope.model.filter)) { - var filter = angular.fromJson($scope.model.filter); + var filter = Utilities.fromJson($scope.model.filter); $scope.model.filter = function (node){ return _.isMatch(node.metaData, filter);}; } else @@ -456,7 +456,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController", if ($scope.model.filterAdvanced) { //filter either based on a method or an object - var filtered = angular.isFunction($scope.model.filter) + var filtered = Utilities.isFunction($scope.model.filter) ? _.filter(nodes, $scope.model.filter) : _.where(nodes, $scope.model.filter); diff --git a/src/Umbraco.Web.UI.Client/test/lib/angular/angular-mocks.js b/src/Umbraco.Web.UI.Client/test/lib/angular/angular-mocks.js index 1c13b21fb1..c9dde30c4f 100644 --- a/src/Umbraco.Web.UI.Client/test/lib/angular/angular-mocks.js +++ b/src/Umbraco.Web.UI.Client/test/lib/angular/angular-mocks.js @@ -699,7 +699,7 @@ angular.mock.dump = function (object) { }); out = '[ ' + out.join(', ') + ' ]'; } else if (Utilities.isObject(object)) { - if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { + if (Utilities.isFunction(object.$eval) && Utilities.isFunction(object.$apply)) { out = serializeScope(object); } else if (object instanceof Error) { out = object.stack || ('' + object.name + ': ' + object.message); @@ -927,7 +927,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { responsesPush = angular.bind(responses, responses.push); function createResponse(status, data, headers) { - if (angular.isFunction(status)) return status; + if (Utilities.isFunction(status)) return status; return function () { return angular.isNumber(status) @@ -943,7 +943,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { wasExpected = false; function prettyPrint(data) { - return (Utilities.isString(data) || angular.isFunction(data) || data instanceof RegExp) + return (Utilities.isString(data) || Utilities.isFunction(data) || data instanceof RegExp) ? data : angular.toJson(data); } @@ -1372,20 +1372,20 @@ function MockHttpExpectation(method, url, data, headers) { this.matchUrl = function (u) { if (!url) return true; - if (angular.isFunction(url.test)) return url.test(u); + if (Utilities.isFunction(url.test)) return url.test(u); return url == u; }; this.matchHeaders = function (h) { if (Utilities.isUndefined(headers)) return true; - if (angular.isFunction(headers)) return headers(h); + if (Utilities.isFunction(headers)) return headers(h); return Utilities.equals(headers, h); }; this.matchData = function (d) { if (Utilities.isUndefined(data)) return true; - if (data && angular.isFunction(data.test)) return data.test(d); - if (data && !Utilities.isString(data)) return angular.toJson(data) == d; + if (data && Utilities.isFunction(data.test)) return data.test(d); + if (data && !Utilities.isString(data)) return Utilities.toJson(data) == d; return data == d; }; @@ -1484,7 +1484,7 @@ angular.mock.$TimeoutDecorator = function ($delegate, $browser) { function formatPendingTasksAsString(tasks) { var result = []; - angular.forEach(tasks, function (task) { + Utilities.forEach(tasks, function (task) { result.push('{id: ' + task.id + ', ' + 'time: ' + task.time + '}'); });