1
0
mirror of https://github.com/lrsjng/h5ai.git synced 2025-03-23 13:59:59 +01:00

Loads qrcode extension on demand now.

This commit is contained in:
Lars Jung 2012-10-13 21:30:41 +02:00
parent 787d37853b
commit 17ad8d0632
5 changed files with 37 additions and 13 deletions

@ -78,15 +78,13 @@ modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/resource',
adjustSize = function () {
var rect = $(window).fracs('viewport'),
var $window = $(window),
$container = $('#pv-txt-content'),
margin = 20,
barheight = 31;
$container.css({
// width: rect.width - 2 * margin,
height: rect.height - 2 * margin - barheight - 32,
// left: margin,
height: $window.height() - 2 * margin - barheight - 32,
top: margin
});
},

@ -10,14 +10,32 @@ modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/eve
$qrcode, hideTimeoutId,
loadQrCodeExtension = function (callback) {
if ($.fn.qrcode) {
callback();
} else {
$.ajax({
url: allsettings.h5aiAbsHref + 'client/js/qrcode.js',
dataType: 'script',
complete: function () {
callback();
}
});
}
},
update = function (entry) {
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
width: settings.size,
height: settings.size,
color: '#333',
text: 'http://' + document.domain + entry.absHref
loadQrCodeExtension(function () {
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
width: settings.size,
height: settings.size,
color: '#333',
text: 'http://' + document.domain + entry.absHref
});
});
},

@ -73,13 +73,15 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
selectionStart = function (event) {
var view = $(document).fracs('viewport');
var $window = $(window),
viewRight = $window.scrollLeft() + $window.width(),
viewBottom = $window.scrollTop() + $window.height();
x = event.pageX;
y = event.pageY;
// only on left button and don't block the scrollbars
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
if (event.button !== 0 || x >= viewRight || y >= viewBottom) {
return;
}

@ -0,0 +1,2 @@
// @include "lib/jquery.qrcode-*.js"

@ -2,7 +2,11 @@
// jQuery libs
// -----------
// @include "lib/jquery-*.js"
// @include "lib/jquery.*.js"
// @include "lib/jquery.filedrop-*.js"
// @include "lib/jquery.fracs-*.js"
// @include "lib/jquery.mousewheel-*.js"
// @include "lib/jquery.scrollpanel-*.js"
// @include "lib/jquery.spin-*.js"
// other libs
// ----------