From 151e20240a66a69caf28fe9ab615840569810039 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 29 Oct 2013 09:18:47 +1100 Subject: [PATCH] Changes debounce function to use underscore --- .../lib/throttle/jquery.ba-throttle-debounce.min.js | 9 --------- src/Umbraco.Web.UI.Client/src/loader.js | 4 +--- .../src/views/common/search.controller.js | 4 ++-- src/Umbraco.Web/UI/JavaScript/JsInitialize.js | 2 -- 4 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/lib/throttle/jquery.ba-throttle-debounce.min.js diff --git a/src/Umbraco.Web.UI.Client/lib/throttle/jquery.ba-throttle-debounce.min.js b/src/Umbraco.Web.UI.Client/lib/throttle/jquery.ba-throttle-debounce.min.js deleted file mode 100644 index c954c1b1ab..0000000000 --- a/src/Umbraco.Web.UI.Client/lib/throttle/jquery.ba-throttle-debounce.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery throttle / debounce - v1.1 - 3/7/2010 - * http://benalman.com/projects/jquery-throttle-debounce-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function (b, c) { var $ = b.jQuery || b.Cowboy || (b.Cowboy = {}), a; $.throttle = a = function (e, f, j, i) { var h, d = 0; if (typeof f !== "boolean") { i = j; j = f; f = c } function g() { var o = this, m = +new Date() - d, n = arguments; function l() { d = +new Date(); j.apply(o, n) } function k() { h = c } if (i && !h) { l() } h && clearTimeout(h); if (i === c && m > e) { l() } else { if (f !== true) { h = setTimeout(i ? k : l, i === c ? e - m : e) } } } if ($.guid) { g.guid = j.guid = j.guid || $.guid++ } return g }; $.debounce = function (d, e, f) { return f === c ? a(d, e, false) : a(d, f, e !== false) } })(this); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/loader.js b/src/Umbraco.Web.UI.Client/src/loader.js index 81d5fe66be..b06ecd0905 100644 --- a/src/Umbraco.Web.UI.Client/src/loader.js +++ b/src/Umbraco.Web.UI.Client/src/loader.js @@ -40,9 +40,7 @@ yepnope({ 'lib/jquery/jquery.upload/js/jquery.fileupload.js', 'lib/jquery/jquery.upload/js/jquery.fileupload-process.js', 'lib/jquery/jquery.upload/js/jquery.fileupload-angular.js', - - 'lib/throttle/jquery.ba-throttle-debounce.min.js', - + 'lib/bootstrap/js/bootstrap.js', 'lib/underscore/underscore.js', 'lib/umbraco/Extensions.js', diff --git a/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js index f7b56c2055..d4d8402663 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/search.controller.js @@ -15,7 +15,7 @@ function SearchController($scope, searchService, $log, navigationService) { //watch the value change but don't do the search on every change - that's far too many queries // we need to debounce - $scope.$watch("searchTerm", $.debounce(400, function () { + $scope.$watch("searchTerm", _.debounce(function () { if ($scope.searchTerm) { $scope.isSearching = true; navigationService.showSearch(); @@ -26,7 +26,7 @@ function SearchController($scope, searchService, $log, navigationService) { $scope.isSearching = false; navigationService.hideSearch(); } - }), true); + }), 400); } //register it diff --git a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js index 164af40506..1727e837ea 100644 --- a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js +++ b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js @@ -34,8 +34,6 @@ 'lib/jquery/jquery.upload/js/jquery.fileupload-image.js', 'lib/jquery/jquery.upload/js/jquery.fileupload-angular.js', - 'lib/throttle/jquery.ba-throttle-debounce.min.js', - 'lib/bootstrap/js/bootstrap.2.2.3.min.js', 'lib/umbraco/Extensions.js',