Skip to content

Commit

Permalink
initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngryman committed Jan 22, 2013
1 parent ab1a3ed commit 4dcb9c5
Show file tree
Hide file tree
Showing 16 changed files with 11,752 additions and 3 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing

## Important notes
Please don't edit files in the `dist` subdirectory as they are generated via grunt. You'll find source code in the `src` subdirectory!

### Code style
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**

### PhantomJS
While grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers.

See the [Why does grunt complain that PhantomJS isn't installed?](https://github.com/gruntjs/grunt/blob/master/docs/faq.md#why-does-grunt-complain-that-phantomjs-isnt-installed) guide in the [Grunt FAQ](https://github.com/gruntjs/grunt/blob/master/docs/faq.md) for help with installing or troubleshooting PhantomJS.

## Modifying the code
First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed.

Test that grunt is installed globally by running `grunt --version` at the command-line. If grunt isn't installed globally, run `npm install -g grunt` to install the latest version. _You may need to run `sudo npm install -g grunt`._

_Note that in Windows, you may have to run `grunt.cmd` instead of `grunt`._

1. Fork and clone the repo.
1. Run `npm install` to install all dependencies (including grunt).
1. Run `grunt` to grunt this project.

Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken.

## Submitting pull requests

1. Create a new branch, please don't work in your `master` branch directly.
1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail.
1. Fix stuff.
1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done.
1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere.
1. Update the documentation to reflect any changes.
1. Push to your fork and submit a pull request.
22 changes: 22 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2013 ngryman

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
jquery.finger
=============
# jQuery Finger

jQuery touch & gestures, fingers in the nose.
jQuery touch gestures, fingers in the nose.

## Getting Started
Download the [production version][min] or the [development version][max].

[min]: https://raw.github.com/ngryman/jquery.finger/master/dist/jquery.finger.min.js
[max]: https://raw.github.com/ngryman/jquery.finger/master/dist/jquery.finger.js

In your web page:

```html
<script src="jquery.js"></script>
<script src="dist/jquery.finger.min.js"></script>
<script>
jQuery(function($) {
$.awesome(); // "awesome"
});
</script>
```

## Documentation
_(Coming soon)_

## Examples
_(Coming soon)_

## Release History
_(Nothing yet)_
45 changes: 45 additions & 0 deletions dist/jquery.finger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*! jQuery Finger - v0.1.0 - 2013-01-21
* https://github.com/ngryman/jquery.finger
* Copyright (c) 2013 ngryman; Licensed MIT */

(function($) {

var hasTouch = 'ontouchstart' in window,
startEvent = hasTouch ? 'touchstart' : 'mousedown',
stopEvent = hasTouch ? 'touchend touchcancel' : 'mouseup',
moveEvent = hasTouch ? 'touchmove' : 'touchmove';

$.event.special.tap = (function() {
return {
add: function(handleObj) {
var events = $._data(this, 'events');
events.tap.push(handleObj.handler);

$.event.add(this, startEvent, startHandler, null, handleObj.selector);
}
}

function startHandler() {
$.event.add(this, moveEvent, moveHandler);
$.event.add(this, stopEvent, stopHandler);
}

function moveHandler() {
var events = $._data(this, 'events');
$.event.remove(this, stopEvent, stopHandler);
}

function stopHandler() {
var tapEvts = $._data(this, 'events').tap,
handler;

for (var i = 0, len = tapEvts.length; i < len; i++) {
handler = tapEvts[i];
if ($.isFunction(handler)) {
handler.apply(this, arguments);
}
}
}
})();

})(jQuery);
4 changes: 4 additions & 0 deletions dist/jquery.finger.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions grunt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*global module:false*/
module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: '<json:jquery.finger.jquery.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat: {
dist: {
src: ['<banner:meta.banner>', '<file_strip_banner:src/<%= pkg.name %>.js>'],
dest: 'dist/<%= pkg.name %>.js'
}
},
min: {
dist: {
src: ['<banner:meta.banner>', '<config:concat.dist.dest>'],
dest: 'dist/<%= pkg.name %>.min.js'
}
},
qunit: {
files: ['test/**/*.html']
},
lint: {
files: ['grunt.js', 'src/**/*.js', 'test/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint qunit'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
jQuery: true
}
},
uglify: {}
});

// Default task.
grunt.registerTask('default', 'lint qunit concat min');
grunt.registerTask("run", "server watch");
};
28 changes: 28 additions & 0 deletions jquery.finger.jquery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "jquery.finger",
"title": "jQuery Finger",
"description": "jQuery touch gestures, fingers in the nose.",
"version": "0.1.0",
"homepage": "https://github.com/ngryman/jquery.finger",
"author": {
"name": "ngryman",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "git://github.com/ngryman/jquery.finger.git"
},
"bugs": {
"url": "https://github.com/ngryman/jquery.finger/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/ngryman/jquery.finger/blob/master/LICENSE-MIT"
}
],
"dependencies": {
"jquery": "*"
},
"keywords": []
}
14 changes: 14 additions & 0 deletions libs/jquery-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function() {
// Get any jquery=___ param from the query string.
var jqversion = location.search.match(/[?&]jquery=(.*?)(?=&|$)/);
var path;
if (jqversion) {
// A version was specified, load that version from code.jquery.com.
path = 'http://code.jquery.com/jquery-' + jqversion[1] + '.js';
} else {
// No version was specified, load the local version.
path = '../libs/jquery/jquery.js';
}
// This is the only time I'll ever use document.write, I promise!
document.write('<script src="' + path + '"></script>');
}());
Loading

0 comments on commit 4dcb9c5

Please sign in to comment.