From a577ba39dfb1f61a68af2e62dcacaf7aa87516ab Mon Sep 17 00:00:00 2001 From: farthinker Date: Tue, 19 May 2015 11:01:46 +0800 Subject: [PATCH] remove dependencies of simple-util && jquery-mousewheel --- bower.json | 6 ++---- lib/select.js | 7 ++----- package.json | 6 ++---- src/select.coffee | 5 +---- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/bower.json b/bower.json index a18cb48..7ab6161 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "simple-select", - "version": "2.0.6", + "version": "2.0.7", "homepage": "https://github.com/mycolorway/simple-select", "authors": [ "kshift " @@ -26,8 +26,6 @@ ], "dependencies": { "jquery": "2.x", - "simple-module": "2.x", - "jquery-mousewheel": "~3.x", - "simple-util": "2.x" + "simple-module": "~2.0.5" } } diff --git a/lib/select.js b/lib/select.js index 698e2f8..f9115c5 100644 --- a/lib/select.js +++ b/lib/select.js @@ -149,7 +149,7 @@ Select = (function(superClass) { })(this)); this.list.on("mousedown", (function(_this) { return function(e) { - if (simple.util.browser.msie) { + if (window.navigator.userAgent.toLowerCase().indexOf('msie') > -1) { _this._scrollMousedown = true; setTimeout(function() { return _this.input.focus(); @@ -157,10 +157,7 @@ Select = (function(superClass) { } return false; }; - })(this)).on("mousewheel", function(e, delta) { - $(this).scrollTop($(this).scrollTop() - 25 * delta); - return false; - }).on("mousedown", ".select-item", (function(_this) { + })(this)).on("mousedown", ".select-item", (function(_this) { return function(e) { var index; index = _this.list.find(".select-item").index($(e.currentTarget)); diff --git a/package.json b/package.json index 0728779..19cd294 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-select", - "version": "2.0.6", + "version": "2.0.7", "description": "a simple select plugin based on Simple Module", "repository": { "type": "git", @@ -14,9 +14,7 @@ "homepage": "https://github.com/mycolorway/simple-select", "dependencies": { "jquery": "2.x", - "simplemodule": "2.x", - "jquery-mousewheel": "3.x", - "simple-util": "2.x" + "simple-module": "~2.0.5" }, "devDependencies": { "grunt": "0.x", diff --git a/src/select.coffee b/src/select.coffee index 980508e..ba11dcb 100644 --- a/src/select.coffee +++ b/src/select.coffee @@ -117,15 +117,12 @@ class Select extends SimpleModule return false @list.on "mousedown", (e) => - if simple.util.browser.msie + if window.navigator.userAgent.toLowerCase().indexOf('msie') > -1 @_scrollMousedown = true setTimeout => @input.focus() , 0 return false - .on "mousewheel", (e, delta) -> - $(@).scrollTop($(@).scrollTop() - 25 * delta) - return false .on "mousedown", ".select-item", (e) => index = @list.find(".select-item").index $(e.currentTarget) @selectItem index