Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var Parser = require("./Parser.js");
  2. var DomHandler = require("domhandler");
  3. function defineProp(name, value) {
  4. delete module.exports[name];
  5. module.exports[name] = value;
  6. return value;
  7. }
  8. module.exports = {
  9. Parser: Parser,
  10. Tokenizer: require("./Tokenizer.js"),
  11. ElementType: require("domelementtype"),
  12. DomHandler: DomHandler,
  13. get FeedHandler() {
  14. return defineProp("FeedHandler", require("./FeedHandler.js"));
  15. },
  16. get Stream() {
  17. return defineProp("Stream", require("./Stream.js"));
  18. },
  19. get WritableStream() {
  20. return defineProp("WritableStream", require("./WritableStream.js"));
  21. },
  22. get ProxyHandler() {
  23. return defineProp("ProxyHandler", require("./ProxyHandler.js"));
  24. },
  25. get DomUtils() {
  26. return defineProp("DomUtils", require("domutils"));
  27. },
  28. get CollectingHandler() {
  29. return defineProp(
  30. "CollectingHandler",
  31. require("./CollectingHandler.js")
  32. );
  33. },
  34. // For legacy support
  35. DefaultHandler: DomHandler,
  36. get RssHandler() {
  37. return defineProp("RssHandler", this.FeedHandler);
  38. },
  39. //helper methods
  40. parseDOM: function(data, options) {
  41. var handler = new DomHandler(options);
  42. new Parser(handler, options).end(data);
  43. return handler.dom;
  44. },
  45. parseFeed: function(feed, options) {
  46. var handler = new module.exports.FeedHandler(options);
  47. new Parser(handler, options).end(feed);
  48. return handler.dom;
  49. },
  50. createDomStream: function(cb, options, elementCb) {
  51. var handler = new DomHandler(cb, options, elementCb);
  52. return new Parser(handler, options);
  53. },
  54. // List of all events that the parser emits
  55. EVENTS: {
  56. /* Format: eventname: number of arguments */
  57. attribute: 2,
  58. cdatastart: 0,
  59. cdataend: 0,
  60. text: 1,
  61. processinginstruction: 2,
  62. comment: 1,
  63. commentend: 0,
  64. closetag: 1,
  65. opentag: 2,
  66. opentagname: 1,
  67. error: 1,
  68. end: 0
  69. }
  70. };