view release on metacpan or search on metacpan
1.08 22.05.2007
- Event.stop() for keypad '*' and '-' in treeNavigator
1.07 02.05.2007
- autocompleter : support for "" in strict mode
1.06 22.04.2007
- fix strict mode when autoSuggest=false
1.05 18.04.2007
- fixes from Jean-Christophe (parentOffset, set_datasource)
1.04 06.04.2007
- bug fixes && refactoring some details in autocompleter
- added option ANTIREGEX in KeyMap
- added PAGE_UP/DOWN in choiceList and option scrollCount
1.03 01.04.2007
- added options caseSensitive in autoCompleter
- fixed bug in Builder.pm (dependendy on Pod:POM::View::HTML)
doc/html/CustomButtons.html view on Meta::CPAN
.gva-actionsbar {background-color:#E8E8E8;border:1px solid #8c8c8c;border-width:1px 0px;height:25px;padding:4px 0 1px;}
.gva-btn-container {display:inline;}
.gva-btn-container .btn {margin:0 3px;font-size:12px;cursor:pointer;}
.gva-btn-container .btn {
font-family:verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif;
background:none;
border:none;
cursor:pointer;
padding:1px 2px;
color:#000;
background-color:transparent !important;
}
.gva-btn-container .btn {float:left;}
.gva-btn-container.btn-focus .btn {color:#aa0000;}
.gva-btn-container span {display:block;float:left;height:21px;}
.gva-btn-container span.left {background:transparent url(btn_sprite.gif) no-repeat scroll 0 0;padding:0 1px 0 2px;margin-left:4px;}
.gva-btn-container span.center {background:transparent url(btn_sprite.gif) repeat-x scroll 0 -42px;padding:0 2px}
.gva-btn-container span.right {background:transparent url(btn_sprite.gif) no-repeat scroll 0 -21px;padding:0 1px 0 2px;}
.gva-btn-container.btn-hover span.left {background-position:0 -63px;}
.gva-btn-container.btn-hover span.center {background-position:0 -105px;}
.gva-btn-container.btn-hover span.right {background-position:0 -84px;}
.gva-btn-container.btn-focus span.left {background-position:0 -63px;}
.gva-btn-container.btn-focus span.center {background-position:0 -126px;}
.gva-btn-container.btn-focus span.right {background-position:0 -84px;}
.gva-btn-container.flash .btn {color:red !important}</pre>
</div>
doc/html/ProtoExtensions.html view on Meta::CPAN
<p>Returns an array of children of <code>rootElement</code> that have any
of the given class names.</p>
</div>
</div>
<div class="TN_node" id="navigateDom">
<h4 class="TN_label">navigateDom</h4>
<div class="TN_content">
<pre> var wantedClasses = ["class1", "class2", ...];
// which direction to navigate (could be "parentNode", etc.)
var direction = "nextSibling";
// some criteria for stopping navigation (can be anything, here a stupid
// example)
var stopCondition = function(elem) {return elem.innerHTML.length > 10}
var nextElement
= Element.navigateDom(startElement, direction, wantedClasses,
stopCondition);</pre>
doc/html/ProtoExtensions.html view on Meta::CPAN
condition (in which case <code>null</code> is returned).</p>
</div>
</div>
<div class="TN_node" id="autoScroll">
<h4 class="TN_label">autoScroll</h4>
<div class="TN_content">
<pre> Element.autoScroll(elem, percentage)</pre>
<p>Makes sure that <code>elem</code> is visible in the central area of
its offset parent; if not, the parent is scrolled.
<code>percentage</code> is the ratio between the parent height and the
margin at which scrolling must occur, i.e. if
<code>percentage = 20</code> (the default), then scrolling
occurs if the element is in the higher than the top 20% or
lower than the bottom 20% of the viewport.</p>
</div>
</div>
<div class="TN_node" id="outerHTML">
<h4 class="TN_label">outerHTML</h4>
<div class="TN_content">
doc/html/Repeat.html view on Meta::CPAN
of repetition blocks under that number. Default is 0.</p>
</li>
<li><a name="item_repeat_max"></a><b>repeat-max</b>
<p>maximum number of repetition blocks. Prevents addition
of repetition blocks over that number. Default is 99.</p>
</li>
<li><a name="item_repeat_prefix"></a><b>repeat-prefix</b>
<p>defines the initial fragment of the <code>repeat path</code> (see
explanation below). Only valid for top-level repetition elements,
because nested repetition elements are automatically prefixed
by their parent repetition element. Default is the empty string.</p>
</li>
</ul>
</div>
</div>
<div class="TN_node" id="String_substitutions_within_repeat_elements">
<h3 class="TN_label">String substitutions within repeat elements</h3>
<div class="TN_content">
<p>The content of a repeat element may contain special markup
for repetition variables, which will be replaced by values
doc/html/TreeNavigator.html view on Meta::CPAN
<div class="TN_node" id="Tree_structure">
<h3 class="TN_label">Tree structure</h3>
<div class="TN_content">
<p>A tree is a collection of <i>nodes</i>. Each node must have a <i>label</i>
element and can have a <i>content</i> element. A node may be either
<i>open</i> (its content is visible) or <i>closed</i> (its content is
invisible). The label of the node is always visible, if the node
itself is visible. Some nodes can be declared as <i>leaves</i> : in that
case they have no content and have no open/close operations.</p>
<p>The content of a node may include other nodes, so a whole subtree may
become invisible if the parent node is closed. Opening or closing
nodes may be controlled by the mouse, by the keyboard, or through the
programming interface.</p>
<p>A node's content may also by dynamic, by
specifying <code>TN:contentURL</code> with the URL as value:</p>
<pre> <div class="TN_node TN_closed" TN:contentURL="/my/url.html">
<div class="TN_label">Label for dynamic node</div>
</div></pre>
<p>If the user opens that node, the content of the URL will by
dynamically fetched and inserted into the tree. The content then
doc/html/TreeNavigator.html view on Meta::CPAN
item (maybe the next node, or another tabindex-enabled HTML element,
such as a form control).</p>
</li>
<li><a name="item__code_ARROW_UP__code_"></a><b><code>ARROW_UP</code></b>
<p>move to previous displayed node</p>
</li>
<li><a name="item__code_ARROW_DOWN__code_"></a><b><code>ARROW_DOWN</code></b>
<p>move to next displayed node</p>
</li>
<li><a name="item__code_ARROW_LEFT__code_"></a><b><code>ARROW_LEFT</code></b>
<p>if open, close the node; if already closed, move to parent node</p>
</li>
<li><a name="item__code_ARROW_RIGHT__code_"></a><b><code>ARROW_RIGHT</code></b>
<p>if closed, open the node; if already open, move to next subnode</p>
</li>
<li><a name="item__code_HOME__code_"></a><b><code>HOME</code></b>
<p>select the first node of the tree</p>
</li>
<li><a name="item__code_END__code_"></a><b><code>END</code></b>
<p>select the last visible subnode of the tree</p>
</li>
doc/html/TreeNavigator.html view on Meta::CPAN
<p>The id of the container where the tree overflows.
Default to <code>tree.ownerDocument.documentElement</code>.</p>
<p>This is used for keyboard tree navigation autoscrolling.</p>
</div>
</div>
<div class="TN_node" id="autoScrollPercentage">
<h5 class="TN_label">autoScrollPercentage</h5>
<div class="TN_content">
<p>Makes sure that the selected node is visible in the central area of
its offset parent; if not, the parent is scrolled.
The percentage is the ratio between the parent height and the
margin at which scrolling must occur (default is 20%);</p>
</div>
</div>
<div class="TN_node" id="keymap">
<h5 class="TN_label">keymap</h5>
<div class="TN_content">
<p>A keymap object (see <code>Keymap.js</code>). If that option is given, keyboard
handlers are pushed into that keymap; otherwise a new keymap is
created.</p>
doc/html/TreeNavigator.html view on Meta::CPAN
<div class="TN_content">
<ul>
<li><a name="item__code_nextSibling_node___code_"></a><b><code>nextSibling(node)</code></b>
<p>Returns the next sibling tree node (i.e. next HTML sibling element
having class <code>TN_node</code>; this is <i>not</i> equivalent to
<code>node.nextSibling</code>).</p>
</li>
<li><a name="item__code_previousSibling_node___code_"></a><b><code>previousSibling(node)</code></b>
<p>Returns the previous sibling tree node.</p>
</li>
<li><a name="item__code_parentNode_node___code_"></a><b><code>parentNode(node)</code></b>
<p>Returns the parent tree node.</p>
</li>
<li><a name="item__code_firstSubNode_node___code_"></a><b><code>firstSubNode(node)</code></b>
<p>Returns the first subnode within that node's content. If no argument
is given, returns the first node of the tree.</p>
</li>
<li><a name="item__code_lastSubNode_node___code_"></a><b><code>lastSubNode(node)</code></b>
<p>Returns the last subnode within that node's content. If no argument
is given, returns the last node of the tree.</p>
</li>
<li><a name="item__code_lastVisibleSubNode_node___code_"></a><b><code>lastVisibleSubNode(node)</code></b>
doc/html/TreeNavigator.html view on Meta::CPAN
</li>
<li><a name="item__code_treeNavigator__code_"></a><b><code>treeNavigator</code></b>
<p>the tree navigator object</p>
</li>
<li><a name="item__code_event__code_"></a><b><code>event</code></b>
<p>an event structure as described above</p>
</li>
</ul>
<p>If the string just contains the name of a
handler function (i.e. without the
parentheses), then that function will be
called with a single argument, namely the
event structure described above. Therefore</p>
<pre> <div class="TN_node" TN:onOpen="handleOpen"></pre>
<p>is equivalent to</p>
<pre> <div class="TN_node" TN:onOpen="handleOpen(event)"></pre>
</div>
</div>
lib/Alien/GvaScript/CustomButtons.pod view on Meta::CPAN
.gva-actionsbar {background-color:#E8E8E8;border:1px solid #8c8c8c;border-width:1px 0px;height:25px;padding:4px 0 1px;}
.gva-btn-container {display:inline;}
.gva-btn-container .btn {margin:0 3px;font-size:12px;cursor:pointer;}
.gva-btn-container .btn {
font-family:verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif;
background:none;
border:none;
cursor:pointer;
padding:1px 2px;
color:#000;
background-color:transparent !important;
}
.gva-btn-container .btn {float:left;}
.gva-btn-container.btn-focus .btn {color:#aa0000;}
.gva-btn-container span {display:block;float:left;height:21px;}
.gva-btn-container span.left {background:transparent url(btn_sprite.gif) no-repeat scroll 0 0;padding:0 1px 0 2px;margin-left:4px;}
.gva-btn-container span.center {background:transparent url(btn_sprite.gif) repeat-x scroll 0 -42px;padding:0 2px}
.gva-btn-container span.right {background:transparent url(btn_sprite.gif) no-repeat scroll 0 -21px;padding:0 1px 0 2px;}
.gva-btn-container.btn-hover span.left {background-position:0 -63px;}
.gva-btn-container.btn-hover span.center {background-position:0 -105px;}
.gva-btn-container.btn-hover span.right {background-position:0 -84px;}
.gva-btn-container.btn-focus span.left {background-position:0 -63px;}
.gva-btn-container.btn-focus span.center {background-position:0 -126px;}
.gva-btn-container.btn-focus span.right {background-position:0 -84px;}
.gva-btn-container.flash .btn {color:red !important}
lib/Alien/GvaScript/ProtoExtensions.pod view on Meta::CPAN
var subElements
= Element.getElementsByClassNames(rootElement, ["class1", "class2", ...]);
Returns an array of children of C<rootElement> that have any
of the given class names.
=head3 navigateDom
var wantedClasses = ["class1", "class2", ...];
// which direction to navigate (could be "parentNode", etc.)
var direction = "nextSibling";
// some criteria for stopping navigation (can be anything, here a stupid
// example)
var stopCondition = function(elem) {return elem.innerHTML.length > 10}
var nextElement
= Element.navigateDom(startElement, direction, wantedClasses,
stopCondition);
lib/Alien/GvaScript/ProtoExtensions.pod view on Meta::CPAN
Walks through the DOM in the given direction, until finding an
element that has one of the given classnames, or finding a stop
condition (in which case C<null> is returned).
=head3 autoScroll
Element.autoScroll(elem, percentage)
Makes sure that C<elem> is visible in the central area of
its offset parent; if not, the parent is scrolled.
C<percentage> is the ratio between the parent height and the
margin at which scrolling must occur, i.e. if
C<percentage = 20> (the default), then scrolling
occurs if the element is in the higher than the top 20% or
lower than the bottom 20% of the viewport.
=head3 outerHTML
Element.outerHTML(elem)
lib/Alien/GvaScript/Repeat.pod view on Meta::CPAN
=item repeat-max
maximum number of repetition blocks. Prevents addition
of repetition blocks over that number. Default is 99.
=item repeat-prefix
defines the initial fragment of the C<repeat path> (see
explanation below). Only valid for top-level repetition elements,
because nested repetition elements are automatically prefixed
by their parent repetition element. Default is the empty string.
=back
=head2 String substitutions within repeat elements
The content of a repeat element may contain special markup
for repetition variables, which will be replaced by values
when the element is instanciated into a repetition block.
lib/Alien/GvaScript/TreeNavigator.pod view on Meta::CPAN
A tree is a collection of I<nodes>. Each node must have a I<label>
element and can have a I<content> element. A node may be either
I<open> (its content is visible) or I<closed> (its content is
invisible). The label of the node is always visible, if the node
itself is visible. Some nodes can be declared as I<leaves> : in that
case they have no content and have no open/close operations.
The content of a node may include other nodes, so a whole subtree may
become invisible if the parent node is closed. Opening or closing
nodes may be controlled by the mouse, by the keyboard, or through the
programming interface.
A node's content may also by dynamic, by
specifying C<TN:contentURL> with the URL as value:
<div class="TN_node TN_closed" TN:contentURL="/my/url.html">
<div class="TN_label">Label for dynamic node</div>
</div>
lib/Alien/GvaScript/TreeNavigator.pod view on Meta::CPAN
=item C<ARROW_UP>
move to previous displayed node
=item C<ARROW_DOWN>
move to next displayed node
=item C<ARROW_LEFT>
if open, close the node; if already closed, move to parent node
=item C<ARROW_RIGHT>
if closed, open the node; if already open, move to next subnode
=item C<HOME>
select the first node of the tree
=item C<END>
lib/Alien/GvaScript/TreeNavigator.pod view on Meta::CPAN
The id of the container where the tree overflows.
Default to C<tree.ownerDocument.documentElement>.
This is used for keyboard tree navigation autoscrolling.
=head4 autoScrollPercentage
Makes sure that the selected node is visible in the central area of
its offset parent; if not, the parent is scrolled.
The percentage is the ratio between the parent height and the
margin at which scrolling must occur (default is 20%);
=head4 keymap
A keymap object (see C<Keymap.js>). If that option is given, keyboard
handlers are pushed into that keymap; otherwise a new keymap is
created.
lib/Alien/GvaScript/TreeNavigator.pod view on Meta::CPAN
Returns the next sibling tree node (i.e. next HTML sibling element
having class C<TN_node>; this is I<not> equivalent to
C<node.nextSibling>).
=item C<previousSibling(node)>
Returns the previous sibling tree node.
=item C<parentNode(node)>
Returns the parent tree node.
=item C<firstSubNode(node)>
Returns the first subnode within that node's content. If no argument
is given, returns the first node of the tree.
=item C<lastSubNode(node)>
Returns the last subnode within that node's content. If no argument
is given, returns the last node of the tree.
lib/Alien/GvaScript/TreeNavigator.pod view on Meta::CPAN
the tree navigator object
=item C<event>
an event structure as described above
=back
If the string just contains the name of a
handler function (i.e. without the
parentheses), then that function will be
called with a single argument, namely the
event structure described above. Therefore
<div class="TN_node" TN:onOpen="handleOpen">
is equivalent to
<div class="TN_node" TN:onOpen="handleOpen(event)">
lib/Alien/GvaScript/lib/GvaScript.css view on Meta::CPAN
.gva-actionsbar {background-color:#E8E8E8;border:1px solid #8c8c8c;border-width:1px 0px;height:25px;padding:4px 0 1px;}
.gva-btn-container {display:inline;}
.gva-btn-container .btn {margin:0 3px;font-size:12px;cursor:pointer;}
.gva-btn-container .btn {
font-family:verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif;
background:none;
border:none;
cursor:pointer;
padding:1px 2px;
color:#000;
background-color:transparent !important;
}
.gva-btn-container .btn {float:left;}
.gva-btn-container.btn-focus .btn {color:#aa0000;}
.gva-btn-container span {display:block;float:left;height:21px;}
.gva-btn-container span.left {background:transparent url(btn_sprite.gif) no-repeat scroll 0 0;padding:0 1px 0 2px;margin-left:4px;}
.gva-btn-container span.center {background:transparent url(btn_sprite.gif) repeat-x scroll 0 -42px;padding:0 2px}
.gva-btn-container span.right {background:transparent url(btn_sprite.gif) no-repeat scroll 0 -21px;padding:0 1px 0 2px;}
.gva-btn-container.btn-hover span.left {background-position:0 -63px;}
.gva-btn-container.btn-hover span.center {background-position:0 -105px;}
.gva-btn-container.btn-hover span.right {background-position:0 -84px;}
.gva-btn-container.btn-focus span.left {background-position:0 -63px;}
.gva-btn-container.btn-focus span.center {background-position:0 -126px;}
.gva-btn-container.btn-focus span.right {background-position:0 -84px;}
/* GRID */
table {padding:0;margin: 0;border-collapse:collapse;}
#grid_container {border: 1px solid #a3bad9; border-width: 0 1px;}
lib/Alien/GvaScript/lib/GvaScript.css view on Meta::CPAN
.gva-grid td.grid-cell.center {text-align:center;float:none;}
.gva-grid td.grid-cell.right {text-align:right;float:none;}
.gva-grid td.grid-cell.red {color:#a00;}
.icon-add {
display:inline-table;
width:16px;
height:16px;
cursor:pointer;
background: transparent url(add.png) no-repeat left center;
}
.icon-delete {
display:inline-table;
float: right;
width:16px;
height:16px;
cursor:pointer;
background: transparent url(delete.png) no-repeat left center;
}
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
if (typeof wanted_classes != "string" &&
wanted_classes instanceof Array)
wanted_classes = wanted_classes.join("|");
return new RegExp("\\b(" + wanted_classes + ")\\b");
},
hasAnyClass: function (elem, wanted_classes) {
return Element.classRegExp(wanted_classes).test(elem.className);
},
getElementsByClassNames: function(parent, wanted_classes) {
var regexp = Element.classRegExp(wanted_classes);
var children = ($(parent) || document.body).getElementsByTagName('*');
var result = [];
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (regexp.test(child.className)) result.push(child);
}
return result;
},
// start at elem, walk nav_property until find any of wanted_classes
navigateDom: function (elem, navigation_property,
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
if (element.nodeType == 1) {
element = Element.extend(element);
for (var selector in rules[o_id][eventType]) {
if (_match = matches(rules[o_id][eventType][selector]._selector, element)) {
for (var i=0, handlers=rules[o_id][eventType][selector], l=handlers.length; i<l; ++i) {
handlers[i].call(element, Object.extend(event, { _target: element, _match: _match }));
}
}
}
}
} while (element = element.parentNode)
}
var matches = function(selectors, element) {
for (var i=0, l=selectors.length; i<l; ++i) {
if (Prototype.Selector.match(element, selectors[i])) return selectors[i];
}
return undefined;
}
Event.register = function(observer, selector, eventName, handler) {
var use_capture = (eventName == 'focus' || eventName == 'blur');
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
label.tabIndex = _idx;
});
}
// add tree navigation buttons per label
if (this.options.createButtons) {
var button = document.createElement("span");
button.className = this.classes.button;
labels.each(function(label) {
label.parentNode.insertBefore(button.cloneNode(true), label);
});
}
},
isClosed: function (node) {
return Element.hasAnyClass(node, this.classes.closed);
},
isVisible: function(elem) { // true if elem is not display:none
return !(elem.offsetWidth == 0 && elem.offsetHeight == 0);
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
},
isRootElement: function(elem) {
return (elem === this.rootElement);
},
isLabel: function(elem) {
if(elem.hasClassName(this.classes.label))
return elem;
else
return Element.navigateDom(elem, 'parentNode', this.classes.label);
},
close: function (node) {
if (this.isLeaf(node))
return;
Element.addClassName(node, this.classes.closed);
this.fireEvent("Close", node, this.rootElement);
},
open: function (node) {
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
this.open(node);
else
this.close(node);
},
openEnclosingNodes: function (elem) {
var node = this.enclosingNode(elem);
while (node) {
if (this.isClosed(node))
this.open(node);
node = this.parentNode(node);
}
},
openAtLevel: function(elem, level) {
var method = this[(level > 1) ? "open" : "close"];
var node = this.firstSubNode(elem);
while (node) {
method.call(this, node); // open or close
this.openAtLevel(node, level-1);
node = this.nextSibling(node);
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
this.classes.label);
},
content: function(node) {
if (this.isLeaf(node)) return null;
this._assertNode(node, 'content: arg type');
return Element.navigateDom(node.lastChild, 'previousSibling',
this.classes.content);
},
parentNode: function (node) {
this._assertNodeOrLeaf(node, 'parentNode: arg type');
return Element.navigateDom(
node.parentNode, 'parentNode', this.classes.node,
this.isRootElement.bind(this));
},
nextSibling: function (node) {
this._assertNodeOrLeaf(node, 'nextSibling: arg type');
return Element.navigateDom(node.nextSibling, 'nextSibling',
this.classes.nodeOrLeaf);
},
previousSibling: function (node) {
this._assertNodeOrLeaf(node, 'previousSibling: arg type');
return Element.navigateDom(node.previousSibling, 'previousSibling',
this.classes.nodeOrLeaf);
},
firstSubNode: function (node) {
node = node || this.rootElement;
var parent = (node == this.rootElement) ? node
: this.isLeaf(node) ? null
: this.content(node);
return parent ? Element.navigateDom(parent.firstChild, 'nextSibling',
this.classes.nodeOrLeaf)
: null;
},
lastSubNode: function (node) {
node = node || this.rootElement;
var parent = (node == this.rootElement) ? node
: this.isLeaf(node) ? null
: this.content(node);
return parent ? Element.navigateDom(parent.lastChild, 'previousSibling',
this.classes.nodeOrLeaf)
: null;
},
lastVisibleSubnode: function(node) {
node = node || this.rootElement;
while(!this.isClosed(node)) {
var lastSubNode = this.lastSubNode(node);
if (!lastSubNode) break;
node = lastSubNode;
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
// find next displayed node (i.e. skipping hidden nodes).
nextDisplayedNode: function (node) {
this._assertNodeOrLeaf(node, 'nextDisplayedNode: arg type');
// case 1: node is opened and has a subtree : then return first subchild
if (!this.isClosed(node)) {
var firstSubNode = this.firstSubNode(node);
if (firstSubNode) return firstSubNode;
}
// case 2: current node or one of its parents has a sibling
while (node) {
var sibling = this.nextSibling(node);
if (sibling) {
if (this.isVisible(sibling))
return sibling;
else
node = sibling;
}
else
node = this.parentNode(node);
}
// case 3: no next Node
return null;
},
// find previous displayed node (i.e. skipping hidden nodes).
previousDisplayedNode: function (node) {
this._assertNodeOrLeaf(node, 'previousDisplayedNode: arg type');
var node_init = node;
while (node) {
node = this.previousSibling(node);
if (node && this.isVisible(node))
return this.lastVisibleSubnode(node);
}
// if no previous sibling
return this.parentNode(node_init);
},
enclosingNode: function (elem) {
return Element.navigateDom(
$(elem), 'parentNode', this.classes.nodeOrLeaf,
this.isRootElement.bind(this));
},
// flash the node
flash: function (node) {
var label = this.label(node);
ASSERT(label, "node has no label");
label.flash({duration: 200});
},
fireEvent: function(eventName, elem) {
var args = [eventName];
while (elem) {
args.push(elem);
elem = this.parentNode(elem);
}
args.push(this.rootElement);
return GvaScript.fireEvent.apply(this, args);
},
//-----------------------------------------------------
// Private methods
//-----------------------------------------------------
// quick navigation initialization:
// - exit navi_mode
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
if(target.nodeType != 1) return;
// ignore right mousedown
if(!Event.isLeftClick(event)) return;
// button clicked
if(target.hasClassName(this.classes.button)) {
// as not to fire blur_handler
// on treeNode
Event.stop(event);
return this._buttonClicked(target.parentNode);
}
// label (or one of its childElements) clicked
if(label = this.isLabel(target)) {
return this._labelClicked(label.parentNode, event);
}
},
_treeDblClickHandler : function(event) {
var target = Event.element(event);
if(target.nodeType != 1) return;
// only consider doubleclicks on labels
if(!(label = this.isLabel(target))) return;
var event_stop_mode;
// should_ping_on_dblclick was just set within _labelClicked
if (this.should_ping_on_dblclick) {
event_stop_mode = this.fireEvent("Ping", label.parentNode, this.rootElement);
}
// stop the event unless the ping_handler decided otherwise
Event.detailedStop(event, event_stop_mode || Event.stopAll);
},
_treeMouseOverHandler: function(event) {
var target = Event.element(event);
if(target.nodeType != 1) return;
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
_addTabbingBehaviour: function() {
if (this.options.tabIndex < 0) return; // no tabbing
var treeNavigator = this; // handlers will be closures on this
// focus handler
var focus_handler = function(e) {
var label = e._target;
label.writeAttribute('hasFocus', 'hasFocus');
var node = Element.navigateDom(label, 'parentNode',
treeNavigator.classes.nodeOrLeaf);
// not yet been selected
if(node && !label.hasClassName(treeNavigator.classes.selected)) {
treeNavigator.select (node);
}
};
// blur handler
var blur_handler = function(e) {
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
// otherwise: do nothing and let default behaviour happen
},
_leftHandler: function (event) {
var selectedNode = this.selectedNode;
if (selectedNode) {
if (!this.isLeaf(selectedNode) && !this.isClosed(selectedNode)) {
this.close(selectedNode);
}
else {
var zparent = this.parentNode(selectedNode);
if (zparent) {
this.scrollTo(zparent);
this.select (zparent);
}
else
this.flash(selectedNode);
}
Event.stop(event);
}
},
_rightHandler: function (event) {
var selectedNode = this.selectedNode;
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
// we're still on the same page
this._jumpToIndex(event, nextIndex);
},
//----------------------------------------------------------------------
// navigation
//----------------------------------------------------------------------
_findChoiceItem: function(event) { // walk up DOM to find mouse target
var stop_condition = function(elem){return elem === this.container};
return Element.navigateDom(Event.element(event), "parentNode",
this.classes.choiceItem,
stop_condition);
},
_listOverHandler: function(event) {
var elem = this._findChoiceItem(event);
if (elem) {
this._highlightChoiceNum(this._choiceIndex(elem), false);
if (this.options.grabfocus)
this.container.focus();
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
throw new Error("unexpected datasource type");
},
// 'fireEvent' function is copied from GvaScript.fireEvent, so that "this"
// in that code gets properly bound to the current object
fireEvent: GvaScript.fireEvent,
// Set the element for the AC to look at to adapt its position. If elem is
// null, stop observing the scroll.
// DALNOTE 10.01.09 : pas certain de l'utilité de "set_observed_scroll"; si
// l'élément est positionné correctement dans le DOM par rapport à son parent,
// il devrait suivre le scroll automatiquement. N'est utilisé dans DMWeb que
// par "avocat.js".
set_observed_scroll : function(elem) {
if (!elem) {
Event.stopObserving(this.observed_scroll, 'scroll',
correct_dropdown_position);
return;
}
this.observed_scroll = elem;
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
}
// determine dynamically
else {
// set the height of the grid_container
// height is preset
if(typeof this.options.gridheight == 'number') {
this.grid_container.setStyle({height: this.options.gridheight+'px'});
}
// determine dynamically
else {
var parentHeight = this.grid_container.up(0).getHeight();
var sibsHeights = this.grid_container.siblings().collect(function(s) {return s.getHeight()});
var sibsHeight = 0;
sibsHeights.each(function(h) {sibsHeight += h});
this.grid_container.setStyle({height: parentHeight-sibsHeight+'px'});
}
this.limit = Math.floor((this.grid_container.getHeight()-22)/this.options.recordheight);
}
this.grid_container.setStyle({width: this.grid_container.up(0).getWidth()+'px'});
this.toolbar_container.addClassName(bcss+'-grid-toolbar');
this.toolbar_container.update();
lib/Alien/GvaScript/lib/GvaScript.js view on Meta::CPAN
repeat.count = 0;
repeat.path = (path ? path + "." : "") + repeat.name;
// create a new element (placeholder for new insertion blocks)
var placeholder_tag = element.tagName.match(/^(TR|TD|TBODY|THEAD|TH)$/i)
? element.tagName
: 'SPAN';
var placeholder = document.createElement(placeholder_tag);
placeholder.id = repeat.path + ".placeholder";
placeholder.fireEvent = GvaScript.fireEvent;
element.parentNode.insertBefore(placeholder, element);
// take this elem out of the DOM and into a string ...
{
// a) force the id that will be needed in the template)
element.id = "#{" + repeat.name + ".path}";
// b) remove "repeat*" attributes (don't want them in the template)
var attrs = element.attributes;
var repeat_attrs = [];
for (var i = 0; i < attrs.length; i++) {
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
var IS_DONTENUM_BUGGY = (function(){
for (var p in { toString: 1 }) {
if (p === 'toString') return false;
}
return true;
})();
function subclass() {};
function create() {
var parent = null, properties = $A(arguments);
if (Object.isFunction(properties[0]))
parent = properties.shift();
function klass() {
this.initialize.apply(this, arguments);
}
Object.extend(klass, Class.Methods);
klass.superclass = parent;
klass.subclasses = [];
if (parent) {
subclass.prototype = parent.prototype;
klass.prototype = new subclass;
parent.subclasses.push(klass);
}
for (var i = 0, length = properties.length; i < length; i++)
klass.addMethods(properties[i]);
if (!klass.prototype.initialize)
klass.prototype.initialize = Prototype.emptyFunction;
klass.prototype.constructor = klass;
return klass;
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (Object.isString(element))
element = document.getElementById(element);
return Element.extend(element);
}
if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function(expression, parentElement) {
var results = [];
var query = document.evaluate(expression, $(parentElement) || document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0, length = query.snapshotLength; i < length; i++)
results.push(Element.extend(query.snapshotItem(i)));
return results;
};
}
/*--------------------------------------------------------------------------*/
if (!Node) var Node = { };
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
},
show: function(element) {
element = $(element);
element.style.display = '';
return element;
},
remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
return element;
},
update: (function(){
var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
var el = document.createElement("select"),
isBuggy = true;
el.innerHTML = "<option value=\"test\">test</option>";
if (el.options && el.options[0]) {
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
replace: function(element, content) {
element = $(element);
if (content && content.toElement) content = content.toElement();
else if (!Object.isElement(content)) {
content = Object.toHTML(content);
var range = element.ownerDocument.createRange();
range.selectNode(element);
content.evalScripts.bind(content).defer();
content = range.createContextualFragment(content.stripScripts());
}
element.parentNode.replaceChild(content, element);
return element;
},
insert: function(element, insertions) {
element = $(element);
if (Object.isString(insertions) || Object.isNumber(insertions) ||
Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
insertions = {bottom:insertions};
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
if (content && content.toElement) content = content.toElement();
if (Object.isElement(content)) {
insert(element, content);
continue;
}
content = Object.toHTML(content);
tagName = ((position == 'before' || position == 'after')
? element.parentNode : element).tagName.toUpperCase();
childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
if (position == 'top' || position == 'after') childNodes.reverse();
childNodes.each(insert.curry(element));
content.evalScripts.bind(content).defer();
}
return element;
},
wrap: function(element, wrapper, attributes) {
element = $(element);
if (Object.isElement(wrapper))
$(wrapper).writeAttribute(attributes || { });
else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
else wrapper = new Element('div', wrapper);
if (element.parentNode)
element.parentNode.replaceChild(wrapper, element);
wrapper.appendChild(element);
return wrapper;
},
inspect: function(element) {
element = $(element);
var result = '<' + element.tagName.toLowerCase();
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
var property = pair.first(),
attribute = pair.last(),
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
if (element.nodeType == 1)
elements.push(Element.extend(element));
if (elements.length == maximumLength)
break;
}
return elements;
},
ancestors: function(element) {
return Element.recursivelyCollect(element, 'parentNode');
},
descendants: function(element) {
return Element.select(element, "*");
},
firstDescendant: function(element) {
element = $(element).firstChild;
while (element && element.nodeType != 1) element = element.nextSibling;
return $(element);
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
match: function(element, selector) {
element = $(element);
if (Object.isString(selector))
return Prototype.Selector.match(element, selector);
return selector.match(element);
},
up: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return $(element.parentNode);
var ancestors = Element.ancestors(element);
return Object.isNumber(expression) ? ancestors[expression] :
Prototype.Selector.find(ancestors, expression, index);
},
down: function(element, expression, index) {
element = $(element);
if (arguments.length == 1) return Element.firstDescendant(element);
return Object.isNumber(expression) ? Element.descendants(element)[expression] :
Element.select(element, expression)[index || 0];
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
select: function(element) {
element = $(element);
var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
return Prototype.Selector.select(expressions, element);
},
adjacent: function(element) {
element = $(element);
var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
return Prototype.Selector.select(expressions, element.parentNode).without(element);
},
identify: function(element) {
element = $(element);
var id = Element.readAttribute(element, 'id');
if (id) return id;
do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
Element.writeAttribute(element, 'id', id);
return id;
},
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
descendantOf: function(element, ancestor) {
element = $(element), ancestor = $(ancestor);
if (element.compareDocumentPosition)
return (element.compareDocumentPosition(ancestor) & 8) === 8;
if (ancestor.contains)
return ancestor.contains(element) && ancestor !== element;
while (element = element.parentNode)
if (element == ancestor) return true;
return false;
},
scrollTo: function(element) {
element = $(element);
var pos = Element.cumulativeOffset(element);
window.scrollTo(pos[0], pos[1]);
return element;
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
var options = Object.extend({
setLeft: true,
setTop: true,
setWidth: true,
setHeight: true,
offsetTop: 0,
offsetLeft: 0
}, arguments[2] || { });
source = $(source);
var p = Element.viewportOffset(source), delta = [0, 0], parent = null;
element = $(element);
if (Element.getStyle(element, 'position') == 'absolute') {
parent = Element.getOffsetParent(element);
delta = Element.viewportOffset(parent);
}
if (parent == document.body) {
delta[0] -= document.body.offsetLeft;
delta[1] -= document.body.offsetTop;
}
if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
if (options.setWidth) element.style.width = source.offsetWidth + 'px';
if (options.setHeight) element.style.height = source.offsetHeight + 'px';
return element;
}
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
return element;
};
}
if ('outerHTML' in document.documentElement) {
Element.Methods.replace = function(element, content) {
element = $(element);
if (content && content.toElement) content = content.toElement();
if (Object.isElement(content)) {
element.parentNode.replaceChild(content, element);
return element;
}
content = Object.toHTML(content);
var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
if (Element._insertionTranslations.tags[tagName]) {
var nextSibling = element.next(),
fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
parent.removeChild(element);
if (nextSibling)
fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
else
fragments.each(function(node) { parent.appendChild(node) });
}
else element.outerHTML = content.stripScripts();
content.evalScripts.bind(content).defer();
return element;
};
}
Element._returnOffset = function(l, t) {
var result = [l, t];
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
}
}
else {
div.innerHTML = html;
}
return $A(div.childNodes);
};
Element._insertionTranslations = {
before: function(element, node) {
element.parentNode.insertBefore(node, element);
},
top: function(element, node) {
element.insertBefore(node, element.firstChild);
},
bottom: function(element, node) {
element.appendChild(node);
},
after: function(element, node) {
element.parentNode.insertBefore(node, element.nextSibling);
},
tags: {
TABLE: ['<table>', '</table>', 1],
TBODY: ['<table><tbody>', '</tbody></table>', 2],
TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
SELECT: ['<select>', '</select>', 1]
}
};
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
element.runtimeStyle.left = element.currentStyle.left;
element.style.left = value || 0;
value = element.style.pixelLeft;
element.style.left = style;
element.runtimeStyle.left = rStyle;
return value;
}
if (element && isPercentage) {
context = context || element.parentNode;
var decimal = toDecimal(value);
var whole = null;
var position = element.getStyle('position');
var isHorizontal = property.include('left') || property.include('right') ||
property.include('width');
var isVertical = property.include('top') || property.include('bottom') ||
property.include('height');
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
function toCSSPixels(number) {
if (Object.isString(number) && number.endsWith('px')) {
return number;
}
return number + 'px';
}
function isDisplayed(element) {
var originalElement = element;
while (element && element.parentNode) {
var display = element.getStyle('display');
if (display === 'none') {
return false;
}
element = $(element.parentNode);
}
return true;
}
var hasLayout = Prototype.K;
if ('currentStyle' in document.documentElement) {
hasLayout = function(element) {
if (!element.currentStyle.hasLayout) {
element.style.zoom = 1;
}
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
var position = element.getStyle('position'),
width = element.getStyle('width');
if (width === "0px" || width === null) {
element.style.display = 'block';
width = element.getStyle('width');
}
var context = (position === 'fixed') ? document.viewport :
element.parentNode;
element.setStyle({
position: 'absolute',
visibility: 'hidden',
display: 'block'
});
var positionedWidth = element.getStyle('width');
var newWidth;
if (width && (positionedWidth === width)) {
newWidth = getPixelValue(element, 'width', context);
} else if (position === 'absolute' || position === 'fixed') {
newWidth = getPixelValue(element, 'width', context);
} else {
var parent = element.parentNode, pLayout = $(parent).getLayout();
newWidth = pLayout.get('width') -
this.get('margin-left') -
this.get('border-left') -
this.get('padding-left') -
this.get('padding-right') -
this.get('border-right') -
this.get('margin-right');
}
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
return bWidth + mLeft + mRight;
},
'top': function(element) {
var offset = element.positionedOffset();
return offset.top;
},
'bottom': function(element) {
var offset = element.positionedOffset(),
parent = element.getOffsetParent(),
pHeight = parent.measure('height');
var mHeight = this.get('border-box-height');
return pHeight - mHeight - offset.top;
},
'left': function(element) {
var offset = element.positionedOffset();
return offset.left;
},
'right': function(element) {
var offset = element.positionedOffset(),
parent = element.getOffsetParent(),
pWidth = parent.measure('width');
var mWidth = this.get('border-box-width');
return pWidth - mWidth - offset.left;
},
'padding-top': function(element) {
return getPixelValue(element, 'paddingTop');
},
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
'margin-right': function(element) {
return getPixelValue(element, 'marginRight');
}
}
});
if ('getBoundingClientRect' in document.documentElement) {
Object.extend(Element.Layout.COMPUTATIONS, {
'right': function(element) {
var parent = hasLayout(element.getOffsetParent());
var rect = element.getBoundingClientRect(),
pRect = parent.getBoundingClientRect();
return (pRect.right - rect.right).round();
},
'bottom': function(element) {
var parent = hasLayout(element.getOffsetParent());
var rect = element.getBoundingClientRect(),
pRect = parent.getBoundingClientRect();
return (pRect.bottom - rect.bottom).round();
}
});
}
Element.Offset = Class.create({
initialize: function(left, top) {
this.left = left.round();
this.top = top.round();
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
function getOffsetParent(element) {
element = $(element);
if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element))
return $(document.body);
var isInline = (Element.getStyle(element, 'display') === 'inline');
if (!isInline && element.offsetParent) return $(element.offsetParent);
while ((element = element.parentNode) && element !== document.body) {
if (Element.getStyle(element, 'position') !== 'static') {
return isHtml(element) ? $(document.body) : $(element);
}
}
return $(document.body);
}
function cumulativeOffset(element) {
element = $(element);
var valueT = 0, valueL = 0;
if (element.parentNode) {
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
}
return new Element.Offset(valueL, valueT);
}
function positionedOffset(element) {
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
valueT -= layout.get('margin-left');
return new Element.Offset(valueL, valueT);
}
function cumulativeScrollOffset(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.scrollTop || 0;
valueL += element.scrollLeft || 0;
element = element.parentNode;
} while (element);
return new Element.Offset(valueL, valueT);
}
function viewportOffset(forElement) {
element = $(element);
var valueT = 0, valueL = 0, docBody = document.body;
var element = forElement;
do {
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
if (element.offsetParent == docBody &&
Element.getStyle(element, 'position') == 'absolute') break;
} while (element = element.offsetParent);
element = forElement;
do {
if (element != docBody) {
valueT -= element.scrollTop || 0;
valueL -= element.scrollLeft || 0;
}
} while (element = element.parentNode);
return new Element.Offset(valueL, valueT);
}
function absolutize(element) {
element = $(element);
if (Element.getStyle(element, 'position') === 'absolute') {
return element;
}
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
element.setStyle({ position: 'relative' });
var value = proceed(element);
element.setStyle({ position: position });
return value;
}
);
positionedOffset = positionedOffset.wrap(function(proceed, element) {
element = $(element);
if (!element.parentNode) return new Element.Offset(0, 0);
var position = element.getStyle('position');
if (position !== 'static') return proceed(element);
var offsetParent = element.getOffsetParent();
if (offsetParent && offsetParent.getStyle('position') === 'fixed')
hasLayout(offsetParent);
element.setStyle({ position: 'relative' });
var value = proceed(element);
element.setStyle({ position: position });
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
} else {
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
var ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
}
if ( context ) {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
prune = false;
}
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
},
">": function(checkSet, part, isXML){
var isPartStr = typeof part === "string";
if ( isPartStr && !/\W/.test(part) ) {
part = isXML ? part : part.toUpperCase();
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName === part ? parent : false;
}
}
} else {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( !/\W/.test(part) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
},
"~": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( typeof part === "string" && !/\W/.test(part) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
enabled: function(elem){
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function(elem){
return elem.disabled === true;
},
checked: function(elem){
return elem.checked === true;
},
selected: function(elem){
elem.parentNode.selectedIndex;
return elem.selected === true;
},
parent: function(elem){
return !!elem.firstChild;
},
empty: function(elem){
return !elem.firstChild;
},
has: function(elem, i, match){
return !!Sizzle( match[3], elem ).length;
},
header: function(elem){
return /h\d/i.test( elem.nodeName );
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
}
return true;
case 'nth':
var first = match[2], last = match[3];
if ( first == 1 && last == 0 ) {
return true;
}
var doneName = match[0],
parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
if ( first == 0 ) {
return diff == 0;
} else {
return ( diff % first == 0 && diff / first >= 0 );
}
}
},
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
currentTarget = event.currentTarget;
if (currentTarget && currentTarget.tagName) {
if (type === 'load' || type === 'error' ||
(type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
&& currentTarget.type === 'radio'))
node = currentTarget;
}
if (node.nodeType == Node.TEXT_NODE)
node = node.parentNode;
return Element.extend(node);
}
function findElement(event, expression) {
var element = Event.element(event);
if (!expression) return element;
while (element) {
if (Object.isElement(element) && Prototype.Selector.match(element, expression)) {
return Element.extend(element);
}
element = element.parentNode;
}
}
function pointer(event) {
return { x: pointerX(event), y: pointerY(event) };
}
function pointerX(event) {
var docElement = document.documentElement,
body = document.body || { scrollLeft: 0 };
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
Event.extend(event, element);
handler.call(element, event);
};
} else {
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
(eventName === "mouseenter" || eventName === "mouseleave")) {
if (eventName === "mouseenter" || eventName === "mouseleave") {
responder = function(event) {
Event.extend(event, element);
var parent = event.relatedTarget;
while (parent && parent !== element) {
try { parent = parent.parentNode; }
catch(e) { parent = element; }
}
if (parent === element) return;
handler.call(element, event);
};
}
} else {
responder = function(event) {
Event.extend(event, element);
handler.call(element, event);
};
}
lib/Alien/GvaScript/lib/prototype.js view on Meta::CPAN
for (var i = 0, child, cn; child = nodes[i]; i++) {
if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
(classNames && classNames.all(function(name) {
return !name.toString().blank() && cn.include(' ' + name + ' ');
}))))
elements.push(Element.extend(child));
}
return elements;
};
return function(className, parentElement) {
return $(parentElement || document.body).getElementsByClassName(className);
};
}(Element.Methods);
/*--------------------------------------------------------------------------*/
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
initialize: function(element) {
this.element = $(element);
},
lib/Alien/GvaScript/lib/unittest.js view on Meta::CPAN
benchmark: function(operation, iterations) {
var startAt = new Date();
(iterations || 1).times(operation);
var timeTaken = ((new Date())-startAt);
this.info((arguments[2] || 'Operation') + ' finished ' +
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
return timeTaken;
},
_isVisible: function(element) {
element = $(element);
if(!element.parentNode) return true;
this.assertNotNull(element);
if(element.style && Element.getStyle(element, 'display') == 'none')
return false;
return this._isVisible(element.parentNode);
},
assertNotVisible: function(element) {
this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
},
assertVisible: function(element) {
this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
},
benchmark: function(operation, iterations) {
var startAt = new Date();
(iterations || 1).times(operation);
var timeTaken = ((new Date())-startAt);
this.info((arguments[2] || 'Operation') + ' finished ' +
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
src/autoCompleter.js view on Meta::CPAN
throw new Error("unexpected datasource type");
},
// 'fireEvent' function is copied from GvaScript.fireEvent, so that "this"
// in that code gets properly bound to the current object
fireEvent: GvaScript.fireEvent,
// Set the element for the AC to look at to adapt its position. If elem is
// null, stop observing the scroll.
// DALNOTE 10.01.09 : pas certain de l'utilité de "set_observed_scroll"; si
// l'élément est positionné correctement dans le DOM par rapport à son parent,
// il devrait suivre le scroll automatiquement. N'est utilisé dans DMWeb que
// par "avocat.js".
set_observed_scroll : function(elem) {
if (!elem) {
Event.stopObserving(this.observed_scroll, 'scroll',
correct_dropdown_position);
return;
}
this.observed_scroll = elem;
src/choiceList.js view on Meta::CPAN
// we're still on the same page
this._jumpToIndex(event, nextIndex);
},
//----------------------------------------------------------------------
// navigation
//----------------------------------------------------------------------
_findChoiceItem: function(event) { // walk up DOM to find mouse target
var stop_condition = function(elem){return elem === this.container};
return Element.navigateDom(Event.element(event), "parentNode",
this.classes.choiceItem,
stop_condition);
},
_listOverHandler: function(event) {
var elem = this._findChoiceItem(event);
if (elem) {
this._highlightChoiceNum(this._choiceIndex(elem), false);
if (this.options.grabfocus)
this.container.focus();
src/grid.js view on Meta::CPAN
}
// determine dynamically
else {
// set the height of the grid_container
// height is preset
if(typeof this.options.gridheight == 'number') {
this.grid_container.setStyle({height: this.options.gridheight+'px'});
}
// determine dynamically
else {
var parentHeight = this.grid_container.up(0).getHeight();
var sibsHeights = this.grid_container.siblings().collect(function(s) {return s.getHeight()});
var sibsHeight = 0;
sibsHeights.each(function(h) {sibsHeight += h});
this.grid_container.setStyle({height: parentHeight-sibsHeight+'px'});
}
this.limit = Math.floor((this.grid_container.getHeight()-22)/this.options.recordheight);
}
this.grid_container.setStyle({width: this.grid_container.up(0).getWidth()+'px'});
this.toolbar_container.addClassName(bcss+'-grid-toolbar');
this.toolbar_container.update();
src/protoExtensions.js view on Meta::CPAN
if (typeof wanted_classes != "string" &&
wanted_classes instanceof Array)
wanted_classes = wanted_classes.join("|");
return new RegExp("\\b(" + wanted_classes + ")\\b");
},
hasAnyClass: function (elem, wanted_classes) {
return Element.classRegExp(wanted_classes).test(elem.className);
},
getElementsByClassNames: function(parent, wanted_classes) {
var regexp = Element.classRegExp(wanted_classes);
var children = ($(parent) || document.body).getElementsByTagName('*');
var result = [];
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (regexp.test(child.className)) result.push(child);
}
return result;
},
// start at elem, walk nav_property until find any of wanted_classes
navigateDom: function (elem, navigation_property,
src/protoExtensions.js view on Meta::CPAN
if (element.nodeType == 1) {
element = Element.extend(element);
for (var selector in rules[o_id][eventType]) {
if (_match = matches(rules[o_id][eventType][selector]._selector, element)) {
for (var i=0, handlers=rules[o_id][eventType][selector], l=handlers.length; i<l; ++i) {
handlers[i].call(element, Object.extend(event, { _target: element, _match: _match }));
}
}
}
}
} while (element = element.parentNode)
}
var matches = function(selectors, element) {
for (var i=0, l=selectors.length; i<l; ++i) {
if (Prototype.Selector.match(element, selectors[i])) return selectors[i];
}
return undefined;
}
Event.register = function(observer, selector, eventName, handler) {
var use_capture = (eventName == 'focus' || eventName == 'blur');
src/repeat.js view on Meta::CPAN
repeat.count = 0;
repeat.path = (path ? path + "." : "") + repeat.name;
// create a new element (placeholder for new insertion blocks)
var placeholder_tag = element.tagName.match(/^(TR|TD|TBODY|THEAD|TH)$/i)
? element.tagName
: 'SPAN';
var placeholder = document.createElement(placeholder_tag);
placeholder.id = repeat.path + ".placeholder";
placeholder.fireEvent = GvaScript.fireEvent;
element.parentNode.insertBefore(placeholder, element);
// take this elem out of the DOM and into a string ...
{
// a) force the id that will be needed in the template)
element.id = "#{" + repeat.name + ".path}";
// b) remove "repeat*" attributes (don't want them in the template)
var attrs = element.attributes;
var repeat_attrs = [];
for (var i = 0; i < attrs.length; i++) {
src/treeNavigator.js view on Meta::CPAN
label.tabIndex = _idx;
});
}
// add tree navigation buttons per label
if (this.options.createButtons) {
var button = document.createElement("span");
button.className = this.classes.button;
labels.each(function(label) {
label.parentNode.insertBefore(button.cloneNode(true), label);
});
}
},
isClosed: function (node) {
return Element.hasAnyClass(node, this.classes.closed);
},
isVisible: function(elem) { // true if elem is not display:none
return !(elem.offsetWidth == 0 && elem.offsetHeight == 0);
src/treeNavigator.js view on Meta::CPAN
},
isRootElement: function(elem) {
return (elem === this.rootElement);
},
isLabel: function(elem) {
if(elem.hasClassName(this.classes.label))
return elem;
else
return Element.navigateDom(elem, 'parentNode', this.classes.label);
},
close: function (node) {
if (this.isLeaf(node))
return;
Element.addClassName(node, this.classes.closed);
this.fireEvent("Close", node, this.rootElement);
},
open: function (node) {
src/treeNavigator.js view on Meta::CPAN
this.open(node);
else
this.close(node);
},
openEnclosingNodes: function (elem) {
var node = this.enclosingNode(elem);
while (node) {
if (this.isClosed(node))
this.open(node);
node = this.parentNode(node);
}
},
openAtLevel: function(elem, level) {
var method = this[(level > 1) ? "open" : "close"];
var node = this.firstSubNode(elem);
while (node) {
method.call(this, node); // open or close
this.openAtLevel(node, level-1);
node = this.nextSibling(node);
src/treeNavigator.js view on Meta::CPAN
this.classes.label);
},
content: function(node) {
if (this.isLeaf(node)) return null;
this._assertNode(node, 'content: arg type');
return Element.navigateDom(node.lastChild, 'previousSibling',
this.classes.content);
},
parentNode: function (node) {
this._assertNodeOrLeaf(node, 'parentNode: arg type');
return Element.navigateDom(
node.parentNode, 'parentNode', this.classes.node,
this.isRootElement.bind(this));
},
nextSibling: function (node) {
this._assertNodeOrLeaf(node, 'nextSibling: arg type');
return Element.navigateDom(node.nextSibling, 'nextSibling',
this.classes.nodeOrLeaf);
},
previousSibling: function (node) {
this._assertNodeOrLeaf(node, 'previousSibling: arg type');
return Element.navigateDom(node.previousSibling, 'previousSibling',
this.classes.nodeOrLeaf);
},
firstSubNode: function (node) {
node = node || this.rootElement;
var parent = (node == this.rootElement) ? node
: this.isLeaf(node) ? null
: this.content(node);
return parent ? Element.navigateDom(parent.firstChild, 'nextSibling',
this.classes.nodeOrLeaf)
: null;
},
lastSubNode: function (node) {
node = node || this.rootElement;
var parent = (node == this.rootElement) ? node
: this.isLeaf(node) ? null
: this.content(node);
return parent ? Element.navigateDom(parent.lastChild, 'previousSibling',
this.classes.nodeOrLeaf)
: null;
},
lastVisibleSubnode: function(node) {
node = node || this.rootElement;
while(!this.isClosed(node)) {
var lastSubNode = this.lastSubNode(node);
if (!lastSubNode) break;
node = lastSubNode;
src/treeNavigator.js view on Meta::CPAN
// find next displayed node (i.e. skipping hidden nodes).
nextDisplayedNode: function (node) {
this._assertNodeOrLeaf(node, 'nextDisplayedNode: arg type');
// case 1: node is opened and has a subtree : then return first subchild
if (!this.isClosed(node)) {
var firstSubNode = this.firstSubNode(node);
if (firstSubNode) return firstSubNode;
}
// case 2: current node or one of its parents has a sibling
while (node) {
var sibling = this.nextSibling(node);
if (sibling) {
if (this.isVisible(sibling))
return sibling;
else
node = sibling;
}
else
node = this.parentNode(node);
}
// case 3: no next Node
return null;
},
// find previous displayed node (i.e. skipping hidden nodes).
previousDisplayedNode: function (node) {
this._assertNodeOrLeaf(node, 'previousDisplayedNode: arg type');
var node_init = node;
while (node) {
node = this.previousSibling(node);
if (node && this.isVisible(node))
return this.lastVisibleSubnode(node);
}
// if no previous sibling
return this.parentNode(node_init);
},
enclosingNode: function (elem) {
return Element.navigateDom(
$(elem), 'parentNode', this.classes.nodeOrLeaf,
this.isRootElement.bind(this));
},
// flash the node
flash: function (node) {
var label = this.label(node);
ASSERT(label, "node has no label");
label.flash({duration: 200});
},
fireEvent: function(eventName, elem) {
var args = [eventName];
while (elem) {
args.push(elem);
elem = this.parentNode(elem);
}
args.push(this.rootElement);
return GvaScript.fireEvent.apply(this, args);
},
//-----------------------------------------------------
// Private methods
//-----------------------------------------------------
// quick navigation initialization:
// - exit navi_mode
src/treeNavigator.js view on Meta::CPAN
if(target.nodeType != 1) return;
// ignore right mousedown
if(!Event.isLeftClick(event)) return;
// button clicked
if(target.hasClassName(this.classes.button)) {
// as not to fire blur_handler
// on treeNode
Event.stop(event);
return this._buttonClicked(target.parentNode);
}
// label (or one of its childElements) clicked
if(label = this.isLabel(target)) {
return this._labelClicked(label.parentNode, event);
}
},
_treeDblClickHandler : function(event) {
var target = Event.element(event);
if(target.nodeType != 1) return;
// only consider doubleclicks on labels
if(!(label = this.isLabel(target))) return;
var event_stop_mode;
// should_ping_on_dblclick was just set within _labelClicked
if (this.should_ping_on_dblclick) {
event_stop_mode = this.fireEvent("Ping", label.parentNode, this.rootElement);
}
// stop the event unless the ping_handler decided otherwise
Event.detailedStop(event, event_stop_mode || Event.stopAll);
},
_treeMouseOverHandler: function(event) {
var target = Event.element(event);
if(target.nodeType != 1) return;
src/treeNavigator.js view on Meta::CPAN
_addTabbingBehaviour: function() {
if (this.options.tabIndex < 0) return; // no tabbing
var treeNavigator = this; // handlers will be closures on this
// focus handler
var focus_handler = function(e) {
var label = e._target;
label.writeAttribute('hasFocus', 'hasFocus');
var node = Element.navigateDom(label, 'parentNode',
treeNavigator.classes.nodeOrLeaf);
// not yet been selected
if(node && !label.hasClassName(treeNavigator.classes.selected)) {
treeNavigator.select (node);
}
};
// blur handler
var blur_handler = function(e) {
src/treeNavigator.js view on Meta::CPAN
// otherwise: do nothing and let default behaviour happen
},
_leftHandler: function (event) {
var selectedNode = this.selectedNode;
if (selectedNode) {
if (!this.isLeaf(selectedNode) && !this.isClosed(selectedNode)) {
this.close(selectedNode);
}
else {
var zparent = this.parentNode(selectedNode);
if (zparent) {
this.scrollTo(zparent);
this.select (zparent);
}
else
this.flash(selectedNode);
}
Event.stop(event);
}
},
_rightHandler: function (event) {
var selectedNode = this.selectedNode;
test/functional/form/effects.js view on Meta::CPAN
effect.element.style[transform.style] = '';
});
}
}
}
this.start(options);
},
setup: function(){
function parseColor(color){
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
color = color.parseColor();
return $R(0,2).map(function(i){
return parseInt( color.slice(i*2+1,i*2+3), 16 )
});
}
this.transforms = this.style.map(function(pair){
var property = pair[0], value = pair[1], unit = null;
if (value.parseColor('#zzzzzz') != '#zzzzzz') {
value = value.parseColor();
test/functional/form/validation.js view on Meta::CPAN
try {
if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
if(!elm[prop]) {
var advice = Validation.getAdvice(name, elm);
if(advice == null) {
var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
switch (elm.type.toLowerCase()) {
case 'checkbox':
case 'radio':
var p = elm.parentNode;
if(p) {
new Insertion.Bottom(p, advice);
} else {
new Insertion.After(elm, advice);
}
break;
default:
new Insertion.After(elm, advice);
}
advice = Validation.getAdvice(name, elm);
test/functional/form/validation.js view on Meta::CPAN
elm.addClassName('validation-passed');
return true;
}
} catch(e) {
throw(e)
}
},
isVisible : function(elm) {
while(elm.tagName != 'BODY') {
if(!$(elm).visible()) return false;
elm = elm.parentNode;
}
return true;
},
getAdvice : function(name, elm) {
return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
},
getElmID : function(elm) {
return elm.id ? elm.id : elm.name;
},
reset : function(elm) {
test/functional/form/validation.js view on Meta::CPAN
// [$]1[##][,###]+[.##]
// [$]1###+[.##]
// [$]0.##
// [$].##
return Validation.get('IsEmpty').test(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
}],
['validate-selection', 'Please make a selection', function(v,elm){
return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v);
}],
['validate-one-required', 'Please select one of the above options.', function (v,elm) {
var p = elm.parentNode;
var options = p.getElementsByTagName('INPUT');
return $A(options).any(function(elm) {
return $F(elm);
});
}]
]);
test/functional/keyMap/basic.html view on Meta::CPAN
<script>
function Red(event) {
$('current_cell').style.backgroundColor="red";
Event.stop(event);
}
function Up() {
var cell = $('current_cell');
var colIndex = cell.cellIndex;
var row = cell.parentNode;
if (row.rowIndex > 0) {
cell.id = null;
row.parentNode.rows[row.rowIndex - 1].cells[colIndex].id = "current_cell";
}
}
function Down() {
var cell = $('current_cell');
var colIndex = cell.cellIndex;
var row = cell.parentNode;
if (row.rowIndex + 1 < row.parentNode.rows.length) {
cell.id = null;
row.parentNode.rows[row.rowIndex + 1].cells[colIndex].id = "current_cell";
}
}
function Left() {
var cell = $('current_cell');
if (cell.cellIndex > 0) {
cell.id = null;
cell.parentNode.cells[cell.cellIndex - 1].id = "current_cell";
}
}
function Right() {
var cell = $('current_cell');
if (cell.cellIndex + 1 < cell.parentNode.cells.length) {
cell.id = null;
cell.parentNode.cells[cell.cellIndex + 1].id = "current_cell";
}
}
function fill_cell_from_key(event) {
$('current_cell').innerHTML = event.keyName;
Event.stop(event);
}
function say(msg) {
test/images/GvaScript.css view on Meta::CPAN
/* TREE NAVIGATOR */
.TN_node { display : block; }
.TN_label { cursor: pointer; } /* labels are clickable */
.TN_selected { background-color: yellow; } /* how to highlight the current selected node */
.TN_content { display : block; margin: 0; margin-left: 15px; } /* node content is 15px more on the right than the node itself */
.TN_mouse { text-decoration: underline; } /* class to implement pseudo-hover on node labels */
/* buttons in front of each node label */
.TN_button {
background: transparent url(tn_sprite.png) no-repeat 0 -9px;
float:left;
width:9px;
height:9px;
margin:1px;margin-left:0;
padding-right:2px;
cursor:pointer;
clear:left;
}
/* when a node is closed, the button icon becomes a 'plus', and
the content is hidden */
test/images/GvaScript.css view on Meta::CPAN
.gva-actionsbar {background-color:#E8E8E8;border:1px solid #8c8c8c;border-width:1px 0px;height:25px;padding:4px 0 1px;}
.gva-btn-container {display:inline;}
.gva-btn-container .btn {margin:0 3px;font-size:12px;cursor:pointer;}
.gva-btn-container .btn {
font-family:verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif;
background:none;
border:none;
cursor:pointer;
padding:1px 2px;
color:#000;
background-color:transparent !important;
}
.gva-btn-container .btn {float:left;}
.gva-btn-container.btn-focus .btn {color:#aa0000;}
.gva-btn-container span {display:block;float:left;height:21px;}
.gva-btn-container span.left {background:transparent url(btn_sprite.gif) no-repeat scroll 0 0;padding:0 1px 0 2px;margin-left:4px;}
.gva-btn-container span.center {background:transparent url(btn_sprite.gif) repeat-x scroll 0 -42px;padding:0 2px}
.gva-btn-container span.right {background:transparent url(btn_sprite.gif) no-repeat scroll 0 -21px;padding:0 1px 0 2px;}
.gva-btn-container.btn-hover span.left {background-position:0 -63px;}
.gva-btn-container.btn-hover span.center {background-position:0 -105px;}
.gva-btn-container.btn-hover span.right {background-position:0 -84px;}
.gva-btn-container.btn-focus span.left {background-position:0 -63px;}
.gva-btn-container.btn-focus span.center {background-position:0 -126px;}
.gva-btn-container.btn-focus span.right {background-position:0 -84px;}
/* GRID */
table {padding:0;margin: 0;border-collapse:collapse;}
#grid_container {border: 1px solid #a3bad9; }
test/images/GvaScript.css view on Meta::CPAN
.gva-grid td.grid-cell.right {text-align:right;float:none;}
.gva-grid td.grid-cell.red {color:#a00;}
/* FORM REPEAT */
.icon-add {
display:inline-table;
width:16px;
height:16px;
cursor:pointer;
background: transparent url(add.png) no-repeat left center;
}
.icon-delete {
display:inline-table;
float: right;
width:16px;
height:16px;
cursor:pointer;
background: transparent url(delete.png) no-repeat left center;
}
test/test.css view on Meta::CPAN
}
.navigation ul li {
font-size: 12px;
margin-top: 1px;
margin-bottom: 1px;
color: #555;
}
.navigation p#version strong {color: #fff;}
.navigation .footnote {background-color: #4e5b82; margin-top: 15px; font-size: 8pt; border-top: 1px solid; position: absolute; bottom: 0;}
.navigation .footnote * {color:#f5f5f5;}
.navigation .footnote tt {background-color: transparent; border: none; font-size: 8pt;}
/* LOG BLOCK */
#logs {
height:100px;
padding: 0.3em;
margin: 0.2em 0 2em;
background-color: #E0EFE2;
overflow-y:auto;
border:1px solid green;
test/unittest.js view on Meta::CPAN
benchmark: function(operation, iterations) {
var startAt = new Date();
(iterations || 1).times(operation);
var timeTaken = ((new Date())-startAt);
this.info((arguments[2] || 'Operation') + ' finished ' +
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
return timeTaken;
},
_isVisible: function(element) {
element = $(element);
if(!element.parentNode) return true;
this.assertNotNull(element);
if(element.style && Element.getStyle(element, 'display') == 'none')
return false;
return this._isVisible(element.parentNode);
},
assertNotVisible: function(element) {
this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
},
assertVisible: function(element) {
this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
},
benchmark: function(operation, iterations) {
var startAt = new Date();
(iterations || 1).times(operation);
var timeTaken = ((new Date())-startAt);
this.info((arguments[2] || 'Operation') + ' finished ' +
iterations + ' iterations in ' + (timeTaken/1000)+'s' );