mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 22:16:00 -04:00
Loads qrcode extension on demand now.
This commit is contained in:
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 () {
|
adjustSize = function () {
|
||||||
|
|
||||||
var rect = $(window).fracs('viewport'),
|
var $window = $(window),
|
||||||
$container = $('#pv-txt-content'),
|
$container = $('#pv-txt-content'),
|
||||||
margin = 20,
|
margin = 20,
|
||||||
barheight = 31;
|
barheight = 31;
|
||||||
|
|
||||||
$container.css({
|
$container.css({
|
||||||
// width: rect.width - 2 * margin,
|
height: $window.height() - 2 * margin - barheight - 32,
|
||||||
height: rect.height - 2 * margin - barheight - 32,
|
|
||||||
// left: margin,
|
|
||||||
top: margin
|
top: margin
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,14 +10,32 @@ modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/eve
|
||||||
|
|
||||||
$qrcode, hideTimeoutId,
|
$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) {
|
update = function (entry) {
|
||||||
|
|
||||||
$qrcode.empty().qrcode({
|
loadQrCodeExtension(function () {
|
||||||
render: modernizr.canvas ? 'canvas' : 'div',
|
$qrcode.empty().qrcode({
|
||||||
width: settings.size,
|
render: modernizr.canvas ? 'canvas' : 'div',
|
||||||
height: settings.size,
|
width: settings.size,
|
||||||
color: '#333',
|
height: settings.size,
|
||||||
text: 'http://' + document.domain + entry.absHref
|
color: '#333',
|
||||||
|
text: 'http://' + document.domain + entry.absHref
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,15 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
|
||||||
|
|
||||||
selectionStart = function (event) {
|
selectionStart = function (event) {
|
||||||
|
|
||||||
var view = $(document).fracs('viewport');
|
var $window = $(window),
|
||||||
|
viewRight = $window.scrollLeft() + $window.width(),
|
||||||
|
viewBottom = $window.scrollTop() + $window.height();
|
||||||
|
|
||||||
x = event.pageX;
|
x = event.pageX;
|
||||||
y = event.pageY;
|
y = event.pageY;
|
||||||
|
|
||||||
// only on left button and don't block the scrollbars
|
// 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;
|
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
|
// jQuery libs
|
||||||
// -----------
|
// -----------
|
||||||
// @include "lib/jquery-*.js"
|
// @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
|
// other libs
|
||||||
// ----------
|
// ----------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue