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:
parent
787d37853b
commit
17ad8d0632
src/_h5ai/client/js
@ -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;
|
||||
}
|
||||
|
||||
|
2
src/_h5ai/client/js/qrcode.js
Normal file
2
src/_h5ai/client/js/qrcode.js
Normal file
@ -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
|
||||
// ----------
|
||||
|
Loading…
x
Reference in New Issue
Block a user