props.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <script>(function(){
  6. var props = {};
  7. function addObject(obj) {
  8. if (obj == null) return;
  9. try {
  10. Object.getOwnPropertyNames(obj).forEach(add);
  11. } catch(ex) {}
  12. if (obj.prototype) {
  13. Object.getOwnPropertyNames(obj.prototype).forEach(add);
  14. }
  15. if (typeof obj == "function") {
  16. try {
  17. Object.getOwnPropertyNames(new obj).forEach(add);
  18. } catch(ex) {}
  19. }
  20. }
  21. function add(name) {
  22. props[name] = true;
  23. }
  24. Object.getOwnPropertyNames(window).forEach(function(thing){
  25. addObject(window[thing]);
  26. });
  27. try {
  28. addObject(new Event("click"));
  29. addObject(new Event("contextmenu"));
  30. addObject(new Event("mouseup"));
  31. addObject(new Event("mousedown"));
  32. addObject(new Event("keydown"));
  33. addObject(new Event("keypress"));
  34. addObject(new Event("keyup"));
  35. } catch(ex) {}
  36. var ta = document.createElement("textarea");
  37. ta.style.width = "100%";
  38. ta.style.height = "20em";
  39. ta.style.boxSizing = "border-box";
  40. <!-- ta.value = Object.keys(props).sort(cmp).map(function(name){ -->
  41. <!-- return JSON.stringify(name); -->
  42. <!-- }).join(",\n"); -->
  43. ta.value = JSON.stringify({
  44. vars: [],
  45. props: Object.keys(props).sort(cmp)
  46. }, null, 2);
  47. document.body.appendChild(ta);
  48. function cmp(a, b) {
  49. a = a.toLowerCase();
  50. b = b.toLowerCase();
  51. return a < b ? -1 : a > b ? 1 : 0;
  52. }
  53. })();</script>
  54. </body>
  55. </html>