Updates demo.

pull/18/head
Lars Jung 12 years ago
parent 974002f950
commit ceac699d47

@ -15,6 +15,7 @@ Uses [QR Code Generator](http://www.d-project.com/qrcode/index.html) (MIT). Kudo
* some fixes
* adds image support for fore- and background
* adds label and image positioning
* updates build process

@ -2,152 +2,111 @@
'use strict';
var path = require('path'),
child_process = require('child_process');
var pkg = require('./package.json'),
root = path.resolve(__dirname),
src = path.resolve(root, 'src'),
build = path.resolve(root, 'build'),
jshint = {
// Enforcing Options
bitwise: true,
curly: true,
eqeqeq: true,
forin: true,
latedef: true,
newcap: true,
noempty: true,
plusplus: true,
trailing: true,
undef: true,
// Environments
browser: true,
// Globals
predef: [
"jQuery", "qrcode"
]
},
mapperSrc = function (blob) {
return blob.source.replace(src, build);
},
mapperRoot = function (blob) {
return blob.source.replace(root, build);
};
module.exports = function (make) {
module.exports = function (make) {
var path = require('path'),
pkg = require('./package.json'),
var Event = make.Event,
$ = make.fQuery,
moment = make.moment,
stamp, replacements;
root = path.resolve(__dirname),
src = path.join(root, 'src'),
build = path.join(root, 'build');
make.version('>=0.8.1');
make.version('>=0.10.0');
make.defaults('release');
make.before(function () {
stamp = moment();
var moment = make.moment();
replacements = {
make.env = {
pkg: pkg,
stamp: stamp.format('YYYY-MM-DD HH:mm:ss')
stamp: moment.format('YYYY-MM-DD HH:mm:ss')
};
Event.info({ method: 'before', message: pkg.version + ' ' + replacements.stamp });
$.info({ method: 'before', message: pkg.version + ' ' + make.env.stamp });
});
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
if (!/-dev$/.test(pkg.version)) {
if (!/\+$/.test(pkg.version)) {
done();
return;
}
$.git(root, function (err, result) {
pkg.version += '-' + result.revListOriginMasterHead.length + '-' + result.revParseHead.slice(0, 7);
Event.info({
method: 'check-version',
message: 'version set to ' + pkg.version
});
pkg.version += result.buildSuffix;
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
done();
});
});
make.target('clean', [], 'delete build folder')
.sync(function () {
make.target('clean', [], 'delete build folder').sync(function () {
$.rmfr($.I_AM_SURE, build);
$.DELETE(build);
});
make.target('lint', [], 'lint all JavaScript files with JSHint')
.sync(function () {
make.target('lint', [], 'lint all JavaScript files with JSHint').sync(function () {
$(src + ': jquery.qrcode.js')
.jshint(jshint);
});
var options = {
// Enforcing Options
bitwise: true,
curly: true,
eqeqeq: true,
forin: true,
latedef: true,
newcap: true,
noempty: true,
plusplus: true,
trailing: true,
undef: true,
// Environments
browser: true
},
global = {
'jQuery': true,
'qrcode': true
};
make.target('build', ['check-version'], 'build all updated files')
.sync(function () {
$(src + ': jquery.qrcode.js, demo/scripts.js').log(-3)
.jshint(options, global);
});
var scriptName = pkg.name;
$(src + '/demo/*')
.handlebars(replacements)
.write($.OVERWRITE, mapperSrc);
make.target('build', ['check-version'], 'build all updated files').sync(function () {
$(src + ': ' + scriptName + '.js')
$(src + ': jquery.qrcode.js')
.includify()
.handlebars(replacements)
.write($.OVERWRITE, path.join(build, scriptName + '-' + pkg.version + '.js'))
.write($.OVERWRITE, path.join(build, 'demo', scriptName + '.js'))
.handlebars(make.env)
.WRITE($.map.p(src, build).s('.js', '-' + pkg.version + '.js'))
.uglifyjs()
.write($.OVERWRITE, path.join(build, scriptName + '-' + pkg.version + '.min.js'));
.WRITE($.map.p(src, build).s('.js', '-' + pkg.version + '.min.js'));
$(src + ': **, ! *.js')
.handlebars(make.env)
.WRITE($.map.p(src, build));
$(root + ': README*, LICENSE*')
.write($.OVERWRITE, mapperRoot);
.handlebars(make.env)
.WRITE($.map.p(root, build));
});
make.target('release', ['clean', 'build'], 'create a zipball')
.async(function (done, fail) {
var target = path.join(build, pkg.name + '-' + pkg.version + '.zip'),
cmd = 'zip',
args = ['-ro', target, '.'],
options = { cwd: build },
proc = child_process.spawn(cmd, args, options);
Event.info({ method: 'exec', message: cmd + ' ' + args.join(' ') });
make.target('release', ['clean', 'build'], 'create a zipball').async(function (done, fail) {
proc.stderr.on('data', function (data) {
process.stderr.write(data);
});
proc.on('exit', function (code) {
if (code) {
Event.error({ method: 'exec', message: cmd + ' exit code ' + code });
fail();
} else {
Event.ok({ method: 'exec', message: 'created zipball ' + target });
done();
}
$(build + ': **').shzip({
target: path.join(build, pkg.name + '-' + pkg.version + '.zip'),
dir: build,
callback: done
});
});
};

@ -1,5 +1,13 @@
{
"name": "jquery.qrcode",
"displayName": "jQuery.qrcode",
"version": "0.6.0-dev"
"version": "0.6.0+",
"description": "generate QR codes dynamically",
"url": "http://larsjung.de/qrcode/",
"author": "Lars Jung",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/lrsjng/jQuery.qrcode.git"
}
}

@ -15,7 +15,7 @@
<link href='http://fonts.googleapis.com/css?family=Ubuntu:400,700' rel='stylesheet'>
<link href='styles.css' rel='stylesheet'>
<script src="jquery-1.10.2.js"></script>
<script src="jquery.qrcode.js"></script>
<script src="../jquery.qrcode-{{pkg.version}}.js"></script>
<script src="ff-range.js"></script>
<script src="scripts.js"></script>
</head>

@ -1,5 +1,8 @@
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]',
(function ($) {
'use strict';
var isOpera = Object.prototype.toString.call(window.opera) === '[object Opera]',
guiValuePairs = [
["size", "px"],
@ -13,13 +16,12 @@ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]',
updateGui = function () {
for (var idx in guiValuePairs) {
$.each(guiValuePairs, function (idx, pair) {
var pair = guiValuePairs[idx],
$label = $('label[for="' + pair[0] + '"]');
var $label = $('label[for="' + pair[0] + '"]');
$label.text($label.text().replace(/:.*/, ': ' + $('#' + pair[0]).val() + pair[1]));
}
});
},
updateQrCode = function () {
@ -97,3 +99,5 @@ $(function () {
$(window).load(update);
update();
});
}(jQuery));

@ -101,10 +101,7 @@ input, textarea, select {
input[type="range"] {
-webkit-appearance: none;
/* height: 8px;
margin-top: 4px;
margin-bottom: 4px;
*/ cursor: pointer;
cursor: pointer;
}
input::-webkit-slider-thumb {
-webkit-appearance: none;

Loading…
Cancel
Save