From 9fd81e39e7ac44bcd48ebc9c953fc0e8ee8e2e67 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 3 Nov 2008 14:08:07 +0000 Subject: [PATCH] Made keystrokes working with Safari (Chrome) SVN revision: 2138 --- scripts/elcode.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/elcode.js b/scripts/elcode.js index d3122b72..e177a263 100755 --- a/scripts/elcode.js +++ b/scripts/elcode.js @@ -7,7 +7,7 @@ function getSelection(text) rng = sel.createRange(); rng.colapse; return rng.text; - } else if (browser == 'Mozilla') + } else if (browser == 'Mozilla' || browser == 'Safari') if (text.selectionEnd > 0 && text.selectionEnd != text.selectionStart && text.value.charAt(text.selectionEnd-1) == ' ') return text.value.substring(text.selectionStart, text.selectionEnd-1); @@ -31,7 +31,7 @@ function replaceSelection(doc, text, newSelection, cursorPos) rng.moveEnd('character', -(newSelection.length-cursorPos)); rng.select(); } - } else if (browser == 'Mozilla') { + } else if (browser == 'Mozilla' || browser == 'Safari') { start = text.selectionStart; stop = text.selectionEnd; if (text.selectionEnd > 0 && text.selectionStart != text.selectionEnd && @@ -166,7 +166,7 @@ function elKeyPress(evt) if (evt.ctrlKey && !evt.shiftKey && !evt.altKey) { - if (browser == 'MSIE') { + if (browser == 'MSIE' || browser == 'Safari') { if (unicode == 10) unicode = 13; else