o.onclick = L.bind(this.handleRestore, this);
- if (procmtd.length) {
+ var mtdblocks = [];
+ procmtd.split(/\n/).forEach(function(ln) {
+ var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/);
+ if (match)
+ mtdblocks.push(match[1], match[2]);
+ });
+
+ if (mtdblocks.length) {
o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Save mtdblock contents'), _('Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )'));
ss = o.subsection;
o = ss.option(form.ListValue, 'mtdselect', _('Choose mtdblock'));
- procmtd.split(/\n/).forEach(function(ln) {
- var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/);
- if (match)
- o.value(match[1], match[2]);
- });
+
+ for (var i = 0; i < mtdblocks.length; i += 2)
+ o.value(mtdblocks[i], mtdblocks[i+1]);
o = ss.option(form.Button, 'mtddownload', _('Download mtdblock'));
o.inputstyle = 'action important';