Merge pull request #80 from XhmikosR/master

Minor improvements
This commit is contained in:
Brandon Aaron
2013-11-18 07:34:29 -08:00
7 changed files with 62 additions and 60 deletions
-2
View File
@@ -7,13 +7,11 @@
"indent": 4,
"jquery" : true,
"latedef": true,
"maxerr": 50,
"noarg": true,
"node": true,
"noempty": true,
"plusplus": false,
"quotmark": "single",
"regexp": true,
"strict": false,
"trailing": true,
"unused": true,
+10 -10
View File
@@ -2,23 +2,23 @@
## 3.1.6
* Deprecating delta, deltaX, and deltaY event handler arguments
* Update actual event object with normalized deltaX and deltaY values (event.deltaX, event.deltaY)
* Add deltaFactor to the event object (event.deltaFactor)
* Handle > 0 but < 1 deltas better
* Do not fire the event if deltaX and deltaY are 0
* Better handle different devices that give different lowestDelta values
* Add $.event.special.mousewheel.version
* Deprecating `delta`, `deltaX`, and `deltaY` event handler arguments
* Update actual event object with normalized `deltaX `and `deltaY` values (`event.deltaX`, `event.deltaY`)
* Add `deltaFactor` to the event object (`event.deltaFactor`)
* Handle `> 0` but `< 1` deltas better
* Do not fire the event if `deltaX` and `deltaY` are `0`
* Better handle different devices that give different `lowestDelta` values
* Add `$.event.special.mousewheel.version`
* Some clean up
## 3.1.5
* Bad release because I did not update the new $.event.special.mousewheel.version
* Bad release because I did not update the new `$.event.special.mousewheel.version`
## 3.1.4
* Always set the deltaY
* Add back in the deltaX and deltaY support for older Firefox versions
* Always set the `deltaY`
* Add back in the `deltaX` and `deltaY` support for older Firefox versions
## 3.1.3
+11 -11
View File
@@ -21,18 +21,18 @@ module.exports = function(grunt) {
}
},
connect: {
server: {
options: {
hostname: '*',
keepalive: true,
middleware: function(connect, options) {
return [
connect.static(options.base),
connect.directory(options.base)
];
}
server: {
options: {
hostname: '*',
keepalive: true,
middleware: function(connect, options) {
return [
connect.static(options.base),
connect.directory(options.base)
];
}
}
}
}
}
});
+5 -5
View File
@@ -3,12 +3,12 @@
"version": "3.1.6",
"main": "./jquery.mousewheel.js",
"ignore": [
".*",
"*.txt",
"*.markdown",
"*.json",
"test",
"Gruntfile.js"
"*.markdown",
"*.txt",
".*",
"Gruntfile.js",
"test"
],
"dependencies": {
"jquery": ">=1.2.2"
+6 -6
View File
@@ -93,12 +93,12 @@
// New school wheel delta (wheel event)
if ( 'deltaY' in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( 'deltaX' in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
}
// No change actually happened, no reason to go any further
@@ -107,7 +107,7 @@
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
if ( !lowestDelta || absDelta < lowestDelta ) {
lowestDelta = absDelta;
lowestDelta = absDelta;
}
// Get a whole, normalized value for the deltas
@@ -134,7 +134,7 @@
}
function nullLowestDelta() {
lowestDelta = null;
lowestDelta = null;
}
}));
+9 -8
View File
@@ -3,6 +3,8 @@
"version": "3.1.6",
"author": "Brandon Aaron <brandon.aaron@gmail.com> (http://brandonaaron.net/)",
"description": "A jQuery plugin that adds cross-browser mouse wheel support.",
"license": "MIT",
"homepage": "https://github.com/brandonaaron/jquery-mousewheel",
"main": "./jquery.mousewheel.js",
"repository": {
"type": "git",
@@ -20,17 +22,16 @@
"plugin",
"browser"
],
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
}
"files": [
"ChangeLog.md",
"jquery.mousewheel.js",
"README.md"
],
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-connect": "~0.5.0"
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.7"
},
"directories": {
"test": "test"
+21 -18
View File
@@ -5,24 +5,29 @@
<title>Testing mousewheel plugin</title>
<script>
(function(){
var verMatch = /v=([\w\.]+)/.exec( location.search ),
version = verMatch && verMatch[1], src;
if ( version ) {
src = 'code.jquery.com/jquery-' + version;
} else {
src = 'code.jquery.com/jquery-git';
}
document.write( '<script src="http://' + src + '.js"><\/script>' );
(function() {
var verMatch = /v=([\w\.]+)/.exec(location.search),
version = verMatch && verMatch[1],
src;
if (version)
src = 'code.jquery.com/jquery-' + version;
else
src = 'code.jquery.com/jquery-git';
document.write('<script src="http://' + src + '.js"><\/script>');
})();
</script>
<script src="../jquery.mousewheel.js"></script>
<style>
html {
font: 13px Arial, sans-serif;
}
#stage {
position: relative;
zoom: 1;
}
#test1 {
background-color: #000;
width: 120px;
@@ -98,15 +103,13 @@
}
#logger p {
font-family: Arial, sans-serif;
font-size: 13px;
padding: 2px;
border-bottom: 1px solid #ccc;
margin: 0;
}
#logger p:nth-child(even) {
background-color: #FFFFE8;
background-color: #ffffe8;
}
#logger p:nth-child(10n) {
@@ -157,12 +160,12 @@
$('#test3')
.hover(function() { log('#test3: mouseover'); }, function() { log('#test3: mouseout'); })
.mousewheel(function(event, delta, deltaX, deltaY) {
.mousewheel(function() {
log('#test3: I should not have been logged');
})
.unmousewheel();
var testRemoval = function(event, delta, deltaX, deltaY) {
var testRemoval = function() {
log('#test4: I should not have been logged');
};
@@ -199,8 +202,8 @@
});
function log(msg) {
$('#logger').append('<p>'+msg+'<\/p>')[0].scrollTop = 999999;
};
$('#logger').append('<p>' + msg + '<\/p>')[0].scrollTop = 999999;
}
});
</script>
</head>
@@ -209,9 +212,9 @@
<h2 id="userAgent"></h2>
<ul>
<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>
<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>
<li><strong>Test2</strong> should prevent the default action.</li>
<li><strong>Test3</strong> should only log a mouseover and mouseout event. Testing unmousewheel().</li>
<li><strong>Test3</strong> should only log a <code>mouseover</code> and <code>mouseout</code> event. Testing <code>unmousewheel()</code>.</li>
<li><strong>Test4</strong> has two handlers.</li>
<li><strong>Test5</strong> is like Test2 but has children. The children should not scroll until mousing over them.</li>
<li><strong>Test6</strong> is like Test5 but should not scroll children or parents.</li>