mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Updates jQuery.qrcode to 0.2 and jQuery.scrollpanel to 0.1.
This commit is contained in:
parent
76e89820eb
commit
9266be9708
6 changed files with 23 additions and 1775 deletions
|
@ -19,8 +19,10 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
|
||||||
* [Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-173323228) (GPL)
|
* [Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-173323228) (GPL)
|
||||||
* [HTML5 ★ Boilerplate](http://html5boilerplate.com)
|
* [HTML5 ★ Boilerplate](http://html5boilerplate.com)
|
||||||
* [jQuery](http://jquery.com) (MIT/GPL)
|
* [jQuery](http://jquery.com) (MIT/GPL)
|
||||||
* [jQuery.fracs](http://larsjung.de/fracs) (MIT)
|
* [jQuery.fracs](http://larsjung.de/fracs/) (MIT)
|
||||||
* [jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) (MIT)
|
* [jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) (MIT)
|
||||||
|
* [jQuery.qrcode](http://larsjung.de/qrcode/) (MIT)
|
||||||
|
* [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) (MIT)
|
||||||
* [modernizr](http://www.modernizr.com) (MIT/BSD)
|
* [modernizr](http://www.modernizr.com) (MIT/BSD)
|
||||||
* [Moment.js](http://momentjs.com) (MIT)
|
* [Moment.js](http://momentjs.com) (MIT)
|
||||||
* [qrcode](http://www.d-project.com/qrcode/index.html) (MIT)
|
* [qrcode](http://www.d-project.com/qrcode/index.html) (MIT)
|
||||||
|
@ -33,6 +35,8 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h
|
||||||
### v0.21 - *2012-??*
|
### v0.21 - *2012-??*
|
||||||
|
|
||||||
* adds `hu` translation by [Rodolffo](http://github.com/Rodolffo)
|
* adds `hu` translation by [Rodolffo](http://github.com/Rodolffo)
|
||||||
|
* updates to [jQuery.qrcode](http://larsjung.de/qrcode/) 0.2
|
||||||
|
* updates to [jQuery.scrollpanel](http://larsjung.de/scrollpanel/) 0.1
|
||||||
|
|
||||||
|
|
||||||
### v0.20 - *2012-05-11*
|
### v0.20 - *2012-05-11*
|
||||||
|
|
|
@ -193,27 +193,33 @@ module.define('ext/tree', [jQuery, 'core/settings', 'core/resource', 'core/event
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $tree = $('<div id="tree" />').appendTo('body');
|
var $tree = $('<div id="tree" />')
|
||||||
|
.appendTo('body')
|
||||||
|
.scrollpanel()
|
||||||
|
.on('click', '.indicator', createOnIndicatorClick(parser))
|
||||||
|
.on('mouseenter', function () {
|
||||||
|
|
||||||
|
shiftTree(true);
|
||||||
|
})
|
||||||
|
.on('mouseleave', function () {
|
||||||
|
|
||||||
|
shiftTree();
|
||||||
|
});
|
||||||
|
|
||||||
fetchTree(entry, parser, function (root) {
|
fetchTree(entry, parser, function (root) {
|
||||||
|
|
||||||
$tree
|
$tree
|
||||||
.append(update(root))
|
.find('.sp-container').append(update(root)).end()
|
||||||
.scrollpanel()
|
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
adjustSpacing();
|
adjustSpacing();
|
||||||
shiftTree(false, true);
|
shiftTree(false, true);
|
||||||
$tree.scrollpanel('update');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$tree
|
|
||||||
.on('click', '.indicator', createOnIndicatorClick(parser))
|
|
||||||
.on('mouseenter', function () { shiftTree(true); })
|
|
||||||
.on('mouseleave', function () { shiftTree(); });
|
|
||||||
|
|
||||||
event.sub('ready', adjustSpacing);
|
event.sub('ready', adjustSpacing);
|
||||||
|
|
||||||
$(window).on('resize', function () {
|
$(window).on('resize', function () {
|
||||||
|
|
||||||
adjustSpacing();
|
adjustSpacing();
|
||||||
shiftTree();
|
shiftTree();
|
||||||
});
|
});
|
||||||
|
|
2
src/_h5ai/js/inc/lib/jquery.qrcode-0.2.min.js
vendored
Normal file
2
src/_h5ai/js/inc/lib/jquery.qrcode-0.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,130 +0,0 @@
|
||||||
/*!
|
|
||||||
* jQuery.qrcode
|
|
||||||
* author: Lars Jung
|
|
||||||
* license: MIT
|
|
||||||
*
|
|
||||||
* kudos to http://github.com/jeromeetienne/jquery-qrcode
|
|
||||||
*/
|
|
||||||
(function ($) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// @include "qrcode.js"
|
|
||||||
|
|
||||||
var createQr = function (typeNumber, correctLevel, text) {
|
|
||||||
|
|
||||||
var qr = new qrcode(typeNumber, correctLevel);
|
|
||||||
qr.addData(text);
|
|
||||||
qr.make();
|
|
||||||
|
|
||||||
return qr;
|
|
||||||
},
|
|
||||||
createBestQr = function (text) {
|
|
||||||
|
|
||||||
for (var type = 2; type <= 10; type += 1) {
|
|
||||||
try {
|
|
||||||
return createQr(type, 'L', text);
|
|
||||||
} catch (err) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
createCanvas = function (settings) {
|
|
||||||
|
|
||||||
var qr = createBestQr(settings.text),
|
|
||||||
$canvas = $('<canvas/>').attr('width', settings.width).attr('height', settings.height),
|
|
||||||
ctx = $canvas[0].getContext('2d');
|
|
||||||
|
|
||||||
if (settings.bgColor) {
|
|
||||||
ctx.fillStyle = settings.bgColor;
|
|
||||||
ctx.fillRect(0, 0, settings.width, settings.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qr) {
|
|
||||||
var moduleCount = qr.getModuleCount(),
|
|
||||||
moduleWidth = settings.width / moduleCount,
|
|
||||||
moduleHeight = settings.height / moduleCount,
|
|
||||||
row, col;
|
|
||||||
|
|
||||||
ctx.beginPath();
|
|
||||||
for (row = 0; row < moduleCount; row += 1) {
|
|
||||||
for (col = 0; col < moduleCount; col += 1) {
|
|
||||||
if (qr.isDark(row, col)) {
|
|
||||||
ctx.rect(col * moduleWidth, row * moduleHeight, moduleWidth, moduleHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.fillStyle = settings.color;
|
|
||||||
ctx.fill();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $canvas;
|
|
||||||
},
|
|
||||||
createDiv = function (settings) {
|
|
||||||
|
|
||||||
var qr = createBestQr(settings.text),
|
|
||||||
$div = $('<div/>').css({
|
|
||||||
position: 'relative',
|
|
||||||
left: 0,
|
|
||||||
top: 0,
|
|
||||||
padding: 0,
|
|
||||||
margin: 0,
|
|
||||||
width: settings.width,
|
|
||||||
height: settings.height
|
|
||||||
});
|
|
||||||
|
|
||||||
if (settings.bgColor) {
|
|
||||||
$div.css('background-color', settings.bgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qr) {
|
|
||||||
var moduleCount = qr.getModuleCount(),
|
|
||||||
moduleWidth = Math.floor(settings.width / moduleCount),
|
|
||||||
moduleHeight = Math.floor(settings.height / moduleCount),
|
|
||||||
offsetLeft = Math.floor(0.5 * (settings.width - moduleWidth * moduleCount)),
|
|
||||||
offsetTop = Math.floor(0.5 * (settings.height - moduleHeight * moduleCount)),
|
|
||||||
row, col;
|
|
||||||
|
|
||||||
for (row = 0; row < moduleCount; row++) {
|
|
||||||
for (col = 0; col < moduleCount; col++) {
|
|
||||||
if (qr.isDark(row, col)) {
|
|
||||||
$('<div/>')
|
|
||||||
.css({
|
|
||||||
left: offsetLeft + col * moduleWidth,
|
|
||||||
top: offsetTop + row * moduleHeight
|
|
||||||
})
|
|
||||||
.appendTo($div);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$div.children()
|
|
||||||
.css({
|
|
||||||
position: 'absolute',
|
|
||||||
padding: 0,
|
|
||||||
margin: 0,
|
|
||||||
width: moduleWidth,
|
|
||||||
height: moduleHeight,
|
|
||||||
'background-color': settings.color
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return $div;
|
|
||||||
},
|
|
||||||
|
|
||||||
defaults = {
|
|
||||||
render: 'canvas',
|
|
||||||
width: 256,
|
|
||||||
height: 256,
|
|
||||||
color: '#000',
|
|
||||||
bgColor: null,
|
|
||||||
text: 'no text'
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.qrcode = function(options) {
|
|
||||||
|
|
||||||
var settings = $.extend({}, defaults, options);
|
|
||||||
|
|
||||||
$(this).append(settings.render === 'canvas' ? createCanvas(settings) : createDiv(settings));
|
|
||||||
};
|
|
||||||
|
|
||||||
}(jQuery));
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
||||||
// @include "inc/lib/jquery-1.7.2.min.js"
|
// @include "inc/lib/jquery-1.7.2.min.js"
|
||||||
// @include "inc/lib/jquery.fracs-0.11.min.js"
|
// @include "inc/lib/jquery.fracs-0.11.min.js"
|
||||||
// @include "inc/lib/jquery.mousewheel-3.0.6.js"
|
// @include "inc/lib/jquery.mousewheel-3.0.6.js"
|
||||||
// @include "inc/lib/jquery.qrcode.js"
|
// @include "inc/lib/jquery.qrcode-0.2.min.js"
|
||||||
// @include "inc/lib/jquery.scrollpanel-0.1.min.js"
|
// @include "inc/lib/jquery.scrollpanel-0.1.min.js"
|
||||||
|
|
||||||
// underscore libs
|
// underscore libs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue