From 75a5dbd01dd4c57b96dd1fa322bc4d9ec9f865d1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 28 Jun 2008 11:34:53 +0000 Subject: [PATCH] Upgraded to Prototype 1.6.0.1. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1594 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- public/javascripts/context_menu.js | 8 +- public/javascripts/controls.js | 838 +++--- public/javascripts/dragdrop.js | 146 +- public/javascripts/effects.js | 760 +++--- public/javascripts/prototype.js | 3924 ++++++++++++++++++++-------- 5 files changed, 3789 insertions(+), 1887 deletions(-) diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index 3e2d571fa..dfd72b1fa 100644 --- a/public/javascripts/context_menu.js +++ b/public/javascripts/context_menu.js @@ -28,11 +28,11 @@ ContextMenu.prototype = { RightClick: function(e) { this.hideMenu(); // do not show the context menu on links - if (Event.findElement(e, 'a') != document) { return; } + if (Event.findElement(e, 'a') != document && Event.findElement(e, 'a') != undefined) { return; } // right-click simulated by Alt+Click with Opera if (window.opera && !e.altKey) { return; } var tr = Event.findElement(e, 'tr'); - if ((tr == document) || !tr.hasClassName('hascontextmenu')) { return; } + if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; } Event.stop(e); if (!this.isSelected(tr)) { this.unselectAll(); @@ -44,14 +44,14 @@ ContextMenu.prototype = { Click: function(e) { this.hideMenu(); - if (Event.findElement(e, 'a') != document) { return; } + if (Event.findElement(e, 'a') != document && Event.findElement(e, 'a') != undefined ) { return; } if (window.opera && e.altKey) { return; } if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) { var tr = Event.findElement(e, 'tr'); if (tr!=document && tr.hasClassName('hascontextmenu')) { // a row was clicked, check if the click was on checkbox var box = Event.findElement(e, 'input'); - if (box!=document) { + if (box!=document && box!=undefined) { // a checkbox may be clicked if (box.checked) { tr.addClassName('context-menu-selection'); diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js index 8c273f874..5aaf0bb2b 100644 --- a/public/javascripts/controls.js +++ b/public/javascripts/controls.js @@ -1,6 +1,6 @@ -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) +// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) // Contributors: // Richard Livsey // Rahul Bhargava @@ -37,22 +37,23 @@ if(typeof Effect == 'undefined') throw("controls.js requires including script.aculo.us' effects.js library"); -var Autocompleter = {} -Autocompleter.Base = function() {}; -Autocompleter.Base.prototype = { +var Autocompleter = { } +Autocompleter.Base = Class.create({ baseInitialize: function(element, update, options) { - this.element = $(element); + element = $(element) + this.element = element; this.update = $(update); this.hasFocus = false; this.changed = false; this.active = false; this.index = 0; this.entryCount = 0; + this.oldElementValue = this.element.value; if(this.setOptions) this.setOptions(options); else - this.options = options || {}; + this.options = options || { }; this.options.paramName = this.options.paramName || this.element.name; this.options.tokens = this.options.tokens || []; @@ -74,6 +75,9 @@ Autocompleter.Base.prototype = { if(typeof(this.options.tokens) == 'string') this.options.tokens = new Array(this.options.tokens); + // Force carriage returns as token delimiters anyway + if (!this.options.tokens.include('\n')) + this.options.tokens.push('\n'); this.observer = null; @@ -81,15 +85,14 @@ Autocompleter.Base.prototype = { Element.hide(this.update); - Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); + Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); }, show: function() { if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); if(!this.iefix && - (navigator.appVersion.indexOf('MSIE')>0) && - (navigator.userAgent.indexOf('Opera')<0) && + (Prototype.Browser.IE) && (Element.getStyle(this.update, 'position')=='absolute')) { new Insertion.After(this.update, '