mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-07-31 10:30:15 +02:00
Add info options.
This commit is contained in:
@@ -45,11 +45,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.qrcode {
|
.qrcode {
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
border: 1px solid @col-border;
|
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
display: block;
|
display: block;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resource', 'core/store', 'core/event', 'core/format'], function (_, $, modernizr, allsettings, resource, store, event, format) {
|
modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resource', 'core/store', 'core/event', 'core/format'], function (_, $, modernizr, allsettings, resource, store, event, format) {
|
||||||
|
|
||||||
var settings = _.extend({
|
var settings = _.extend({
|
||||||
enabled: false
|
enabled: false,
|
||||||
|
qrcode: true,
|
||||||
|
qrColor: "#999"
|
||||||
}, allsettings.info);
|
}, allsettings.info);
|
||||||
var template =
|
var template =
|
||||||
'<div id="info">' +
|
'<div id="info">' +
|
||||||
@@ -64,15 +66,17 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
|
|||||||
$size.append(' - ' + stats.folders + ' - ' + stats.files);
|
$size.append(' - ' + stats.folders + ' - ' + stats.files);
|
||||||
}
|
}
|
||||||
|
|
||||||
$qrcode.empty().qrcode({
|
if (settings.qrcode) {
|
||||||
render: modernizr.canvas ? 'canvas' : 'div',
|
$qrcode.empty().qrcode({
|
||||||
size: 200,
|
render: modernizr.canvas ? 'canvas' : 'div',
|
||||||
fill: '#555',
|
size: 200,
|
||||||
background: null,
|
fill: settings.qrColor,
|
||||||
quiet: 2,
|
background: null,
|
||||||
radius: 0.3,
|
quiet: 2,
|
||||||
text: window.location.protocol + '//' + window.location.host + item.absHref
|
// radius: 0.3,
|
||||||
});
|
text: window.location.protocol + '//' + window.location.host + item.absHref
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseenter(item) {
|
function onMouseenter(item) {
|
||||||
@@ -104,6 +108,10 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
|
|||||||
$size = $info.find('.size');
|
$size = $info.find('.size');
|
||||||
$qrcode = $info.find('.qrcode');
|
$qrcode = $info.find('.qrcode');
|
||||||
|
|
||||||
|
if (!settings.qrcode) {
|
||||||
|
$qrcode.remove();
|
||||||
|
}
|
||||||
|
|
||||||
$(settingsTemplate)
|
$(settingsTemplate)
|
||||||
.appendTo('#settings')
|
.appendTo('#settings')
|
||||||
.find('#view-info')
|
.find('#view-info')
|
||||||
|
@@ -139,9 +139,14 @@ Options
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Enable a generic info side bar.
|
Enable a generic info side bar.
|
||||||
|
|
||||||
|
- qrcode: show a QR-Code
|
||||||
|
- qrColor: QR-Code fill color
|
||||||
*/
|
*/
|
||||||
"info": {
|
"info": {
|
||||||
"enabled": true
|
"enabled": true,
|
||||||
|
"qrcode": true,
|
||||||
|
"qrColor": "#999"
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user