12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <!-- ++ BEGIN ++ Privoxy ++ detail_startstop.htm ++ -->
- <script type="text/javascript">//<![CDATA[
- // show XHR.poll/XHR.get response on button
- function _data2elements(x) {
- var btn = document.getElementById("cbid.privoxy.privoxy._startstop");
- if ( ! btn ) { return; } // security check
- if (x.responseText == "0") {
- btn.value = "<%:Start%>";
- btn.className = "cbi-button cbi-button-apply";
- btn.disabled = false;
- } else {
- btn.value = "PID: " + x.responseText;
- btn.className = "cbi-button cbi-button-reset";
- btn.disabled = false;
- }
- }
- // event handler for start/stop button
- function onclick_startstop(id) {
- // do start/stop
- var btnXHR = new XHR();
- btnXHR.post('<%=url('admin/services/privoxy/startstop')%>', { token: '<%=token%>' },
- function(x) { _data2elements(x); }
- );
- }
- XHR.poll(5, '<%=url('admin/services/privoxy/status')%>', null,
- function(x, data) { _data2elements(x); }
- );
- //]]></script>
- <%+cbi/valueheader%>
- <% if self:cfgvalue(section) ~= false then
- -- We need to garantie that function cfgvalue run first to set missing parameters
- %>
- <!-- style="font-size: 100%;" needed for openwrt theme to fix font size -->
- <!-- type="button" onclick="..." enable standard onclick functionalty -->
- <input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="font-size: 100%;" type="button" onclick="onclick_startstop(this.id)"
- <%=
- attr("name", section) .. attr("id", cbid) .. attr("value", self.inputtitle) .. ifattr(self.disabled, "disabled")
- %> />
- <% end %>
- <%+cbi/valuefooter%>
- <!-- ++ END ++ Privoxy ++ detail_startstop.htm ++ -->
|