Merge pull request #3619 from Andy2244/luci-app-samba4_new-UCI
[oweals/luci.git] / docs / jsapi / luci.js.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <meta charset="utf-8">
5     <title>Source: luci.js</title>
6     
7     
8     <script src="scripts/prettify/prettify.js"></script>
9     <script src="scripts/prettify/lang-css.js"></script>
10     <script src="scripts/jquery.min.js"></script>
11     <!--[if lt IE 9]>
12       <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13     <![endif]-->
14     <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
15     <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
16     <link type="text/css" rel="stylesheet" href="styles/jaguar.css">
17     
18     
19     <script>
20     var config = {"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":true}};
21     </script>
22     
23
24     
25 </head>
26 <body>
27 <div id="wrap" class="clearfix">
28     
29 <div class="navigation">
30     <h3 class="applicationName"><a href="index.html"></a></h3>
31
32     <div class="search">
33         <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
34     </div>
35     <ul class="list">
36     
37         <li class="item" data-name="LuCI">
38             <span class="title">
39                 <a href="LuCI.html">LuCI</a>
40                 
41             </span>
42             <ul class="members itemMembers">
43             
44             <span class="subtitle">Members</span>
45             
46                 <li data-name="LuCI#env"><a href="LuCI.html#env">env</a></li>
47             
48             </ul>
49             <ul class="typedefs itemMembers">
50             
51             <span class="subtitle">Typedefs</span>
52             
53                 <li data-name="LuCI.requestCallbackFn"><a href="LuCI.html#.requestCallbackFn">requestCallbackFn</a></li>
54             
55             </ul>
56             <ul class="typedefs itemMembers">
57             
58             </ul>
59             <ul class="methods itemMembers">
60             
61             <span class="subtitle">Methods</span>
62             
63                 <li data-name="LuCI#bind"><a href="LuCI.html#bind">bind</a></li>
64             
65                 <li data-name="LuCI#error"><a href="LuCI.html#error">error</a></li>
66             
67                 <li data-name="LuCI#get"><a href="LuCI.html#get">get</a></li>
68             
69                 <li data-name="LuCI#halt"><a href="LuCI.html#halt">halt</a></li>
70             
71                 <li data-name="LuCI#hasSystemFeature"><a href="LuCI.html#hasSystemFeature">hasSystemFeature</a></li>
72             
73                 <li data-name="LuCI#isObject"><a href="LuCI.html#isObject">isObject</a></li>
74             
75                 <li data-name="LuCI#location"><a href="LuCI.html#location">location</a></li>
76             
77                 <li data-name="LuCI#media"><a href="LuCI.html#media">media</a></li>
78             
79                 <li data-name="LuCI#path"><a href="LuCI.html#path">path</a></li>
80             
81                 <li data-name="LuCI#poll"><a href="LuCI.html#poll">poll</a></li>
82             
83                 <li data-name="LuCI#post"><a href="LuCI.html#post">post</a></li>
84             
85                 <li data-name="LuCI#raise"><a href="LuCI.html#raise">raise</a></li>
86             
87                 <li data-name="LuCI#require"><a href="LuCI.html#require">require</a></li>
88             
89                 <li data-name="LuCI#resolveDefault"><a href="LuCI.html#resolveDefault">resolveDefault</a></li>
90             
91                 <li data-name="LuCI#resource"><a href="LuCI.html#resource">resource</a></li>
92             
93                 <li data-name="LuCI#run"><a href="LuCI.html#run">run</a></li>
94             
95                 <li data-name="LuCI#sortedKeys"><a href="LuCI.html#sortedKeys">sortedKeys</a></li>
96             
97                 <li data-name="LuCI#stop"><a href="LuCI.html#stop">stop</a></li>
98             
99                 <li data-name="LuCI#toArray"><a href="LuCI.html#toArray">toArray</a></li>
100             
101                 <li data-name="LuCI#url"><a href="LuCI.html#url">url</a></li>
102             
103             </ul>
104             <ul class="events itemMembers">
105             
106             </ul>
107         </li>
108     
109         <li class="item" data-name="LuCI.Class">
110             <span class="title">
111                 <a href="LuCI.Class.html">LuCI.Class</a>
112                 
113             </span>
114             <ul class="members itemMembers">
115             
116             </ul>
117             <ul class="typedefs itemMembers">
118             
119             </ul>
120             <ul class="typedefs itemMembers">
121             
122             </ul>
123             <ul class="methods itemMembers">
124             
125             <span class="subtitle">Methods</span>
126             
127                 <li data-name="LuCI.Class.extend"><a href="LuCI.Class.html#.extend">extend</a></li>
128             
129                 <li data-name="LuCI.Class.instantiate"><a href="LuCI.Class.html#.instantiate">instantiate</a></li>
130             
131                 <li data-name="LuCI.Class.isSubclass"><a href="LuCI.Class.html#.isSubclass">isSubclass</a></li>
132             
133                 <li data-name="LuCI.Class.singleton"><a href="LuCI.Class.html#.singleton">singleton</a></li>
134             
135                 <li data-name="LuCI.Class#super"><a href="LuCI.Class.html#super">super</a></li>
136             
137                 <li data-name="LuCI.Class#varargs"><a href="LuCI.Class.html#varargs">varargs</a></li>
138             
139             </ul>
140             <ul class="events itemMembers">
141             
142             </ul>
143         </li>
144     
145         <li class="item" data-name="LuCI.dom">
146             <span class="title">
147                 <a href="LuCI.dom.html">LuCI.dom</a>
148                 
149             </span>
150             <ul class="members itemMembers">
151             
152             </ul>
153             <ul class="typedefs itemMembers">
154             
155             <span class="subtitle">Typedefs</span>
156             
157                 <li data-name="LuCI.dom~ignoreCallbackFn"><a href="LuCI.dom.html#~ignoreCallbackFn">ignoreCallbackFn</a></li>
158             
159             </ul>
160             <ul class="typedefs itemMembers">
161             
162             </ul>
163             <ul class="methods itemMembers">
164             
165             <span class="subtitle">Methods</span>
166             
167                 <li data-name="LuCI.dom#append"><a href="LuCI.dom.html#append">append</a></li>
168             
169                 <li data-name="LuCI.dom#attr"><a href="LuCI.dom.html#attr">attr</a></li>
170             
171                 <li data-name="LuCI.dom#bindClassInstance"><a href="LuCI.dom.html#bindClassInstance">bindClassInstance</a></li>
172             
173                 <li data-name="LuCI.dom#callClassMethod"><a href="LuCI.dom.html#callClassMethod">callClassMethod</a></li>
174             
175                 <li data-name="LuCI.dom#content"><a href="LuCI.dom.html#content">content</a></li>
176             
177                 <li data-name="LuCI.dom#create"><a href="LuCI.dom.html#create">create</a></li>
178             
179                 <li data-name="LuCI.dom#data"><a href="LuCI.dom.html#data">data</a></li>
180             
181                 <li data-name="LuCI.dom#elem"><a href="LuCI.dom.html#elem">elem</a></li>
182             
183                 <li data-name="LuCI.dom#findClassInstance"><a href="LuCI.dom.html#findClassInstance">findClassInstance</a></li>
184             
185                 <li data-name="LuCI.dom#isEmpty"><a href="LuCI.dom.html#isEmpty">isEmpty</a></li>
186             
187                 <li data-name="LuCI.dom#matches"><a href="LuCI.dom.html#matches">matches</a></li>
188             
189                 <li data-name="LuCI.dom#parent"><a href="LuCI.dom.html#parent">parent</a></li>
190             
191                 <li data-name="LuCI.dom#parse"><a href="LuCI.dom.html#parse">parse</a></li>
192             
193             </ul>
194             <ul class="events itemMembers">
195             
196             </ul>
197         </li>
198     
199         <li class="item" data-name="LuCI.fs">
200             <span class="title">
201                 <a href="LuCI.fs.html">LuCI.fs</a>
202                 
203             </span>
204             <ul class="members itemMembers">
205             
206             </ul>
207             <ul class="typedefs itemMembers">
208             
209             <span class="subtitle">Typedefs</span>
210             
211                 <li data-name="LuCI.fs.FileExecResult"><a href="LuCI.fs.html#.FileExecResult">FileExecResult</a></li>
212             
213                 <li data-name="LuCI.fs.FileStatEntry"><a href="LuCI.fs.html#.FileStatEntry">FileStatEntry</a></li>
214             
215             </ul>
216             <ul class="typedefs itemMembers">
217             
218             </ul>
219             <ul class="methods itemMembers">
220             
221             <span class="subtitle">Methods</span>
222             
223                 <li data-name="LuCI.fs#exec"><a href="LuCI.fs.html#exec">exec</a></li>
224             
225                 <li data-name="LuCI.fs#exec_direct"><a href="LuCI.fs.html#exec_direct">exec_direct</a></li>
226             
227                 <li data-name="LuCI.fs#lines"><a href="LuCI.fs.html#lines">lines</a></li>
228             
229                 <li data-name="LuCI.fs#list"><a href="LuCI.fs.html#list">list</a></li>
230             
231                 <li data-name="LuCI.fs#read"><a href="LuCI.fs.html#read">read</a></li>
232             
233                 <li data-name="LuCI.fs#read_direct"><a href="LuCI.fs.html#read_direct">read_direct</a></li>
234             
235                 <li data-name="LuCI.fs#remove"><a href="LuCI.fs.html#remove">remove</a></li>
236             
237                 <li data-name="LuCI.fs#stat"><a href="LuCI.fs.html#stat">stat</a></li>
238             
239                 <li data-name="LuCI.fs#trimmed"><a href="LuCI.fs.html#trimmed">trimmed</a></li>
240             
241                 <li data-name="LuCI.fs#write"><a href="LuCI.fs.html#write">write</a></li>
242             
243             </ul>
244             <ul class="events itemMembers">
245             
246             </ul>
247         </li>
248     
249         <li class="item" data-name="LuCI.Headers">
250             <span class="title">
251                 <a href="LuCI.Headers.html">LuCI.Headers</a>
252                 
253             </span>
254             <ul class="members itemMembers">
255             
256             </ul>
257             <ul class="typedefs itemMembers">
258             
259             </ul>
260             <ul class="typedefs itemMembers">
261             
262             </ul>
263             <ul class="methods itemMembers">
264             
265             <span class="subtitle">Methods</span>
266             
267                 <li data-name="LuCI.Headers#get"><a href="LuCI.Headers.html#get">get</a></li>
268             
269                 <li data-name="LuCI.Headers#has"><a href="LuCI.Headers.html#has">has</a></li>
270             
271             </ul>
272             <ul class="events itemMembers">
273             
274             </ul>
275         </li>
276     
277         <li class="item" data-name="LuCI.Network">
278             <span class="title">
279                 <a href="LuCI.Network.html">LuCI.Network</a>
280                 
281             </span>
282             <ul class="members itemMembers">
283             
284             </ul>
285             <ul class="typedefs itemMembers">
286             
287             <span class="subtitle">Typedefs</span>
288             
289                 <li data-name="LuCI.Network.SwitchTopology"><a href="LuCI.Network.html#.SwitchTopology">SwitchTopology</a></li>
290             
291                 <li data-name="LuCI.Network.WifiEncryption"><a href="LuCI.Network.html#.WifiEncryption">WifiEncryption</a></li>
292             
293                 <li data-name="LuCI.Network.WifiPeerEntry"><a href="LuCI.Network.html#.WifiPeerEntry">WifiPeerEntry</a></li>
294             
295                 <li data-name="LuCI.Network.WifiRateEntry"><a href="LuCI.Network.html#.WifiRateEntry">WifiRateEntry</a></li>
296             
297                 <li data-name="LuCI.Network.WifiScanResult"><a href="LuCI.Network.html#.WifiScanResult">WifiScanResult</a></li>
298             
299             </ul>
300             <ul class="typedefs itemMembers">
301             
302             </ul>
303             <ul class="methods itemMembers">
304             
305             <span class="subtitle">Methods</span>
306             
307                 <li data-name="LuCI.Network#addNetwork"><a href="LuCI.Network.html#addNetwork">addNetwork</a></li>
308             
309                 <li data-name="LuCI.Network#addWifiNetwork"><a href="LuCI.Network.html#addWifiNetwork">addWifiNetwork</a></li>
310             
311                 <li data-name="LuCI.Network#deleteNetwork"><a href="LuCI.Network.html#deleteNetwork">deleteNetwork</a></li>
312             
313                 <li data-name="LuCI.Network#deleteWifiNetwork"><a href="LuCI.Network.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
314             
315                 <li data-name="LuCI.Network#flushCache"><a href="LuCI.Network.html#flushCache">flushCache</a></li>
316             
317                 <li data-name="LuCI.Network#formatWifiEncryption"><a href="LuCI.Network.html#formatWifiEncryption">formatWifiEncryption</a></li>
318             
319                 <li data-name="LuCI.Network#getDevice"><a href="LuCI.Network.html#getDevice">getDevice</a></li>
320             
321                 <li data-name="LuCI.Network#getDevices"><a href="LuCI.Network.html#getDevices">getDevices</a></li>
322             
323                 <li data-name="LuCI.Network#getDSLModemType"><a href="LuCI.Network.html#getDSLModemType">getDSLModemType</a></li>
324             
325                 <li data-name="LuCI.Network#getHostHints"><a href="LuCI.Network.html#getHostHints">getHostHints</a></li>
326             
327                 <li data-name="LuCI.Network#getIfnameOf"><a href="LuCI.Network.html#getIfnameOf">getIfnameOf</a></li>
328             
329                 <li data-name="LuCI.Network#getNetwork"><a href="LuCI.Network.html#getNetwork">getNetwork</a></li>
330             
331                 <li data-name="LuCI.Network#getNetworks"><a href="LuCI.Network.html#getNetworks">getNetworks</a></li>
332             
333                 <li data-name="LuCI.Network#getProtocol"><a href="LuCI.Network.html#getProtocol">getProtocol</a></li>
334             
335                 <li data-name="LuCI.Network#getProtocols"><a href="LuCI.Network.html#getProtocols">getProtocols</a></li>
336             
337                 <li data-name="LuCI.Network#getSwitchTopologies"><a href="LuCI.Network.html#getSwitchTopologies">getSwitchTopologies</a></li>
338             
339                 <li data-name="LuCI.Network#getWAN6Networks"><a href="LuCI.Network.html#getWAN6Networks">getWAN6Networks</a></li>
340             
341                 <li data-name="LuCI.Network#getWANNetworks"><a href="LuCI.Network.html#getWANNetworks">getWANNetworks</a></li>
342             
343                 <li data-name="LuCI.Network#getWifiDevice"><a href="LuCI.Network.html#getWifiDevice">getWifiDevice</a></li>
344             
345                 <li data-name="LuCI.Network#getWifiDevices"><a href="LuCI.Network.html#getWifiDevices">getWifiDevices</a></li>
346             
347                 <li data-name="LuCI.Network#getWifiNetwork"><a href="LuCI.Network.html#getWifiNetwork">getWifiNetwork</a></li>
348             
349                 <li data-name="LuCI.Network#getWifiNetworks"><a href="LuCI.Network.html#getWifiNetworks">getWifiNetworks</a></li>
350             
351                 <li data-name="LuCI.Network#isIgnoredDevice"><a href="LuCI.Network.html#isIgnoredDevice">isIgnoredDevice</a></li>
352             
353                 <li data-name="LuCI.Network#maskToPrefix"><a href="LuCI.Network.html#maskToPrefix">maskToPrefix</a></li>
354             
355                 <li data-name="LuCI.Network#prefixToMask"><a href="LuCI.Network.html#prefixToMask">prefixToMask</a></li>
356             
357                 <li data-name="LuCI.Network#registerErrorCode"><a href="LuCI.Network.html#registerErrorCode">registerErrorCode</a></li>
358             
359                 <li data-name="LuCI.Network#registerPatternVirtual"><a href="LuCI.Network.html#registerPatternVirtual">registerPatternVirtual</a></li>
360             
361                 <li data-name="LuCI.Network#registerProtocol"><a href="LuCI.Network.html#registerProtocol">registerProtocol</a></li>
362             
363                 <li data-name="LuCI.Network#renameNetwork"><a href="LuCI.Network.html#renameNetwork">renameNetwork</a></li>
364             
365             </ul>
366             <ul class="events itemMembers">
367             
368             </ul>
369         </li>
370     
371         <li class="item" data-name="LuCI.Network.Device">
372             <span class="title">
373                 <a href="LuCI.Network.Device.html">LuCI.Network.Device</a>
374                 
375             </span>
376             <ul class="members itemMembers">
377             
378             </ul>
379             <ul class="typedefs itemMembers">
380             
381             </ul>
382             <ul class="typedefs itemMembers">
383             
384             </ul>
385             <ul class="methods itemMembers">
386             
387             <span class="subtitle">Methods</span>
388             
389                 <li data-name="LuCI.Network.Device#getBridgeID"><a href="LuCI.Network.Device.html#getBridgeID">getBridgeID</a></li>
390             
391                 <li data-name="LuCI.Network.Device#getBridgeSTP"><a href="LuCI.Network.Device.html#getBridgeSTP">getBridgeSTP</a></li>
392             
393                 <li data-name="LuCI.Network.Device#getI18n"><a href="LuCI.Network.Device.html#getI18n">getI18n</a></li>
394             
395                 <li data-name="LuCI.Network.Device#getIP6Addrs"><a href="LuCI.Network.Device.html#getIP6Addrs">getIP6Addrs</a></li>
396             
397                 <li data-name="LuCI.Network.Device#getIPAddrs"><a href="LuCI.Network.Device.html#getIPAddrs">getIPAddrs</a></li>
398             
399                 <li data-name="LuCI.Network.Device#getMAC"><a href="LuCI.Network.Device.html#getMAC">getMAC</a></li>
400             
401                 <li data-name="LuCI.Network.Device#getMTU"><a href="LuCI.Network.Device.html#getMTU">getMTU</a></li>
402             
403                 <li data-name="LuCI.Network.Device#getName"><a href="LuCI.Network.Device.html#getName">getName</a></li>
404             
405                 <li data-name="LuCI.Network.Device#getNetwork"><a href="LuCI.Network.Device.html#getNetwork">getNetwork</a></li>
406             
407                 <li data-name="LuCI.Network.Device#getNetworks"><a href="LuCI.Network.Device.html#getNetworks">getNetworks</a></li>
408             
409                 <li data-name="LuCI.Network.Device#getPorts"><a href="LuCI.Network.Device.html#getPorts">getPorts</a></li>
410             
411                 <li data-name="LuCI.Network.Device#getRXBytes"><a href="LuCI.Network.Device.html#getRXBytes">getRXBytes</a></li>
412             
413                 <li data-name="LuCI.Network.Device#getRXPackets"><a href="LuCI.Network.Device.html#getRXPackets">getRXPackets</a></li>
414             
415                 <li data-name="LuCI.Network.Device#getShortName"><a href="LuCI.Network.Device.html#getShortName">getShortName</a></li>
416             
417                 <li data-name="LuCI.Network.Device#getTXBytes"><a href="LuCI.Network.Device.html#getTXBytes">getTXBytes</a></li>
418             
419                 <li data-name="LuCI.Network.Device#getTXPackets"><a href="LuCI.Network.Device.html#getTXPackets">getTXPackets</a></li>
420             
421                 <li data-name="LuCI.Network.Device#getType"><a href="LuCI.Network.Device.html#getType">getType</a></li>
422             
423                 <li data-name="LuCI.Network.Device#getTypeI18n"><a href="LuCI.Network.Device.html#getTypeI18n">getTypeI18n</a></li>
424             
425                 <li data-name="LuCI.Network.Device#getWifiNetwork"><a href="LuCI.Network.Device.html#getWifiNetwork">getWifiNetwork</a></li>
426             
427                 <li data-name="LuCI.Network.Device#isBridge"><a href="LuCI.Network.Device.html#isBridge">isBridge</a></li>
428             
429                 <li data-name="LuCI.Network.Device#isBridgePort"><a href="LuCI.Network.Device.html#isBridgePort">isBridgePort</a></li>
430             
431                 <li data-name="LuCI.Network.Device#isUp"><a href="LuCI.Network.Device.html#isUp">isUp</a></li>
432             
433             </ul>
434             <ul class="events itemMembers">
435             
436             </ul>
437         </li>
438     
439         <li class="item" data-name="LuCI.Network.Hosts">
440             <span class="title">
441                 <a href="LuCI.Network.Hosts.html">LuCI.Network.Hosts</a>
442                 
443             </span>
444             <ul class="members itemMembers">
445             
446             </ul>
447             <ul class="typedefs itemMembers">
448             
449             </ul>
450             <ul class="typedefs itemMembers">
451             
452             </ul>
453             <ul class="methods itemMembers">
454             
455             <span class="subtitle">Methods</span>
456             
457                 <li data-name="LuCI.Network.Hosts#getHostnameByIP6Addr"><a href="LuCI.Network.Hosts.html#getHostnameByIP6Addr">getHostnameByIP6Addr</a></li>
458             
459                 <li data-name="LuCI.Network.Hosts#getHostnameByIPAddr"><a href="LuCI.Network.Hosts.html#getHostnameByIPAddr">getHostnameByIPAddr</a></li>
460             
461                 <li data-name="LuCI.Network.Hosts#getHostnameByMACAddr"><a href="LuCI.Network.Hosts.html#getHostnameByMACAddr">getHostnameByMACAddr</a></li>
462             
463                 <li data-name="LuCI.Network.Hosts#getIP6AddrByMACAddr"><a href="LuCI.Network.Hosts.html#getIP6AddrByMACAddr">getIP6AddrByMACAddr</a></li>
464             
465                 <li data-name="LuCI.Network.Hosts#getIPAddrByMACAddr"><a href="LuCI.Network.Hosts.html#getIPAddrByMACAddr">getIPAddrByMACAddr</a></li>
466             
467                 <li data-name="LuCI.Network.Hosts#getMACAddrByIP6Addr"><a href="LuCI.Network.Hosts.html#getMACAddrByIP6Addr">getMACAddrByIP6Addr</a></li>
468             
469                 <li data-name="LuCI.Network.Hosts#getMACAddrByIPAddr"><a href="LuCI.Network.Hosts.html#getMACAddrByIPAddr">getMACAddrByIPAddr</a></li>
470             
471                 <li data-name="LuCI.Network.Hosts#getMACHints"><a href="LuCI.Network.Hosts.html#getMACHints">getMACHints</a></li>
472             
473             </ul>
474             <ul class="events itemMembers">
475             
476             </ul>
477         </li>
478     
479         <li class="item" data-name="LuCI.Network.Protocol">
480             <span class="title">
481                 <a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a>
482                 
483             </span>
484             <ul class="members itemMembers">
485             
486             </ul>
487             <ul class="typedefs itemMembers">
488             
489             </ul>
490             <ul class="typedefs itemMembers">
491             
492             </ul>
493             <ul class="methods itemMembers">
494             
495             <span class="subtitle">Methods</span>
496             
497                 <li data-name="LuCI.Network.Protocol#addDevice"><a href="LuCI.Network.Protocol.html#addDevice">addDevice</a></li>
498             
499                 <li data-name="LuCI.Network.Protocol#containsDevice"><a href="LuCI.Network.Protocol.html#containsDevice">containsDevice</a></li>
500             
501                 <li data-name="LuCI.Network.Protocol#deleteDevice"><a href="LuCI.Network.Protocol.html#deleteDevice">deleteDevice</a></li>
502             
503                 <li data-name="LuCI.Network.Protocol#get"><a href="LuCI.Network.Protocol.html#get">get</a></li>
504             
505                 <li data-name="LuCI.Network.Protocol#getDevice"><a href="LuCI.Network.Protocol.html#getDevice">getDevice</a></li>
506             
507                 <li data-name="LuCI.Network.Protocol#getDevices"><a href="LuCI.Network.Protocol.html#getDevices">getDevices</a></li>
508             
509                 <li data-name="LuCI.Network.Protocol#getDNS6Addrs"><a href="LuCI.Network.Protocol.html#getDNS6Addrs">getDNS6Addrs</a></li>
510             
511                 <li data-name="LuCI.Network.Protocol#getDNSAddrs"><a href="LuCI.Network.Protocol.html#getDNSAddrs">getDNSAddrs</a></li>
512             
513                 <li data-name="LuCI.Network.Protocol#getErrors"><a href="LuCI.Network.Protocol.html#getErrors">getErrors</a></li>
514             
515                 <li data-name="LuCI.Network.Protocol#getExpiry"><a href="LuCI.Network.Protocol.html#getExpiry">getExpiry</a></li>
516             
517                 <li data-name="LuCI.Network.Protocol#getGateway6Addr"><a href="LuCI.Network.Protocol.html#getGateway6Addr">getGateway6Addr</a></li>
518             
519                 <li data-name="LuCI.Network.Protocol#getGatewayAddr"><a href="LuCI.Network.Protocol.html#getGatewayAddr">getGatewayAddr</a></li>
520             
521                 <li data-name="LuCI.Network.Protocol#getI18n"><a href="LuCI.Network.Protocol.html#getI18n">getI18n</a></li>
522             
523                 <li data-name="LuCI.Network.Protocol#getIfname"><a href="LuCI.Network.Protocol.html#getIfname">getIfname</a></li>
524             
525                 <li data-name="LuCI.Network.Protocol#getIP6Addr"><a href="LuCI.Network.Protocol.html#getIP6Addr">getIP6Addr</a></li>
526             
527                 <li data-name="LuCI.Network.Protocol#getIP6Addrs"><a href="LuCI.Network.Protocol.html#getIP6Addrs">getIP6Addrs</a></li>
528             
529                 <li data-name="LuCI.Network.Protocol#getIP6Prefix"><a href="LuCI.Network.Protocol.html#getIP6Prefix">getIP6Prefix</a></li>
530             
531                 <li data-name="LuCI.Network.Protocol#getIPAddr"><a href="LuCI.Network.Protocol.html#getIPAddr">getIPAddr</a></li>
532             
533                 <li data-name="LuCI.Network.Protocol#getIPAddrs"><a href="LuCI.Network.Protocol.html#getIPAddrs">getIPAddrs</a></li>
534             
535                 <li data-name="LuCI.Network.Protocol#getL2Device"><a href="LuCI.Network.Protocol.html#getL2Device">getL2Device</a></li>
536             
537                 <li data-name="LuCI.Network.Protocol#getL3Device"><a href="LuCI.Network.Protocol.html#getL3Device">getL3Device</a></li>
538             
539                 <li data-name="LuCI.Network.Protocol#getMetric"><a href="LuCI.Network.Protocol.html#getMetric">getMetric</a></li>
540             
541                 <li data-name="LuCI.Network.Protocol#getName"><a href="LuCI.Network.Protocol.html#getName">getName</a></li>
542             
543                 <li data-name="LuCI.Network.Protocol#getNetmask"><a href="LuCI.Network.Protocol.html#getNetmask">getNetmask</a></li>
544             
545                 <li data-name="LuCI.Network.Protocol#getOpkgPackage"><a href="LuCI.Network.Protocol.html#getOpkgPackage">getOpkgPackage</a></li>
546             
547                 <li data-name="LuCI.Network.Protocol#getProtocol"><a href="LuCI.Network.Protocol.html#getProtocol">getProtocol</a></li>
548             
549                 <li data-name="LuCI.Network.Protocol#getType"><a href="LuCI.Network.Protocol.html#getType">getType</a></li>
550             
551                 <li data-name="LuCI.Network.Protocol#getUptime"><a href="LuCI.Network.Protocol.html#getUptime">getUptime</a></li>
552             
553                 <li data-name="LuCI.Network.Protocol#getZoneName"><a href="LuCI.Network.Protocol.html#getZoneName">getZoneName</a></li>
554             
555                 <li data-name="LuCI.Network.Protocol#isAlias"><a href="LuCI.Network.Protocol.html#isAlias">isAlias</a></li>
556             
557                 <li data-name="LuCI.Network.Protocol#isBridge"><a href="LuCI.Network.Protocol.html#isBridge">isBridge</a></li>
558             
559                 <li data-name="LuCI.Network.Protocol#isDynamic"><a href="LuCI.Network.Protocol.html#isDynamic">isDynamic</a></li>
560             
561                 <li data-name="LuCI.Network.Protocol#isEmpty"><a href="LuCI.Network.Protocol.html#isEmpty">isEmpty</a></li>
562             
563                 <li data-name="LuCI.Network.Protocol#isFloating"><a href="LuCI.Network.Protocol.html#isFloating">isFloating</a></li>
564             
565                 <li data-name="LuCI.Network.Protocol#isInstalled"><a href="LuCI.Network.Protocol.html#isInstalled">isInstalled</a></li>
566             
567                 <li data-name="LuCI.Network.Protocol#isUp"><a href="LuCI.Network.Protocol.html#isUp">isUp</a></li>
568             
569                 <li data-name="LuCI.Network.Protocol#isVirtual"><a href="LuCI.Network.Protocol.html#isVirtual">isVirtual</a></li>
570             
571                 <li data-name="LuCI.Network.Protocol#set"><a href="LuCI.Network.Protocol.html#set">set</a></li>
572             
573             </ul>
574             <ul class="events itemMembers">
575             
576             </ul>
577         </li>
578     
579         <li class="item" data-name="LuCI.Network.WifiDevice">
580             <span class="title">
581                 <a href="LuCI.Network.WifiDevice.html">LuCI.Network.WifiDevice</a>
582                 
583             </span>
584             <ul class="members itemMembers">
585             
586             </ul>
587             <ul class="typedefs itemMembers">
588             
589             </ul>
590             <ul class="typedefs itemMembers">
591             
592             </ul>
593             <ul class="methods itemMembers">
594             
595             <span class="subtitle">Methods</span>
596             
597                 <li data-name="LuCI.Network.WifiDevice#addWifiNetwork"><a href="LuCI.Network.WifiDevice.html#addWifiNetwork">addWifiNetwork</a></li>
598             
599                 <li data-name="LuCI.Network.WifiDevice#deleteWifiNetwork"><a href="LuCI.Network.WifiDevice.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
600             
601                 <li data-name="LuCI.Network.WifiDevice#get"><a href="LuCI.Network.WifiDevice.html#get">get</a></li>
602             
603                 <li data-name="LuCI.Network.WifiDevice#getHTModes"><a href="LuCI.Network.WifiDevice.html#getHTModes">getHTModes</a></li>
604             
605                 <li data-name="LuCI.Network.WifiDevice#getHWModes"><a href="LuCI.Network.WifiDevice.html#getHWModes">getHWModes</a></li>
606             
607                 <li data-name="LuCI.Network.WifiDevice#getI18n"><a href="LuCI.Network.WifiDevice.html#getI18n">getI18n</a></li>
608             
609                 <li data-name="LuCI.Network.WifiDevice#getName"><a href="LuCI.Network.WifiDevice.html#getName">getName</a></li>
610             
611                 <li data-name="LuCI.Network.WifiDevice#getScanList"><a href="LuCI.Network.WifiDevice.html#getScanList">getScanList</a></li>
612             
613                 <li data-name="LuCI.Network.WifiDevice#getWifiNetwork"><a href="LuCI.Network.WifiDevice.html#getWifiNetwork">getWifiNetwork</a></li>
614             
615                 <li data-name="LuCI.Network.WifiDevice#getWifiNetworks"><a href="LuCI.Network.WifiDevice.html#getWifiNetworks">getWifiNetworks</a></li>
616             
617                 <li data-name="LuCI.Network.WifiDevice#isDisabled"><a href="LuCI.Network.WifiDevice.html#isDisabled">isDisabled</a></li>
618             
619                 <li data-name="LuCI.Network.WifiDevice#isUp"><a href="LuCI.Network.WifiDevice.html#isUp">isUp</a></li>
620             
621                 <li data-name="LuCI.Network.WifiDevice#set"><a href="LuCI.Network.WifiDevice.html#set">set</a></li>
622             
623             </ul>
624             <ul class="events itemMembers">
625             
626             </ul>
627         </li>
628     
629         <li class="item" data-name="LuCI.Network.WifiNetwork">
630             <span class="title">
631                 <a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a>
632                 
633             </span>
634             <ul class="members itemMembers">
635             
636             </ul>
637             <ul class="typedefs itemMembers">
638             
639             </ul>
640             <ul class="typedefs itemMembers">
641             
642             </ul>
643             <ul class="methods itemMembers">
644             
645             <span class="subtitle">Methods</span>
646             
647                 <li data-name="LuCI.Network.WifiNetwork#disconnectClient"><a href="LuCI.Network.WifiNetwork.html#disconnectClient">disconnectClient</a></li>
648             
649                 <li data-name="LuCI.Network.WifiNetwork#get"><a href="LuCI.Network.WifiNetwork.html#get">get</a></li>
650             
651                 <li data-name="LuCI.Network.WifiNetwork#getActiveBSSID"><a href="LuCI.Network.WifiNetwork.html#getActiveBSSID">getActiveBSSID</a></li>
652             
653                 <li data-name="LuCI.Network.WifiNetwork#getActiveEncryption"><a href="LuCI.Network.WifiNetwork.html#getActiveEncryption">getActiveEncryption</a></li>
654             
655                 <li data-name="LuCI.Network.WifiNetwork#getActiveMode"><a href="LuCI.Network.WifiNetwork.html#getActiveMode">getActiveMode</a></li>
656             
657                 <li data-name="LuCI.Network.WifiNetwork#getActiveModeI18n"><a href="LuCI.Network.WifiNetwork.html#getActiveModeI18n">getActiveModeI18n</a></li>
658             
659                 <li data-name="LuCI.Network.WifiNetwork#getActiveSSID"><a href="LuCI.Network.WifiNetwork.html#getActiveSSID">getActiveSSID</a></li>
660             
661                 <li data-name="LuCI.Network.WifiNetwork#getAssocList"><a href="LuCI.Network.WifiNetwork.html#getAssocList">getAssocList</a></li>
662             
663                 <li data-name="LuCI.Network.WifiNetwork#getBitRate"><a href="LuCI.Network.WifiNetwork.html#getBitRate">getBitRate</a></li>
664             
665                 <li data-name="LuCI.Network.WifiNetwork#getBSSID"><a href="LuCI.Network.WifiNetwork.html#getBSSID">getBSSID</a></li>
666             
667                 <li data-name="LuCI.Network.WifiNetwork#getChannel"><a href="LuCI.Network.WifiNetwork.html#getChannel">getChannel</a></li>
668             
669                 <li data-name="LuCI.Network.WifiNetwork#getCountryCode"><a href="LuCI.Network.WifiNetwork.html#getCountryCode">getCountryCode</a></li>
670             
671                 <li data-name="LuCI.Network.WifiNetwork#getDevice"><a href="LuCI.Network.WifiNetwork.html#getDevice">getDevice</a></li>
672             
673                 <li data-name="LuCI.Network.WifiNetwork#getFrequency"><a href="LuCI.Network.WifiNetwork.html#getFrequency">getFrequency</a></li>
674             
675                 <li data-name="LuCI.Network.WifiNetwork#getI18n"><a href="LuCI.Network.WifiNetwork.html#getI18n">getI18n</a></li>
676             
677                 <li data-name="LuCI.Network.WifiNetwork#getID"><a href="LuCI.Network.WifiNetwork.html#getID">getID</a></li>
678             
679                 <li data-name="LuCI.Network.WifiNetwork#getIfname"><a href="LuCI.Network.WifiNetwork.html#getIfname">getIfname</a></li>
680             
681                 <li data-name="LuCI.Network.WifiNetwork#getMeshID"><a href="LuCI.Network.WifiNetwork.html#getMeshID">getMeshID</a></li>
682             
683                 <li data-name="LuCI.Network.WifiNetwork#getMode"><a href="LuCI.Network.WifiNetwork.html#getMode">getMode</a></li>
684             
685                 <li data-name="LuCI.Network.WifiNetwork#getName"><a href="LuCI.Network.WifiNetwork.html#getName">getName</a></li>
686             
687                 <li data-name="LuCI.Network.WifiNetwork#getNetwork"><a href="LuCI.Network.WifiNetwork.html#getNetwork">getNetwork</a></li>
688             
689                 <li data-name="LuCI.Network.WifiNetwork#getNetworkNames"><a href="LuCI.Network.WifiNetwork.html#getNetworkNames">getNetworkNames</a></li>
690             
691                 <li data-name="LuCI.Network.WifiNetwork#getNetworks"><a href="LuCI.Network.WifiNetwork.html#getNetworks">getNetworks</a></li>
692             
693                 <li data-name="LuCI.Network.WifiNetwork#getNoise"><a href="LuCI.Network.WifiNetwork.html#getNoise">getNoise</a></li>
694             
695                 <li data-name="LuCI.Network.WifiNetwork#getShortName"><a href="LuCI.Network.WifiNetwork.html#getShortName">getShortName</a></li>
696             
697                 <li data-name="LuCI.Network.WifiNetwork#getSignal"><a href="LuCI.Network.WifiNetwork.html#getSignal">getSignal</a></li>
698             
699                 <li data-name="LuCI.Network.WifiNetwork#getSignalLevel"><a href="LuCI.Network.WifiNetwork.html#getSignalLevel">getSignalLevel</a></li>
700             
701                 <li data-name="LuCI.Network.WifiNetwork#getSignalPercent"><a href="LuCI.Network.WifiNetwork.html#getSignalPercent">getSignalPercent</a></li>
702             
703                 <li data-name="LuCI.Network.WifiNetwork#getSSID"><a href="LuCI.Network.WifiNetwork.html#getSSID">getSSID</a></li>
704             
705                 <li data-name="LuCI.Network.WifiNetwork#getTXPower"><a href="LuCI.Network.WifiNetwork.html#getTXPower">getTXPower</a></li>
706             
707                 <li data-name="LuCI.Network.WifiNetwork#getTXPowerOffset"><a href="LuCI.Network.WifiNetwork.html#getTXPowerOffset">getTXPowerOffset</a></li>
708             
709                 <li data-name="LuCI.Network.WifiNetwork#getWifiDevice"><a href="LuCI.Network.WifiNetwork.html#getWifiDevice">getWifiDevice</a></li>
710             
711                 <li data-name="LuCI.Network.WifiNetwork#getWifiDeviceName"><a href="LuCI.Network.WifiNetwork.html#getWifiDeviceName">getWifiDeviceName</a></li>
712             
713                 <li data-name="LuCI.Network.WifiNetwork#isClientDisconnectSupported"><a href="LuCI.Network.WifiNetwork.html#isClientDisconnectSupported">isClientDisconnectSupported</a></li>
714             
715                 <li data-name="LuCI.Network.WifiNetwork#isDisabled"><a href="LuCI.Network.WifiNetwork.html#isDisabled">isDisabled</a></li>
716             
717                 <li data-name="LuCI.Network.WifiNetwork#isUp"><a href="LuCI.Network.WifiNetwork.html#isUp">isUp</a></li>
718             
719                 <li data-name="LuCI.Network.WifiNetwork#set"><a href="LuCI.Network.WifiNetwork.html#set">set</a></li>
720             
721             </ul>
722             <ul class="events itemMembers">
723             
724             </ul>
725         </li>
726     
727         <li class="item" data-name="LuCI.Poll">
728             <span class="title">
729                 <a href="LuCI.Poll.html">LuCI.Poll</a>
730                 
731             </span>
732             <ul class="members itemMembers">
733             
734             </ul>
735             <ul class="typedefs itemMembers">
736             
737             </ul>
738             <ul class="typedefs itemMembers">
739             
740             </ul>
741             <ul class="methods itemMembers">
742             
743             <span class="subtitle">Methods</span>
744             
745                 <li data-name="LuCI.Poll#active"><a href="LuCI.Poll.html#active">active</a></li>
746             
747                 <li data-name="LuCI.Poll#add"><a href="LuCI.Poll.html#add">add</a></li>
748             
749                 <li data-name="LuCI.Poll#remove"><a href="LuCI.Poll.html#remove">remove</a></li>
750             
751                 <li data-name="LuCI.Poll#start"><a href="LuCI.Poll.html#start">start</a></li>
752             
753                 <li data-name="LuCI.Poll#stop"><a href="LuCI.Poll.html#stop">stop</a></li>
754             
755             </ul>
756             <ul class="events itemMembers">
757             
758             </ul>
759         </li>
760     
761         <li class="item" data-name="LuCI.Request">
762             <span class="title">
763                 <a href="LuCI.Request.html">LuCI.Request</a>
764                 
765             </span>
766             <ul class="members itemMembers">
767             
768             </ul>
769             <ul class="typedefs itemMembers">
770             
771             <span class="subtitle">Typedefs</span>
772             
773                 <li data-name="LuCI.Request.interceptorFn"><a href="LuCI.Request.html#.interceptorFn">interceptorFn</a></li>
774             
775                 <li data-name="LuCI.Request.RequestOptions"><a href="LuCI.Request.html#.RequestOptions">RequestOptions</a></li>
776             
777             </ul>
778             <ul class="typedefs itemMembers">
779             
780             </ul>
781             <ul class="methods itemMembers">
782             
783             <span class="subtitle">Methods</span>
784             
785                 <li data-name="LuCI.Request#addInterceptor"><a href="LuCI.Request.html#addInterceptor">addInterceptor</a></li>
786             
787                 <li data-name="LuCI.Request#expandURL"><a href="LuCI.Request.html#expandURL">expandURL</a></li>
788             
789                 <li data-name="LuCI.Request#get"><a href="LuCI.Request.html#get">get</a></li>
790             
791                 <li data-name="LuCI.Request#post"><a href="LuCI.Request.html#post">post</a></li>
792             
793                 <li data-name="LuCI.Request#removeInterceptor"><a href="LuCI.Request.html#removeInterceptor">removeInterceptor</a></li>
794             
795                 <li data-name="LuCI.Request#request"><a href="LuCI.Request.html#request">request</a></li>
796             
797             </ul>
798             <ul class="events itemMembers">
799             
800             </ul>
801         </li>
802     
803         <li class="item" data-name="LuCI.Request.poll">
804             <span class="title">
805                 <a href="LuCI.Request.poll.html">LuCI.Request.poll</a>
806                 
807             </span>
808             <ul class="members itemMembers">
809             
810             </ul>
811             <ul class="typedefs itemMembers">
812             
813             <span class="subtitle">Typedefs</span>
814             
815                 <li data-name="LuCI.Request.poll~callbackFn"><a href="LuCI.Request.poll.html#~callbackFn">callbackFn</a></li>
816             
817             </ul>
818             <ul class="typedefs itemMembers">
819             
820             </ul>
821             <ul class="methods itemMembers">
822             
823             <span class="subtitle">Methods</span>
824             
825                 <li data-name="LuCI.Request.poll#active"><a href="LuCI.Request.poll.html#active">active</a></li>
826             
827                 <li data-name="LuCI.Request.poll#add"><a href="LuCI.Request.poll.html#add">add</a></li>
828             
829                 <li data-name="LuCI.Request.poll#remove"><a href="LuCI.Request.poll.html#remove">remove</a></li>
830             
831                 <li data-name="LuCI.Request.poll#start"><a href="LuCI.Request.poll.html#start">start</a></li>
832             
833                 <li data-name="LuCI.Request.poll#stop"><a href="LuCI.Request.poll.html#stop">stop</a></li>
834             
835             </ul>
836             <ul class="events itemMembers">
837             
838             </ul>
839         </li>
840     
841         <li class="item" data-name="LuCI.Response">
842             <span class="title">
843                 <a href="LuCI.Response.html">LuCI.Response</a>
844                 
845             </span>
846             <ul class="members itemMembers">
847             
848             <span class="subtitle">Members</span>
849             
850                 <li data-name="LuCI.Response#duration"><a href="LuCI.Response.html#duration">duration</a></li>
851             
852                 <li data-name="LuCI.Response#headers"><a href="LuCI.Response.html#headers">headers</a></li>
853             
854                 <li data-name="LuCI.Response#ok"><a href="LuCI.Response.html#ok">ok</a></li>
855             
856                 <li data-name="LuCI.Response#status"><a href="LuCI.Response.html#status">status</a></li>
857             
858                 <li data-name="LuCI.Response#statusText"><a href="LuCI.Response.html#statusText">statusText</a></li>
859             
860                 <li data-name="LuCI.Response#url"><a href="LuCI.Response.html#url">url</a></li>
861             
862             </ul>
863             <ul class="typedefs itemMembers">
864             
865             </ul>
866             <ul class="typedefs itemMembers">
867             
868             </ul>
869             <ul class="methods itemMembers">
870             
871             <span class="subtitle">Methods</span>
872             
873                 <li data-name="LuCI.Response#blob"><a href="LuCI.Response.html#blob">blob</a></li>
874             
875                 <li data-name="LuCI.Response#clone"><a href="LuCI.Response.html#clone">clone</a></li>
876             
877                 <li data-name="LuCI.Response#json"><a href="LuCI.Response.html#json">json</a></li>
878             
879                 <li data-name="LuCI.Response#text"><a href="LuCI.Response.html#text">text</a></li>
880             
881             </ul>
882             <ul class="events itemMembers">
883             
884             </ul>
885         </li>
886     
887         <li class="item" data-name="LuCI.rpc">
888             <span class="title">
889                 <a href="LuCI.rpc.html">LuCI.rpc</a>
890                 
891             </span>
892             <ul class="members itemMembers">
893             
894             </ul>
895             <ul class="typedefs itemMembers">
896             
897             <span class="subtitle">Typedefs</span>
898             
899                 <li data-name="LuCI.rpc.DeclareOptions"><a href="LuCI.rpc.html#.DeclareOptions">DeclareOptions</a></li>
900             
901                 <li data-name="LuCI.rpc~filterFn"><a href="LuCI.rpc.html#~filterFn">filterFn</a></li>
902             
903                 <li data-name="LuCI.rpc~interceptorFn"><a href="LuCI.rpc.html#~interceptorFn">interceptorFn</a></li>
904             
905                 <li data-name="LuCI.rpc~invokeFn"><a href="LuCI.rpc.html#~invokeFn">invokeFn</a></li>
906             
907             </ul>
908             <ul class="typedefs itemMembers">
909             
910             </ul>
911             <ul class="methods itemMembers">
912             
913             <span class="subtitle">Methods</span>
914             
915                 <li data-name="LuCI.rpc#addInterceptor"><a href="LuCI.rpc.html#addInterceptor">addInterceptor</a></li>
916             
917                 <li data-name="LuCI.rpc#declare"><a href="LuCI.rpc.html#declare">declare</a></li>
918             
919                 <li data-name="LuCI.rpc#getBaseURL"><a href="LuCI.rpc.html#getBaseURL">getBaseURL</a></li>
920             
921                 <li data-name="LuCI.rpc#getSessionID"><a href="LuCI.rpc.html#getSessionID">getSessionID</a></li>
922             
923                 <li data-name="LuCI.rpc#getStatusText"><a href="LuCI.rpc.html#getStatusText">getStatusText</a></li>
924             
925                 <li data-name="LuCI.rpc#list"><a href="LuCI.rpc.html#list">list</a></li>
926             
927                 <li data-name="LuCI.rpc#removeInterceptor"><a href="LuCI.rpc.html#removeInterceptor">removeInterceptor</a></li>
928             
929                 <li data-name="LuCI.rpc#setBaseURL"><a href="LuCI.rpc.html#setBaseURL">setBaseURL</a></li>
930             
931                 <li data-name="LuCI.rpc#setSessionID"><a href="LuCI.rpc.html#setSessionID">setSessionID</a></li>
932             
933             </ul>
934             <ul class="events itemMembers">
935             
936             </ul>
937         </li>
938     
939         <li class="item" data-name="LuCI.uci">
940             <span class="title">
941                 <a href="LuCI.uci.html">LuCI.uci</a>
942                 
943             </span>
944             <ul class="members itemMembers">
945             
946             </ul>
947             <ul class="typedefs itemMembers">
948             
949             <span class="subtitle">Typedefs</span>
950             
951                 <li data-name="LuCI.uci.ChangeRecord"><a href="LuCI.uci.html#.ChangeRecord">ChangeRecord</a></li>
952             
953                 <li data-name="LuCI.uci.SectionObject"><a href="LuCI.uci.html#.SectionObject">SectionObject</a></li>
954             
955                 <li data-name="LuCI.uci~sectionsFn"><a href="LuCI.uci.html#~sectionsFn">sectionsFn</a></li>
956             
957             </ul>
958             <ul class="typedefs itemMembers">
959             
960             </ul>
961             <ul class="methods itemMembers">
962             
963             <span class="subtitle">Methods</span>
964             
965                 <li data-name="LuCI.uci#add"><a href="LuCI.uci.html#add">add</a></li>
966             
967                 <li data-name="LuCI.uci#apply"><a href="LuCI.uci.html#apply">apply</a></li>
968             
969                 <li data-name="LuCI.uci#changes"><a href="LuCI.uci.html#changes">changes</a></li>
970             
971                 <li data-name="LuCI.uci#createSID"><a href="LuCI.uci.html#createSID">createSID</a></li>
972             
973                 <li data-name="LuCI.uci#get"><a href="LuCI.uci.html#get">get</a></li>
974             
975                 <li data-name="LuCI.uci#get_first"><a href="LuCI.uci.html#get_first">get_first</a></li>
976             
977                 <li data-name="LuCI.uci#load"><a href="LuCI.uci.html#load">load</a></li>
978             
979                 <li data-name="LuCI.uci#move"><a href="LuCI.uci.html#move">move</a></li>
980             
981                 <li data-name="LuCI.uci#remove"><a href="LuCI.uci.html#remove">remove</a></li>
982             
983                 <li data-name="LuCI.uci#resolveSID"><a href="LuCI.uci.html#resolveSID">resolveSID</a></li>
984             
985                 <li data-name="LuCI.uci#save"><a href="LuCI.uci.html#save">save</a></li>
986             
987                 <li data-name="LuCI.uci#sections"><a href="LuCI.uci.html#sections">sections</a></li>
988             
989                 <li data-name="LuCI.uci#set"><a href="LuCI.uci.html#set">set</a></li>
990             
991                 <li data-name="LuCI.uci#set_first"><a href="LuCI.uci.html#set_first">set_first</a></li>
992             
993                 <li data-name="LuCI.uci#unload"><a href="LuCI.uci.html#unload">unload</a></li>
994             
995                 <li data-name="LuCI.uci#unset"><a href="LuCI.uci.html#unset">unset</a></li>
996             
997                 <li data-name="LuCI.uci#unset_first"><a href="LuCI.uci.html#unset_first">unset_first</a></li>
998             
999             </ul>
1000             <ul class="events itemMembers">
1001             
1002             </ul>
1003         </li>
1004     
1005         <li class="item" data-name="LuCI.view">
1006             <span class="title">
1007                 <a href="LuCI.view.html">LuCI.view</a>
1008                 
1009             </span>
1010             <ul class="members itemMembers">
1011             
1012             </ul>
1013             <ul class="typedefs itemMembers">
1014             
1015             </ul>
1016             <ul class="typedefs itemMembers">
1017             
1018             </ul>
1019             <ul class="methods itemMembers">
1020             
1021             <span class="subtitle">Methods</span>
1022             
1023                 <li data-name="LuCI.view#addFooter"><a href="LuCI.view.html#addFooter">addFooter</a></li>
1024             
1025                 <li data-name="LuCI.view#handleReset"><a href="LuCI.view.html#handleReset">handleReset</a></li>
1026             
1027                 <li data-name="LuCI.view#handleSave"><a href="LuCI.view.html#handleSave">handleSave</a></li>
1028             
1029                 <li data-name="LuCI.view#handleSaveApply"><a href="LuCI.view.html#handleSaveApply">handleSaveApply</a></li>
1030             
1031                 <li data-name="LuCI.view#load"><a href="LuCI.view.html#load">load</a></li>
1032             
1033                 <li data-name="LuCI.view#render"><a href="LuCI.view.html#render">render</a></li>
1034             
1035             </ul>
1036             <ul class="events itemMembers">
1037             
1038             </ul>
1039         </li>
1040     
1041         <li class="item" data-name="LuCI.XHR">
1042             <span class="title">
1043                 <a href="LuCI.XHR.html">LuCI.XHR</a>
1044                 
1045             </span>
1046             <ul class="members itemMembers">
1047             
1048             </ul>
1049             <ul class="typedefs itemMembers">
1050             
1051             </ul>
1052             <ul class="typedefs itemMembers">
1053             
1054             </ul>
1055             <ul class="methods itemMembers">
1056             
1057             <span class="subtitle">Methods</span>
1058             
1059                 <li data-name="LuCI.XHR#abort"><a href="LuCI.XHR.html#abort">abort</a></li>
1060             
1061                 <li data-name="LuCI.XHR#busy"><a href="LuCI.XHR.html#busy">busy</a></li>
1062             
1063                 <li data-name="LuCI.XHR#cancel"><a href="LuCI.XHR.html#cancel">cancel</a></li>
1064             
1065                 <li data-name="LuCI.XHR#get"><a href="LuCI.XHR.html#get">get</a></li>
1066             
1067                 <li data-name="LuCI.XHR#post"><a href="LuCI.XHR.html#post">post</a></li>
1068             
1069                 <li data-name="LuCI.XHR#send_form"><a href="LuCI.XHR.html#send_form">send_form</a></li>
1070             
1071             </ul>
1072             <ul class="events itemMembers">
1073             
1074             </ul>
1075         </li>
1076     
1077     </ul>
1078 </div>
1079     <div class="main">
1080         <h1 class="page-title" data-filename="luci.js.html">Source: luci.js</h1>
1081         
1082
1083
1084     
1085     <section>
1086         <article>
1087             <pre id="source-code" class="prettyprint source "><code>/**
1088  * @class LuCI
1089  * @classdesc
1090  *
1091  * This is the LuCI base class. It is automatically instantiated and
1092  * accessible using the global `L` variable.
1093  *
1094  * @param {Object} env
1095  * The environment settings to use for the LuCI runtime.
1096  */
1097
1098 (function(window, document, undefined) {
1099         'use strict';
1100
1101         /* Object.assign polyfill for IE */
1102         if (typeof Object.assign !== 'function') {
1103                 Object.defineProperty(Object, 'assign', {
1104                         value: function assign(target, varArgs) {
1105                                 if (target == null)
1106                                         throw new TypeError('Cannot convert undefined or null to object');
1107
1108                                 var to = Object(target);
1109
1110                                 for (var index = 1; index &lt; arguments.length; index++)
1111                                         if (arguments[index] != null)
1112                                                 for (var nextKey in arguments[index])
1113                                                         if (Object.prototype.hasOwnProperty.call(arguments[index], nextKey))
1114                                                                 to[nextKey] = arguments[index][nextKey];
1115
1116                                 return to;
1117                         },
1118                         writable: true,
1119                         configurable: true
1120                 });
1121         }
1122
1123         /* Promise.finally polyfill */
1124         if (typeof Promise.prototype.finally !== 'function') {
1125                 Promise.prototype.finally = function(fn) {
1126                         var onFinally = function(cb) {
1127                                 return Promise.resolve(fn.call(this)).then(cb);
1128                         };
1129
1130                         return this.then(
1131                                 function(result) { return onFinally.call(this, function() { return result }) },
1132                                 function(reason) { return onFinally.call(this, function() { return Promise.reject(reason) }) }
1133                         );
1134                 };
1135         }
1136
1137         /*
1138          * Class declaration and inheritance helper
1139          */
1140
1141         var toCamelCase = function(s) {
1142                 return s.replace(/(?:^|[\. -])(.)/g, function(m0, m1) { return m1.toUpperCase() });
1143         };
1144
1145         /**
1146          * @class Class
1147          * @hideconstructor
1148          * @memberof LuCI
1149          * @classdesc
1150          *
1151          * `LuCI.Class` is the abstract base class all LuCI classes inherit from.
1152          *
1153          * It provides simple means to create subclasses of given classes and
1154          * implements prototypal inheritance.
1155          */
1156         var superContext = {}, classIndex = 0, Class = Object.assign(function() {}, {
1157                 /**
1158                  * Extends this base class with the properties described in
1159                  * `properties` and returns a new subclassed Class instance
1160                  *
1161                  * @memberof LuCI.Class
1162                  *
1163                  * @param {Object&lt;string, *>} properties
1164                  * An object describing the properties to add to the new
1165                  * subclass.
1166                  *
1167                  * @returns {LuCI.Class}
1168                  * Returns a new LuCI.Class sublassed from this class, extended
1169                  * by the given properties and with its prototype set to this base
1170                  * class to enable inheritance. The resulting value represents a
1171                  * class constructor and can be instantiated with `new`.
1172                  */
1173                 extend: function(properties) {
1174                         var props = {
1175                                 __id__: { value: classIndex },
1176                                 __base__: { value: this.prototype },
1177                                 __name__: { value: properties.__name__ || 'anonymous' + classIndex++ }
1178                         };
1179
1180                         var ClassConstructor = function() {
1181                                 if (!(this instanceof ClassConstructor))
1182                                         throw new TypeError('Constructor must not be called without "new"');
1183
1184                                 if (Object.getPrototypeOf(this).hasOwnProperty('__init__')) {
1185                                         if (typeof(this.__init__) != 'function')
1186                                                 throw new TypeError('Class __init__ member is not a function');
1187
1188                                         this.__init__.apply(this, arguments)
1189                                 }
1190                                 else {
1191                                         this.super('__init__', arguments);
1192                                 }
1193                         };
1194
1195                         for (var key in properties)
1196                                 if (!props[key] &amp;&amp; properties.hasOwnProperty(key))
1197                                         props[key] = { value: properties[key], writable: true };
1198
1199                         ClassConstructor.prototype = Object.create(this.prototype, props);
1200                         ClassConstructor.prototype.constructor = ClassConstructor;
1201                         Object.assign(ClassConstructor, this);
1202                         ClassConstructor.displayName = toCamelCase(props.__name__.value + 'Class');
1203
1204                         return ClassConstructor;
1205                 },
1206
1207                 /**
1208                  * Extends this base class with the properties described in
1209                  * `properties`, instantiates the resulting subclass using
1210                  * the additional optional arguments passed to this function
1211                  * and returns the resulting subclassed Class instance.
1212                  *
1213                  * This function serves as a convenience shortcut for
1214                  * {@link LuCI.Class.extend Class.extend()} and subsequent
1215                  * `new`.
1216                  *
1217                  * @memberof LuCI.Class
1218                  *
1219                  * @param {Object&lt;string, *>} properties
1220                  * An object describing the properties to add to the new
1221                  * subclass.
1222                  *
1223                  * @param {...*} [new_args]
1224                  * Specifies arguments to be passed to the subclass constructor
1225                  * as-is in order to instantiate the new subclass.
1226                  *
1227                  * @returns {LuCI.Class}
1228                  * Returns a new LuCI.Class instance extended by the given
1229                  * properties with its prototype set to this base class to
1230                  * enable inheritance.
1231                  */
1232                 singleton: function(properties /*, ... */) {
1233                         return Class.extend(properties)
1234                                 .instantiate(Class.prototype.varargs(arguments, 1));
1235                 },
1236
1237                 /**
1238                  * Calls the class constructor using `new` with the given argument
1239                  * array being passed as variadic parameters to the constructor.
1240                  *
1241                  * @memberof LuCI.Class
1242                  *
1243                  * @param {Array&lt;*>} params
1244                  * An array of arbitrary values which will be passed as arguments
1245                  * to the constructor function.
1246                  *
1247                  * @param {...*} [new_args]
1248                  * Specifies arguments to be passed to the subclass constructor
1249                  * as-is in order to instantiate the new subclass.
1250                  *
1251                  * @returns {LuCI.Class}
1252                  * Returns a new LuCI.Class instance extended by the given
1253                  * properties with its prototype set to this base class to
1254                  * enable inheritance.
1255                  */
1256                 instantiate: function(args) {
1257                         return new (Function.prototype.bind.apply(this,
1258                                 Class.prototype.varargs(args, 0, null)))();
1259                 },
1260
1261                 /* unused */
1262                 call: function(self, method) {
1263                         if (typeof(this.prototype[method]) != 'function')
1264                                 throw new ReferenceError(method + ' is not defined in class');
1265
1266                         return this.prototype[method].apply(self, self.varargs(arguments, 1));
1267                 },
1268
1269                 /**
1270                  * Checks whether the given class value is a subclass of this class.
1271                  *
1272                  * @memberof LuCI.Class
1273                  *
1274                  * @param {LuCI.Class} classValue
1275                  * The class object to test.
1276                  *
1277                  * @returns {boolean}
1278                  * Returns `true` when the given `classValue` is a subclass of this
1279                  * class or `false` if the given value is not a valid class or not
1280                  * a subclass of this class'.
1281                  */
1282                 isSubclass: function(classValue) {
1283                         return (classValue != null &amp;&amp;
1284                                 typeof(classValue) == 'function' &amp;&amp;
1285                                 classValue.prototype instanceof this);
1286                 },
1287
1288                 prototype: {
1289                         /**
1290                          * Extract all values from the given argument array beginning from
1291                          * `offset` and prepend any further given optional parameters to
1292                          * the beginning of the resulting array copy.
1293                          *
1294                          * @memberof LuCI.Class
1295                          * @instance
1296                          *
1297                          * @param {Array&lt;*>} args
1298                          * The array to extract the values from.
1299                          *
1300                          * @param {number} offset
1301                          * The offset from which to extract the values. An offset of `0`
1302                          * would copy all values till the end.
1303                          *
1304                          * @param {...*} [extra_args]
1305                          * Extra arguments to add to prepend to the resultung array.
1306                          *
1307                          * @returns {Array&lt;*>}
1308                          * Returns a new array consisting of the optional extra arguments
1309                          * and the values extracted from the `args` array beginning with
1310                          * `offset`.
1311                          */
1312                         varargs: function(args, offset /*, ... */) {
1313                                 return Array.prototype.slice.call(arguments, 2)
1314                                         .concat(Array.prototype.slice.call(args, offset));
1315                         },
1316
1317                         /**
1318                          * Walks up the parent class chain and looks for a class member
1319                          * called `key` in any of the parent classes this class inherits
1320                          * from. Returns the member value of the superclass or calls the
1321                          * member as function and returns its return value when the
1322                          * optional `callArgs` array is given.
1323                          *
1324                          * This function has two signatures and is sensitive to the
1325                          * amount of arguments passed to it:
1326                          *  - `super('key')` -
1327                          *    Returns the value of `key` when found within one of the
1328                          *    parent classes.
1329                          *  - `super('key', ['arg1', 'arg2'])` -
1330                          *    Calls the `key()` method with parameters `arg1` and `arg2`
1331                          *    when found within one of the parent classes.
1332                          *
1333                          * @memberof LuCI.Class
1334                          * @instance
1335                          *
1336                          * @param {string} key
1337                          * The name of the superclass member to retrieve.
1338                          *
1339                          * @param {Array&lt;*>} [callArgs]
1340                          * An optional array of function call parameters to use. When
1341                          * this parameter is specified, the found member value is called
1342                          * as function using the values of this array as arguments.
1343                          *
1344                          * @throws {ReferenceError}
1345                          * Throws a `ReferenceError` when `callArgs` are specified and
1346                          * the found member named by `key` is not a function value.
1347                          *
1348                          * @returns {*|null}
1349                          * Returns the value of the found member or the return value of
1350                          * the call to the found method. Returns `null` when no member
1351                          * was found in the parent class chain or when the call to the
1352                          * superclass method returned `null`.
1353                          */
1354                         super: function(key, callArgs) {
1355                                 if (key == null)
1356                                         return null;
1357
1358                                 var slotIdx = this.__id__ + '.' + key,
1359                                     symStack = superContext[slotIdx],
1360                                     protoCtx = null;
1361
1362                                 for (protoCtx = Object.getPrototypeOf(symStack ? symStack[0] : Object.getPrototypeOf(this));
1363                                      protoCtx != null &amp;&amp; !protoCtx.hasOwnProperty(key);
1364                                      protoCtx = Object.getPrototypeOf(protoCtx)) {}
1365
1366                                 if (protoCtx == null)
1367                                         return null;
1368
1369                                 var res = protoCtx[key];
1370
1371                                 if (arguments.length > 1) {
1372                                         if (typeof(res) != 'function')
1373                                                 throw new ReferenceError(key + ' is not a function in base class');
1374
1375                                         if (typeof(callArgs) != 'object')
1376                                                 callArgs = this.varargs(arguments, 1);
1377
1378                                         if (symStack)
1379                                                 symStack.unshift(protoCtx);
1380                                         else
1381                                                 superContext[slotIdx] = [ protoCtx ];
1382
1383                                         res = res.apply(this, callArgs);
1384
1385                                         if (symStack &amp;&amp; symStack.length > 1)
1386                                                 symStack.shift(protoCtx);
1387                                         else
1388                                                 delete superContext[slotIdx];
1389                                 }
1390
1391                                 return res;
1392                         },
1393
1394                         /**
1395                          * Returns a string representation of this class.
1396                          *
1397                          * @returns {string}
1398                          * Returns a string representation of this class containing the
1399                          * constructor functions `displayName` and describing the class
1400                          * members and their respective types.
1401                          */
1402                         toString: function() {
1403                                 var s = '[' + this.constructor.displayName + ']', f = true;
1404                                 for (var k in this) {
1405                                         if (this.hasOwnProperty(k)) {
1406                                                 s += (f ? ' {\n' : '') + '  ' + k + ': ' + typeof(this[k]) + '\n';
1407                                                 f = false;
1408                                         }
1409                                 }
1410                                 return s + (f ? '' : '}');
1411                         }
1412                 }
1413         });
1414
1415
1416         /**
1417          * @class
1418          * @memberof LuCI
1419          * @hideconstructor
1420          * @classdesc
1421          *
1422          * The `Headers` class is an internal utility class exposed in HTTP
1423          * response objects using the `response.headers` property.
1424          */
1425         var Headers = Class.extend(/** @lends LuCI.Headers.prototype */ {
1426                 __name__: 'LuCI.XHR.Headers',
1427                 __init__: function(xhr) {
1428                         var hdrs = this.headers = {};
1429                         xhr.getAllResponseHeaders().split(/\r\n/).forEach(function(line) {
1430                                 var m = /^([^:]+):(.*)$/.exec(line);
1431                                 if (m != null)
1432                                         hdrs[m[1].trim().toLowerCase()] = m[2].trim();
1433                         });
1434                 },
1435
1436                 /**
1437                  * Checks whether the given header name is present.
1438                  * Note: Header-Names are case-insensitive.
1439                  *
1440                  * @instance
1441                  * @memberof LuCI.Headers
1442                  * @param {string} name
1443                  * The header name to check
1444                  *
1445                  * @returns {boolean}
1446                  * Returns `true` if the header name is present, `false` otherwise
1447                  */
1448                 has: function(name) {
1449                         return this.headers.hasOwnProperty(String(name).toLowerCase());
1450                 },
1451
1452                 /**
1453                  * Returns the value of the given header name.
1454                  * Note: Header-Names are case-insensitive.
1455                  *
1456                  * @instance
1457                  * @memberof LuCI.Headers
1458                  * @param {string} name
1459                  * The header name to read
1460                  *
1461                  * @returns {string|null}
1462                  * The value of the given header name or `null` if the header isn't present.
1463                  */
1464                 get: function(name) {
1465                         var key = String(name).toLowerCase();
1466                         return this.headers.hasOwnProperty(key) ? this.headers[key] : null;
1467                 }
1468         });
1469
1470         /**
1471          * @class
1472          * @memberof LuCI
1473          * @hideconstructor
1474          * @classdesc
1475          *
1476          * The `Response` class is an internal utility class representing HTTP responses.
1477          */
1478         var Response = Class.extend({
1479                 __name__: 'LuCI.XHR.Response',
1480                 __init__: function(xhr, url, duration, headers, content) {
1481                         /**
1482                          * Describes whether the response is successful (status codes `200..299`) or not
1483                          * @instance
1484                          * @memberof LuCI.Response
1485                          * @name ok
1486                          * @type {boolean}
1487                          */
1488                         this.ok = (xhr.status >= 200 &amp;&amp; xhr.status &lt;= 299);
1489
1490                         /**
1491                          * The numeric HTTP status code of the response
1492                          * @instance
1493                          * @memberof LuCI.Response
1494                          * @name status
1495                          * @type {number}
1496                          */
1497                         this.status = xhr.status;
1498
1499                         /**
1500                          * The HTTP status description message of the response
1501                          * @instance
1502                          * @memberof LuCI.Response
1503                          * @name statusText
1504                          * @type {string}
1505                          */
1506                         this.statusText = xhr.statusText;
1507
1508                         /**
1509                          * The HTTP headers of the response
1510                          * @instance
1511                          * @memberof LuCI.Response
1512                          * @name headers
1513                          * @type {LuCI.Headers}
1514                          */
1515                         this.headers = (headers != null) ? headers : new Headers(xhr);
1516
1517                         /**
1518                          * The total duration of the HTTP request in milliseconds
1519                          * @instance
1520                          * @memberof LuCI.Response
1521                          * @name duration
1522                          * @type {number}
1523                          */
1524                         this.duration = duration;
1525
1526                         /**
1527                          * The final URL of the request, i.e. after following redirects.
1528                          * @instance
1529                          * @memberof LuCI.Response
1530                          * @name url
1531                          * @type {string}
1532                          */
1533                         this.url = url;
1534
1535                         /* privates */
1536                         this.xhr = xhr;
1537
1538                         if (content instanceof Blob) {
1539                                 this.responseBlob = content;
1540                                 this.responseJSON = null;
1541                                 this.responseText = null;
1542                         }
1543                         else if (content != null &amp;&amp; typeof(content) == 'object') {
1544                                 this.responseBlob = null;
1545                                 this.responseJSON = content;
1546                                 this.responseText = null;
1547                         }
1548                         else if (content != null) {
1549                                 this.responseBlob = null;
1550                                 this.responseJSON = null;
1551                                 this.responseText = String(content);
1552                         }
1553                         else {
1554                                 this.responseJSON = null;
1555
1556                                 if (xhr.responseType == 'blob') {
1557                                         this.responseBlob = xhr.response;
1558                                         this.responseText = null;
1559                                 }
1560                                 else {
1561                                         this.responseBlob = null;
1562                                         this.responseText = xhr.responseText;
1563                                 }
1564                         }
1565                 },
1566
1567                 /**
1568                  * Clones the given response object, optionally overriding the content
1569                  * of the cloned instance.
1570                  *
1571                  * @instance
1572                  * @memberof LuCI.Response
1573                  * @param {*} [content]
1574                  * Override the content of the cloned response. Object values will be
1575                  * treated as JSON response data, all other types will be converted
1576                  * using `String()` and treated as response text.
1577                  *
1578                  * @returns {LuCI.Response}
1579                  * The cloned `Response` instance.
1580                  */
1581                 clone: function(content) {
1582                         var copy = new Response(this.xhr, this.url, this.duration, this.headers, content);
1583
1584                         copy.ok = this.ok;
1585                         copy.status = this.status;
1586                         copy.statusText = this.statusText;
1587
1588                         return copy;
1589                 },
1590
1591                 /**
1592                  * Access the response content as JSON data.
1593                  *
1594                  * @instance
1595                  * @memberof LuCI.Response
1596                  * @throws {SyntaxError}
1597                  * Throws `SyntaxError` if the content isn't valid JSON.
1598                  *
1599                  * @returns {*}
1600                  * The parsed JSON data.
1601                  */
1602                 json: function() {
1603                         if (this.responseJSON == null)
1604                                 this.responseJSON = JSON.parse(this.responseText);
1605
1606                         return this.responseJSON;
1607                 },
1608
1609                 /**
1610                  * Access the response content as string.
1611                  *
1612                  * @instance
1613                  * @memberof LuCI.Response
1614                  * @returns {string}
1615                  * The response content.
1616                  */
1617                 text: function() {
1618                         if (this.responseText == null &amp;&amp; this.responseJSON != null)
1619                                 this.responseText = JSON.stringify(this.responseJSON);
1620
1621                         return this.responseText;
1622                 },
1623
1624                 /**
1625                  * Access the response content as blob.
1626                  *
1627                  * @instance
1628                  * @memberof LuCI.Response
1629                  * @returns {Blob}
1630                  * The response content as blob.
1631                  */
1632                 blob: function() {
1633                         return this.responseBlob;
1634                 }
1635         });
1636
1637
1638         var requestQueue = [];
1639
1640         function isQueueableRequest(opt) {
1641                 if (!classes.rpc)
1642                         return false;
1643
1644                 if (opt.method != 'POST' || typeof(opt.content) != 'object')
1645                         return false;
1646
1647                 if (opt.nobatch === true)
1648                         return false;
1649
1650                 var rpcBaseURL = Request.expandURL(classes.rpc.getBaseURL());
1651
1652                 return (rpcBaseURL != null &amp;&amp; opt.url.indexOf(rpcBaseURL) == 0);
1653         }
1654
1655         function flushRequestQueue() {
1656                 if (!requestQueue.length)
1657                         return;
1658
1659                 var reqopt = Object.assign({}, requestQueue[0][0], { content: [], nobatch: true }),
1660                     batch = [];
1661
1662                 for (var i = 0; i &lt; requestQueue.length; i++) {
1663                         batch[i] = requestQueue[i];
1664                         reqopt.content[i] = batch[i][0].content;
1665                 }
1666
1667                 requestQueue.length = 0;
1668
1669                 Request.request(rpcBaseURL, reqopt).then(function(reply) {
1670                         var json = null, req = null;
1671
1672                         try { json = reply.json() }
1673                         catch(e) { }
1674
1675                         while ((req = batch.shift()) != null)
1676                                 if (Array.isArray(json) &amp;&amp; json.length)
1677                                         req[2].call(reqopt, reply.clone(json.shift()));
1678                                 else
1679                                         req[1].call(reqopt, new Error('No related RPC reply'));
1680                 }).catch(function(error) {
1681                         var req = null;
1682
1683                         while ((req = batch.shift()) != null)
1684                                 req[1].call(reqopt, error);
1685                 });
1686         }
1687
1688         /**
1689          * @class
1690          * @memberof LuCI
1691          * @hideconstructor
1692          * @classdesc
1693          *
1694          * The `Request` class allows initiating HTTP requests and provides utilities
1695          * for dealing with responses.
1696          */
1697         var Request = Class.singleton(/** @lends LuCI.Request.prototype */ {
1698                 __name__: 'LuCI.Request',
1699
1700                 interceptors: [],
1701
1702                 /**
1703                  * Turn the given relative URL into an absolute URL if necessary.
1704                  *
1705                  * @instance
1706                  * @memberof LuCI.Request
1707                  * @param {string} url
1708                  * The URL to convert.
1709                  *
1710                  * @returns {string}
1711                  * The absolute URL derived from the given one, or the original URL
1712                  * if it already was absolute.
1713                  */
1714                 expandURL: function(url) {
1715                         if (!/^(?:[^/]+:)?\/\//.test(url))
1716                                 url = location.protocol + '//' + location.host + url;
1717
1718                         return url;
1719                 },
1720
1721                 /**
1722                  * @typedef {Object} RequestOptions
1723                  * @memberof LuCI.Request
1724                  *
1725                  * @property {string} [method=GET]
1726                  * The HTTP method to use, e.g. `GET` or `POST`.
1727                  *
1728                  * @property {Object&lt;string, Object|string>} [query]
1729                  * Query string data to append to the URL. Non-string values of the
1730                  * given object will be converted to JSON.
1731                  *
1732                  * @property {boolean} [cache=false]
1733                  * Specifies whether the HTTP response may be retrieved from cache.
1734                  *
1735                  * @property {string} [username]
1736                  * Provides a username for HTTP basic authentication.
1737                  *
1738                  * @property {string} [password]
1739                  * Provides a password for HTTP basic authentication.
1740                  *
1741                  * @property {number} [timeout]
1742                  * Specifies the request timeout in seconds.
1743                  *
1744                  * @property {boolean} [credentials=false]
1745                  * Whether to include credentials such as cookies in the request.
1746                  *
1747                  * @property {string} [responseType=text]
1748                  * Overrides the request response type. Valid values or `text` to
1749                  * interpret the response as UTF-8 string or `blob` to handle the
1750                  * response as binary `Blob` data.
1751                  *
1752                  * @property {*} [content]
1753                  * Specifies the HTTP message body to send along with the request.
1754                  * If the value is a function, it is invoked and the return value
1755                  * used as content, if it is a FormData instance, it is used as-is,
1756                  * if it is an object, it will be converted to JSON, in all other
1757                  * cases it is converted to a string.
1758                  *
1759              * @property {Object&lt;string, string>} [header]
1760              * Specifies HTTP headers to set for the request.
1761              *
1762              * @property {function} [progress]
1763              * An optional request callback function which receives ProgressEvent
1764              * instances as sole argument during the HTTP request transfer.
1765                  */
1766
1767                 /**
1768                  * Initiate an HTTP request to the given target.
1769                  *
1770                  * @instance
1771                  * @memberof LuCI.Request
1772                  * @param {string} target
1773                  * The URL to request.
1774                  *
1775                  * @param {LuCI.Request.RequestOptions} [options]
1776                  * Additional options to configure the request.
1777                  *
1778                  * @returns {Promise&lt;LuCI.Response>}
1779                  * The resulting HTTP response.
1780                  */
1781                 request: function(target, options) {
1782                         var state = { xhr: new XMLHttpRequest(), url: this.expandURL(target), start: Date.now() },
1783                             opt = Object.assign({}, options, state),
1784                             content = null,
1785                             contenttype = null,
1786                             callback = this.handleReadyStateChange;
1787
1788                         return new Promise(function(resolveFn, rejectFn) {
1789                                 opt.xhr.onreadystatechange = callback.bind(opt, resolveFn, rejectFn);
1790                                 opt.method = String(opt.method || 'GET').toUpperCase();
1791
1792                                 if ('query' in opt) {
1793                                         var q = (opt.query != null) ? Object.keys(opt.query).map(function(k) {
1794                                                 if (opt.query[k] != null) {
1795                                                         var v = (typeof(opt.query[k]) == 'object')
1796                                                                 ? JSON.stringify(opt.query[k])
1797                                                                 : String(opt.query[k]);
1798
1799                                                         return '%s=%s'.format(encodeURIComponent(k), encodeURIComponent(v));
1800                                                 }
1801                                                 else {
1802                                                         return encodeURIComponent(k);
1803                                                 }
1804                                         }).join('&amp;') : '';
1805
1806                                         if (q !== '') {
1807                                                 switch (opt.method) {
1808                                                 case 'GET':
1809                                                 case 'HEAD':
1810                                                 case 'OPTIONS':
1811                                                         opt.url += ((/\?/).test(opt.url) ? '&amp;' : '?') + q;
1812                                                         break;
1813
1814                                                 default:
1815                                                         if (content == null) {
1816                                                                 content = q;
1817                                                                 contenttype = 'application/x-www-form-urlencoded';
1818                                                         }
1819                                                 }
1820                                         }
1821                                 }
1822
1823                                 if (!opt.cache)
1824                                         opt.url += ((/\?/).test(opt.url) ? '&amp;' : '?') + (new Date()).getTime();
1825
1826                                 if (isQueueableRequest(opt)) {
1827                                         requestQueue.push([opt, rejectFn, resolveFn]);
1828                                         requestAnimationFrame(flushRequestQueue);
1829                                         return;
1830                                 }
1831
1832                                 if ('username' in opt &amp;&amp; 'password' in opt)
1833                                         opt.xhr.open(opt.method, opt.url, true, opt.username, opt.password);
1834                                 else
1835                                         opt.xhr.open(opt.method, opt.url, true);
1836
1837                                 opt.xhr.responseType = opt.responseType || 'text';
1838
1839                                 if ('overrideMimeType' in opt.xhr)
1840                                         opt.xhr.overrideMimeType('application/octet-stream');
1841
1842                                 if ('timeout' in opt)
1843                                         opt.xhr.timeout = +opt.timeout;
1844
1845                                 if ('credentials' in opt)
1846                                         opt.xhr.withCredentials = !!opt.credentials;
1847
1848                                 if (opt.content != null) {
1849                                         switch (typeof(opt.content)) {
1850                                         case 'function':
1851                                                 content = opt.content(xhr);
1852                                                 break;
1853
1854                                         case 'object':
1855                                                 if (!(opt.content instanceof FormData)) {
1856                                                         content = JSON.stringify(opt.content);
1857                                                         contenttype = 'application/json';
1858                                                 }
1859                                                 else {
1860                                                         content = opt.content;
1861                                                 }
1862                                                 break;
1863
1864                                         default:
1865                                                 content = String(opt.content);
1866                                         }
1867                                 }
1868
1869                                 if ('headers' in opt)
1870                                         for (var header in opt.headers)
1871                                                 if (opt.headers.hasOwnProperty(header)) {
1872                                                         if (header.toLowerCase() != 'content-type')
1873                                                                 opt.xhr.setRequestHeader(header, opt.headers[header]);
1874                                                         else
1875                                                                 contenttype = opt.headers[header];
1876                                                 }
1877
1878                                 if ('progress' in opt &amp;&amp; 'upload' in opt.xhr)
1879                                         opt.xhr.upload.addEventListener('progress', opt.progress);
1880
1881                                 if (contenttype != null)
1882                                         opt.xhr.setRequestHeader('Content-Type', contenttype);
1883
1884                                 try {
1885                                         opt.xhr.send(content);
1886                                 }
1887                                 catch (e) {
1888                                         rejectFn.call(opt, e);
1889                                 }
1890                         });
1891                 },
1892
1893                 handleReadyStateChange: function(resolveFn, rejectFn, ev) {
1894                         var xhr = this.xhr,
1895                             duration = Date.now() - this.start;
1896
1897                         if (xhr.readyState !== 4)
1898                                 return;
1899
1900                         if (xhr.status === 0 &amp;&amp; xhr.statusText === '') {
1901                                 if (duration >= this.timeout)
1902                                         rejectFn.call(this, new Error('XHR request timed out'));
1903                                 else
1904                                         rejectFn.call(this, new Error('XHR request aborted by browser'));
1905                         }
1906                         else {
1907                                 var response = new Response(
1908                                         xhr, xhr.responseURL || this.url, duration);
1909
1910                                 Promise.all(Request.interceptors.map(function(fn) { return fn(response) }))
1911                                         .then(resolveFn.bind(this, response))
1912                                         .catch(rejectFn.bind(this));
1913                         }
1914                 },
1915
1916                 /**
1917                  * Initiate an HTTP GET request to the given target.
1918                  *
1919                  * @instance
1920                  * @memberof LuCI.Request
1921                  * @param {string} target
1922                  * The URL to request.
1923                  *
1924                  * @param {LuCI.Request.RequestOptions} [options]
1925                  * Additional options to configure the request.
1926                  *
1927                  * @returns {Promise&lt;LuCI.Response>}
1928                  * The resulting HTTP response.
1929                  */
1930                 get: function(url, options) {
1931                         return this.request(url, Object.assign({ method: 'GET' }, options));
1932                 },
1933
1934                 /**
1935                  * Initiate an HTTP POST request to the given target.
1936                  *
1937                  * @instance
1938                  * @memberof LuCI.Request
1939                  * @param {string} target
1940                  * The URL to request.
1941                  *
1942                  * @param {*} [data]
1943                  * The request data to send, see {@link LuCI.Request.RequestOptions} for details.
1944                  *
1945                  * @param {LuCI.Request.RequestOptions} [options]
1946                  * Additional options to configure the request.
1947                  *
1948                  * @returns {Promise&lt;LuCI.Response>}
1949                  * The resulting HTTP response.
1950                  */
1951                 post: function(url, data, options) {
1952                         return this.request(url, Object.assign({ method: 'POST', content: data }, options));
1953                 },
1954
1955                 /**
1956                  * Interceptor functions are invoked whenever an HTTP reply is received, in the order
1957                  * these functions have been registered.
1958                  * @callback LuCI.Request.interceptorFn
1959                  * @param {LuCI.Response} res
1960                  * The HTTP response object
1961                  */
1962
1963                 /**
1964                  * Register an HTTP response interceptor function. Interceptor
1965                  * functions are useful to perform default actions on incoming HTTP
1966                  * responses, such as checking for expired authentication or for
1967                  * implementing request retries before returning a failure.
1968                  *
1969                  * @instance
1970                  * @memberof LuCI.Request
1971                  * @param {LuCI.Request.interceptorFn} interceptorFn
1972                  * The interceptor function to register.
1973                  *
1974                  * @returns {LuCI.Request.interceptorFn}
1975                  * The registered function.
1976                  */
1977                 addInterceptor: function(interceptorFn) {
1978                         if (typeof(interceptorFn) == 'function')
1979                                 this.interceptors.push(interceptorFn);
1980                         return interceptorFn;
1981                 },
1982
1983                 /**
1984                  * Remove an HTTP response interceptor function. The passed function
1985                  * value must be the very same value that was used to register the
1986                  * function.
1987                  *
1988                  * @instance
1989                  * @memberof LuCI.Request
1990                  * @param {LuCI.Request.interceptorFn} interceptorFn
1991                  * The interceptor function to remove.
1992                  *
1993                  * @returns {boolean}
1994                  * Returns `true` if any function has been removed, else `false`.
1995                  */
1996                 removeInterceptor: function(interceptorFn) {
1997                         var oldlen = this.interceptors.length, i = oldlen;
1998                         while (i--)
1999                                 if (this.interceptors[i] === interceptorFn)
2000                                         this.interceptors.splice(i, 1);
2001                         return (this.interceptors.length &lt; oldlen);
2002                 },
2003
2004                 /**
2005                  * @class
2006                  * @memberof LuCI.Request
2007                  * @hideconstructor
2008                  * @classdesc
2009                  *
2010                  * The `Request.poll` class provides some convience wrappers around
2011                  * {@link LuCI.Poll} mainly to simplify registering repeating HTTP
2012                  * request calls as polling functions.
2013                  */
2014                 poll: {
2015                         /**
2016                          * The callback function is invoked whenever an HTTP reply to a
2017                          * polled request is received or when the polled request timed
2018                          * out.
2019                          *
2020                          * @callback LuCI.Request.poll~callbackFn
2021                          * @param {LuCI.Response} res
2022                          * The HTTP response object.
2023                          *
2024                          * @param {*} data
2025                          * The response JSON if the response could be parsed as such,
2026                          * else `null`.
2027                          *
2028                          * @param {number} duration
2029                          * The total duration of the request in milliseconds.
2030                          */
2031
2032                         /**
2033                          * Register a repeating HTTP request with an optional callback
2034                          * to invoke whenever a response for the request is received.
2035                          *
2036                          * @instance
2037                          * @memberof LuCI.Request.poll
2038                          * @param {number} interval
2039                          * The poll interval in seconds.
2040                          *
2041                          * @param {string} url
2042                          * The URL to request on each poll.
2043                          *
2044                          * @param {LuCI.Request.RequestOptions} [options]
2045                          * Additional options to configure the request.
2046                          *
2047                          * @param {LuCI.Request.poll~callbackFn} [callback]
2048                          * {@link LuCI.Request.poll~callbackFn Callback} function to
2049                          * invoke for each HTTP reply.
2050                          *
2051                          * @throws {TypeError}
2052                          * Throws `TypeError` when an invalid interval was passed.
2053                          *
2054                          * @returns {function}
2055                          * Returns the internally created poll function.
2056                          */
2057                         add: function(interval, url, options, callback) {
2058                                 if (isNaN(interval) || interval &lt;= 0)
2059                                         throw new TypeError('Invalid poll interval');
2060
2061                                 var ival = interval >>> 0,
2062                                     opts = Object.assign({}, options, { timeout: ival * 1000 - 5 });
2063
2064                                 var fn = function() {
2065                                         return Request.request(url, options).then(function(res) {
2066                                                 if (!Poll.active())
2067                                                         return;
2068
2069                                                 try {
2070                                                         callback(res, res.json(), res.duration);
2071                                                 }
2072                                                 catch (err) {
2073                                                         callback(res, null, res.duration);
2074                                                 }
2075                                         });
2076                                 };
2077
2078                                 return (Poll.add(fn, ival) ? fn : null);
2079                         },
2080
2081                         /**
2082                          * Remove a polling request that has been previously added using `add()`.
2083                          * This function is essentially a wrapper around
2084                          * {@link LuCI.Poll.remove LuCI.Poll.remove()}.
2085                          *
2086                          * @instance
2087                          * @memberof LuCI.Request.poll
2088                          * @param {function} entry
2089                          * The poll function returned by {@link LuCI.Request.poll#add add()}.
2090                          *
2091                          * @returns {boolean}
2092                          * Returns `true` if any function has been removed, else `false`.
2093                          */
2094                         remove: function(entry) { return Poll.remove(entry) },
2095
2096                         /**
2097                           * Alias for {@link LuCI.Poll.start LuCI.Poll.start()}.
2098                           *
2099                           * @instance
2100                           * @memberof LuCI.Request.poll
2101                           */
2102                         start: function() { return Poll.start() },
2103
2104                         /**
2105                           * Alias for {@link LuCI.Poll.stop LuCI.Poll.stop()}.
2106                           *
2107                           * @instance
2108                           * @memberof LuCI.Request.poll
2109                           */
2110                         stop: function() { return Poll.stop() },
2111
2112                         /**
2113                           * Alias for {@link LuCI.Poll.active LuCI.Poll.active()}.
2114                           *
2115                           * @instance
2116                           * @memberof LuCI.Request.poll
2117                           */
2118                         active: function() { return Poll.active() }
2119                 }
2120         });
2121
2122         /**
2123          * @class
2124          * @memberof LuCI
2125          * @hideconstructor
2126          * @classdesc
2127          *
2128          * The `Poll` class allows registering and unregistering poll actions,
2129          * as well as starting, stopping and querying the state of the polling
2130          * loop.
2131          */
2132         var Poll = Class.singleton(/** @lends LuCI.Poll.prototype */ {
2133                 __name__: 'LuCI.Poll',
2134
2135                 queue: [],
2136
2137                 /**
2138                  * Add a new operation to the polling loop. If the polling loop is not
2139                  * already started at this point, it will be implicitely started.
2140                  *
2141                  * @instance
2142                  * @memberof LuCI.Poll
2143                  * @param {function} fn
2144                  * The function to invoke on each poll interval.
2145                  *
2146                  * @param {number} interval
2147                  * The poll interval in seconds.
2148                  *
2149                  * @throws {TypeError}
2150                  * Throws `TypeError` when an invalid interval was passed.
2151                  *
2152                  * @returns {boolean}
2153                  * Returns `true` if the function has been added or `false` if it
2154                  * already is registered.
2155                  */
2156                 add: function(fn, interval) {
2157                         if (interval == null || interval &lt;= 0)
2158                                 interval = window.L ? window.L.env.pollinterval : null;
2159
2160                         if (isNaN(interval) || typeof(fn) != 'function')
2161                                 throw new TypeError('Invalid argument to LuCI.Poll.add()');
2162
2163                         for (var i = 0; i &lt; this.queue.length; i++)
2164                                 if (this.queue[i].fn === fn)
2165                                         return false;
2166
2167                         var e = {
2168                                 r: true,
2169                                 i: interval >>> 0,
2170                                 fn: fn
2171                         };
2172
2173                         this.queue.push(e);
2174
2175                         if (this.tick != null &amp;&amp; !this.active())
2176                                 this.start();
2177
2178                         return true;
2179                 },
2180
2181                 /**
2182                  * Remove an operation from the polling loop. If no further operatons
2183                  * are registered, the polling loop is implicitely stopped.
2184                  *
2185                  * @instance
2186                  * @memberof LuCI.Poll
2187                  * @param {function} fn
2188                  * The function to remove.
2189                  *
2190                  * @throws {TypeError}
2191                  * Throws `TypeError` when the given argument isn't a function.
2192                  *
2193                  * @returns {boolean}
2194                  * Returns `true` if the function has been removed or `false` if it
2195                  * wasn't found.
2196                  */
2197                 remove: function(fn) {
2198                         if (typeof(fn) != 'function')
2199                                 throw new TypeError('Invalid argument to LuCI.Poll.remove()');
2200
2201                         var len = this.queue.length;
2202
2203                         for (var i = len; i > 0; i--)
2204                                 if (this.queue[i-1].fn === fn)
2205                                         this.queue.splice(i-1, 1);
2206
2207                         if (!this.queue.length &amp;&amp; this.stop())
2208                                 this.tick = 0;
2209
2210                         return (this.queue.length != len);
2211                 },
2212
2213                 /**
2214                  * (Re)start the polling loop. Dispatches a custom `poll-start` event
2215                  * to the `document` object upon successful start.
2216                  *
2217                  * @instance
2218                  * @memberof LuCI.Poll
2219                  * @returns {boolean}
2220                  * Returns `true` if polling has been started (or if no functions
2221                  * where registered) or `false` when the polling loop already runs.
2222                  */
2223                 start: function() {
2224                         if (this.active())
2225                                 return false;
2226
2227                         this.tick = 0;
2228
2229                         if (this.queue.length) {
2230                                 this.timer = window.setInterval(this.step, 1000);
2231                                 this.step();
2232                                 document.dispatchEvent(new CustomEvent('poll-start'));
2233                         }
2234
2235                         return true;
2236                 },
2237
2238                 /**
2239                  * Stop the polling loop. Dispatches a custom `poll-stop` event
2240                  * to the `document` object upon successful stop.
2241                  *
2242                  * @instance
2243                  * @memberof LuCI.Poll
2244                  * @returns {boolean}
2245                  * Returns `true` if polling has been stopped or `false` if it din't
2246                  * run to begin with.
2247                  */
2248                 stop: function() {
2249                         if (!this.active())
2250                                 return false;
2251
2252                         document.dispatchEvent(new CustomEvent('poll-stop'));
2253                         window.clearInterval(this.timer);
2254                         delete this.timer;
2255                         delete this.tick;
2256                         return true;
2257                 },
2258
2259                 /* private */
2260                 step: function() {
2261                         for (var i = 0, e = null; (e = Poll.queue[i]) != null; i++) {
2262                                 if ((Poll.tick % e.i) != 0)
2263                                         continue;
2264
2265                                 if (!e.r)
2266                                         continue;
2267
2268                                 e.r = false;
2269
2270                                 Promise.resolve(e.fn()).finally((function() { this.r = true }).bind(e));
2271                         }
2272
2273                         Poll.tick = (Poll.tick + 1) % Math.pow(2, 32);
2274                 },
2275
2276                 /**
2277                  * Test whether the polling loop is running.
2278                  *
2279                  * @instance
2280                  * @memberof LuCI.Poll
2281                  * @returns {boolean} - Returns `true` if polling is active, else `false`.
2282                  */
2283                 active: function() {
2284                         return (this.timer != null);
2285                 }
2286         });
2287
2288
2289         var dummyElem = null,
2290             domParser = null,
2291             originalCBIInit = null,
2292             rpcBaseURL = null,
2293             sysFeatures = null,
2294             classes = {};
2295
2296         var LuCI = Class.extend(/** @lends LuCI.prototype */ {
2297                 __name__: 'LuCI',
2298                 __init__: function(env) {
2299
2300                         document.querySelectorAll('script[src*="/luci.js"]').forEach(function(s) {
2301                                 if (env.base_url == null || env.base_url == '') {
2302                                         var m = (s.getAttribute('src') || '').match(/^(.*)\/luci\.js(?:\?v=([^?]+))?$/);
2303                                         if (m) {
2304                                                 env.base_url = m[1];
2305                                                 env.resource_version = m[2];
2306                                         }
2307                                 }
2308                         });
2309
2310                         if (env.base_url == null)
2311                                 this.error('InternalError', 'Cannot find url of luci.js');
2312
2313                         env.cgi_base = env.scriptname.replace(/\/[^\/]+$/, '');
2314
2315                         Object.assign(this.env, env);
2316
2317                         document.addEventListener('poll-start', function(ev) {
2318                                 document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
2319                                         e.style.display = (e.id == 'xhr_poll_status_off') ? 'none' : '';
2320                                 });
2321                         });
2322
2323                         document.addEventListener('poll-stop', function(ev) {
2324                                 document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
2325                                         e.style.display = (e.id == 'xhr_poll_status_on') ? 'none' : '';
2326                                 });
2327                         });
2328
2329                         var domReady = new Promise(function(resolveFn, rejectFn) {
2330                                 document.addEventListener('DOMContentLoaded', resolveFn);
2331                         });
2332
2333                         Promise.all([
2334                                 domReady,
2335                                 this.require('ui'),
2336                                 this.require('rpc'),
2337                                 this.require('form'),
2338                                 this.probeRPCBaseURL()
2339                         ]).then(this.setupDOM.bind(this)).catch(this.error);
2340
2341                         originalCBIInit = window.cbi_init;
2342                         window.cbi_init = function() {};
2343                 },
2344
2345                 /**
2346                  * Captures the current stack trace and throws an error of the
2347                  * specified type as a new exception. Also logs the exception as
2348                  * error to the debug console if it is available.
2349                  *
2350                  * @instance
2351                  * @memberof LuCI
2352                  *
2353                  * @param {Error|string} [type=Error]
2354                  * Either a string specifying the type of the error to throw or an
2355                  * existing `Error` instance to copy.
2356                  *
2357                  * @param {string} [fmt=Unspecified error]
2358                  * A format string which is used to form the error message, together
2359                  * with all subsequent optional arguments.
2360                  *
2361                  * @param {...*} [args]
2362                  * Zero or more variable arguments to the supplied format string.
2363                  *
2364                  * @throws {Error}
2365                  * Throws the created error object with the captured stack trace
2366                  * appended to the message and the type set to the given type
2367                  * argument or copied from the given error instance.
2368                  */
2369                 raise: function(type, fmt /*, ...*/) {
2370                         var e = null,
2371                             msg = fmt ? String.prototype.format.apply(fmt, this.varargs(arguments, 2)) : null,
2372                             stack = null;
2373
2374                         if (type instanceof Error) {
2375                                 e = type;
2376
2377                                 if (msg)
2378                                         e.message = msg + ': ' + e.message;
2379                         }
2380                         else {
2381                                 try { throw new Error('stacktrace') }
2382                                 catch (e2) { stack = (e2.stack || '').split(/\n/) }
2383
2384                                 e = new (window[type || 'Error'] || Error)(msg || 'Unspecified error');
2385                                 e.name = type || 'Error';
2386                         }
2387
2388                         stack = (stack || []).map(function(frame) {
2389                                 frame = frame.replace(/(.*?)@(.+):(\d+):(\d+)/g, 'at $1 ($2:$3:$4)').trim();
2390                                 return frame ? '  ' + frame : '';
2391                         });
2392
2393                         if (!/^  at /.test(stack[0]))
2394                                 stack.shift();
2395
2396                         if (/\braise /.test(stack[0]))
2397                                 stack.shift();
2398
2399                         if (/\berror /.test(stack[0]))
2400                                 stack.shift();
2401
2402                         if (stack.length)
2403                                 e.message += '\n' + stack.join('\n');
2404
2405                         if (window.console &amp;&amp; console.debug)
2406                                 console.debug(e);
2407
2408                         throw e;
2409                 },
2410
2411                 /**
2412                  * A wrapper around {@link LuCI#raise raise()} which also renders
2413                  * the error either as modal overlay when `ui.js` is already loaed
2414                  * or directly into the view body.
2415                  *
2416                  * @instance
2417                  * @memberof LuCI
2418                  *
2419                  * @param {Error|string} [type=Error]
2420                  * Either a string specifying the type of the error to throw or an
2421                  * existing `Error` instance to copy.
2422                  *
2423                  * @param {string} [fmt=Unspecified error]
2424                  * A format string which is used to form the error message, together
2425                  * with all subsequent optional arguments.
2426                  *
2427                  * @param {...*} [args]
2428                  * Zero or more variable arguments to the supplied format string.
2429                  *
2430                  * @throws {Error}
2431                  * Throws the created error object with the captured stack trace
2432                  * appended to the message and the type set to the given type
2433                  * argument or copied from the given error instance.
2434                  */
2435                 error: function(type, fmt /*, ...*/) {
2436                         try {
2437                                 L.raise.apply(L, Array.prototype.slice.call(arguments));
2438                         }
2439                         catch (e) {
2440                                 if (!e.reported) {
2441                                         if (L.ui)
2442                                                 L.ui.addNotification(e.name || _('Runtime error'),
2443                                                         E('pre', {}, e.message), 'danger');
2444                                         else
2445                                                 L.dom.content(document.querySelector('#maincontent'),
2446                                                         E('pre', { 'class': 'alert-message error' }, e.message));
2447
2448                                         e.reported = true;
2449                                 }
2450
2451                                 throw e;
2452                         }
2453                 },
2454
2455                 /**
2456                  * Return a bound function using the given `self` as `this` context
2457                  * and any further arguments as parameters to the bound function.
2458                  *
2459                  * @instance
2460                  * @memberof LuCI
2461                  *
2462                  * @param {function} fn
2463                  * The function to bind.
2464                  *
2465                  * @param {*} self
2466                  * The value to bind as `this` context to the specified function.
2467                  *
2468                  * @param {...*} [args]
2469                  * Zero or more variable arguments which are bound to the function
2470                  * as parameters.
2471                  *
2472                  * @returns {function}
2473                  * Returns the bound function.
2474                  */
2475                 bind: function(fn, self /*, ... */) {
2476                         return Function.prototype.bind.apply(fn, this.varargs(arguments, 2, self));
2477                 },
2478
2479                 /**
2480                  * Load an additional LuCI JavaScript class and its dependencies,
2481                  * instantiate it and return the resulting class instance. Each
2482                  * class is only loaded once. Subsequent attempts to load the same
2483                  * class will return the already instantiated class.
2484                  *
2485                  * @instance
2486                  * @memberof LuCI
2487                  *
2488                  * @param {string} name
2489                  * The name of the class to load in dotted notation. Dots will
2490                  * be replaced by spaces and joined with the runtime-determined
2491                  * base URL of LuCI.js to form an absolute URL to load the class
2492                  * file from.
2493                  *
2494                  * @throws {DependencyError}
2495                  * Throws a `DependencyError` when the class to load includes
2496                  * circular dependencies.
2497                  *
2498                  * @throws {NetworkError}
2499                  * Throws `NetworkError` when the underlying {@link LuCI.Request}
2500                  * call failed.
2501                  *
2502                  * @throws {SyntaxError}
2503                  * Throws `SyntaxError` when the loaded class file code cannot
2504                  * be interpreted by `eval`.
2505                  *
2506                  * @throws {TypeError}
2507                  * Throws `TypeError` when the class file could be loaded and
2508                  * interpreted, but when invoking its code did not yield a valid
2509                  * class instance.
2510                  *
2511                  * @returns {Promise&lt;LuCI#Class>}
2512                  * Returns the instantiated class.
2513                  */
2514                 require: function(name, from) {
2515                         var L = this, url = null, from = from || [];
2516
2517                         /* Class already loaded */
2518                         if (classes[name] != null) {
2519                                 /* Circular dependency */
2520                                 if (from.indexOf(name) != -1)
2521                                         L.raise('DependencyError',
2522                                                 'Circular dependency: class "%s" depends on "%s"',
2523                                                 name, from.join('" which depends on "'));
2524
2525                                 return Promise.resolve(classes[name]);
2526                         }
2527
2528                         url = '%s/%s.js%s'.format(L.env.base_url, name.replace(/\./g, '/'), (L.env.resource_version ? '?v=' + L.env.resource_version : ''));
2529                         from = [ name ].concat(from);
2530
2531                         var compileClass = function(res) {
2532                                 if (!res.ok)
2533                                         L.raise('NetworkError',
2534                                                 'HTTP error %d while loading class file "%s"', res.status, url);
2535
2536                                 var source = res.text(),
2537                                     requirematch = /^require[ \t]+(\S+)(?:[ \t]+as[ \t]+([a-zA-Z_]\S*))?$/,
2538                                     strictmatch = /^use[ \t]+strict$/,
2539                                     depends = [],
2540                                     args = '';
2541
2542                                 /* find require statements in source */
2543                                 for (var i = 0, off = -1, quote = -1, esc = false; i &lt; source.length; i++) {
2544                                         var chr = source.charCodeAt(i);
2545
2546                                         if (esc) {
2547                                                 esc = false;
2548                                         }
2549                                         else if (chr == 92) {
2550                                                 esc = true;
2551                                         }
2552                                         else if (chr == quote) {
2553                                                 var s = source.substring(off, i),
2554                                                     m = requirematch.exec(s);
2555
2556                                                 if (m) {
2557                                                         var dep = m[1], as = m[2] || dep.replace(/[^a-zA-Z0-9_]/g, '_');
2558                                                         depends.push(L.require(dep, from));
2559                                                         args += ', ' + as;
2560                                                 }
2561                                                 else if (!strictmatch.exec(s)) {
2562                                                         break;
2563                                                 }
2564
2565                                                 off = -1;
2566                                                 quote = -1;
2567                                         }
2568                                         else if (quote == -1 &amp;&amp; (chr == 34 || chr == 39)) {
2569                                                 off = i + 1;
2570                                                 quote = chr;
2571                                         }
2572                                 }
2573
2574                                 /* load dependencies and instantiate class */
2575                                 return Promise.all(depends).then(function(instances) {
2576                                         var _factory, _class;
2577
2578                                         try {
2579                                                 _factory = eval(
2580                                                         '(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n'
2581                                                                 .format(args, source, res.url));
2582                                         }
2583                                         catch (error) {
2584                                                 L.raise('SyntaxError', '%s\n  in %s:%s',
2585                                                         error.message, res.url, error.lineNumber || '?');
2586                                         }
2587
2588                                         _factory.displayName = toCamelCase(name + 'ClassFactory');
2589                                         _class = _factory.apply(_factory, [window, document, L].concat(instances));
2590
2591                                         if (!Class.isSubclass(_class))
2592                                             L.error('TypeError', '"%s" factory yields invalid constructor', name);
2593
2594                                         if (_class.displayName == 'AnonymousClass')
2595                                                 _class.displayName = toCamelCase(name + 'Class');
2596
2597                                         var ptr = Object.getPrototypeOf(L),
2598                                             parts = name.split(/\./),
2599                                             instance = new _class();
2600
2601                                         for (var i = 0; ptr &amp;&amp; i &lt; parts.length - 1; i++)
2602                                                 ptr = ptr[parts[i]];
2603
2604                                         if (ptr)
2605                                                 ptr[parts[i]] = instance;
2606
2607                                         classes[name] = instance;
2608
2609                                         return instance;
2610                                 });
2611                         };
2612
2613                         /* Request class file */
2614                         classes[name] = Request.get(url, { cache: true }).then(compileClass);
2615
2616                         return classes[name];
2617                 },
2618
2619                 /* DOM setup */
2620                 probeRPCBaseURL: function() {
2621                         if (rpcBaseURL == null) {
2622                                 try {
2623                                         rpcBaseURL = window.sessionStorage.getItem('rpcBaseURL');
2624                                 }
2625                                 catch (e) { }
2626                         }
2627
2628                         if (rpcBaseURL == null) {
2629                                 var rpcFallbackURL = this.url('admin/ubus');
2630
2631                                 rpcBaseURL = Request.get(this.env.ubuspath).then(function(res) {
2632                                         return (rpcBaseURL = (res.status == 400) ? L.env.ubuspath : rpcFallbackURL);
2633                                 }, function() {
2634                                         return (rpcBaseURL = rpcFallbackURL);
2635                                 }).then(function(url) {
2636                                         try {
2637                                                 window.sessionStorage.setItem('rpcBaseURL', url);
2638                                         }
2639                                         catch (e) { }
2640
2641                                         return url;
2642                                 });
2643                         }
2644
2645                         return Promise.resolve(rpcBaseURL);
2646                 },
2647
2648                 probeSystemFeatures: function() {
2649                         var sessionid = classes.rpc.getSessionID();
2650
2651                         if (sysFeatures == null) {
2652                                 try {
2653                                         var data = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
2654
2655                                         if (this.isObject(data) &amp;&amp; this.isObject(data[sessionid]))
2656                                                 sysFeatures = data[sessionid];
2657                                 }
2658                                 catch (e) {}
2659                         }
2660
2661                         if (!this.isObject(sysFeatures)) {
2662                                 sysFeatures = classes.rpc.declare({
2663                                         object: 'luci',
2664                                         method: 'getFeatures',
2665                                         expect: { '': {} }
2666                                 })().then(function(features) {
2667                                         try {
2668                                                 var data = {};
2669                                                     data[sessionid] = features;
2670
2671                                                 window.sessionStorage.setItem('sysFeatures', JSON.stringify(data));
2672                                         }
2673                                         catch (e) {}
2674
2675                                         sysFeatures = features;
2676
2677                                         return features;
2678                                 });
2679                         }
2680
2681                         return Promise.resolve(sysFeatures);
2682                 },
2683
2684                 /**
2685                  * Test whether a particular system feature is available, such as
2686                  * hostapd SAE support or an installed firewall. The features are
2687                  * queried once at the beginning of the LuCI session and cached in
2688                  * `SessionStorage` throughout the lifetime of the associated tab or
2689                  * browser window.
2690                  *
2691                  * @instance
2692                  * @memberof LuCI
2693                  *
2694                  * @param {string} feature
2695                  * The feature to test. For detailed list of known feature flags,
2696                  * see `/modules/luci-base/root/usr/libexec/rpcd/luci`.
2697                  *
2698                  * @param {string} [subfeature]
2699                  * Some feature classes like `hostapd` provide sub-feature flags,
2700                  * such as `sae` or `11w` support. The `subfeature` argument can
2701                  * be used to query these.
2702                  *
2703                  * @return {boolean|null}
2704                  * Return `true` if the queried feature (and sub-feature) is available
2705                  * or `false` if the requested feature isn't present or known.
2706                  * Return `null` when a sub-feature was queried for a feature which
2707                  * has no sub-features.
2708                  */
2709                 hasSystemFeature: function() {
2710                         var ft = sysFeatures[arguments[0]];
2711
2712                         if (arguments.length == 2)
2713                                 return this.isObject(ft) ? ft[arguments[1]] : null;
2714
2715                         return (ft != null &amp;&amp; ft != false);
2716                 },
2717
2718                 /* private */
2719                 notifySessionExpiry: function() {
2720                         Poll.stop();
2721
2722                         L.ui.showModal(_('Session expired'), [
2723                                 E('div', { class: 'alert-message warning' },
2724                                         _('A new login is required since the authentication session expired.')),
2725                                 E('div', { class: 'right' },
2726                                         E('div', {
2727                                                 class: 'btn primary',
2728                                                 click: function() {
2729                                                         var loc = window.location;
2730                                                         window.location = loc.protocol + '//' + loc.host + loc.pathname + loc.search;
2731                                                 }
2732                                         }, _('To login…')))
2733                         ]);
2734
2735                         L.raise('SessionError', 'Login session is expired');
2736                 },
2737
2738                 /* private */
2739                 setupDOM: function(res) {
2740                         var domEv = res[0],
2741                             uiClass = res[1],
2742                             rpcClass = res[2],
2743                             formClass = res[3],
2744                             rpcBaseURL = res[4];
2745
2746                         rpcClass.setBaseURL(rpcBaseURL);
2747
2748                         rpcClass.addInterceptor(function(msg, req) {
2749                                 if (!L.isObject(msg) || !L.isObject(msg.error) || msg.error.code != -32002)
2750                                         return;
2751
2752                                 if (!L.isObject(req) || (req.object == 'session' &amp;&amp; req.method == 'access'))
2753                                         return;
2754
2755                                 return rpcClass.declare({
2756                                         'object': 'session',
2757                                         'method': 'access',
2758                                         'params': [ 'scope', 'object', 'function' ],
2759                                         'expect': { access: true }
2760                                 })('uci', 'luci', 'read').catch(L.notifySessionExpiry);
2761                         });
2762
2763                         Request.addInterceptor(function(res) {
2764                                 var isDenied = false;
2765
2766                                 if (res.status == 403 &amp;&amp; res.headers.get('X-LuCI-Login-Required') == 'yes')
2767                                         isDenied = true;
2768
2769                                 if (!isDenied)
2770                                         return;
2771
2772                                 L.notifySessionExpiry();
2773                         });
2774
2775                         return this.probeSystemFeatures().finally(this.initDOM);
2776                 },
2777
2778                 /* private */
2779                 initDOM: function() {
2780                         originalCBIInit();
2781                         Poll.start();
2782                         document.dispatchEvent(new CustomEvent('luci-loaded'));
2783                 },
2784
2785                 /**
2786                  * The `env` object holds environment settings used by LuCI, such
2787                  * as request timeouts, base URLs etc.
2788                  *
2789                  * @instance
2790                  * @memberof LuCI
2791                  */
2792                 env: {},
2793
2794                 /**
2795                  * Construct a relative URL path from the given prefix and parts.
2796                  * The resulting URL is guaranteed to only contain the characters
2797                  * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
2798                  * as `/` for the path separator.
2799                  *
2800                  * @instance
2801                  * @memberof LuCI
2802                  *
2803                  * @param {string} [prefix]
2804                  * The prefix to join the given parts with. If the `prefix` is
2805                  * omitted, it defaults to an empty string.
2806                  *
2807                  * @param {string[]} [parts]
2808                  * An array of parts to join into an URL path. Parts may contain
2809                  * slashes and any of the other characters mentioned above.
2810                  *
2811                  * @return {string}
2812                  * Return the joined URL path.
2813                  */
2814                 path: function(prefix, parts) {
2815                         var url = [ prefix || '' ];
2816
2817                         for (var i = 0; i &lt; parts.length; i++)
2818                                 if (/^(?:[a-zA-Z0-9_.%,;-]+\/)*[a-zA-Z0-9_.%,;-]+$/.test(parts[i]))
2819                                         url.push('/', parts[i]);
2820
2821                         if (url.length === 1)
2822                                 url.push('/');
2823
2824                         return url.join('');
2825                 },
2826
2827                 /**
2828                  * Construct an URL  pathrelative to the script path of the server
2829                  * side LuCI application (usually `/cgi-bin/luci`).
2830                  *
2831                  * The resulting URL is guaranteed to only contain the characters
2832                  * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
2833                  * as `/` for the path separator.
2834                  *
2835                  * @instance
2836                  * @memberof LuCI
2837                  *
2838                  * @param {string[]} [parts]
2839                  * An array of parts to join into an URL path. Parts may contain
2840                  * slashes and any of the other characters mentioned above.
2841                  *
2842                  * @return {string}
2843                  * Returns the resulting URL path.
2844                  */
2845                 url: function() {
2846                         return this.path(this.env.scriptname, arguments);
2847                 },
2848
2849                 /**
2850                  * Construct an URL path relative to the global static resource path
2851                  * of the LuCI ui (usually `/luci-static/resources`).
2852                  *
2853                  * The resulting URL is guaranteed to only contain the characters
2854                  * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
2855                  * as `/` for the path separator.
2856                  *
2857                  * @instance
2858                  * @memberof LuCI
2859                  *
2860                  * @param {string[]} [parts]
2861                  * An array of parts to join into an URL path. Parts may contain
2862                  * slashes and any of the other characters mentioned above.
2863                  *
2864                  * @return {string}
2865                  * Returns the resulting URL path.
2866                  */
2867                 resource: function() {
2868                         return this.path(this.env.resource, arguments);
2869                 },
2870
2871                 /**
2872                  * Construct an URL path relative to the media resource path of the
2873                  * LuCI ui (usually `/luci-static/$theme_name`).
2874                  *
2875                  * The resulting URL is guaranteed to only contain the characters
2876                  * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
2877                  * as `/` for the path separator.
2878                  *
2879                  * @instance
2880                  * @memberof LuCI
2881                  *
2882                  * @param {string[]} [parts]
2883                  * An array of parts to join into an URL path. Parts may contain
2884                  * slashes and any of the other characters mentioned above.
2885                  *
2886                  * @return {string}
2887                  * Returns the resulting URL path.
2888                  */
2889                 media: function() {
2890                         return this.path(this.env.media, arguments);
2891                 },
2892
2893                 /**
2894                  * Return the complete URL path to the current view.
2895                  *
2896                  * @instance
2897                  * @memberof LuCI
2898                  *
2899                  * @return {string}
2900                  * Returns the URL path to the current view.
2901                  */
2902                 location: function() {
2903                         return this.path(this.env.scriptname, this.env.requestpath);
2904                 },
2905
2906
2907                 /**
2908                  * Tests whether the passed argument is a JavaScript object.
2909                  * This function is meant to be an object counterpart to the
2910                  * standard `Array.isArray()` function.
2911                  *
2912                  * @instance
2913                  * @memberof LuCI
2914                  *
2915                  * @param {*} [val]
2916                  * The value to test
2917                  *
2918                  * @return {boolean}
2919                  * Returns `true` if the given value is of type object and
2920                  * not `null`, else returns `false`.
2921                  */
2922                 isObject: function(val) {
2923                         return (val != null &amp;&amp; typeof(val) == 'object');
2924                 },
2925
2926                 /**
2927                  * Return an array of sorted object keys, optionally sorted by
2928                  * a different key or a different sorting mode.
2929                  *
2930                  * @instance
2931                  * @memberof LuCI
2932                  *
2933                  * @param {object} obj
2934                  * The object to extract the keys from. If the given value is
2935                  * not an object, the function will return an empty array.
2936                  *
2937                  * @param {string} [key]
2938                  * Specifies the key to order by. This is mainly useful for
2939                  * nested objects of objects or objects of arrays when sorting
2940                  * shall not be performed by the primary object keys but by
2941                  * some other key pointing to a value within the nested values.
2942                  *
2943                  * @param {string} [sortmode]
2944                  * May be either `addr` or `num` to override the natural
2945                  * lexicographic sorting with a sorting suitable for IP/MAC style
2946                  * addresses or numeric values respectively.
2947                  *
2948                  * @return {string[]}
2949                  * Returns an array containing the sorted keys of the given object.
2950                  */
2951                 sortedKeys: function(obj, key, sortmode) {
2952                         if (obj == null || typeof(obj) != 'object')
2953                                 return [];
2954
2955                         return Object.keys(obj).map(function(e) {
2956                                 var v = (key != null) ? obj[e][key] : e;
2957
2958                                 switch (sortmode) {
2959                                 case 'addr':
2960                                         v = (v != null) ? v.replace(/(?:^|[.:])([0-9a-fA-F]{1,4})/g,
2961                                                 function(m0, m1) { return ('000' + m1.toLowerCase()).substr(-4) }) : null;
2962                                         break;
2963
2964                                 case 'num':
2965                                         v = (v != null) ? +v : null;
2966                                         break;
2967                                 }
2968
2969                                 return [ e, v ];
2970                         }).filter(function(e) {
2971                                 return (e[1] != null);
2972                         }).sort(function(a, b) {
2973                                 return (a[1] > b[1]);
2974                         }).map(function(e) {
2975                                 return e[0];
2976                         });
2977                 },
2978
2979                 /**
2980                  * Converts the given value to an array. If the given value is of
2981                  * type array, it is returned as-is, values of type object are
2982                  * returned as one-element array containing the object, empty
2983                  * strings and `null` values are returned as empty array, all other
2984                  * values are converted using `String()`, trimmed, split on white
2985                  * space and returned as array.
2986                  *
2987                  * @instance
2988                  * @memberof LuCI
2989                  *
2990                  * @param {*} val
2991                  * The value to convert into an array.
2992                  *
2993                  * @return {Array&lt;*>}
2994                  * Returns the resulting array.
2995                  */
2996                 toArray: function(val) {
2997                         if (val == null)
2998                                 return [];
2999                         else if (Array.isArray(val))
3000                                 return val;
3001                         else if (typeof(val) == 'object')
3002                                 return [ val ];
3003
3004                         var s = String(val).trim();
3005
3006                         if (s == '')
3007                                 return [];
3008
3009                         return s.split(/\s+/);
3010                 },
3011
3012                 /**
3013                  * Returns a promise resolving with either the given value or or with
3014                  * the given default in case the input value is a rejecting promise.
3015                  *
3016                  * @instance
3017                  * @memberof LuCI
3018                  *
3019                  * @param {*} value
3020                  * The value to resolve the promise with.
3021                  *
3022                  * @param {*} defvalue
3023                  * The default value to resolve the promise with in case the given
3024                  * input value is a rejecting promise.
3025                  *
3026                  * @returns {Promise&lt;*>}
3027                  * Returns a new promise resolving either to the given input value or
3028                  * to the given default value on error.
3029                  */
3030                 resolveDefault: function(value, defvalue) {
3031                         return Promise.resolve(value).catch(function() { return defvalue });
3032                 },
3033
3034                 /**
3035                  * The request callback function is invoked whenever an HTTP
3036                  * reply to a request made using the `L.get()`, `L.post()` or
3037                  * `L.poll()` function is timed out or received successfully.
3038                  *
3039                  * @instance
3040                  * @memberof LuCI
3041                  *
3042                  * @callback LuCI.requestCallbackFn
3043                  * @param {XMLHTTPRequest} xhr
3044                  * The XMLHTTPRequest instance used to make the request.
3045                  *
3046                  * @param {*} data
3047                  * The response JSON if the response could be parsed as such,
3048                  * else `null`.
3049                  *
3050                  * @param {number} duration
3051                  * The total duration of the request in milliseconds.
3052                  */
3053
3054                 /**
3055                  * Issues a GET request to the given url and invokes the specified
3056                  * callback function. The function is a wrapper around
3057                  * {@link LuCI.Request#request Request.request()}.
3058                  *
3059                  * @deprecated
3060                  * @instance
3061                  * @memberof LuCI
3062                  *
3063                  * @param {string} url
3064                  * The URL to request.
3065                  *
3066                  * @param {Object&lt;string, string>} [args]
3067                  * Additional query string arguments to append to the URL.
3068                  *
3069                  * @param {LuCI.requestCallbackFn} cb
3070                  * The callback function to invoke when the request finishes.
3071                  *
3072                  * @return {Promise&lt;null>}
3073                  * Returns a promise resolving to `null` when concluded.
3074                  */
3075                 get: function(url, args, cb) {
3076                         return this.poll(null, url, args, cb, false);
3077                 },
3078
3079                 /**
3080                  * Issues a POST request to the given url and invokes the specified
3081                  * callback function. The function is a wrapper around
3082                  * {@link LuCI.Request#request Request.request()}. The request is
3083                  * sent using `application/x-www-form-urlencoded` encoding and will
3084                  * contain a field `token` with the current value of `LuCI.env.token`
3085                  * by default.
3086                  *
3087                  * @deprecated
3088                  * @instance
3089                  * @memberof LuCI
3090                  *
3091                  * @param {string} url
3092                  * The URL to request.
3093                  *
3094                  * @param {Object&lt;string, string>} [args]
3095                  * Additional post arguments to append to the request body.
3096                  *
3097                  * @param {LuCI.requestCallbackFn} cb
3098                  * The callback function to invoke when the request finishes.
3099                  *
3100                  * @return {Promise&lt;null>}
3101                  * Returns a promise resolving to `null` when concluded.
3102                  */
3103                 post: function(url, args, cb) {
3104                         return this.poll(null, url, args, cb, true);
3105                 },
3106
3107                 /**
3108                  * Register a polling HTTP request that invokes the specified
3109                  * callback function. The function is a wrapper around
3110                  * {@link LuCI.Request.poll#add Request.poll.add()}.
3111                  *
3112                  * @deprecated
3113                  * @instance
3114                  * @memberof LuCI
3115                  *
3116                  * @param {number} interval
3117                  * The poll interval to use. If set to a value less than or equal
3118                  * to `0`, it will default to the global poll interval configured
3119                  * in `LuCI.env.pollinterval`.
3120                  *
3121                  * @param {string} url
3122                  * The URL to request.
3123                  *
3124                  * @param {Object&lt;string, string>} [args]
3125                  * Specifies additional arguments for the request. For GET requests,
3126                  * the arguments are appended to the URL as query string, for POST
3127                  * requests, they'll be added to the request body.
3128                  *
3129                  * @param {LuCI.requestCallbackFn} cb
3130                  * The callback function to invoke whenever a request finishes.
3131                  *
3132                  * @param {boolean} [post=false]
3133                  * When set to `false` or not specified, poll requests will be made
3134                  * using the GET method. When set to `true`, POST requests will be
3135                  * issued. In case of POST requests, the request body will contain
3136                  * an argument `token` with the current value of `LuCI.env.token` by
3137                  * default, regardless of the parameters specified with `args`.
3138                  *
3139                  * @return {function}
3140                  * Returns the internally created function that has been passed to
3141                  * {@link LuCI.Request.poll#add Request.poll.add()}. This value can
3142                  * be passed to {@link LuCI.Poll.remove Poll.remove()} to remove the
3143                  * polling request.
3144                  */
3145                 poll: function(interval, url, args, cb, post) {
3146                         if (interval !== null &amp;&amp; interval &lt;= 0)
3147                                 interval = this.env.pollinterval;
3148
3149                         var data = post ? { token: this.env.token } : null,
3150                             method = post ? 'POST' : 'GET';
3151
3152                         if (!/^(?:\/|\S+:\/\/)/.test(url))
3153                                 url = this.url(url);
3154
3155                         if (args != null)
3156                                 data = Object.assign(data || {}, args);
3157
3158                         if (interval !== null)
3159                                 return Request.poll.add(interval, url, { method: method, query: data }, cb);
3160                         else
3161                                 return Request.request(url, { method: method, query: data })
3162                                         .then(function(res) {
3163                                                 var json = null;
3164                                                 if (/^application\/json\b/.test(res.headers.get('Content-Type')))
3165                                                         try { json = res.json() } catch(e) {}
3166                                                 cb(res.xhr, json, res.duration);
3167                                         });
3168                 },
3169
3170                 /**
3171                  * Deprecated wrapper around {@link LuCI.Poll.remove Poll.remove()}.
3172                  *
3173                  * @deprecated
3174                  * @instance
3175                  * @memberof LuCI
3176                  *
3177                  * @param {function} entry
3178                  * The polling function to remove.
3179                  *
3180                  * @return {boolean}
3181                  * Returns `true` when the function has been removed or `false` if
3182                  * it could not be found.
3183                  */
3184                 stop: function(entry) { return Poll.remove(entry) },
3185
3186                 /**
3187                  * Deprecated wrapper around {@link LuCI.Poll.stop Poll.stop()}.
3188                  *
3189                  * @deprecated
3190                  * @instance
3191                  * @memberof LuCI
3192                  *
3193                  * @return {boolean}
3194                  * Returns `true` when the polling loop has been stopped or `false`
3195                  * when it didn't run to begin with.
3196                  */
3197                 halt: function() { return Poll.stop() },
3198
3199                 /**
3200                  * Deprecated wrapper around {@link LuCI.Poll.start Poll.start()}.
3201                  *
3202                  * @deprecated
3203                  * @instance
3204                  * @memberof LuCI
3205                  *
3206                  * @return {boolean}
3207                  * Returns `true` when the polling loop has been started or `false`
3208                  * when it was already running.
3209                  */
3210                 run: function() { return Poll.start() },
3211
3212
3213                 /**
3214                  * @class
3215                  * @memberof LuCI
3216                  * @hideconstructor
3217                  * @classdesc
3218                  *
3219                  * The `dom` class provides convenience method for creating and
3220                  * manipulating DOM elements.
3221                  */
3222                 dom: Class.singleton(/* @lends LuCI.dom.prototype */ {
3223                         __name__: 'LuCI.DOM',
3224
3225                         /**
3226                          * Tests whether the given argument is a valid DOM `Node`.
3227                          *
3228                          * @instance
3229                          * @memberof LuCI.dom
3230                          * @param {*} e
3231                          * The value to test.
3232                          *
3233                          * @returns {boolean}
3234                          * Returns `true` if the value is a DOM `Node`, else `false`.
3235                          */
3236                         elem: function(e) {
3237                                 return (e != null &amp;&amp; typeof(e) == 'object' &amp;&amp; 'nodeType' in e);
3238                         },
3239
3240                         /**
3241                          * Parses a given string as HTML and returns the first child node.
3242                          *
3243                          * @instance
3244                          * @memberof LuCI.dom
3245                          * @param {string} s
3246                          * A string containing an HTML fragment to parse. Note that only
3247                          * the first result of the resulting structure is returned, so an
3248                          * input value of `&lt;div>foo&lt;/div> &lt;div>bar&lt;/div>` will only return
3249                          * the first `div` element node.
3250                          *
3251                          * @returns {Node}
3252                          * Returns the first DOM `Node` extracted from the HTML fragment or
3253                          * `null` on parsing failures or if no element could be found.
3254                          */
3255                         parse: function(s) {
3256                                 var elem;
3257
3258                                 try {
3259                                         domParser = domParser || new DOMParser();
3260                                         elem = domParser.parseFromString(s, 'text/html').body.firstChild;
3261                                 }
3262                                 catch(e) {}
3263
3264                                 if (!elem) {
3265                                         try {
3266                                                 dummyElem = dummyElem || document.createElement('div');
3267                                                 dummyElem.innerHTML = s;
3268                                                 elem = dummyElem.firstChild;
3269                                         }
3270                                         catch (e) {}
3271                                 }
3272
3273                                 return elem || null;
3274                         },
3275
3276                         /**
3277                          * Tests whether a given `Node` matches the given query selector.
3278                          *
3279                          * This function is a convenience wrapper around the standard
3280                          * `Node.matches("selector")` function with the added benefit that
3281                          * the `node` argument may be a non-`Node` value, in which case
3282                          * this function simply returns `false`.
3283                          *
3284                          * @instance
3285                          * @memberof LuCI.dom
3286                          * @param {*} node
3287                          * The `Node` argument to test the selector against.
3288                          *
3289                          * @param {string} [selector]
3290                          * The query selector expression to test against the given node.
3291                          *
3292                          * @returns {boolean}
3293                          * Returns `true` if the given node matches the specified selector
3294                          * or `false` when the node argument is no valid DOM `Node` or the
3295                          * selector didn't match.
3296                          */
3297                         matches: function(node, selector) {
3298                                 var m = this.elem(node) ? node.matches || node.msMatchesSelector : null;
3299                                 return m ? m.call(node, selector) : false;
3300                         },
3301
3302                         /**
3303                          * Returns the closest parent node that matches the given query
3304                          * selector expression.
3305                          *
3306                          * This function is a convenience wrapper around the standard
3307                          * `Node.closest("selector")` function with the added benefit that
3308                          * the `node` argument may be a non-`Node` value, in which case
3309                          * this function simply returns `null`.
3310                          *
3311                          * @instance
3312                          * @memberof LuCI.dom
3313                          * @param {*} node
3314                          * The `Node` argument to find the closest parent for.
3315                          *
3316                          * @param {string} [selector]
3317                          * The query selector expression to test against each parent.
3318                          *
3319                          * @returns {Node|null}
3320                          * Returns the closest parent node matching the selector or
3321                          * `null` when the node argument is no valid DOM `Node` or the
3322                          * selector didn't match any parent.
3323                          */
3324                         parent: function(node, selector) {
3325                                 if (this.elem(node) &amp;&amp; node.closest)
3326                                         return node.closest(selector);
3327
3328                                 while (this.elem(node))
3329                                         if (this.matches(node, selector))
3330                                                 return node;
3331                                         else
3332                                                 node = node.parentNode;
3333
3334                                 return null;
3335                         },
3336
3337                         /**
3338                          * Appends the given children data to the given node.
3339                          *
3340                          * @instance
3341                          * @memberof LuCI.dom
3342                          * @param {*} node
3343                          * The `Node` argument to append the children to.
3344                          *
3345                          * @param {*} [children]
3346                          * The childrens to append to the given node.
3347                          *
3348                          * When `children` is an array, then each item of the array
3349                          * will be either appended as child element or text node,
3350                          * depending on whether the item is a DOM `Node` instance or
3351                          * some other non-`null` value. Non-`Node`, non-`null` values
3352                          * will be converted to strings first before being passed as
3353                          * argument to `createTextNode()`.
3354                          *
3355                          * When `children` is a function, it will be invoked with
3356                          * the passed `node` argument as sole parameter and the `append`
3357                          * function will be invoked again, with the given `node` argument
3358                          * as first and the return value of the `children` function as
3359                          * second parameter.
3360                          *
3361                          * When `children` is is a DOM `Node` instance, it will be
3362                          * appended to the given `node`.
3363                          *
3364                          * When `children` is any other non-`null` value, it will be
3365                          * converted to a string and appened to the `innerHTML` property
3366                          * of the given `node`.
3367                          *
3368                          * @returns {Node|null}
3369                          * Returns the last children `Node` appended to the node or `null`
3370                          * if either the `node` argument was no valid DOM `node` or if the
3371                          * `children` was `null` or didn't result in further DOM nodes.
3372                          */
3373                         append: function(node, children) {
3374                                 if (!this.elem(node))
3375                                         return null;
3376
3377                                 if (Array.isArray(children)) {
3378                                         for (var i = 0; i &lt; children.length; i++)
3379                                                 if (this.elem(children[i]))
3380                                                         node.appendChild(children[i]);
3381                                                 else if (children !== null &amp;&amp; children !== undefined)
3382                                                         node.appendChild(document.createTextNode('' + children[i]));
3383
3384                                         return node.lastChild;
3385                                 }
3386                                 else if (typeof(children) === 'function') {
3387                                         return this.append(node, children(node));
3388                                 }
3389                                 else if (this.elem(children)) {
3390                                         return node.appendChild(children);
3391                                 }
3392                                 else if (children !== null &amp;&amp; children !== undefined) {
3393                                         node.innerHTML = '' + children;
3394                                         return node.lastChild;
3395                                 }
3396
3397                                 return null;
3398                         },
3399
3400                         /**
3401                          * Replaces the content of the given node with the given children.
3402                          *
3403                          * This function first removes any children of the given DOM
3404                          * `Node` and then adds the given given children following the
3405                          * rules outlined below.
3406                          *
3407                          * @instance
3408                          * @memberof LuCI.dom
3409                          * @param {*} node
3410                          * The `Node` argument to replace the children of.
3411                          *
3412                          * @param {*} [children]
3413                          * The childrens to replace into the given node.
3414                          *
3415                          * When `children` is an array, then each item of the array
3416                          * will be either appended as child element or text node,
3417                          * depending on whether the item is a DOM `Node` instance or
3418                          * some other non-`null` value. Non-`Node`, non-`null` values
3419                          * will be converted to strings first before being passed as
3420                          * argument to `createTextNode()`.
3421                          *
3422                          * When `children` is a function, it will be invoked with
3423                          * the passed `node` argument as sole parameter and the `append`
3424                          * function will be invoked again, with the given `node` argument
3425                          * as first and the return value of the `children` function as
3426                          * second parameter.
3427                          *
3428                          * When `children` is is a DOM `Node` instance, it will be
3429                          * appended to the given `node`.
3430                          *
3431                          * When `children` is any other non-`null` value, it will be
3432                          * converted to a string and appened to the `innerHTML` property
3433                          * of the given `node`.
3434                          *
3435                          * @returns {Node|null}
3436                          * Returns the last children `Node` appended to the node or `null`
3437                          * if either the `node` argument was no valid DOM `node` or if the
3438                          * `children` was `null` or didn't result in further DOM nodes.
3439                          */
3440                         content: function(node, children) {
3441                                 if (!this.elem(node))
3442                                         return null;
3443
3444                                 var dataNodes = node.querySelectorAll('[data-idref]');
3445
3446                                 for (var i = 0; i &lt; dataNodes.length; i++)
3447                                         delete this.registry[dataNodes[i].getAttribute('data-idref')];
3448
3449                                 while (node.firstChild)
3450                                         node.removeChild(node.firstChild);
3451
3452                                 return this.append(node, children);
3453                         },
3454
3455                         /**
3456                          * Sets attributes or registers event listeners on element nodes.
3457                          *
3458                          * @instance
3459                          * @memberof LuCI.dom
3460                          * @param {*} node
3461                          * The `Node` argument to set the attributes or add the event
3462                          * listeners for. When the given `node` value is not a valid
3463                          * DOM `Node`, the function returns and does nothing.
3464                          *
3465                          * @param {string|Object&lt;string, *>} key
3466                          * Specifies either the attribute or event handler name to use,
3467                          * or an object containing multiple key, value pairs which are
3468                          * each added to the node as either attribute or event handler,
3469                          * depending on the respective value.
3470                          *
3471                          * @param {*} [val]
3472                          * Specifies the attribute value or event handler function to add.
3473                          * If the `key` parameter is an `Object`, this parameter will be
3474                          * ignored.
3475                          *
3476                          * When `val` is of type function, it will be registered as event
3477                          * handler on the given `node` with the `key` parameter being the
3478                          * event name.
3479                          *
3480                          * When `val` is of type object, it will be serialized as JSON and
3481                          * added as attribute to the given `node`, using the given `key`
3482                          * as attribute name.
3483                          *
3484                          * When `val` is of any other type, it will be added as attribute
3485                          * to the given `node` as-is, with the underlying `setAttribute()`
3486                          * call implicitely turning it into a string.
3487                          */
3488                         attr: function(node, key, val) {
3489                                 if (!this.elem(node))
3490                                         return null;
3491
3492                                 var attr = null;
3493
3494                                 if (typeof(key) === 'object' &amp;&amp; key !== null)
3495                                         attr = key;
3496                                 else if (typeof(key) === 'string')
3497                                         attr = {}, attr[key] = val;
3498
3499                                 for (key in attr) {
3500                                         if (!attr.hasOwnProperty(key) || attr[key] == null)
3501                                                 continue;
3502
3503                                         switch (typeof(attr[key])) {
3504                                         case 'function':
3505                                                 node.addEventListener(key, attr[key]);
3506                                                 break;
3507
3508                                         case 'object':
3509                                                 node.setAttribute(key, JSON.stringify(attr[key]));
3510                                                 break;
3511
3512                                         default:
3513                                                 node.setAttribute(key, attr[key]);
3514                                         }
3515                                 }
3516                         },
3517
3518                         /**
3519                          * Creates a new DOM `Node` from the given `html`, `attr` and
3520                          * `data` parameters.
3521                          *
3522                          * This function has multiple signatures, it can be either invoked
3523                          * in the form `create(html[, attr[, data]])` or in the form
3524                          * `create(html[, data])`. The used variant is determined from the
3525                          * type of the second argument.
3526                          *
3527                          * @instance
3528                          * @memberof LuCI.dom
3529                          * @param {*} html
3530                          * Describes the node to create.
3531                          *
3532                          * When the value of `html` is of type array, a `DocumentFragment`
3533                          * node is created and each item of the array is first converted
3534                          * to a DOM `Node` by passing it through `create()` and then added
3535                          * as child to the fragment.
3536                          *
3537                          * When the value of `html` is a DOM `Node` instance, no new
3538                          * element will be created but the node will be used as-is.
3539                          *
3540                          * When the value of `html` is a string starting with `&lt;`, it will
3541                          * be passed to `dom.parse()` and the resulting value is used.
3542                          *
3543                          * When the value of `html` is any other string, it will be passed
3544                          * to `document.createElement()` for creating a new DOM `Node` of
3545                          * the given name.
3546                          *
3547                          * @param {Object&lt;string, *>} [attr]
3548                          * Specifies an Object of key, value pairs to set as attributes
3549                          * or event handlers on the created node. Refer to
3550                          * {@link LuCI.dom#attr dom.attr()} for details.
3551                          *
3552                          * @param {*} [data]
3553                          * Specifies children to append to the newly created element.
3554                          * Refer to {@link LuCI.dom#append dom.append()} for details.
3555                          *
3556                          * @throws {InvalidCharacterError}
3557                          * Throws an `InvalidCharacterError` when the given `html`
3558                          * argument contained malformed markup (such as not escaped
3559                          * `&amp;` characters in XHTML mode) or when the given node name
3560                          * in `html` contains characters which are not legal in DOM
3561                          * element names, such as spaces.
3562                          *
3563                          * @returns {Node}
3564                          * Returns the newly created `Node`.
3565                          */
3566                         create: function() {
3567                                 var html = arguments[0],
3568                                     attr = arguments[1],
3569                                     data = arguments[2],
3570                                     elem;
3571
3572                                 if (!(attr instanceof Object) || Array.isArray(attr))
3573                                         data = attr, attr = null;
3574
3575                                 if (Array.isArray(html)) {
3576                                         elem = document.createDocumentFragment();
3577                                         for (var i = 0; i &lt; html.length; i++)
3578                                                 elem.appendChild(this.create(html[i]));
3579                                 }
3580                                 else if (this.elem(html)) {
3581                                         elem = html;
3582                                 }
3583                                 else if (html.charCodeAt(0) === 60) {
3584                                         elem = this.parse(html);
3585                                 }
3586                                 else {
3587                                         elem = document.createElement(html);
3588                                 }
3589
3590                                 if (!elem)
3591                                         return null;
3592
3593                                 this.attr(elem, attr);
3594                                 this.append(elem, data);
3595
3596                                 return elem;
3597                         },
3598
3599                         registry: {},
3600
3601                         /**
3602                          * Attaches or detaches arbitrary data to and from a DOM `Node`.
3603                          *
3604                          * This function is useful to attach non-string values or runtime
3605                          * data that is not serializable to DOM nodes. To decouple data
3606                          * from the DOM, values are not added directly to nodes, but
3607                          * inserted into a registry instead which is then referenced by a
3608                          * string key stored as `data-idref` attribute in the node.
3609                          *
3610                          * This function has multiple signatures and is sensitive to the
3611                          * number of arguments passed to it.
3612                          *
3613                          *  - `dom.data(node)` -
3614                          *     Fetches all data associated with the given node.
3615                          *  - `dom.data(node, key)` -
3616                          *     Fetches a specific key associated with the given node.
3617                          *  - `dom.data(node, key, val)` -
3618                          *     Sets a specific key to the given value associated with the
3619                          *     given node.
3620                          *  - `dom.data(node, null)` -
3621                          *     Clears any data associated with the node.
3622                          *  - `dom.data(node, key, null)` -
3623                          *     Clears the given key associated with the node.
3624                          *
3625                          * @instance
3626                          * @memberof LuCI.dom
3627                          * @param {Node} node
3628                          * The DOM `Node` instance to set or retrieve the data for.
3629                          *
3630                          * @param {string|null} [key]
3631                          * This is either a string specifying the key to retrieve, or
3632                          * `null` to unset the entire node data.
3633                          *
3634                          * @param {*|null} [val]
3635                          * This is either a non-`null` value to set for a given key or
3636                          * `null` to remove the given `key` from the specified node.
3637                          *
3638                          * @returns {*}
3639                          * Returns the get or set value, or `null` when no value could
3640                          * be found.
3641                          */
3642                         data: function(node, key, val) {
3643                                 var id = node.getAttribute('data-idref');
3644
3645                                 /* clear all data */
3646                                 if (arguments.length > 1 &amp;&amp; key == null) {
3647                                         if (id != null) {
3648                                                 node.removeAttribute('data-idref');
3649                                                 val = this.registry[id]
3650                                                 delete this.registry[id];
3651                                                 return val;
3652                                         }
3653
3654                                         return null;
3655                                 }
3656
3657                                 /* clear a key */
3658                                 else if (arguments.length > 2 &amp;&amp; key != null &amp;&amp; val == null) {
3659                                         if (id != null) {
3660                                                 val = this.registry[id][key];
3661                                                 delete this.registry[id][key];
3662                                                 return val;
3663                                         }
3664
3665                                         return null;
3666                                 }
3667
3668                                 /* set a key */
3669                                 else if (arguments.length > 2 &amp;&amp; key != null &amp;&amp; val != null) {
3670                                         if (id == null) {
3671                                                 do { id = Math.floor(Math.random() * 0xffffffff).toString(16) }
3672                                                 while (this.registry.hasOwnProperty(id));
3673
3674                                                 node.setAttribute('data-idref', id);
3675                                                 this.registry[id] = {};
3676                                         }
3677
3678                                         return (this.registry[id][key] = val);
3679                                 }
3680
3681                                 /* get all data */
3682                                 else if (arguments.length == 1) {
3683                                         if (id != null)
3684                                                 return this.registry[id];
3685
3686                                         return null;
3687                                 }
3688
3689                                 /* get a key */
3690                                 else if (arguments.length == 2) {
3691                                         if (id != null)
3692                                                 return this.registry[id][key];
3693                                 }
3694
3695                                 return null;
3696                         },
3697
3698                         /**
3699                          * Binds the given class instance ot the specified DOM `Node`.
3700                          *
3701                          * This function uses the `dom.data()` facility to attach the
3702                          * passed instance of a Class to a node. This is needed for
3703                          * complex widget elements or similar where the corresponding
3704                          * class instance responsible for the element must be retrieved
3705                          * from DOM nodes obtained by `querySelector()` or similar means.
3706                          *
3707                          * @instance
3708                          * @memberof LuCI.dom
3709                          * @param {Node} node
3710                          * The DOM `Node` instance to bind the class to.
3711                          *
3712                          * @param {Class} inst
3713                          * The Class instance to bind to the node.
3714                          *
3715                          * @throws {TypeError}
3716                          * Throws a `TypeError` when the given instance argument isn't
3717                          * a valid Class instance.
3718                          *
3719                          * @returns {Class}
3720                          * Returns the bound class instance.
3721                          */
3722                         bindClassInstance: function(node, inst) {
3723                                 if (!(inst instanceof Class))
3724                                         L.error('TypeError', 'Argument must be a class instance');
3725
3726                                 return this.data(node, '_class', inst);
3727                         },
3728
3729                         /**
3730                          * Finds a bound class instance on the given node itself or the
3731                          * first bound instance on its closest parent node.
3732                          *
3733                          * @instance
3734                          * @memberof LuCI.dom
3735                          * @param {Node} node
3736                          * The DOM `Node` instance to start from.
3737                          *
3738                          * @returns {Class|null}
3739                          * Returns the founds class instance if any or `null` if no bound
3740                          * class could be found on the node itself or any of its parents.
3741                          */
3742                         findClassInstance: function(node) {
3743                                 var inst = null;
3744
3745                                 do {
3746                                         inst = this.data(node, '_class');
3747                                         node = node.parentNode;
3748                                 }
3749                                 while (!(inst instanceof Class) &amp;&amp; node != null);
3750
3751                                 return inst;
3752                         },
3753
3754                         /**
3755                          * Finds a bound class instance on the given node itself or the
3756                          * first bound instance on its closest parent node and invokes
3757                          * the specified method name on the found class instance.
3758                          *
3759                          * @instance
3760                          * @memberof LuCI.dom
3761                          * @param {Node} node
3762                          * The DOM `Node` instance to start from.
3763                          *
3764                          * @param {string} method
3765                          * The name of the method to invoke on the found class instance.
3766                          *
3767                          * @param {...*} params
3768                          * Additional arguments to pass to the invoked method as-is.
3769                          *
3770                          * @returns {*|null}
3771                          * Returns the return value of the invoked method if a class
3772                          * instance and method has been found. Returns `null` if either
3773                          * no bound class instance could be found, or if the found
3774                          * instance didn't have the requested `method`.
3775                          */
3776                         callClassMethod: function(node, method /*, ... */) {
3777                                 var inst = this.findClassInstance(node);
3778
3779                                 if (inst == null || typeof(inst[method]) != 'function')
3780                                         return null;
3781
3782                                 return inst[method].apply(inst, inst.varargs(arguments, 2));
3783                         },
3784
3785                         /**
3786                          * The ignore callback function is invoked by `isEmpty()` for each
3787                          * child node to decide whether to ignore a child node or not.
3788                          *
3789                          * When this function returns `false`, the node passed to it is
3790                          * ignored, else not.
3791                          *
3792                          * @callback LuCI.dom~ignoreCallbackFn
3793                          * @param {Node} node
3794                          * The child node to test.
3795                          *
3796                          * @returns {boolean}
3797                          * Boolean indicating whether to ignore the node or not.
3798                          */
3799
3800                         /**
3801                          * Tests whether a given DOM `Node` instance is empty or appears
3802                          * empty.
3803                          *
3804                          * Any element child nodes which have the CSS class `hidden` set
3805                          * or for which the optionally passed `ignoreFn` callback function
3806                          * returns `false` are ignored.
3807                          *
3808                          * @instance
3809                          * @memberof LuCI.dom
3810                          * @param {Node} node
3811                          * The DOM `Node` instance to test.
3812                          *
3813                          * @param {LuCI.dom~ignoreCallbackFn} [ignoreFn]
3814                          * Specifies an optional function which is invoked for each child
3815                          * node to decide whether the child node should be ignored or not.
3816                          *
3817                          * @returns {boolean}
3818                          * Returns `true` if the node does not have any children or if
3819                          * any children node either has a `hidden` CSS class or a `false`
3820                          * result when testing it using the given `ignoreFn`.
3821                          */
3822                         isEmpty: function(node, ignoreFn) {
3823                                 for (var child = node.firstElementChild; child != null; child = child.nextElementSibling)
3824                                         if (!child.classList.contains('hidden') &amp;&amp; (!ignoreFn || !ignoreFn(child)))
3825                                                 return false;
3826
3827                                 return true;
3828                         }
3829                 }),
3830
3831                 Poll: Poll,
3832                 Class: Class,
3833                 Request: Request,
3834
3835                 /**
3836                  * @class
3837                  * @memberof LuCI
3838                  * @hideconstructor
3839                  * @classdesc
3840                  *
3841                  * The `view` class forms the basis of views and provides a standard
3842                  * set of methods to inherit from.
3843                  */
3844                 view: Class.extend(/* @lends LuCI.view.prototype */ {
3845                         __name__: 'LuCI.View',
3846
3847                         __init__: function() {
3848                                 var vp = document.getElementById('view');
3849
3850                                 L.dom.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…')));
3851
3852                                 return Promise.resolve(this.load())
3853                                         .then(L.bind(this.render, this))
3854                                         .then(L.bind(function(nodes) {
3855                                                 var vp = document.getElementById('view');
3856
3857                                                 L.dom.content(vp, nodes);
3858                                                 L.dom.append(vp, this.addFooter());
3859                                         }, this)).catch(L.error);
3860                         },
3861
3862                         /**
3863                          * The load function is invoked before the view is rendered.
3864                          *
3865                          * The invocation of this function is wrapped by
3866                          * `Promise.resolve()` so it may return Promises if needed.
3867                          *
3868                          * The return value of the function (or the resolved values
3869                          * of the promise returned by it) will be passed as first
3870                          * argument to `render()`.
3871                          *
3872                          * This function is supposed to be overwritten by subclasses,
3873                          * the default implementation does nothing.
3874                          *
3875                          * @instance
3876                          * @abstract
3877                          * @memberof LuCI.view
3878                          *
3879                          * @returns {*|Promise&lt;*>}
3880                          * May return any value or a Promise resolving to any value.
3881                          */
3882                         load: function() {},
3883
3884                         /**
3885                          * The render function is invoked after the
3886                          * {@link LuCI.view#load load()} function and responsible
3887                          * for setting up the view contents. It must return a DOM
3888                          * `Node` or `DocumentFragment` holding the contents to
3889                          * insert into the view area.
3890                          *
3891                          * The invocation of this function is wrapped by
3892                          * `Promise.resolve()` so it may return Promises if needed.
3893                          *
3894                          * The return value of the function (or the resolved values
3895                          * of the promise returned by it) will be inserted into the
3896                          * main content area using
3897                          * {@link LuCI.dom#append dom.append()}.
3898                          *
3899                          * This function is supposed to be overwritten by subclasses,
3900                          * the default implementation does nothing.
3901                          *
3902                          * @instance
3903                          * @abstract
3904                          * @memberof LuCI.view
3905                          * @param {*|null} load_results
3906                          * This function will receive the return value of the
3907                          * {@link LuCI.view#load view.load()} function as first
3908                          * argument.
3909                          *
3910                          * @returns {Node|Promise&lt;Node>}
3911                          * Should return a DOM `Node` value or a `Promise` resolving
3912                          * to a `Node` value.
3913                          */
3914                         render: function() {},
3915
3916                         /**
3917                          * The handleSave function is invoked when the user clicks
3918                          * the `Save` button in the page action footer.
3919                          *
3920                          * The default implementation should be sufficient for most
3921                          * views using {@link form#Map form.Map()} based forms - it
3922                          * will iterate all forms present in the view and invoke
3923                          * the {@link form#Map#save Map.save()} method on each form.
3924                          *
3925                          * Views not using `Map` instances or requiring other special
3926                          * logic should overwrite `handleSave()` with a custom
3927                          * implementation.
3928                          *
3929                          * To disable the `Save` page footer button, views extending
3930                          * this base class should overwrite the `handleSave` function
3931                          * with `null`.
3932                          *
3933                          * The invocation of this function is wrapped by
3934                          * `Promise.resolve()` so it may return Promises if needed.
3935                          *
3936                          * @instance
3937                          * @memberof LuCI.view
3938                          * @param {Event} ev
3939                          * The DOM event that triggered the function.
3940                          *
3941                          * @returns {*|Promise&lt;*>}
3942                          * Any return values of this function are discarded, but
3943                          * passed through `Promise.resolve()` to ensure that any
3944                          * returned promise runs to completion before the button
3945                          * is reenabled.
3946                          */
3947                         handleSave: function(ev) {
3948                                 var tasks = [];
3949
3950                                 document.getElementById('maincontent')
3951                                         .querySelectorAll('.cbi-map').forEach(function(map) {
3952                                                 tasks.push(L.dom.callClassMethod(map, 'save'));
3953                                         });
3954
3955                                 return Promise.all(tasks);
3956                         },
3957
3958                         /**
3959                          * The handleSaveApply function is invoked when the user clicks
3960                          * the `Save &amp; Apply` button in the page action footer.
3961                          *
3962                          * The default implementation should be sufficient for most
3963                          * views using {@link form#Map form.Map()} based forms - it
3964                          * will first invoke
3965                          * {@link LuCI.view.handleSave view.handleSave()} and then
3966                          * call {@link ui#changes#apply ui.changes.apply()} to start the
3967                          * modal config apply and page reload flow.
3968                          *
3969                          * Views not using `Map` instances or requiring other special
3970                          * logic should overwrite `handleSaveApply()` with a custom
3971                          * implementation.
3972                          *
3973                          * To disable the `Save &amp; Apply` page footer button, views
3974                          * extending this base class should overwrite the
3975                          * `handleSaveApply` function with `null`.
3976                          *
3977                          * The invocation of this function is wrapped by
3978                          * `Promise.resolve()` so it may return Promises if needed.
3979                          *
3980                          * @instance
3981                          * @memberof LuCI.view
3982                          * @param {Event} ev
3983                          * The DOM event that triggered the function.
3984                          *
3985                          * @returns {*|Promise&lt;*>}
3986                          * Any return values of this function are discarded, but
3987                          * passed through `Promise.resolve()` to ensure that any
3988                          * returned promise runs to completion before the button
3989                          * is reenabled.
3990                          */
3991                         handleSaveApply: function(ev, mode) {
3992                                 return this.handleSave(ev).then(function() {
3993                                         L.ui.changes.apply(mode == '0');
3994                                 });
3995                         },
3996
3997                         /**
3998                          * The handleReset function is invoked when the user clicks
3999                          * the `Reset` button in the page action footer.
4000                          *
4001                          * The default implementation should be sufficient for most
4002                          * views using {@link form#Map form.Map()} based forms - it
4003                          * will iterate all forms present in the view and invoke
4004                          * the {@link form#Map#save Map.reset()} method on each form.
4005                          *
4006                          * Views not using `Map` instances or requiring other special
4007                          * logic should overwrite `handleReset()` with a custom
4008                          * implementation.
4009                          *
4010                          * To disable the `Reset` page footer button, views extending
4011                          * this base class should overwrite the `handleReset` function
4012                          * with `null`.
4013                          *
4014                          * The invocation of this function is wrapped by
4015                          * `Promise.resolve()` so it may return Promises if needed.
4016                          *
4017                          * @instance
4018                          * @memberof LuCI.view
4019                          * @param {Event} ev
4020                          * The DOM event that triggered the function.
4021                          *
4022                          * @returns {*|Promise&lt;*>}
4023                          * Any return values of this function are discarded, but
4024                          * passed through `Promise.resolve()` to ensure that any
4025                          * returned promise runs to completion before the button
4026                          * is reenabled.
4027                          */
4028                         handleReset: function(ev) {
4029                                 var tasks = [];
4030
4031                                 document.getElementById('maincontent')
4032                                         .querySelectorAll('.cbi-map').forEach(function(map) {
4033                                                 tasks.push(L.dom.callClassMethod(map, 'reset'));
4034                                         });
4035
4036                                 return Promise.all(tasks);
4037                         },
4038
4039                         /**
4040                          * Renders a standard page action footer if any of the
4041                          * `handleSave()`, `handleSaveApply()` or `handleReset()`
4042                          * functions are defined.
4043                          *
4044                          * The default implementation should be sufficient for most
4045                          * views - it will render a standard page footer with action
4046                          * buttons labeled `Save`, `Save &amp; Apply` and `Reset`
4047                          * triggering the `handleSave()`, `handleSaveApply()` and
4048                          * `handleReset()` functions respectively.
4049                          *
4050                          * When any of these `handle*()` functions is overwritten
4051                          * with `null` by a view extending this class, the
4052                          * corresponding button will not be rendered.
4053                          *
4054                          * @instance
4055                          * @memberof LuCI.view
4056                          * @returns {DocumentFragment}
4057                          * Returns a `DocumentFragment` containing the footer bar
4058                          * with buttons for each corresponding `handle*()` action
4059                          * or an empty `DocumentFragment` if all three `handle*()`
4060                          * methods are overwritten with `null`.
4061                          */
4062                         addFooter: function() {
4063                                 var footer = E([]);
4064
4065                                 var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', {
4066                                         0: [ _('Save &amp; Apply') ],
4067                                         1: [ _('Apply unchecked') ]
4068                                 }, {
4069                                         classes: {
4070                                                 0: 'cbi-button cbi-button-apply important',
4071                                                 1: 'cbi-button cbi-button-negative important'
4072                                         },
4073                                         click: L.ui.createHandlerFn(this, 'handleSaveApply')
4074                                 }).render() : E([]);
4075
4076                                 if (this.handleSaveApply || this.handleSave || this.handleReset) {
4077                                         footer.appendChild(E('div', { 'class': 'cbi-page-actions' }, [
4078                                                 saveApplyBtn, ' ',
4079                                                 this.handleSave ? E('button', {
4080                                                         'class': 'cbi-button cbi-button-save',
4081                                                         'click': L.ui.createHandlerFn(this, 'handleSave')
4082                                                 }, [ _('Save') ]) : '', ' ',
4083                                                 this.handleReset ? E('button', {
4084                                                         'class': 'cbi-button cbi-button-reset',
4085                                                         'click': L.ui.createHandlerFn(this, 'handleReset')
4086                                                 }, [ _('Reset') ]) : ''
4087                                         ]));
4088                                 }
4089
4090                                 return footer;
4091                         }
4092                 })
4093         });
4094
4095         /**
4096          * @class
4097          * @memberof LuCI
4098          * @deprecated
4099          * @classdesc
4100          *
4101          * The `LuCI.XHR` class is a legacy compatibility shim for the
4102          * functionality formerly provided by `xhr.js`. It is registered as global
4103          * `window.XHR` symbol for compatibility with legacy code.
4104          *
4105          * New code should use {@link LuCI.Request} instead to implement HTTP
4106          * request handling.
4107          */
4108         var XHR = Class.extend(/** @lends LuCI.XHR.prototype */ {
4109                 __name__: 'LuCI.XHR',
4110                 __init__: function() {
4111                         if (window.console &amp;&amp; console.debug)
4112                                 console.debug('Direct use XHR() is deprecated, please use L.Request instead');
4113                 },
4114
4115                 _response: function(cb, res, json, duration) {
4116                         if (this.active)
4117                                 cb(res, json, duration);
4118                         delete this.active;
4119                 },
4120
4121                 /**
4122                  * This function is a legacy wrapper around
4123                  * {@link LuCI#get LuCI.get()}.
4124                  *
4125                  * @instance
4126                  * @deprecated
4127                  * @memberof LuCI.XHR
4128                  *
4129                  * @param {string} url
4130                  * The URL to request
4131                  *
4132                  * @param {Object} [data]
4133                  * Additional query string data
4134                  *
4135                  * @param {LuCI.requestCallbackFn} [callback]
4136                  * Callback function to invoke on completion
4137                  *
4138                  * @param {number} [timeout]
4139                  * Request timeout to use
4140                  *
4141                  * @return {Promise&lt;null>}
4142                  */
4143                 get: function(url, data, callback, timeout) {
4144                         this.active = true;
4145                         L.get(url, data, this._response.bind(this, callback), timeout);
4146                 },
4147
4148                 /**
4149                  * This function is a legacy wrapper around
4150                  * {@link LuCI#post LuCI.post()}.
4151                  *
4152                  * @instance
4153                  * @deprecated
4154                  * @memberof LuCI.XHR
4155                  *
4156                  * @param {string} url
4157                  * The URL to request
4158                  *
4159                  * @param {Object} [data]
4160                  * Additional data to append to the request body.
4161                  *
4162                  * @param {LuCI.requestCallbackFn} [callback]
4163                  * Callback function to invoke on completion
4164                  *
4165                  * @param {number} [timeout]
4166                  * Request timeout to use
4167                  *
4168                  * @return {Promise&lt;null>}
4169                  */
4170                 post: function(url, data, callback, timeout) {
4171                         this.active = true;
4172                         L.post(url, data, this._response.bind(this, callback), timeout);
4173                 },
4174
4175                 /**
4176                  * Cancels a running request.
4177                  *
4178                  * This function does not actually cancel the underlying
4179                  * `XMLHTTPRequest` request but it sets a flag which prevents the
4180                  * invocation of the callback function when the request eventually
4181                  * finishes or timed out.
4182                  *
4183                  * @instance
4184                  * @deprecated
4185                  * @memberof LuCI.XHR
4186                  */
4187                 cancel: function() { delete this.active },
4188
4189                 /**
4190                  * Checks the running state of the request.
4191                  *
4192                  * @instance
4193                  * @deprecated
4194                  * @memberof LuCI.XHR
4195                  *
4196                  * @returns {boolean}
4197                  * Returns `true` if the request is still running or `false` if it
4198                  * already completed.
4199                  */
4200                 busy: function() { return (this.active === true) },
4201
4202                 /**
4203                  * Ignored for backwards compatibility.
4204                  *
4205                  * This function does nothing.
4206                  *
4207                  * @instance
4208                  * @deprecated
4209                  * @memberof LuCI.XHR
4210                  */
4211                 abort: function() {},
4212
4213                 /**
4214                  * Existing for backwards compatibility.
4215                  *
4216                  * This function simply throws an `InternalError` when invoked.
4217                  *
4218                  * @instance
4219                  * @deprecated
4220                  * @memberof LuCI.XHR
4221                  *
4222                  * @throws {InternalError}
4223                  * Throws an `InternalError` with the message `Not implemented`
4224                  * when invoked.
4225                  */
4226                 send_form: function() { L.error('InternalError', 'Not implemented') },
4227         });
4228
4229         XHR.get = function() { return window.L.get.apply(window.L, arguments) };
4230         XHR.post = function() { return window.L.post.apply(window.L, arguments) };
4231         XHR.poll = function() { return window.L.poll.apply(window.L, arguments) };
4232         XHR.stop = Request.poll.remove.bind(Request.poll);
4233         XHR.halt = Request.poll.stop.bind(Request.poll);
4234         XHR.run = Request.poll.start.bind(Request.poll);
4235         XHR.running = Request.poll.active.bind(Request.poll);
4236
4237         window.XHR = XHR;
4238         window.LuCI = LuCI;
4239 })(window, document);
4240 </code></pre>
4241         </article>
4242     </section>
4243
4244
4245
4246
4247
4248
4249         
4250
4251         <footer>
4252             Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Feb 12 2020 11:56:59 GMT+0100 (Central European Standard Time)
4253         </footer>
4254     </div>
4255 </div>
4256 <script>prettyPrint();</script>
4257 <script src="scripts/jaguar.js"></script>
4258 </body>
4259 </html>