[Svn] r2443 - in trunk/roundcubemail: program/js program/steps/mail skins/default skins/default/templates

trac at roundcube.net trac at roundcube.net
Fri May 1 21:27:36 CEST 2009


Author: alec
Date: 2009-05-01 14:27:36 -0500 (Fri, 01 May 2009)
New Revision: 2443

Modified:
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/js/common.js
   trunk/roundcubemail/program/js/googiespell.js
   trunk/roundcubemail/program/steps/mail/compose.inc
   trunk/roundcubemail/skins/default/common.css
   trunk/roundcubemail/skins/default/googiespell.css
   trunk/roundcubemail/skins/default/mail.css
   trunk/roundcubemail/skins/default/templates/compose.html
Log:
- jQuery'fied GoogieSpell 4.0 + some changes in compose


Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2009-05-01 19:12:00 UTC (rev 2442)
+++ trunk/roundcubemail/program/js/app.js	2009-05-01 19:27:36 UTC (rev 2443)
@@ -903,6 +903,7 @@
         }
         else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) {
           this.env.spellcheck.spellCheck();
+          this.set_spellcheck_state('checking');
         }
         break;
 
@@ -2112,7 +2113,7 @@
   this.stop_spellchecking = function()
     {
     if (this.env.spellcheck && !this.spellcheck_ready) {
-      exec_event(this.env.spellcheck.check_link, 'click');
+      $(this.env.spellcheck.spell_span).trigger('click');
       this.set_spellcheck_state('ready');
       }
     };
@@ -2122,16 +2123,15 @@
     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';
+      $(this.env.spellcheck.spell_container).css('visibility', vis ? 'visible' : 'hidden');
       }
     };
 
   this.set_spellcheck_state = function(s)
     {
-    this.spellcheck_ready = (s=='check_spelling' || s=='spell_check' || s=='ready');
+    this.spellcheck_ready = (s == 'ready' || s == 'no_error_found');
     this.enable_command('spellcheck', this.spellcheck_ready);
     };
 

Modified: trunk/roundcubemail/program/js/common.js
===================================================================
--- trunk/roundcubemail/program/js/common.js	2009-05-01 19:12:00 UTC (rev 2442)
+++ trunk/roundcubemail/program/js/common.js	2009-05-01 19:27:36 UTC (rev 2443)
@@ -634,20 +634,3 @@
     return o;
     }
   }
-
-
-// Fire event on specified element
-function exec_event(element,event)
-{  
-  if (document.createEventObject) {
-    // dispatch for IE  
-    var evt = document.createEventObject();
-    return element.fireEvent('on'+event,evt)
-  }
-  else {  
-    // dispatch for firefox + others  
-    var evt = document.createEvent("HTMLEvents");
-    evt.initEvent(event, true, true); // event type,bubbling,cancelable
-    return !element.dispatchEvent(evt);
-   }
-}

Modified: trunk/roundcubemail/program/js/googiespell.js
===================================================================
--- trunk/roundcubemail/program/js/googiespell.js	2009-05-01 19:12:00 UTC (rev 2442)
+++ trunk/roundcubemail/program/js/googiespell.js	2009-05-01 19:27:36 UTC (rev 2443)
@@ -1,1468 +1,43 @@
 /*
-Last Modified: 29/04/07 18:44:48
-
-AJS JavaScript library
-    A very small library with a lot of functionality
-AUTHOR
-    4mir Salihefendic (http://amix.dk) - amix at amix.dk
-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
-    4.0
-SITE
-    http://orangoo.com/AmiNation/AJS
-**/
-if(!AJS) {
-var AJS = {
-    BASE_URL: "",
-
-    drag_obj: null,
-    drag_elm: null,
-    _drop_zones: [],
-    _drag_zones: [],
-    _cur_pos: null,
-
-    ajaxErrorHandler: null,
-
-////
-// General accessor functions
-////
-    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;
-    },
-
-    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);
-    },
-
-
-////
-// Array functions
-////
-    //Shortcut: AJS.$A
-    createArray: function(v) {
-        if(AJS.isArray(v) && !AJS.isString(v))
-            return v;
-        else if(!v)
-            return [];
-        else
-            return [v];
-    },
-
-    forceArray: function(args) {
-        var r = [];
-        AJS.map(args, function(elm) {
-            r.push(elm);
-        });
-        return r;
-    },
-
-    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 + '';
-        }
-    },
-
-    isIn: function(elm, list) {
-        var i = AJS.getIndex(elm, list);
-        if(i != -1)
-            return true;
-        else
-            return false;
-    },
-
-    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;
-    },
-
-
-////
-// Functional programming
-////
-    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;
-        }
-    },
-
-    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;
-        }
-    },
-
-    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;
-    },
-
-    partial: function(fn) {
-        var args = AJS.$FA(arguments);
-        args.shift();
-        return function() {
-            args = args.concat(AJS.$FA(arguments));
-            return fn.apply(window, args);
-        }
-    },
-
-
-////
-// DOM functions
-////
-    //Shortcut: AJS.$
-    getElement: function(id) {
-        if(AJS.isString(id) || AJS.isNumber(id))
-            return document.getElementById(id);
-        else
-            return id;
-    },
-
-    //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) {
-                if(e.name)
-                    r[e.name] = e.value || '';
-            });
-        }
-        fn(AJS.$bytc('input', null, form));
-        fn(AJS.$bytc('textarea', null, form));
-        return r;
-    },
-
-    getBody: function() {
-        return AJS.$bytc('body')[0]
-    },
-
-    nodeName: function(elm) {
-        return elm.nodeName.toLowerCase();
-    },
-
-    hasParent: function(elm, parent_to_consider, max_look_up) {
-        if(elm == parent_to_consider)
-            return true;
-        if(max_look_up == 0)
-            return false;
-        return AJS.hasParent(elm.parentNode, parent_to_consider, max_look_up-1);
-    },
-
-    isElementHidden: function(elm) {
-        return ((elm.style.display == "none") || (elm.style.visibility == "hidden"));
-    },
-
-    //Shortcut: AJS.DI
-    documentInsert: function(elm) {
-        if(typeof(elm) == 'string')
-            elm = AJS.HTML2DOM(elm);
-        document.write('<span id="dummy_holder"></span>');
-        AJS.swapDOM(AJS.$('dummy_holder'), elm);
-    },
-
-    cloner: function(element) {
-        return function() {
-            return element.cloneNode(true);
-        }
-    },
-
-    appendToTop: function(elm/*, elms...*/) {
-        var args = AJS.forceArray(arguments).slice(1);
-        if(args.length >= 1) {
-            var first_child = elm.firstChild;
-            if(first_child) {
-                while(true) {
-                    var t_elm = args.shift();
-                    if(t_elm)
-                        AJS.insertBefore(t_elm, first_child);
-                    else
-                        break;
-                }
-            }
-            else {
-                AJS.ACN.apply(null, arguments);
-            }
-        }
-        return elm;
-    },
-
-    //Shortcut: AJS.ACN
-    appendChildNodes: function(elm/*, elms...*/) {
-        if(arguments.length >= 2) {
-            AJS.map(arguments, function(n) {
-                if(AJS.isString(n))
-                    n = AJS.TN(n);
-                if(AJS.isDefined(n))
-                    elm.appendChild(n);
-            }, 1);
-        }
-        return elm;
-    },
-
-    //Shortcut: AJS.RCN
-    replaceChildNodes: function(elm/*, elms...*/) {
-        var child;
-        while ((child = elm.firstChild))
-            elm.removeChild(child);
-        if (arguments.length < 2)
-            return elm;
-        else
-            return AJS.appendChildNodes.apply(null, arguments);
-        return elm;
-    },
-
-    insertAfter: function(elm, reference_elm) {
-        reference_elm.parentNode.insertBefore(elm, reference_elm.nextSibling);
-        return elm;
-    },
-
-    insertBefore: function(elm, reference_elm) {
-        reference_elm.parentNode.insertBefore(elm, reference_elm);
-        return elm;
-    },
-
-    showElement: function(/*elms...*/) {
-        var args = AJS.forceArray(arguments);
-        AJS.map(args, function(elm) { elm.style.display = ''});
-    },
-
-    hideElement: function(elm) {
-        var args = AJS.forceArray(arguments);
-        AJS.map(args, function(elm) { elm.style.display = 'none'});
-    },
-
-    swapDOM: function(dest, src) {
-        dest = AJS.getElement(dest);
-        var parent = dest.parentNode;
-        if (src) {
-            src = AJS.getElement(src);
-            parent.repl