summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-26 14:59:25 +0100
committerYorhel <git@yorhel.nl>2008-11-26 14:59:25 +0100
commitd803fc7c69beb6715ce4b5cacfbf1c6385de32ba (patch)
tree4ce264f096462da9d5ee4389b5c8038081e68e4a
parent499464bc1618ec9a556c085792fccbd5a7131fa9 (diff)
Added a hack for opera to not submit the form on the return key
-rw-r--r--lib/ChangeLog2
-rw-r--r--static/f/forms.js23
2 files changed, 18 insertions, 7 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index ce2268e5..8181e961 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -31,6 +31,8 @@ TODO:
- Boardmods can edit threads without updating the last edited field
- No more RSS feeds for changes (will be replaced with a notification
system in the future)
+ - Improved formsub interface
+ - Improved VN relation editor interface
1.23 - 2008-10-22 (r117)
- Removed redirects for old revision URLs (the code wasn't very secure...)
diff --git a/static/f/forms.js b/static/f/forms.js
index 8c09e1e2..02f570ad 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -117,16 +117,25 @@ function dsKeyDown(ev) {
// do some processing when the enter key has been pressed
if(c == 13) {
- if(obj.selectedId != 0) {
+ if(obj.selectedId != 0)
obj.value = obj.serFunc(x('ds_box_'+obj.selectedId).itemData);
- x('ds_box').style.top = '-500px';
- obj.selectedId = 0;
- return false;
- } else if(obj.returnFunc) {
+ else if(obj.returnFunc)
obj.returnFunc();
- return false;
+ else
+ return true;
+ x('ds_box').style.top = '-500px';
+ obj.selectedId = 0;
+
+ // opera hack: make sure to not send the form on the return key
+ while(obj && obj.nodeName.toLowerCase() != 'form')
+ obj = obj.parentNode;
+ if(obj) {
+ var oldsubmit = obj.onsubmit;
+ obj.onsubmit = function() { return false };
+ setTimeout(function() { obj.onsubmit = oldsubmit }, 100);
}
- return true;
+
+ return false;
}
// process up/down keys