From: Arno Renevier Date: Thu, 8 Sep 2011 15:04:56 +0000 (+0200) Subject: allow opening terms of use box with space keyboard X-Git-Tag: v.0.3.7~3 X-Git-Url: https://dev.renevier.net/?p=syj.git;a=commitdiff_plain;h=ff69f7714757b203baa031cf3c86a7f4256b11e2;ds=sidebyside allow opening terms of use box with space keyboard --- 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) {