forked from cubiq/iscroll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matteo Spinelli
committed
May 24, 2013
0 parents
commit 8af643a
Showing
67 changed files
with
11,048 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/build/* | ||
/dist/* | ||
/demos/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Contributing to iScroll | ||
|
||
All contributions are welcome but to enforce the openess of this script I have to ask all contributors to sign a Contributor License Agreement. I'm sorry about this but it's the only way to keep the script free and Open Source. | ||
|
||
If you are an individual, please sign the following form: | ||
http://cubiq.org/iscroll/cla/individual.html | ||
|
||
If you are a company or an entity please sing the following form: | ||
http://cubiq.org/iscroll/cla/individual.html | ||
|
||
Thanks! | ||
Matteo Spinelli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2008-2013 Matteo Spinelli, http://cubiq.org/ | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# iScroll 5 beta 1 | ||
|
||
Documentation soon to come. In the meantime please reference to the examples in the demos directory. | ||
|
||
## Build system (for developers only) | ||
|
||
iScroll comes with a custom build system. The required nodejs packages are included in the package.json. To build all main releases just do: | ||
|
||
./build.js dist | ||
|
||
The compiled scripts will be saved in the /build and /dist directories. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#!/usr/bin/env node | ||
|
||
var pkg = require('./package.json'); | ||
var fs = require('fs'); | ||
var hint = require("jshint").JSHINT; | ||
var uglify = require('uglify-js'); | ||
|
||
var banner = '/*! iScroll v' + pkg.version + ' ~ (c) 2008-' + (new Date().getFullYear()) + ' Matteo Spinelli ~ http://cubiq.org/license */\n'; | ||
|
||
var releases = { | ||
// Main releases | ||
lite: { | ||
files: ['default/_animate.js', 'default/handleEvent.js'] | ||
}, | ||
|
||
iscroll: { | ||
files: [ | ||
'indicator/_initIndicators.js', | ||
'wheel/wheel.js', | ||
'snap/snap.js', | ||
'keys/keys.js', | ||
'default/_animate.js', | ||
'default/handleEvent.js', | ||
'indicator/indicator.js' | ||
], | ||
postProcessing: [ 'indicator/build.json', 'wheel/build.json', 'snap/build.json', 'keys/build.json' ] | ||
}, | ||
|
||
probe: { | ||
files: [ | ||
'indicator/_initIndicators.js', | ||
'wheel/wheel.js', | ||
'snap/snap.js', | ||
'keys/keys.js', | ||
'probe/_animate.js', | ||
'default/handleEvent.js', | ||
'indicator/indicator.js' | ||
], | ||
postProcessing: [ 'indicator/build.json', 'wheel/build.json', 'snap/build.json', 'keys/build.json', 'probe/build.json' ] | ||
}, | ||
|
||
zoom: { | ||
files: [ | ||
'indicator/_initIndicators.js', | ||
'zoom/zoom.js', | ||
'wheel/wheel.js', | ||
'snap/snap.js', | ||
'keys/keys.js', | ||
'default/_animate.js', | ||
'zoom/handleEvent.js', | ||
'indicator/indicator.js' | ||
], | ||
postProcessing: [ 'zoom/build.json', 'indicator/build.json', 'wheel/build.json', 'snap/build.json', 'keys/build.json' ] | ||
} | ||
|
||
// Additional releases TBD | ||
}; | ||
|
||
var args = process.argv.slice(2); | ||
|
||
if ( !args.length ) { | ||
args = ['iscroll']; | ||
} | ||
|
||
if ( args[0] == 'dist' ) { | ||
args = ['lite', 'iscroll', 'zoom', 'probe']; | ||
} | ||
|
||
// Get the list of files | ||
args.forEach(function (release) { | ||
if ( !(release in releases) ) { | ||
console.log('Unrecognized release: ' + release); | ||
return; | ||
} | ||
|
||
console.log('Building release: ' + release); | ||
build(release); | ||
}); | ||
|
||
function build (release) { | ||
var out = ''; | ||
var value = ''; | ||
|
||
var fileList = ['open.js', 'utils.js', 'core.js']; | ||
|
||
fileList = fileList.concat(releases[release].files); | ||
|
||
fileList.push('close.js'); | ||
|
||
// Concatenate files | ||
out = banner + fileList.map(function (filePath) { | ||
return fs.readFileSync('src/' + filePath, 'utf-8'); | ||
}).join(''); | ||
|
||
// Update version | ||
out = out.replace('/* VERSION */', pkg.version); | ||
|
||
// Post processing | ||
if ( releases[release].postProcessing ) { | ||
releases[release].postProcessing.forEach(function (file) { | ||
var postProcessing = require('./src/' + file); | ||
|
||
// Insert point | ||
for ( var i in postProcessing.insert ) { | ||
value = postProcessing.insert[i].substr(postProcessing.insert[i].length-3) == '.js' ? | ||
fs.readFileSync('src/' + postProcessing.insert[i]) : | ||
postProcessing.insert[i]; | ||
|
||
out = out.replace('// INSERT POINT: ' + i, value + '\n\n// INSERT POINT: ' + i ); | ||
} | ||
|
||
// Replace | ||
for ( i in postProcessing.replace ) { | ||
value = postProcessing.replace[i].substr(postProcessing.replace[i].length-3) == '.js' ? | ||
fs.readFileSync('src/' + postProcessing.replace[i]) : | ||
postProcessing.replace[i]; | ||
|
||
var regex = new RegExp('\\/\\* REPLACE START: ' + i + ' \\*\\/[\\s\\S]*\\/\\* REPLACE END: ' + i + ' \\*\\/'); | ||
out = out.replace(regex, '/* REPLACE START: ' + i + ' */' + value + '/* REPLACE END: ' + i + ' */'); | ||
} | ||
}); | ||
} | ||
|
||
// Write build file | ||
var buildFile = './build/iscroll' + (release != 'iscroll' ? '-' + release : '') + '.js'; | ||
fs.writeFileSync(buildFile, out); | ||
|
||
// JSHint | ||
if ( !hint(out) ) { | ||
var lines = out.split('\n'); | ||
hint.errors.forEach(function (err) { | ||
console.log('\033[31m[' + err.code + ']\033[0m ' + err.line + ':' + err.character + '\t- ' + err.reason); | ||
console.log('\033[33m' + lines[err.line-1].replace(/\t/g, ' ') + '\033[0m\n'); | ||
}); | ||
|
||
process.exit(); | ||
} | ||
|
||
// Write dist file | ||
var distFile = buildFile.replace('/build/', '/dist/').replace('.js', '-min.js'); | ||
out = uglify.minify(out, { fromString: true }); | ||
fs.writeFileSync(distFile, banner + out.code); | ||
} |
Oops, something went wrong.