From 4904fb5bff72e0d45fea353372ccf9c3061722f8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 30 Dec 2015 16:49:40 -0800 Subject: [PATCH] Prevent certain sites from overriding mappings. Closes issue #118. --- common/content/events.js | 12 ++++++++---- common/content/mappings.js | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index d682ba43..9cd552b5 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -97,7 +97,9 @@ var EventHive = Class("EventHive", Contexts.Hive, { * @instance events */ var Events = Module("events", { - dbg: function () {}, + dbg: function (...args) { + util.dump(...args); + }, debug: false, @@ -818,11 +820,13 @@ var Events = Module("events", { if (!this.processor && event.type === "keydown" && options.get("passunknown").getKey(modes.main.allBases)) { - if (!(modes.main.count && /^\d$/.test(key))) - return true; + if (modes.main.count && /^\d$/.test(key)) + return false; if (modes.main.allBases.some(hasCandidates)) - return true; + return false; + + return true; } return false; diff --git a/common/content/mappings.js b/common/content/mappings.js index 02db6d32..2abf558d 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -245,8 +245,9 @@ var MapHive = Class("MapHive", Contexts.Hive, { get: function (mode, cmd, skipPassThrough = false) { let map = this.getStack(mode).mappings[cmd]; - if (skipPassThrough && map && !map.passThrough) + if (skipPassThrough && map && map.passThrough) return null; + return map; },