diff options
| -rw-r--r-- | notifier.js | 3 | ||||
| -rw-r--r-- | notifier/subject_hatelabo_bottle.js | 7 | 
2 files changed, 3 insertions, 7 deletions
| diff --git a/notifier.js b/notifier.js index 5dcdfe5..48a4b8a 100644 --- a/notifier.js +++ b/notifier.js @@ -229,6 +229,7 @@ function bootstrap() {                  this.options.extra              );              req.addEventListener('onSuccess', $U.bind(this, function(res) { +                logger.log('initialized');                  if (typeof this.parse == 'function') this.cache = this.parse(res);                  if (this.cache)                      this.initialized = true; @@ -249,11 +250,11 @@ function bootstrap() {                  if (typeof this.parse == 'function') parsed = this.parse(res);                  if (parsed && typeof this.diff == 'function') diff = this.diff(this.cache, parsed);                  if (diff && (typeof diff.length != 'undefined' && diff.length > 0)) { +                    this.cache = parsed;                      if (typeof this.buildMessages == 'function') {                          let messages = this.buildMessages([].concat(diff));                          [].concat(messages).forEach($U.bind(this, function(m) this.notify(m)));                      } -                    this.cache = parsed;                  }              }));              req.get(); diff --git a/notifier/subject_hatelabo_bottle.js b/notifier/subject_hatelabo_bottle.js index 6c4a330..7a00d13 100644 --- a/notifier/subject_hatelabo_bottle.js +++ b/notifier/subject_hatelabo_bottle.js @@ -50,15 +50,10 @@ notifier.subject.register(notifier.SubjectHttp, {      diff: function(cache, parsed) {          var ret = [];          parsed.forEach(function(element) { -           if (!cache.some(function(c) { if (c.toString() == element.toString()) return true })) +           if (!cache.some(function(c) { if (c.textContent == element.textContent) return true }))                 ret.push(element);           }); -          return ret; -        var text = (new XMLSerializer()).serializeToString(parsed[0]) -                            .replace(/<[^>]+>/g, function(all) all.toLowerCase()) -                            .replace(/<!--(?:[^-]|-(?!->))*-->/g, ''); // actually -        return text;      },      buildMessages: function(diff) {          var ret = []; | 
