]> git.99rst.org Git - openwrt-luci.git/blob
d46bfb0aa78f13716e286cc69b0b035598b6112c
[openwrt-luci.git] /
1 'use strict';
2 'require form';
3 'require shadowsocks-libev as ss';
4
5 function startsWith(str, search) {
6 return str.substring(0, search.length) === search;
7 }
8
9 return L.view.extend({
10 render: function() {
11 var m, s, o;
12
13 m = new form.Map('shadowsocks-libev', _('Remote Servers'),
14 _('Definition of remote shadowsocks servers. \
15 Disable any of them will also disable instances referring to it.'));
16
17 s = m.section(form.GridSection, 'server');
18 s.addremove = true;
19
20 o = s.option(form.Flag, 'disabled', _('Disable'));
21 o.editable = true;
22
23 ss.options_server(s);
24
25 return m.render();
26 },
27 addFooter: function() {
28 var p = '#edit=';
29 if (startsWith(location.hash, p)) {
30 var section_id = location.hash.substring(p.length);
31 var editBtn = document.querySelector('#cbi-shadowsocks-libev-' + section_id + ' button.cbi-button-edit');
32 if (editBtn)
33 editBtn.click();
34 }
35 return this.super('addFooter', arguments);
36 }
37 });
git clone https://git.99rst.org/PROJECT