mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -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
|
@ -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
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue