[Fusionforge-commits] r9666 - in trunk/gforge/www: . scripts scripts/codendi

Mélanie Le Bail melanelebail at libremir.placard.fr.eu.org
Fri Apr 30 11:15:21 CEST 2010


Author: melanelebail
Date: 2010-04-30 11:15:21 +0200 (Fri, 30 Apr 2010)
New Revision: 9666

Added:
   trunk/gforge/www/scripts/
   trunk/gforge/www/scripts/codendi/
   trunk/gforge/www/scripts/codendi/LayoutManager.js
   trunk/gforge/www/scripts/codendi/ReorderColumns.js
   trunk/gforge/www/scripts/codendi/Tooltip.js
   trunk/gforge/www/scripts/codendi/common.js
   trunk/gforge/www/scripts/codendi/cross_references.js
   trunk/gforge/www/scripts/codendi/debug_reserved_names.js
Log:
Add scripts folder with codendi useful Javascripts


Added: trunk/gforge/www/scripts/codendi/LayoutManager.js
===================================================================
--- trunk/gforge/www/scripts/codendi/LayoutManager.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/LayoutManager.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,183 @@
+/**
+* Copyright (c) Xerox Corporation, Codendi Team, 2001-2008. All rights reserved
+*
+* Originally written by Nicolas Terray, 2008
+*
+* This file is a part of Codendi.
+*
+* Codendi is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Codendi is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Codendi; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+* 
+*/
+
+var codendi = codendi || { };
+
+codendi.layout_manager = { 
+    addCol: function(col) {
+        var new_col = '<td class="layout-manager-column"><div class="layout-manager-column-remove">x</div><div class="layout-manager-column-width"><input type="text" value="" autocomplete="off" size="1" maxlength="3" />%</div></td>';
+        col.up('tr').insert({bottom: new_col});
+        new_col = new Element('td');
+        new_col.addClassName("layout-manager-column-add");
+        new_col.update('+');
+        this.loadColAdd(new_col);
+        col.up('tr').insert({bottom: new_col});
+        
+        this.distributeWidth(col.up('tr'));
+        var rm = col.up('tr').down('.layout-manager-column-remove', col.up('tr').select('.layout-manager-column').size() - 1);
+        this.loadColRemove(rm);
+    },
+    addRow: function(row) {
+        var new_row = '<table class="layout-manager-row" cellspacing="5" cellpadding="2" border="0"><tr><td>+</td></tr></table>';
+        row.insert({after: new_row});
+
+        var new_col = row.next().down('td');
+        new_col.addClassName("layout-manager-column-add");
+        new_col.update('+');
+        this.loadColAdd(new_col);
+        
+        this.addCol(new_col);
+        
+        new_row = new Element('div');
+        new_row.addClassName("layout-manager-row-add");
+        new_row.update('+');
+        this.loadRowAdd(new_row);
+        
+        row.next().insert({after: new_row});
+    },
+    removeCol: function (rm) {
+        var row = rm.up('tr');
+        
+        //Check columns number in layout
+        if ($('layout-manager').select('.layout-manager-column').size() == 1) {
+            alert('You must keep at least one column in your layout.');
+        } else if (row.select('.layout-manager-column').size() == 1) {
+            //remove row
+            Element.remove(row.up('table').next());
+            Element.remove(row.up('table'));
+        } else {
+            //remove column
+            Element.remove(rm.up('td').next());
+            Element.remove(rm.up('td'));
+            this.distributeWidth(row);
+        }
+    },
+    distributeWidth: function (row) {
+        var cols = row.select('input[type=text]');
+        var width = Math.round(100 / cols.size());
+        cols.each(function (input) {
+            input.value = width;
+        });
+    },
+    load: function() {
+        $$(".layout-manager-column-add").each(this.loadColAdd.bind(this));
+        $$(".layout-manager-column-remove").each(this.loadColRemove.bind(this));
+        $$(".layout-manager-row-add").each(this.loadRowAdd.bind(this));
+    },
+    loadColAdd: function(col) {
+        col.observe('mouseover', function() {
+            this.addClassName('layout-manager-column-add_hover');
+        });
+        col.observe('mouseout', function() {
+            this.removeClassName('layout-manager-column-add_hover');
+        });
+        col.observe('click', function () { this.addCol(col) }.bind(this));
+    },
+    loadColRemove: function(rm) {
+        rm.observe('mouseover', function() {
+            this.addClassName('layout-manager-column-remove_hover');
+        }).observe('mouseout', function() {
+            this.removeClassName('layout-manager-column-remove_hover');
+        }).observe('click', function () { this.removeCol(rm); }.bind(this));
+    },
+    loadRowAdd: function(row) {
+        row.observe('mouseover', function() {
+            this.addClassName('layout-manager-row-add_hover');
+        });
+        row.observe('mouseout', function() {
+            this.removeClassName('layout-manager-row-add_hover');
+        });
+        row.observe('click', function () { this.addRow(row); }.bind(this));
+    }
+}
+
+document.observe('dom:loaded', function() {
+    if ($('layout-manager')) {
+        codendi.layout_manager.load();
+        $('save').observe('click', function(evt) {
+            if ($('layout-manager')) {
+                var reg = /^\d+$/
+                var invalid = $('layout-manager').select('.layout-manager-column input[type=text]').find(function (element) {
+                    return (!reg.test(element.value)) ? element : false;
+                });
+                if (invalid) {
+                    alert(invalid.value+' is not a valid number');
+                } else {
+                    var form = $('layout-manager').up('form');
+                    if (form) {
+                        $('layout-manager').select('.layout-manager-row').each(function (row) {
+                            form.insert(new Element('input', {
+                                    type: 'hidden',
+                                    name: 'new_layout[]',
+                                    value: row.select('.layout-manager-column input[type=text]').pluck('value').join(',')
+                            }));
+                        });
+                    }
+                }
+            }
+        });
+        $$('.layout-manager-chooser').each(function (row) {
+                row.down('input[type=radio]').observe('change', function() {
+                        $$('.layout-manager-chooser').each(function (row) {
+                                row.removeClassName('layout-manager-chooser_selected');
+                        });
+                        row.addClassName('layout-manager-chooser_selected');
+                });
+        });
+    }
+
+    //Widget categorizer
+    var default_categ = location.href.match(/#filter-(widget-categ-[a-z0-9-_]+)$/);
+    var current_categ;
+    if (default_categ && default_categ[1]) {
+        current_categ = default_categ[1];
+    } else {
+        current_categ = 'widget-categ-general';
+    }
+    $$('.widget-categ-switcher').each(function (a) {
+        var scan_id = a.href.match(/#(widget-categ-[a-z0-9-_]+)$/);
+        if (scan_id && scan_id[1]) {
+            var id = scan_id[1];
+            a.href = a.href.gsub(/#(widget-categ-[a-z0-9-_]+)$/, '#filter-'+id);
+            a.observe('click', function(evt) {
+                current_categ = id;
+                //Display widgets of this category
+                $('widget-content-categ').childElements().invoke('hide');
+                a.up('ul').select('.widget-categ-switcher').each(function(other_a) {
+                    other_a.up().removeClassName('selected');
+                });
+                a.up().addClassName('selected');
+                $(id).show();
+            });
+            //remove corresponding table
+            if (id != current_categ) {
+                $(id).hide();
+            } else {
+                a.up().addClassName('selected');
+            }
+            Element.remove($(id).down('h4'));
+            $('widget-content-categ').appendChild(Element.remove($(id)));
+        }
+    });
+});

Added: trunk/gforge/www/scripts/codendi/ReorderColumns.js
===================================================================
--- trunk/gforge/www/scripts/codendi/ReorderColumns.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/ReorderColumns.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,103 @@
+/**
+* Copyright (c) Xerox Corporation, Codendi Team, 2001-2008. All rights reserved
+*
+* Originally written by Nicolas Terray, 2008
+*
+* This file is a part of Codendi.
+*
+* Codendi is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Codendi is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Codendi; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+* 
+*/
+
+var codendi = codendi || { };
+
+codendi.ReorderColumns = Class.create({
+    initialize: function(table) {
+        this.has_just_been_dragged = {};
+        //Take the first row, and register the cells
+        Element.childElements(table.rows[0]).map(this.register.bind(this));
+    },
+    register: function (cell) {
+        this.registerDraggables(cell);
+        this.registerDroppables(cell);
+    },
+    registerDraggables: function (cell) {
+        this.has_just_been_dragged[cell.identify()] = false;
+        cell.observe('click', (function(evt) {
+            if (this.has_just_been_dragged[cell.identify()]) {
+                this.has_just_been_dragged[cell.identify()] = false;
+                Event.stop(evt);
+            }
+        }).bind(this));
+        new Draggable(cell.down(), {
+            revert: true,
+            onStart: function () {
+                Element.setStyle(cell, { cursor:"move" });
+            },
+            onEnd: (function () {
+                this.has_just_been_dragged[cell.identify()] = true;
+                Element.setStyle(cell, { cursor:"auto" });
+            }).bind(this)
+        });
+    },
+    registerDroppables: function (cell) {
+        Droppables.add(cell, {
+            hoverclass: 'drop-over',
+            onDrop: (function(dragged, dropped, evt) {
+                dragged.undoPositioned();
+                var from = dragged.up('th').cellIndex;
+                var to   = dropped.cellIndex;
+                
+                //don't change column order if it is not necessary
+                if (from != to) {
+                    var form = dropped.up('form');
+                    var input = new Element('input', { 
+                            type: 'hidden', 
+                            name: 'reordercolumns['+dragged.id+']', 
+                            value: (from < to ? (dropped.next() ? dropped.next().down().id : '-1') : dropped.down().id)
+                    });
+                    form.appendChild(input);
+                    
+                    this.reorder(dropped.up('table'), from, to);
+    
+                    //save the new column order
+                    form.request();
+                    
+                    //remove the input for other requests
+                    Element.remove(input);
+                }
+            }).bind(this)
+        });
+    },
+    reorder: function(table, from, to) {
+        var i = table.rows.length;
+        while (i--) {
+            var row  = table.rows[i];
+            var cell = row.removeChild(row.cells[from]);
+            if (to < row.cells.length) {
+                row.insertBefore(cell, row.cells[to]);
+            } else {
+                row.appendChild(cell);
+            }
+        }
+    }
+});
+
+document.observe('dom:loaded', function() {
+    $$('table.reorderable').each(function (table) {
+            new codendi.ReorderColumns(table);
+    });
+});

Added: trunk/gforge/www/scripts/codendi/Tooltip.js
===================================================================
--- trunk/gforge/www/scripts/codendi/Tooltip.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/Tooltip.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,112 @@
+/**
+* Copyright (c) Xerox Corporation, Codendi Team, 2001-2008. All rights reserved
+*
+* Originally written by Nicolas Terray, 2008
+*
+* This file is a part of Codendi.
+*
+* Codendi is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Codendi is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Codendi; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+* 
+*/
+
+var codendi = codendi || { };
+
+codendi.Tooltip = Class.create({
+    initialize: function(element, url, options) {
+        this.element = $(element);
+        this.url     = url;
+        this.options = Object.extend({
+        }, options || { });
+        
+        this.fetching = false;
+        this.fetched  = false;
+        this.old_title = this.element.title;
+        
+        this.tooltip = false;
+        
+        this.showEvent = this.show.bindAsEventListener(this);
+        this.element.observe('mouseover', this.showEvent);
+        this.hideEvent = this.hide.bindAsEventListener(this);
+        this.element.observe('mouseout', this.hideEvent);
+    },
+    fetch: function() {
+        if (!this.fetching) {
+            this.fetching = true;
+            this.element.title = '';
+            new Ajax.Request(this.url, {
+                onSuccess:(function(transport) {
+                    this.fetching = false;
+                    this.fetched  = true;
+                    if (transport.responseText) {
+                        this.createTooltip(transport.responseText);
+                        if (this.show_tooltip) {
+                            this.show();
+                        }
+                    } else {
+                        this.element.title = this.old_title;
+                    }
+                }).bind(this)
+            });
+        }
+    },
+    createTooltip: function(content) {
+        this.tooltip = new Element('div', {
+                'class': "codendi-tooltip",
+                style: "display:none;"
+        });
+        this.tooltip.update(content);
+        Element.insert(document.body, {
+            bottom: this.tooltip
+        });
+    },
+    show: function(evt) {
+        this.show_tooltip = true;
+        if (this.timeout) {
+            clearTimeout(this.timeout);
+        }
+        if (this.tooltip) {
+            var pos = this.element.cumulativeOffset();
+            Element.setStyle(this.tooltip, {
+                    top: (pos[1] + this.element.offsetHeight)+"px",
+                    left: pos[0]+"px"
+            });
+            this.tooltip.show();
+            if (evt) {
+                //Event.stop(evt);
+                Event.extend(evt);
+                evt.preventDefault();
+            }
+        } else if (!this.fetched) {
+            this.fetch();
+        }
+    },
+    hide: function() {
+        this.show_tooltip = false;
+        if (this.tooltip) {
+            this.timeout = setTimeout((function() { 
+                this.tooltip.hide();
+            }).bindAsEventListener(this), 200);
+        }
+    }
+});
+
+codendi.Tooltips = [];
+
+document.observe('dom:loaded', function() {
+    $$('a[class=cross-reference]').each(function (a) {
+        codendi.Tooltips.push(new codendi.Tooltip(a, a.href));
+    });
+});

Added: trunk/gforge/www/scripts/codendi/common.js
===================================================================
--- trunk/gforge/www/scripts/codendi/common.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/common.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,87 @@
+/**
+* Copyright (c) Xerox Corporation, Codendi Team, 2001-2008. All rights reserved
+*
+* Originally written by Nicolas Terray, 2008
+*
+* This file is a part of Codendi.
+*
+* Codendi is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Codendi is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Codendi; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+* 
+*/
+
+function help_window(helpurl) {
+    var HelpWin = window.open(helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=740,width=1000');
+    HelpWin.focus();
+}
+
+//http://mir.aculo.us/2009/1/7/using-input-values-as-hints-the-easy-way
+(function(){
+  var methods = {
+    defaultValueActsAsHint: function(element){
+      element = $(element);
+      element._default = element.value;
+      
+      return element.observe('focus', function(){
+        if(element._default != element.value) return;
+        element.removeClassName('hint').value = '';
+      }).observe('blur', function(){
+        if(element.value.strip() != '') return;
+        element.addClassName('hint').value = element._default;
+      }).addClassName('hint');
+    }
+  };
+   
+  $w('input textarea').each(function(tag){ Element.addMethods(tag, methods) });
+})();
+
+var codendi = {
+    locales: {},
+    getText: function(key1, key2) {
+        return codendi.locales[key1][key2];
+    }
+}
+
+
+
+document.observe('dom:loaded', function() {
+    //search togglers
+    $$('.toggler', '.toggler-hide', '.toggler-noajax', '.toggler-hide-noajax').each(function (toggler) {
+        //prehide or preshow depending on the initial state of the toggler
+        toggler.nextSiblings().invoke(toggler.hasClassName('toggler-hide') || toggler.hasClassName('toggler-hide-noajax')  ? 'hide' : 'show');
+        
+        toggler.observe('click', function() {
+            //toggle next siblings
+            toggler.nextSiblings().invoke(toggler.hasClassName('toggler') || toggler.hasClassName('toggler-noajax') ? 'hide' : 'show');
+            
+            //toggle the state
+            if (toggler.hasClassName('toggler-noajax') || toggler.hasClassName('toggler-hide-noajax')) {
+                toggler.toggleClassName('toggler-noajax')
+                       .toggleClassName('toggler-hide-noajax');
+            } else {
+                toggler.toggleClassName('toggler')
+                       .toggleClassName('toggler-hide');
+                //save the state with ajax only if the toggler has an id
+                if (toggler.id) {
+                    new Ajax.Request('/toggler.php', {
+                            parameters: {
+                                id: toggler.id
+                            }
+                    });
+                }
+            }
+        });
+    });
+});

Added: trunk/gforge/www/scripts/codendi/cross_references.js
===================================================================
--- trunk/gforge/www/scripts/codendi/cross_references.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/cross_references.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,128 @@
+/**
+* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+*
+* This file is a part of Codendi.
+*
+* Codendi is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Codendi is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with Codendi; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+* 
+*/
+
+/**
+ * Hide references from the current item to other items
+ */
+function hide_references_to() {
+    var references = $$(".reference_to");
+    references.each(
+        function(li) {
+            // hide all <li> with class "reference_to"
+            li.hide();
+            if ( ! li.up().childElements().find(function(other_li) {
+                                    return other_li.visible();
+                                }
+                            )) {
+                // if no other <li> are visible, hide also <ul> and nature of the reference (previous)
+                li.up().hide();
+                li.up().previous().hide();
+            }
+        }
+    );
+    // display 'show link'
+    if (references.size() > 0) {
+        $('cross_references_legend').replace('<p id="cross_references_legend">'+ 
+            codendi.getText('cross_ref_fact_include','legend_referenced_by') +
+            ' <span><a href="#" onclick="show_references_to(); return false;">'+ 
+            codendi.getText('cross_ref_fact_include','show_references_to') +
+            '</span></p>');
+    }
+}
+
+/**
+ * Show references from the current item to other items
+ */
+function show_references_to() {
+    var references = $$(".reference_to");
+    references.each( 
+	    function(li) {
+	        // show all <li> with class "reference_to"
+	        li.show();
+	        // shwo also <ul> and nature of the reference (previous)
+	        li.up().show();
+	        li.up().previous().show();
+	    }
+	);
+	// display 'hide link'
+    if (references.size() > 0) {
+        $('cross_references_legend').replace('<p id="cross_references_legend">'+ 
+            codendi.getText('cross_ref_fact_include','legend') +
+            ' <span><a href="#" onclick="hide_references_to(); return false;">'+ 
+            codendi.getText('cross_ref_fact_include','hide_references_to') +
+            '</span></p>');
+    }
+}
+
+/**
+*Show the delete icon for items
+*/
+function show_delete_icon(){
+    
+    
+}
+
+function delete_ref( id, message ){
+    if(confirm(message)){
+        var opt = {
+            method: 'get',
+            onComplete:function(){
+                /*if current id has 1 sibling (the img), we hide the 'cross_reference'
+                *else if current id has no sibling, we hide the reference nature
+                *else we just hide the reference
+                */
+                if($(id).siblings().length==1  && $(id).up().siblings().length > 0){
+                        $(id).up().hide();
+                }else if($(id).up().siblings().length==0){
+                        $(id).up('.nature').hide();
+                }else {
+                    $(id).hide();
+                }
+            }
+        }
+        new Ajax.Updater('id', $(id).down('.delete_ref').href, opt);
+    }
+    return false;
+}
+
+document.observe('dom:loaded', function() {
+    
+    //hide reference to item to clean the ui
+    if ($('cross_references_legend')) {
+        hide_references_to();
+    }
+    
+    //hide the delete ref icon to clean the ui
+    $$('.link_to_ref').each(function (l) {
+        if (l.down('.delete_ref')) {
+            var a = l.down('.delete_ref');
+            var img = a.down('img');
+            img.src = img.src.replace('cross.png', 'cross-disabled.png');
+            img.observe('mouseover', function(evt) {
+                img.src = img.src.replace('cross-disabled.png', 'cross.png');
+            });
+            img.observe('mouseout', function() {
+                img.src = img.src.replace('cross.png', 'cross-disabled.png');
+            });
+        }
+    });
+});
\ No newline at end of file

Added: trunk/gforge/www/scripts/codendi/debug_reserved_names.js
===================================================================
--- trunk/gforge/www/scripts/codendi/debug_reserved_names.js	                        (rev 0)
+++ trunk/gforge/www/scripts/codendi/debug_reserved_names.js	2010-04-30 09:15:21 UTC (rev 9666)
@@ -0,0 +1,94 @@
+// http://jibbering.com/faq/names/
+// http://thinkweb2.com/projects/prototype/domlint-resolving-name-conflicts/
+document.observe('dom:loaded', function() {
+    //reserved in opera
+    var reserved_names = {
+        firefox: 'hild,previousSibling,nextSibling,attributes,ownerDocument,insertBefore,'+
+                 'replaceChild,removeChild,appendChild,hasChildNodes,cloneNode,normalize,'+
+                 'isSupported,namespaceURI,prefix,localName,hasAttributes,tagName,'+
+                 'getAttribute,setAttribute,removeAttribute,getAttributeNode,'+
+                 'setAttributeNode,removeAttributeNode,getElementsByTagName,getAttributeNS,'+
+                 'setAttributeNS,removeAttributeNS,getAttributeNodeNS,setAttributeNodeNS,'+
+                 'getElementsByTagNameNS,hasAttribute,hasAttributeNS,ELEMENT_NODE,'+
+                 'ATTRIBUTE_NODE,TEXT_NODE,CDATA_SECTION_NODE,ENTITY_REFERENCE_NODE,'+
+                 'ENTITY_NODE,PROCESSING_INSTRUCTION_NODE,COMMENT_NODE,DOCUMENT_NODE,'+
+                 'DOCUMENT_TYPE_NODE,DOCUMENT_FRAGMENT_NODE,NOTATION_NODE,id,title,lang,'+
+                 'dir,className,elements,length,name,acceptCharset,action,enctype,method,'+
+                 'target,submit,reset,encoding,offsetTop,offsetLeft,offsetWidth,offsetHeight,'+
+                 'offsetParent,innerHTML,scrollTop,scrollLeft,scrollHeight,scrollWidth,'+
+                 'clientHeight,clientWidth,tabIndex,blur,focus,spellcheck,style,'+
+                 'removeEventListener,dispatchEvent,baseURI,compareDocumentPosition,textContent,'+
+                 'isSameNode,lookupPrefix,isDefaultNamespace,lookupNamespaceURI,'+
+                 'isEqualNode,getFeature,setUserData,getUserData,DOCUMENT_POSITION_DISCONNECTED,'+
+                 'DOCUMENT_POSITION_PRECEDING,DOCUMENT_POSITION_FOLLOWING,'+
+                 'DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_CONTAINED_BY,'+
+                 'DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC',
+        ie: 'language,scrollHeight,isTextEdit,currentStyle,document,onmouseup,oncontextmenu,'+
+            'isMultiLine,clientHeight,onrowexit,onbeforepaste,onactivate,scrollLeft,'+
+            'lang,onmousemove,onmove,onselectstart,parentTextEdit,oncontrolselect,'+
+            'canHaveHTML,onkeypress,oncut,onrowenter,onmousedown,onpaste,className,id,'+
+            'onreadystatechange,onbeforedeactivate,hideFocus,dir,isContentEditable,'+
+            'onkeydown,clientWidth,onlosecapture,parentElement,ondrag,ondragstart,'+
+            'oncellchange,recordNumber,onfilterchange,onrowsinserted,ondatasetcomplete,'+
+            'onmousewheel,ondragenter,onblur,onresizeend,onerrorupdate,onbeforecopy,'+
+            'ondblclick,scopeName,onkeyup,onresizestart,onmouseover,onmouseleave,outerText,'+
+            'innerText,onmoveend,tagName,title,offsetWidth,onresize,contentEditable,'+
+            'runtimeStyle,filters,ondrop,onpage,onrowsdelete,tagUrn,offsetLeft,clientTop,'+
+            'style,onfocusout,clientLeft,ondatasetchanged,canHaveChildren,ondeactivate,'+
+            'isDisabled,onpropertychange,ondragover,onhelp,ondragend,onbeforeeditfocus,'+
+            'disabled,onfocus,behaviorUrns,accessKey,onscroll,onbeforeactivate,onbeforecut,'+
+            'readyState,all,sourceIndex,onclick,scrollTop,oncopy,onfocusin,tabIndex,'+
+            'onbeforeupdate,outerHTML,innerHTML,ondataavailable,offsetHeight,onmovestart,'+
+            'onmouseout,scrollWidth,offsetTop,onmouseenter,onlayoutcomplete,offsetParent,'+
+            'onafterupdate,ondragleave,children,parentNode,nodeValue,name,length,onreset,'+
+            'onsubmit,lastChild,elements,attributes,acceptCharset,action,method,nodeType,'+
+            'target,previousSibling,ownerDocument,nodeName,childNodes,nextSibling,firstChild,'+
+            'encoding',
+        opera: 'addEventListener,addRepetitionBlock,addRepetitionBlockByIndex,'+
+               'appendChild,attachEvent,blur,checkValidity,cloneNode,contains,'+
+               'detachEvent,dispatchEvent,dispatchFormChange,dispatchFormInput,'+
+               'focus,getAttribute,getAttributeNS,getAttributeNode,getAttributeNodeNS,'+
+               'getElementsByTagName,getElementsByTagNameNS,getFeature,hasAttribute,'+
+               'hasAttributeNS,hasAttributes,hasChildNodes,insertAdjacentElement,'+
+               'insertAdjacentHTML,insertAdjacentText,insertBefore,isDefaultNamespace,'+
+               'isSupported,item,lookupNamespaceURI,lookupPrefix,moveRepetitionBlock,'+
+               'namedItem,normalize,removeAttribute,removeAttributeNS,removeAttributeNode,'+
+               'removeChild,removeEventListener,removeNode,removeRepetitionBlock,'+
+               'replaceChild,reset,resetFromData,scrollIntoView,selectNodes,'+
+               'selectSingleNode,setAttribute,setAttributeNS,setAttributeNode,'+
+               'setAttributeNodeNS,submit,toString,accept,acceptCharset,action,'+
+               'all,attributes,childNodes,children,className,clientHeight,'+
+               'clientLeft,clientTop,clientWidth,contentEditable,currentStyle,'+
+               'data,dir,document,elements,encoding,enctype,firstChild,id,'+
+               'innerHTML,innerText,isContentEditable,lang,lastChild,length,'+
+               'localName,method,name,namespaceURI,nextSibling,nodeName,nodeType,'+
+               'nodeValue,offsetHeight,offsetLeft,offsetParent,offsetTop,offsetWidth,'+
+               'onblur,onclick,ondblclick,onfocus,onkeydown,onkeypress,onkeyup,onload,'+
+               'onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,onunload,'+
+               'outerHTML,outerText,ownerDocument,parentElement,parentNode,prefix,'+
+               'previousSibling,repeatMax,repeatMin,repeatStart,repetitionBlocks,'+
+               'repetitionIndex,repetitionTemplate,repetitionType,replace,scrollHeight,'+
+               'scrollLeft,scrollTop,scrollWidth,sourceIndex,style,tagName,target,'+
+               'templateElements,text,textContent,title,unselectable'
+    };
+    $$('input').each(function (element) {
+        if (element.name) {
+            var name = new RegExp('(^|\W)'+element.name+'(\W|$)');
+            var result = $H(reserved_names).keys().inject([], function(result, browser) {
+                if (reserved_names[browser].match(name)) {
+                    result.push(browser);
+                }
+                return result;
+            });
+            if (result.length) {
+                Element.setStyle(element, {
+                        border:'5px dotted red'
+                });
+                if (!confirm('An <input> has the attribute name="'+element.name+'" which is reserved in '+result.join(' and '))) {
+                    throw $break;
+                }
+            }
+        }
+    });
+});
+




More information about the Fusionforge-commits mailing list