From c4e7d7989a94ec974842120544a9510a56d70319 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Fri, 21 Mar 2014 13:51:45 +0000 Subject: [PATCH] Enable the use of 'optional' on password fields (JavaScript part) See ed0c10a10b0b3a9d9d898a64461de707026cd6d3 --- apps/files_external/js/settings.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index cd2a3103eb..0fceb41c0a 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -181,16 +181,21 @@ $(document).ready(function() { $.each(configurations, function(backend, parameters) { if (backend == backendClass) { $.each(parameters['configuration'], function(parameter, placeholder) { - if (placeholder.indexOf('*') != -1) { - td.append(''); - } else if (placeholder.indexOf('!') != -1) { + var is_optional = false; + if (placeholder.indexOf('&') === 0) { + is_optional = true; + placeholder = placeholder.substring(1); + } + if (placeholder.indexOf('*') === 0) { + var class_string = is_optional ? ' class="optional"' : ''; + td.append(''); + else if (placeholder.indexOf('!') === 0) { td.append(''); - } else if (placeholder.indexOf('&') != -1) { - td.append(''); - } else if (placeholder.indexOf('#') != -1) { + else if (placeholder.indexOf('#') === 0) { td.append(''); - } else { - td.append(''); + else { + var class_string = is_optional ? ' class="optional"' : ''; + td.append(''); } }); if (parameters['custom'] && $('#externalStorage tbody tr.'+backendClass.replace(/\\/g, '\\\\')).length == 1) {