Skip to content

Commit 7568a8e

Browse files
committed
Merge pull request #80 from XhmikosR/master
Minor improvements
2 parents 8ef2a9a + 0f09166 commit 7568a8e

File tree

7 files changed

+62
-60
lines changed

7 files changed

+62
-60
lines changed

.jshintrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
"indent": 4,
88
"jquery" : true,
99
"latedef": true,
10-
"maxerr": 50,
1110
"noarg": true,
1211
"node": true,
1312
"noempty": true,
1413
"plusplus": false,
1514
"quotmark": "single",
16-
"regexp": true,
1715
"strict": false,
1816
"trailing": true,
1917
"unused": true,

ChangeLog.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
## 3.1.6
44

5-
* Deprecating delta, deltaX, and deltaY event handler arguments
6-
* Update actual event object with normalized deltaX and deltaY values (event.deltaX, event.deltaY)
7-
* Add deltaFactor to the event object (event.deltaFactor)
8-
* Handle > 0 but < 1 deltas better
9-
* Do not fire the event if deltaX and deltaY are 0
10-
* Better handle different devices that give different lowestDelta values
11-
* Add $.event.special.mousewheel.version
5+
* Deprecating `delta`, `deltaX`, and `deltaY` event handler arguments
6+
* Update actual event object with normalized `deltaX `and `deltaY` values (`event.deltaX`, `event.deltaY`)
7+
* Add `deltaFactor` to the event object (`event.deltaFactor`)
8+
* Handle `> 0` but `< 1` deltas better
9+
* Do not fire the event if `deltaX` and `deltaY` are `0`
10+
* Better handle different devices that give different `lowestDelta` values
11+
* Add `$.event.special.mousewheel.version`
1212
* Some clean up
1313

1414
## 3.1.5
1515

16-
* Bad release because I did not update the new $.event.special.mousewheel.version
16+
* Bad release because I did not update the new `$.event.special.mousewheel.version`
1717

1818
## 3.1.4
1919

20-
* Always set the deltaY
21-
* Add back in the deltaX and deltaY support for older Firefox versions
20+
* Always set the `deltaY`
21+
* Add back in the `deltaX` and `deltaY` support for older Firefox versions
2222

2323
## 3.1.3
2424

Gruntfile.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ module.exports = function(grunt) {
2121
}
2222
},
2323
connect: {
24-
server: {
25-
options: {
26-
hostname: '*',
27-
keepalive: true,
28-
middleware: function(connect, options) {
29-
return [
30-
connect.static(options.base),
31-
connect.directory(options.base)
32-
];
33-
}
24+
server: {
25+
options: {
26+
hostname: '*',
27+
keepalive: true,
28+
middleware: function(connect, options) {
29+
return [
30+
connect.static(options.base),
31+
connect.directory(options.base)
32+
];
33+
}
34+
}
3435
}
35-
}
3636
}
3737
});
3838

bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"version": "3.1.6",
44
"main": "./jquery.mousewheel.js",
55
"ignore": [
6-
".*",
7-
"*.txt",
8-
"*.markdown",
96
"*.json",
10-
"test",
11-
"Gruntfile.js"
7+
"*.markdown",
8+
"*.txt",
9+
".*",
10+
"Gruntfile.js",
11+
"test"
1212
],
1313
"dependencies": {
1414
"jquery": ">=1.2.2"

jquery.mousewheel.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@
9393

9494
// New school wheel delta (wheel event)
9595
if ( 'deltaY' in orgEvent ) {
96-
deltaY = orgEvent.deltaY * -1;
97-
delta = deltaY;
96+
deltaY = orgEvent.deltaY * -1;
97+
delta = deltaY;
9898
}
9999
if ( 'deltaX' in orgEvent ) {
100-
deltaX = orgEvent.deltaX;
101-
if ( deltaY === 0 ) { delta = deltaX * -1; }
100+
deltaX = orgEvent.deltaX;
101+
if ( deltaY === 0 ) { delta = deltaX * -1; }
102102
}
103103

104104
// No change actually happened, no reason to go any further
@@ -107,7 +107,7 @@
107107
// Store lowest absolute delta to normalize the delta values
108108
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
109109
if ( !lowestDelta || absDelta < lowestDelta ) {
110-
lowestDelta = absDelta;
110+
lowestDelta = absDelta;
111111
}
112112

113113
// Get a whole, normalized value for the deltas
@@ -134,7 +134,7 @@
134134
}
135135

136136
function nullLowestDelta() {
137-
lowestDelta = null;
137+
lowestDelta = null;
138138
}
139139

140140
}));

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"version": "3.1.6",
44
"author": "Brandon Aaron <brandon.aaron@gmail.com> (http://brandonaaron.net/)",
55
"description": "A jQuery plugin that adds cross-browser mouse wheel support.",
6+
"license": "MIT",
7+
"homepage": "https://github.com/brandonaaron/jquery-mousewheel",
68
"main": "./jquery.mousewheel.js",
79
"repository": {
810
"type": "git",
@@ -20,17 +22,16 @@
2022
"plugin",
2123
"browser"
2224
],
23-
"licenses": [
24-
{
25-
"type": "MIT",
26-
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
27-
}
25+
"files": [
26+
"ChangeLog.md",
27+
"jquery.mousewheel.js",
28+
"README.md"
2829
],
2930
"devDependencies": {
3031
"grunt": "~0.4.1",
31-
"grunt-contrib-jshint": "~0.6.4",
32-
"grunt-contrib-uglify": "~0.2.4",
33-
"grunt-contrib-connect": "~0.5.0"
32+
"grunt-contrib-connect": "~0.5.0",
33+
"grunt-contrib-jshint": "~0.7.1",
34+
"grunt-contrib-uglify": "~0.2.7"
3435
},
3536
"directories": {
3637
"test": "test"

test/index.html

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
<title>Testing mousewheel plugin</title>
66

77
<script>
8-
(function(){
9-
var verMatch = /v=([\w\.]+)/.exec( location.search ),
10-
version = verMatch && verMatch[1], src;
11-
if ( version ) {
12-
src = 'code.jquery.com/jquery-' + version;
13-
} else {
14-
src = 'code.jquery.com/jquery-git';
15-
}
16-
document.write( '<script src="http://' + src + '.js"><\/script>' );
8+
(function() {
9+
var verMatch = /v=([\w\.]+)/.exec(location.search),
10+
version = verMatch && verMatch[1],
11+
src;
12+
if (version)
13+
src = 'code.jquery.com/jquery-' + version;
14+
else
15+
src = 'code.jquery.com/jquery-git';
16+
document.write('<script src="http://' + src + '.js"><\/script>');
1717
})();
1818
</script>
1919
<script src="../jquery.mousewheel.js"></script>
2020

2121
<style>
22+
html {
23+
font: 13px Arial, sans-serif;
24+
}
25+
2226
#stage {
2327
position: relative;
2428
zoom: 1;
2529
}
30+
2631
#test1 {
2732
background-color: #000;
2833
width: 120px;
@@ -98,15 +103,13 @@
98103
}
99104

100105
#logger p {
101-
font-family: Arial, sans-serif;
102-
font-size: 13px;
103106
padding: 2px;
104107
border-bottom: 1px solid #ccc;
105108
margin: 0;
106109
}
107110

108111
#logger p:nth-child(even) {
109-
background-color: #FFFFE8;
112+
background-color: #ffffe8;
110113
}
111114

112115
#logger p:nth-child(10n) {
@@ -157,12 +160,12 @@
157160

158161
$('#test3')
159162
.hover(function() { log('#test3: mouseover'); }, function() { log('#test3: mouseout'); })
160-
.mousewheel(function(event, delta, deltaX, deltaY) {
163+
.mousewheel(function() {
161164
log('#test3: I should not have been logged');
162165
})
163166
.unmousewheel();
164167

165-
var testRemoval = function(event, delta, deltaX, deltaY) {
168+
var testRemoval = function() {
166169
log('#test4: I should not have been logged');
167170
};
168171

@@ -199,8 +202,8 @@
199202
});
200203

201204
function log(msg) {
202-
$('#logger').append('<p>'+msg+'<\/p>')[0].scrollTop = 999999;
203-
};
205+
$('#logger').append('<p>' + msg + '<\/p>')[0].scrollTop = 999999;
206+
}
204207
});
205208
</script>
206209
</head>
@@ -209,9 +212,9 @@ <h1 id="banner">jQuery mousewheel.js Test with jQuery <span id="jqueryVersion"><
209212
<h2 id="userAgent"></h2>
210213

211214
<ul>
212-
<li><strong>Test1</strong> is just using the plain on mousewheel() with a function passed in and does not prevent default. (Also logs the value of pageX and pageY event properties.)</li>
215+
<li><strong>Test1</strong> is just using the plain on <code>mousewheel()</code> with a function passed in and does not prevent default. (Also logs the value of <code>pageX</code> and <code>pageY</code> event properties.)</li>
213216
<li><strong>Test2</strong> should prevent the default action.</li>
214-
<li><strong>Test3</strong> should only log a mouseover and mouseout event. Testing unmousewheel().</li>
217+
<li><strong>Test3</strong> should only log a <code>mouseover</code> and <code>mouseout</code> event. Testing <code>unmousewheel()</code>.</li>
215218
<li><strong>Test4</strong> has two handlers.</li>
216219
<li><strong>Test5</strong> is like Test2 but has children. The children should not scroll until mousing over them.</li>
217220
<li><strong>Test6</strong> is like Test5 but should not scroll children or parents.</li>

0 commit comments

Comments
 (0)