luci-base: cbi.js: remove dead code
authorJo-Philipp Wich <jo@mein.io>
Thu, 11 Oct 2018 06:02:38 +0000 (08:02 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 11 Oct 2018 06:02:38 +0000 (08:02 +0200)
Remove some superfluous code which was added with a previous commit.

Fixes: 8270f10f1 ("luci-base: cbi.js: code cleanups")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js

index 29cc69f4bc5d7c67d0b1eb2cad2d3079cf110993..70255c0b588204ee9a53be25f26777734d38fe7a 100644 (file)
@@ -2140,77 +2140,6 @@ function cbi_update_table(table, data, placeholder) {
        });
 }
 
-function renderPreview(section) {
-       var preview = E('div', { class: 'cbi-section-preview' }, [
-               E('ul'), E('div')
-       ]);
-
-       section.querySelectorAll('.cbi-value-field[data-name], .cbi-value').forEach(function(field) {
-               var name = null, title = null, value = null;
-
-               if (field.classList.contains('cbi-value-field')) {
-                       name  = field.getAttribute('data-name');
-                       title = field.getAttribute('data-title');
-               }
-               else {
-                       var label = field.querySelector('label.cbi-value-title[for]');
-                       if (label) {
-                               name  = label.getAttribute('for').split(/\./)[3];
-                               title = (label.innerText || '').trim();
-                       }
-               }
-
-               if (name === null)
-                       return;
-
-               field.querySelectorAll('select, input').forEach(function(input) {
-                       var n = (input.name || input.id || '').split(/\./);
-
-                       if (n.length === 6 && n[0] === 'cbi' && n[1] === 'combobox') {
-                               if (value && input.selectedIndex >= 0)
-                                       value = input.options[input.selectedIndex].text;
-                       }
-                       else if (n.length === 4 && n[0] === 'cbid' && n[3] === name) {
-                               var v = null;
-
-                               switch (input.type) {
-                               case 'checkbox':
-                                       v = input.checked ? '✔' : '✘';
-                                       break;
-
-                               case 'password':
-                                       v = input.value ? '***' : null;
-                                       break;
-
-                               case 'submit':
-                                       v = null;
-                                       break;
-
-                               default:
-                                       if (matchesElem(input, 'select') && input.selectedIndex >= 0)
-                                               v = input.options[input.selectedIndex].text;
-                                       else
-                                               v = input.value;
-                                       break;
-                               }
-
-                               if (v !== undefined && v !== null && v !== '')
-                                       value = (value === null) ? v : value + ', ' + v;
-                       }
-               });
-
-               if (value !== null)
-                       preview.firstChild.appendChild(E('li', {}, [
-                               (title || name), ': ',
-                               E('strong', {}, value)
-                       ]));
-       });
-
-       section.parentNode.insertBefore(preview, section);
-}
-
 document.addEventListener('DOMContentLoaded', function() {
        document.querySelectorAll('.table').forEach(cbi_update_table);
-
-       document.querySelectorAll('.cbi-section-node').forEach(renderPreview);
 });