Alien-GvaScript
view release on metacpan or search on metacpan
doc/html/ProtoExtensions.html view on Meta::CPAN
<p>Returns an extended (prototype's <code>Element.extend()</code>) copy of HTMLElement.</p>
<p>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 <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">
<pre> Element.outerHTML(elem)</pre>
doc/html/TreeNavigator.html view on Meta::CPAN
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>
lib/Alien/GvaScript/ProtoExtensions.pod view on Meta::CPAN
Returns an extended (prototype's C<Element.extend()>) copy of HTMLElement.
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)
Returns a string representation of the DOM element,
including tags and attributes. Implemented through
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/lib/GvaScript.js view on Meta::CPAN
if (elem.nodeType == 1 &&
Element.hasAnyClass(elem, wanted_classes))
return $(elem);
// else walk to next element
elem = elem[navigation_property];
}
return null;
},
autoScroll: function(elem, container, percentage) {
percentage = percentage || 20; // default
container = container || elem.offsetParent;
var offset = elem.offsetTop;
var firstElementChild = container.firstElementChild
|| $(container).firstDescendant();
if (firstElementChild) {
var first_child_offset = firstElementChild.offsetTop;
if (first_child_offset == container.offsetTop)
offset -= first_child_offset;
}
var min = offset - (container.clientHeight * (100-percentage)/100);
var max = offset - (container.clientHeight * percentage/100);
if (container.scrollTop < min) container.scrollTop = min;
else if (container.scrollTop > max) container.scrollTop = max;
},
outerHTML: function(elem) {
var tag = elem.tagName;
if (!tag)
return elem; // not an element node
if (elem.outerHTML)
src/protoExtensions.js view on Meta::CPAN
if (elem.nodeType == 1 &&
Element.hasAnyClass(elem, wanted_classes))
return $(elem);
// else walk to next element
elem = elem[navigation_property];
}
return null;
},
autoScroll: function(elem, container, percentage) {
percentage = percentage || 20; // default
container = container || elem.offsetParent;
var offset = elem.offsetTop;
var firstElementChild = container.firstElementChild
|| $(container).firstDescendant();
if (firstElementChild) {
var first_child_offset = firstElementChild.offsetTop;
if (first_child_offset == container.offsetTop)
offset -= first_child_offset;
}
var min = offset - (container.clientHeight * (100-percentage)/100);
var max = offset - (container.clientHeight * percentage/100);
if (container.scrollTop < min) container.scrollTop = min;
else if (container.scrollTop > max) container.scrollTop = max;
},
outerHTML: function(elem) {
var tag = elem.tagName;
if (!tag)
return elem; // not an element node
if (elem.outerHTML)
test/functional/form/effects.js view on Meta::CPAN
};
Element.collectTextNodesIgnoreClass = function(element, className) {
return $A($(element).childNodes).collect( function(node) {
return (node.nodeType==3 ? node.nodeValue :
((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
Element.collectTextNodesIgnoreClass(node, className) : ''));
}).flatten().join('');
};
Element.setContentZoom = function(element, percent) {
element = $(element);
element.setStyle({fontSize: (percent/100) + 'em'});
if (Prototype.Browser.WebKit) window.scrollBy(0,0);
return element;
};
Element.getInlineOpacity = function(element){
return $(element).style.opacity || '';
};
Element.forceRerendering = function(element) {
try {
test/functional/form/effects.js view on Meta::CPAN
}
});
// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
return new Effect.Move(element,
Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
};
Effect.Scale = Class.create(Effect.Base, {
initialize: function(element, percent) {
this.element = $(element);
if (!this.element) throw(Effect._elementDoesNotExistError);
var options = Object.extend({
scaleX: true,
scaleY: true,
scaleContent: true,
scaleFromCenter: false,
scaleMode: 'box', // 'box' or 'contents' or { } with provided values
scaleFrom: 100.0,
scaleTo: percent
}, arguments[2] || { });
this.start(options);
},
setup: function() {
this.restoreAfterFinish = this.options.restoreAfterFinish || false;
this.elementPositioning = this.element.getStyle('position');
this.originalStyle = { };
['top','left','width','height','fontSize'].each( function(k) {
this.originalStyle[k] = this.element.style[k];
( run in 0.393 second using v1.01-cache-2.11-cpan-10c994e2082 )