@ -51,7 +51,7 @@ define([
'cp-settings-info-block' ,
'cp-settings-displayname' ,
'cp-settings-language-selector' ,
'cp-settings- resettips ',
'cp-settings- mediatag-size ',
'cp-settings-change-password' ,
'cp-settings-delete'
] ,
@ -62,6 +62,7 @@ define([
'cp-settings-userfeedback' ,
] ,
'drive' : [
'cp-settings-resettips' ,
'cp-settings-drive-duplicate' ,
'cp-settings-thumbnails' ,
'cp-settings-drive-backup' ,
@ -576,6 +577,59 @@ define([
cb ( form ) ;
} , true ) ;
Messages . settings _mediatagSizeTitle = "Autodownload size in MegaBytes (MB)" ; // XXX
Messages . settings _mediatagSizeHint = 'Maximum size for automatically loading media elements (images, videos, pdf) embedded into the pads. Elements bigger than the specified size can be loaded manually. Use "-1" to always load the media elements automatically.' ; // XXX
makeBlock ( 'mediatag-size' , function ( cb ) {
var $inputBlock = $ ( '<div>' , {
'class' : 'cp-sidebarlayout-input-block' ,
} ) ;
var spinner ;
var $input = $ ( '<input>' , {
'min' : - 1 ,
'max' : 1000 ,
type : 'number' ,
} ) . appendTo ( $inputBlock ) ;
var oldVal ;
var todo = function ( ) {
var val = parseInt ( $input . val ( ) ) ;
if ( val === oldVal ) { return ; }
if ( typeof ( val ) !== 'number' ) { return UI . warn ( Messages . error ) ; }
spinner . spin ( ) ;
common . setAttribute ( [ 'general' , 'mediatag-size' ] , val , function ( err ) {
if ( err ) {
spinner . hide ( ) ;
console . error ( err ) ;
return UI . warn ( Messages . error ) ;
}
spinner . done ( ) ;
UI . log ( Messages . saved ) ;
} ) ;
} ;
var $save = $ ( h ( 'button.btn.btn-primary' , Messages . settings _save ) ) . appendTo ( $inputBlock ) ;
spinner = UI . makeSpinner ( $inputBlock ) ;
$save . click ( todo ) ;
$input . on ( 'keyup' , function ( e ) {
if ( e . which === 13 ) { todo ( ) ; }
} ) ;
common . getAttribute ( [ 'general' , 'mediatag-size' ] , function ( e , val ) {
if ( e ) { return void console . error ( e ) ; }
if ( typeof ( val ) !== 'number' ) {
oldVal = 5 ;
$input . val ( 5 ) ;
} else {
oldVal = val ;
$input . val ( val ) ;
}
} ) ;
cb ( $inputBlock ) ;
} , true ) ;
// Security
makeBlock ( 'safe-links' , function ( cb ) {