diff --git a/common/content/events.js b/common/content/events.js index 5a25aff9..303be2ea 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -296,7 +296,7 @@ var EventHive = Class("EventHive", Contexts.Hive, { */ listen: function (target, event, callback, capture) { if (isObject(event)) - var [self, events] = [event, event[callback]]; + var [self, events] = [event, event[callback || "events"]]; else [self, events] = [null, array.toObject([[event, callback]])]; diff --git a/common/content/hints.js b/common/content/hints.js index 0ff1a421..479819ff 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -39,6 +39,7 @@ var HintSession = Class("HintSession", CommandMode, { this.top = opts.window || content; this.top.addEventListener("resize", hints.resizeTimer.closure.tell, true); + this.top.addEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true); this.generate(); @@ -90,8 +91,10 @@ var HintSession = Class("HintSession", CommandMode, { if (!stack.push) { if (hints.hintSession == this) hints.hintSession = null; - if (this.top) + if (this.top) { this.top.removeEventListener("resize", hints.resizeTimer.closure.tell, true); + this.top.removeEventListener("dactyl-commandupdate", hints.resizeTimer.closure.tell, true); + } this.removeHints(0); } diff --git a/common/modules/template.jsm b/common/modules/template.jsm index c7e9713d..976c8d67 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -136,7 +136,14 @@ var Template = Module("Template", { }, update: function update() { + let collapsed = this.collapsed; this.collapsed = !this.commandAllowed; + + if (collapsed == this.commandAllowed) { + let event = this.node.ownerDocument.createEvent("Events"); + event.initEvent("dactyl-commandupdate", false, false); + this.node.dispatchEvent(event); + } } }),