[Svn] r2439 - in trunk/roundcubemail: program/js skins/default

trac at roundcube.net trac at roundcube.net
Fri May 1 18:58:26 CEST 2009


Author: thomasb
Date: 2009-05-01 11:58:25 -0500 (Fri, 01 May 2009)
New Revision: 2439

Modified:
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/js/googiespell.js
   trunk/roundcubemail/skins/default/googiespell.css
Log:
Update Googiespell to version 4.0

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2009-05-01 16:07:03 UTC (rev 2438)
+++ trunk/roundcubemail/program/js/app.js	2009-05-01 16:58:25 UTC (rev 2439)
@@ -902,8 +902,7 @@
           tinyMCE.execCommand('mceSpellCheck', true);
         }
         else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) {
-          this.env.spellcheck.spellCheck(this.env.spellcheck.check_link);
-          this.set_spellcheck_state('checking');
+          this.env.spellcheck.spellCheck();
         }
         break;
 
@@ -2123,8 +2122,8 @@
     if (this.env.spellcheck) {
       // stop spellchecking process
       if (!vis)
-	this.stop_spellchecking();
-			      
+        this.stop_spellchecking();
+
       this.env.spellcheck.check_link.style.visibility = vis ? 'visible' : 'hidden';
       this.env.spellcheck.switch_lan_pic.style.visibility = vis ? 'visible' : 'hidden';
       }
@@ -2132,7 +2131,7 @@
 
   this.set_spellcheck_state = function(s)
     {
-    this.spellcheck_ready = (s=='check_spelling' || s=='ready');
+    this.spellcheck_ready = (s=='check_spelling' || s=='spell_check' || s=='ready');
     this.enable_command('spellcheck', this.spellcheck_ready);
     };
 

Modified: trunk/roundcubemail/program/js/googiespell.js
===================================================================
--- trunk/roundcubemail/program/js/googiespell.js	2009-05-01 16:07:03 UTC (rev 2438)
+++ trunk/roundcubemail/program/js/googiespell.js	2009-05-01 16:58:25 UTC (rev 2439)
@@ -1,1308 +1,2553 @@
 /*
-Last Modified: 28/04/06 16:28:09
+Last Modified: 29/04/07 18:44:48
 
-  AmiJs library
-    A very small library with DOM and Ajax functions.
-    For a much larger script look on http://www.mochikit.com/
-  AUTHOR
+AJS JavaScript library
+    A very small library with a lot of functionality
+AUTHOR
     4mir Salihefendic (http://amix.dk) - amix at amix.dk
-  LICENSE
+LICENSE
     Copyright (c) 2006 Amir Salihefendic. All rights reserved.
     Copyright (c) 2005 Bob Ippolito. All rights reserved.
     http://www.opensource.org/licenses/mit-license.php
-  VERSION
-    2.1
-  SITE
-    http://amix.dk/amijs
+VERSION
+    4.0
+SITE
+    http://orangoo.com/AmiNation/AJS
 **/
+if(!AJS) {
+var AJS = {
+    BASE_URL: "",
 
-var AJS = {
+    drag_obj: null,
+    drag_elm: null,
+    _drop_zones: [],
+    _drag_zones: [],
+    _cur_pos: null,
+
+    ajaxErrorHandler: null,
+
 ////
-// Accessor functions
+// General accessor functions
 ////
-  /**
-   * @returns The element with the id
-   */
-  getElement: function(id) {
-    if(typeof(id) == "string") 
-      return document.getElementById(id);
-    else
-      return id;
-  },
+    getQueryArgument: function(var_name) {
+        var query = window.location.search.substring(1);
+        var vars = query.split("&");
+        for (var i=0;i<vars.length;i++) {
+            var pair = vars[i].split("=");
+            if (pair[0] == var_name) {
+                return pair[1];
+            }
+        }
+        return null;
+    },
 
-  /**
-   * @returns The elements with the ids
-   */
-  getElements: function(/*id1, id2, id3*/) {
-    var elements = new Array();
-      for (var i = 0; i < arguments.length; i++) {
-        var element = this.getElement(arguments[i]);
-        elements.push(element);
-      }
-      return elements;
-  },
+    isIe: function() {
+        return (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1);
+    },
+    isNetscape7: function() {
+        return (navigator.userAgent.toLowerCase().indexOf("netscape") != -1 && navigator.userAgent.toLowerCase().indexOf("7.") != -1);
+    },
+    isSafari: function() {
+        return (navigator.userAgent.toLowerCase().indexOf("khtml") != -1);
+    },
+    isOpera: function() {
+        return (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
+    },
+    isMozilla: function() {
+        return (navigator.userAgent.toLowerCase().indexOf("gecko") != -1 && navigator.productSub >= 20030210);
+    },
+    isMac: function() {
+        return (navigator.userAgent.toLowerCase().indexOf('macintosh') != -1);
+    },
 
-  /**
-   * @returns The GET query argument
-   */
-  getQueryArgument: function(var_name) {
-    var query = window.location.search.substring(1);
-    var vars = query.split("&");
-    for (var i=0;i<vars.length;i++) {
-      var pair = vars[i].split("=");
-      if (pair[0] == var_name) {
-        return pair[1];
-      }
-    }
-    return null;
-  },
 
-  /**
-   * @returns If the browser is Internet Explorer
-   */
-  isIe: function() {
-    return (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1);
-  },
+////
+// Array functions
+////
+    //Shortcut: AJS.$A
+    createArray: function(v) {
+        if(AJS.isArray(v) && !AJS.isString(v))
+            return v;
+        else if(!v)
+            return [];
+        else
+            return [v];
+    },
 
-  /**
-   * @returns The document body   
-   */
-  getBody: function() {
-    return this.getElementsByTagAndClassName('body')[0] 
-  },
+    forceArray: function(args) {
+        var r = [];
+        AJS.map(args, function(elm) {
+            r.push(elm);
+        });
+        return r;
+    },
 
-  /**
-   * @returns All the elements that have a specific tag name or class name
-   */
-  getElementsByTagAndClassName: function(tag_name, class_name, /*optional*/ parent) {
-    var class_elements = new Array();
-    if(!this.isDefined(parent))
-      parent = document;
-    if(!this.isDefined(tag_name))
-      tag_name = '*';
+    join: function(delim, list) {
+        try {
+            return list.join(delim);
+        }
+        catch(e) {
+            var r = list[0] || '';
+            AJS.map(list, function(elm) {
+                r += delim + elm;
+            }, 1);
+            return r + '';
+        }
+    },
 
-    var els = parent.getElementsByTagName(tag_name);
-    var els_len = els.length;
-    var pattern = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
+    isIn: function(elm, list) {
+        var i = AJS.getIndex(elm, list);
+        if(i != -1)
+            return true;
+        else
+            return false;
+    },
 
-    for (i = 0, j = 0; i < els_len; i++) {
-      if ( pattern.test(els[i].className) || class_name == null ) {
-        class_elements[j] = els[i];
-        j++;
-      }
-    }
-    return class_elements;
-  },
+    getIndex: function(elm, list/*optional*/, eval_fn) {
+        for(var i=0; i < list.length; i++)
+            if(eval_fn && eval_fn(list[i]) || elm == list[i])
+                return i;
+        return -1;
+    },
 
+    getFirst: function(list) {
+        if(list.length > 0)
+            return list[0];
+        else
+            return null;
+    },
 
+    getLast: function(list) {
+        if(list.length > 0)
+            return list[list.length-1];
+        else
+            return null;
+    },
+
+    update: function(l1, l2) {
+        for(var i in l2)
+            l1[i] = l2[i];
+        return l1;
+    },
+
+    flattenList: function(list) {
+        var r = [];
+        var _flatten = function(r, l) {
+            AJS.map(l, function(o) {
+                if(o == null) {}
+                else if (AJS.isArray(o))
+                    _flatten(r, o);
+                else
+                    r.push(o);
+            });
+        }
+        _flatten(r, list);
+        return r;
+    },
+
+
 ////
-// DOM manipulation
+// Functional programming
 ////
-  /**
-   * Appends some nodes to a node
-   */
-  appendChildNodes: function(node/*, nodes...*/) {
-    if(arguments.length >= 2) {
-      for(var i=1; i < arguments.length; i++) {
-        var n = arguments[i];
-        if(typeof(n) == "string")
-          n = document.createTextNode(n);
-        if(this.isDefined(n))
-          node.appendChild(n);
-      }
-    }
-    return node;
-  },
+    map: function(list, fn,/*optional*/ start_index, end_index) {
+        var i = 0, l = list.length;
+        if(start_index)
+             i = start_index;
+        if(end_index)
+             l = end_index;
+        for(i; i < l; i++) {
+            var val = fn.apply(null, [list[i], i]);
+            if(val != undefined)
+                return val;
+        }
+    },
 
-  /**
-   * Replaces a nodes children with another node(s)
-   */
-  replaceChildNodes: function(node/*, nodes...*/) {
-    var child;
-    while ((child = node.firstChild)) {
-      node.removeChild(child);
-    }
-    if (arguments.length < 2) {
-      return node;
-    } else {
-      return this.appendChildNodes.apply(this, arguments);
-    }
-  },
+    rmap: function(list, fn) {
+        var i = list.length-1, l = 0;
+        for(i; i >= l; i--) {
+            var val = fn.apply(null, [list[i], i]);
+            if(val != undefined)
+                return val;
+        }
+    },
 
-  /**
-   * Insert a node after another node
-   */
-  insertAfter: function(node, referenceNode) {
-    referenceNode.parentNode.insertBefore(node, referenceNode.nextSibling);
-  },
-  
-  /**
-   * Insert a node before another node
-   */
-  insertBefore: function(node, referenceNode) {
-    referenceNode.parentNode.insertBefore(node, referenceNode);
-  },
-  
-  /**
-   * Shows the element
-   */
-  showElement: function(elm) {
-    elm.style.display = '';
-  },
-  
-  /**
-   * Hides the element
-   */
-  hideElement: function(elm) {
-    elm.style.display = 'none';
-  },
+    filter: function(list, fn, /*optional*/ start_index, end_index) {
+        var r = [];
+        AJS.map(list, function(elm) {
+            if(fn(elm))
+                r.push(elm);
+        }, start_index, end_index);
+        return r;
+    },
 
-  isElementHidden: function(elm) {
-    return elm.style.visibility == "hidden";
-  },
-  
-  /**
-   * Swaps one element with another. To delete use swapDOM(elm, null)
-   */
-  swapDOM: function(dest, src) {
-    dest = this.getElement(dest);
-    var parent = dest.parentNode;
-    if (src) {
-      src = this.getElement(src);
-      parent.replaceChild(src, dest);
-    } else {
-      parent.removeChild(dest);
-    }
-    return src;
-  },
+    partial: function(fn) {
+        var args = AJS.$FA(arguments);
+        args.shift();
+        return function() {
+            args = args.concat(AJS.$FA(arguments));
+            return fn.apply(window, args);
+        }
+    },
 
-  /**
-   * Removes an element from the world
-   */
-  removeElement: function(elm) {
-    this.swapDOM(elm, null);
-  },
 
-  /**
-   * @returns Is an object a dictionary?
-   */
-  isDict: function(o) {
-    var str_repr = String(o);
-    return str_repr.indexOf(" Object") != -1;
-  },
-  
-  /**
-   * Creates a DOM element
-   * @param {String} name The elements DOM name
-   * @param {Dict} attrs Attributes sent to the function
-   */
-  createDOM: function(name, attrs) {
-    var i=0;
-    elm = document.createElement(name);
+////
+// DOM functions
+////
+    //Shortcut: AJS.$
+    getElement: function(id) {
+        if(AJS.isString(id) || AJS.isNumber(id))
+            return document.getElementById(id);
+        else
+            return id;
+    },
 
-    if(this.isDict(attrs[i])) {
-      for(k in attrs[0]) {
-        if(k == "style")
-          elm.style.cssText = attrs[0][k];
-        else if(k == "class")
-          elm.className = attrs[0][k];
+    //Shortcut: AJS.$$
+    getElements: function(/*id1, id2, id3*/) {
+        var args = AJS.forceArray(arguments);
+        var elements = new Array();
+            for (var i = 0; i < args.length; i++) {
+                var element = AJS.getElement(args[i]);
+                elements.push(element);
+            }
+            return elements;
+    },
+
+    //Shortcut: AJS.$bytc
+    getElementsByTagAndClassName: function(tag_name, class_name, /*optional*/ parent) {
+        var class_elements = [];
+        if(!AJS.isDefined(parent))
+            parent = document;
+        if(!AJS.isDefined(tag_name))
+            tag_name = '*';
+
+        var els = parent.getElementsByTagName(tag_name);
+        var els_len = els.length;
+        var pattern = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
+
+        for (i = 0, j = 0; i < els_len; i++) {
+            if ( pattern.test(els[i].className) || class_name == null ) {
+                class_elements[j] = els[i];
+                j++;
+            }
+        }
+        return class_elements;
+    },
+
+    _nodeWalk: function(elm, tag_name, class_name, fn_next_elm) {
+        var p = fn_next_elm(elm);
+
+        var checkFn;
+        if(tag_name && class_name) {
+            checkFn = function(p) {
+                return AJS.nodeName(p) == tag_name && AJS.hasClass(p, class_name);
+            }
+        }
+        else if(tag_name) {
+            checkFn = function(p) { return AJS.nodeName(p) == tag_name; }
+        }
+        else {
+            checkFn = function(p) { return AJS.hasClass(p, class_name); }
+        }
+
+        while(p) {
+            if(checkFn(p))
+                return p;
+            p = fn_next_elm(p);
+        }
+        return null;
+    },
+
+    getParentBytc: function(elm, tag_name, class_name) {
+        return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.parentNode; });
+    },
+
+    getPreviousSiblingBytc: function(elm, tag_name, class_name) {
+        return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.previousSibling; });
+    },
+
+    getNextSiblingBytc: function(elm, tag_name, class_name) {
+        return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.nextSibling; });
+    },
+
+    //Shortcut: AJS.$f
+    getFormElement: function(form, name) {
+        form = AJS.$(form);
+        var r = null;
+        AJS.map(form.elements, function(elm) {
+            if(elm.name && elm.name == name)
+                r = elm;
+        });
+        return r;
+    },
+
+    formContents: function(form) {
+        var form = AJS.$(form);
+        var r = {};
+        var fn = function(elms) {
+            AJS.map(elms, function(e) {
+