From ff69f7714757b203baa031cf3c86a7f4256b11e2 Mon Sep 17 00:00:00 2001 From: Arno Renevier Date: Thu, 8 Sep 2011 17:04:56 +0200 Subject: [PATCH] allow opening terms of use box with space keyboard --- public/js/syj.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/js/syj.js b/public/js/syj.js index e76accc..7864fe9 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -755,7 +755,11 @@ var SYJUserClass = Class.create(SYJModalClass, { $super(); $("termsofusearea").hide(); - $$("#user_termsofuse_anchor, #geom_termsofuse_anchor").invoke('observe', "click", function(evt) { + var touevt = (function(evt) { + if (evt.type === "keyup" && evt.keyCode !== 32) { // 32 = space + // allow opening box by pressing space + return; + } if (!this.toubox) { this.toubox = new SimpleBox($("termsofusearea"), { closeMethods: ["onescapekey", "onouterclick", "onbutton"] @@ -767,7 +771,11 @@ var SYJUserClass = Class.create(SYJModalClass, { $("termsofuseiframe").setAttribute("src", evt.target.href); } evt.stop(); - }.bindAsEventListener(this)); + }).bindAsEventListener(this); + + ["click", "keyup"].each(function (evtName) { + $$("#user_termsofuse_anchor, #geom_termsofuse_anchor").invoke('observe', evtName, touevt); + }) $$("#login_area_create > a").invoke('observe', 'click', function(evt) { -- 2.39.2