Add info options.

This commit is contained in:
Lars Jung 2015-04-02 01:26:52 +02:00
parent 52238864c4
commit 42ccda167c
3 changed files with 24 additions and 14 deletions

View file

@ -45,11 +45,8 @@
}
.qrcode {
background: #fff;
border-radius: 2px;
margin: 0 auto;
width: 200px;
border: 1px solid @col-border;
canvas {
display: block;

View file

@ -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) {
var settings = _.extend({
enabled: false
enabled: false,
qrcode: true,
qrColor: "#999"
}, allsettings.info);
var template =
'<div id="info">' +
@ -64,15 +66,17 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
$size.append(' - ' + stats.folders + ' - ' + stats.files);
}
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
size: 200,
fill: '#555',
background: null,
quiet: 2,
radius: 0.3,
text: window.location.protocol + '//' + window.location.host + item.absHref
});
if (settings.qrcode) {
$qrcode.empty().qrcode({
render: modernizr.canvas ? 'canvas' : 'div',
size: 200,
fill: settings.qrColor,
background: null,
quiet: 2,
// radius: 0.3,
text: window.location.protocol + '//' + window.location.host + item.absHref
});
}
}
function onMouseenter(item) {
@ -104,6 +108,10 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
$size = $info.find('.size');
$qrcode = $info.find('.qrcode');
if (!settings.qrcode) {
$qrcode.remove();
}
$(settingsTemplate)
.appendTo('#settings')
.find('#view-info')

View file

@ -139,9 +139,14 @@ Options
/*
Enable a generic info side bar.
- qrcode: show a QR-Code
- qrColor: QR-Code fill color
*/
"info": {
"enabled": true
"enabled": true,
"qrcode": true,
"qrColor": "#999"
},
/*