2
0

query.htm 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <%#
  2. Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
  3. This is free software, licensed under the Apache License, Version 2.0
  4. -%>
  5. <%+header%>
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. var stxhr = new XHR();
  9. function update_status(data)
  10. {
  11. var domain = data.value || data.placeholder;
  12. var input = document.getElementById('query_input');
  13. var output = document.getElementById('query_output');
  14. if (input && output)
  15. {
  16. output.innerHTML =
  17. '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
  18. '<%:Waiting for command to complete...%>'
  19. ;
  20. input.parentNode.style.display = 'block';
  21. input.style.display = 'inline';
  22. stxhr.post('<%=luci.dispatcher.build_url('admin/services/adblock/advanced/result/')%>' + domain, { token: '<%=token%>' },
  23. function(x)
  24. {
  25. if (x.responseText)
  26. {
  27. input.style.display = 'none';
  28. output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
  29. }
  30. else
  31. {
  32. input.style.display = 'none';
  33. output.innerHTML = '<span class="error"><%:Blocklist not found!%></span>';
  34. }
  35. }
  36. );
  37. }
  38. }
  39. //]]>
  40. </script>
  41. <form method="post" action="<%=REQUEST_URI%>">
  42. <div class="cbi-map">
  43. <div class="cbi-section">
  44. <div class="cbi-section-descr"><%:This form allows you to query active block lists for certain domains, e.g. for whitelisting.%></div>
  45. <div style="width:33%; float:left;">
  46. <input type="text" placeholder="google.com" name="input" />
  47. <input type="button" value="<%:Query%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.input)" />
  48. </div>
  49. <br style="clear:both" />
  50. <br />
  51. </div>
  52. </div>
  53. <div class="cbi-section" style="display:none">
  54. <h3 id="query_input"><%:Collecting data...%></h3>
  55. <span id="query_output"></span>
  56. </div>
  57. </form>
  58. <%+footer%>