view release on metacpan or search on metacpan
share/plugins/Jifty/Plugin/CSSQuery/web/static/js/cssquery/cssQuery-level3.js view on Meta::CPAN
case "odd": $arguments = "2n+1";
}
var $$children = childElements($element.parentNode);
function _checkIndex($index) {
var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1;
return $$children[$index] == $element;
};
// it was just a number (no "n")
if (!isNaN($arguments)) return _checkIndex($arguments);
$arguments = $arguments.split("n");
var $multiplier = parseInt($arguments[0]);
var $step = parseInt($arguments[1]);
if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true;
if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step);
if (isNaN($step)) $step = 0;
var $count = 1;
while ($element = $traverse($element)) $count++;
if (isNaN($multiplier) || $multiplier == 1)
return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count);
return ($count % $multiplier) == $step;
};
}); // addModule
share/plugins/Jifty/Plugin/I18N/web/static/js/loc.js view on Meta::CPAN
return distance + _(' from now');
} else {
return distance + _(' ago');
}
} else {
return system_date.toLocaleDateString();
}
},
distance_of_time_in_words: function(minutes) {
if (minutes.isNaN) return "";
minutes = Math.abs(minutes);
if (minutes < 1) return _('less than a minute');
if (minutes < 50) return _(minutes + ' minute' + (minutes == 1 ? '' : 's'));
if (minutes < 90) return _('about one hour');
if (minutes < 1080) return (Math.round(minutes / 60) + ' hours');
if (minutes < 1440) return _('one day');
if (minutes < 2880) return _('about one day');
else return (Math.round(minutes / 1440) + _(' days'))
}
};
share/plugins/Jifty/Plugin/IEFixes/web/static/js/iefixes/IE8.js view on Meta::CPAN
};
IE7._isLang = function(element, code) {
while (element && !element.getAttribute("lang")) element = element.parentNode;
return element && new RegExp("^" + rescape(code), "i").test(element.getAttribute("lang"));
};
function _nthChild(match, args, position, last) {
// ugly but it works...
last = /last/i.test(match) ? last + "+1-" : "";
if (!isNaN(args)) args = "0n+" + args;
else if (args == "even") args = "2n";
else if (args == "odd") args = "2n+1";
args = args.split("n");
var a = args[0] ? (args[0] == "-") ? -1 : parseInt(args[0]) : 1;
var b = parseInt(args[1]) || 0;
var negate = a < 0;
if (negate) {
a = -a;
if (a == 1) b++;
}
share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism/prototype.js view on Meta::CPAN
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
i || (i = 0);
var length = this.length;
if (i < 0) i = length + i;
for (; i < length; i++)
if (this[i] === item) return i;
return -1;
};
if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
var n = this.slice(0, i).reverse().indexOf(item);
return (n < 0) ? n : i - n - 1;
};
Array.prototype.toArray = Array.prototype.clone;
function $w(string) {
if (!Object.isString(string)) return [];
string = string.strip();
return string ? string.split(/\s+/) : [];
share/plugins/Jifty/Plugin/Prototypism/web/static/js/prototypism/scriptaculous/effects.js view on Meta::CPAN
style: property.camelize(),
originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
targetValue: unit=='color' ? parseColor(value) : value,
unit: unit
};
}.bind(this)).reject(function(transform){
return (
(transform.originalValue == transform.targetValue) ||
(
transform.unit != 'color' &&
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
)
)
});
},
update: function(position) {
var style = { }, transform, i = this.transforms.length;
while(i--)
style[(transform = this.transforms[i]).style] =
transform.unit=='color' ? '#'+
(Math.round(transform.originalValue[0]+
share/web/static/js/dom-drag.js view on Meta::CPAN
/**************************************************
* dom-drag.js
* 09.25.2001
* www.youngpup.net
**************************************************
* 10.28.2001 - fixed minor bug where events
* sometimes fired off the handle, not the root.
**************************************************/
var Drag = { obj : null, init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper){ o.onmousedown = Drag.start; o.hmode = bSwapHorzRef ? false : true ; o.vmode = bSwapVertRef ? false : true ; o.root = oRoot && ...
share/web/static/js/jquery-1.4.1.js view on Meta::CPAN
var style = elem.style || elem, set = value !== undefined;
// IE uses filters for opacity
if ( !jQuery.support.opacity && name === "opacity" ) {
if ( set ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
}
return style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
"";
}
// Make sure we're using the right name for getting the float value
share/web/static/js/jquery.timepickr.js view on Meta::CPAN
data: function(elem, i, match) {
return !!$.data(elem, match[3]);
},
focusable: function(element) {
var nodeName = element.nodeName.toLowerCase(),
tabIndex = $.attr(element, 'tabindex');
return (/input|select|textarea|button|object/.test(nodeName)
? !element.disabled
: 'a' == nodeName || 'area' == nodeName
? element.href || !isNaN(tabIndex)
: !isNaN(tabIndex))
// the element and all of its ancestors must be visible
// the browser may report that the area is hidden
&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
},
tabbable: function(element) {
var tabIndex = $.attr(element, 'tabindex');
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
}
});
// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
function getter(namespace, plugin, method, args) {
function getMethods(type) {
var methods = $[namespace][plugin][type] || [];
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
share/web/static/js/jquery.timepickr.js view on Meta::CPAN
// Returns the filename of a path
filename: function(path) {
return path.split('/').pop();
},
// Returns a formated file size
filesizeformat: function(bytes, suffixes){
var b = parseInt(bytes, 10);
var s = suffixes || ['byte', 'bytes', 'KB', 'MB', 'GB'];
if (isNaN(b) || b === 0) { return '0 ' + s[0]; }
if (b == 1) { return '1 ' + s[0]; }
if (b < 1024) { return b.toFixed(2) + ' ' + s[1]; }
if (b < 1048576) { return (b / 1024).toFixed(2) + ' ' + s[2]; }
if (b < 1073741824) { return (b / 1048576).toFixed(2) + ' '+ s[3]; }
else { return (b / 1073741824).toFixed(2) + ' '+ s[4]; }
},
fileExtension: function(s) {
var tokens = s.split('.');
return tokens[tokens.length-1] || false;
share/web/static/js/jquery.timepickr.js view on Meta::CPAN
return o.constructor && Object.prototype.toString.apply(o.constructor.prototype) === '[object Array]';
},
isObject: function(o) {
return (typeof(o) == 'object');
},
// Convert input to currency (two decimal fixed number)
toCurrency: function(i) {
i = parseFloat(i, 10).toFixed(2);
return (i=='NaN') ? '0.00' : i;
},
/*--------------------------------------------------------------------
* javascript method: "pxToEm"
* by:
Scott Jehl (scott@filamentgroup.com)
Maggie Wachs (maggie@filamentgroup.com)
http://www.filamentgroup.com
*
* Copyright (c) 2008 Filament Group
share/web/static/js/rico.js view on Meta::CPAN
}else{
throw("Rico requires Object.extend from Prototype");
}
if (Array.prototype.push) {
Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.push;
}
if (!Array.prototype.remove) {
Array.prototype.remove = function(dx) {
if( isNaN(dx) || dx > this.length )
return false;
for( var i=0,n=0; i<this.length; i++ )
if( i != dx )
this[n++]=this[i];
this.length-=1;
};
Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.remove;
}
if (!Array.prototype.removeItem) {
share/web/static/js/rico.js view on Meta::CPAN
{
if (i != this.options.onLoadShowTab){
this.accordionTabs[i].collapse();
this.accordionTabs[i].content.style.display = 'none';
}
}
this.lastExpandedTab = this.accordionTabs[this.options.onLoadShowTab];
if (this.options.panelHeight == 'auto'){
var tabToCheck = (this.options.onloadShowTab === 0)? 1 : 0;
var titleBarSize = parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[tabToCheck].titleBar, 'height'));
if (isNaN(titleBarSize))
titleBarSize = this.accordionTabs[tabToCheck].titleBar.offsetHeight;
var totalTitleBarSize = this.accordionTabs.length * titleBarSize;
var parentHeight = parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode, 'height'));
if (isNaN(parentHeight))
parentHeight = this.container.parentNode.offsetHeight;
this.options.panelHeight = parentHeight - totalTitleBarSize-2;
}
this.lastExpandedTab.content.style.height = this.options.panelHeight + "px";
this.lastExpandedTab.showExpanded();
this.lastExpandedTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
},
share/web/static/js/rico.js view on Meta::CPAN
this.options.sortHandler(this.options.columns[columnNumber]);
}
},
removeColumnSort: function(n) {
this.options.columns[n].setUnsorted();
this.setSortImage(n);
},
setColumnSort: function(n, direction) {
if(isNaN(n)) return ;
this.options.columns[n].setSorted(direction);
this.setSortImage(n);
},
toggleColumnSort: function(n) {
this.options.columns[n].toggleSort();
this.setSortImage(n);
},
setSortImage: function(n) {
share/web/static/js/rico.js view on Meta::CPAN
var x = 0;
var y = 0;
var parent = element;
while ( parent ) {
var borderXOffset = 0;
var borderYOffset = 0;
if ( parent != element ) {
var borderXOffset = parseInt(this.getElementsComputedStyle(parent, "borderLeftWidth" ));
var borderYOffset = parseInt(this.getElementsComputedStyle(parent, "borderTopWidth" ));
borderXOffset = isNaN(borderXOffset) ? 0 : borderXOffset;
borderYOffset = isNaN(borderYOffset) ? 0 : borderYOffset;
}
x += parent.offsetLeft - parent.scrollLeft + borderXOffset;
y += parent.offsetTop - parent.scrollTop + borderYOffset;
parent = parent.offsetParent;
}
if ( accountForDocScroll ) {
x -= this.docScrollLeft();
y -= this.docScrollTop();
share/web/static/js/ui.core.js view on Meta::CPAN
data: function(elem, i, match) {
return !!$.data(elem, match[3]);
},
focusable: function(element) {
var nodeName = element.nodeName.toLowerCase(),
tabIndex = $.attr(element, 'tabindex');
return (/input|select|textarea|button|object/.test(nodeName)
? !element.disabled
: 'a' == nodeName || 'area' == nodeName
? element.href || !isNaN(tabIndex)
: !isNaN(tabIndex))
// the element and all of its ancestors must be visible
// the browser may report that the area is hidden
&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
},
tabbable: function(element) {
var tabIndex = $.attr(element, 'tabindex');
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
}
});
// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
function getter(namespace, plugin, method, args) {
function getMethods(type) {
var methods = $[namespace][plugin][type] || [];
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
share/web/static/js/yui/calendar.js view on Meta::CPAN
return (typeof val == Config.BOOLEAN_TYPE);
},
/**
* Validates that the value passed in is a number.
* @method checkNumber
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkNumber: function (val) {
return (!isNaN(val));
},
/**
* Fires a configuration property event using the specified value.
* @method fireEvent
* @private
* @param {String} key The configuration property's name
* @param {value} Object The value of the correct type for the property
*/
fireEvent: function ( key, value ) {
share/web/static/js/yui/container.js view on Meta::CPAN
return (typeof val == Config.BOOLEAN_TYPE);
},
/**
* Validates that the value passed in is a number.
* @method checkNumber
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkNumber: function (val) {
return (!isNaN(val));
},
/**
* Fires a configuration property event using the specified value.
* @method fireEvent
* @private
* @param {String} key The configuration property's name
* @param {value} Object The value of the correct type for the property
*/
fireEvent: function ( key, value ) {
share/web/static/js/yui/container.js view on Meta::CPAN
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configzIndex: function (type, args, obj) {
var zIndex = args[0],
el = this.element;
if (! zIndex) {
zIndex = Dom.getStyle(el, "zIndex");
if (! zIndex || isNaN(zIndex)) {
zIndex = 0;
}
}
if (this.iframe || this.cfg.getProperty("iframe") === true) {
if (zIndex <= 0) {
zIndex = 1;
}
}
share/web/static/js/yui/container.js view on Meta::CPAN
aXY;
if (oIFrame) {
// Size <iframe>
oIFrame.style.width = (oElement.offsetWidth + nDimensionOffset + "px");
oIFrame.style.height = (oElement.offsetHeight + nDimensionOffset + "px");
// Position <iframe>
aXY = this.cfg.getProperty("xy");
if (!Lang.isArray(aXY) || (isNaN(aXY[0]) || isNaN(aXY[1]))) {
this.syncPosition();
aXY = this.cfg.getProperty("xy");
}
Dom.setXY(oIFrame, [(aXY[0] - nOffset), (aXY[1] - nOffset)]);
}
},
/**
* Sets the zindex of the iframe shim, if it exists, based on the zindex of
* the Overlay element. The zindex of the iframe is set to be one less
share/web/static/js/yui/container.js view on Meta::CPAN
* to ensure that the iframe shim has a non-negative zindex.
* If you require the iframe zindex to be 0 or higher, the zindex of
* the Overlay element should be set to a value greater than 0, before
* this method is called.
* </p>
* @method stackIframe
*/
stackIframe: function () {
if (this.iframe) {
var overlayZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(overlayZ) && !isNaN(overlayZ)) {
Dom.setStyle(this.iframe, "zIndex", (overlayZ - 1));
}
}
},
/**
* The default event handler fired when the "iframe" property is changed.
* @method configIframe
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
share/web/static/js/yui/container.js view on Meta::CPAN
bringToTop: function () {
var aOverlays = [],
oElement = this.element;
function compareZIndexDesc(p_oOverlay1, p_oOverlay2) {
var sZIndex1 = Dom.getStyle(p_oOverlay1, "zIndex"),
sZIndex2 = Dom.getStyle(p_oOverlay2, "zIndex"),
nZIndex1 = (!sZIndex1 || isNaN(sZIndex1)) ? 0 : parseInt(sZIndex1, 10),
nZIndex2 = (!sZIndex2 || isNaN(sZIndex2)) ? 0 : parseInt(sZIndex2, 10);
if (nZIndex1 > nZIndex2) {
return -1;
} else if (nZIndex1 < nZIndex2) {
return 1;
} else {
return 0;
}
}
share/web/static/js/yui/container.js view on Meta::CPAN
Dom.getElementsBy(isOverlayElement, "DIV", document.body);
aOverlays.sort(compareZIndexDesc);
var oTopOverlay = aOverlays[0],
nTopZIndex;
if (oTopOverlay) {
nTopZIndex = Dom.getStyle(oTopOverlay, "zIndex");
if (!isNaN(nTopZIndex)) {
var bRequiresBump = false;
if (oTopOverlay != oElement) {
bRequiresBump = true;
} else if (aOverlays.length > 1) {
var nNextZIndex = Dom.getStyle(aOverlays[1], "zIndex");
// Don't rely on DOM order to stack if 2 overlays are at the same zindex.
if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) {
bRequiresBump = true;
}
}
if (bRequiresBump) {
this.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2));
}
}
}
},
share/web/static/js/yui/container.js view on Meta::CPAN
overlay.blurEvent.subscribe(mgr._onOverlayBlur);
overlay.hideEvent.subscribe(overlay.blur);
overlay.destroyEvent.subscribe(this._onOverlayDestroy, overlay, this);
Event.on(overlay.element, this.cfg.getProperty("focusevent"),
this._onOverlayElementFocus, null, overlay);
zIndex = Dom.getStyle(overlay.element, "zIndex");
if (!isNaN(zIndex)) {
overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10));
} else {
overlay.cfg.setProperty("zIndex", 0);
}
this.overlays.push(overlay);
this.bringToTop(overlay);
return true;
share/web/static/js/yui/container.js view on Meta::CPAN
if (oOverlay) {
aOverlays = this.overlays;
aOverlays.sort(this.compareZIndexDesc);
oTopOverlay = aOverlays[0];
if (oTopOverlay) {
nTopZIndex = Dom.getStyle(oTopOverlay.element, "zIndex");
if (!isNaN(nTopZIndex)) {
var bRequiresBump = false;
if (oTopOverlay !== oOverlay) {
bRequiresBump = true;
} else if (aOverlays.length > 1) {
var nNextZIndex = Dom.getStyle(aOverlays[1].element, "zIndex");
// Don't rely on DOM order to stack if 2 overlays are at the same zindex.
if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) {
bRequiresBump = true;
}
}
if (bRequiresBump) {
oOverlay.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2));
}
}
aOverlays.sort(this.compareZIndexDesc);
}
share/web/static/js/yui/container.js view on Meta::CPAN
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configzIndex: function (type, args, obj) {
Panel.superclass.configzIndex.call(this, type, args, obj);
if (this.mask || this.cfg.getProperty("modal") === true) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!panelZ || isNaN(panelZ)) {
panelZ = 0;
}
if (panelZ === 0) {
// Recursive call to configzindex (which should be stopped
// from going further because panelZ should no longer === 0)
this.cfg.setProperty("zIndex", 1);
} else {
this.stackMask();
}
share/web/static/js/yui/container.js view on Meta::CPAN
* <p>NOTE: This method will not bump up the zindex of the Panel
* to ensure that the mask has a non-negative zindex. If you require the
* mask zindex to be 0 or higher, the zindex of the Panel
* should be set to a value higher than 0, before this method is called.
* </p>
* @method stackMask
*/
stackMask: function() {
if (this.mask) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) {
Dom.setStyle(this.mask, "zIndex", panelZ - 1);
}
}
},
/**
* Renders the Panel by inserting the elements that are not already in
* the main Panel into their correct places. Optionally appends the
* Panel to the specified node prior to the render's execution. NOTE:
* For Panels without existing markup, the appendToNode argument is
share/web/static/js/yui/dom.js view on Meta::CPAN
var pageXY = this.getXY(el);
if (pageXY === false) { // has to be part of doc to have pageXY
return false;
}
var delta = [ // assuming pixels; if not we will have to retry
parseInt( this.getStyle(el, 'left'), 10 ),
parseInt( this.getStyle(el, 'top'), 10 )
];
if ( isNaN(delta[0]) ) {// in case of 'auto'
delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
}
if ( isNaN(delta[1]) ) { // in case of 'auto'
delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
}
if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
if (!noRetry) {
var newXY = this.getXY(el);
// if retry is true, try one more time if we miss
share/web/static/js/yui/event.js view on Meta::CPAN
* Logic that determines when we should automatically use legacy
* events instead of DOM2 events. Currently this is limited to old
* Safari browsers with a broken preventDefault
* @method useLegacyEvent
* @static
* @private
*/
useLegacyEvent: function(el, sType) {
if (this.webkit && ("click"==sType || "dblclick"==sType)) {
var v = parseInt(this.webkit, 10);
if (!isNaN(v) && v<418) {
return true;
}
}
return false;
},
/**
* Removes an event listener
*
* @method removeListener
share/web/static/js/yui/yahoo.js view on Meta::CPAN
clearInterval(r);
} else {
clearTimeout(r);
}
}
};
},
/**
* A convenience method for detecting a legitimate non-null value.
* Returns false for null/undefined/NaN, true for other values,
* including 0/false/''
* @method isValue
* @since 2.3.0
* @param o {any} the item to test
* @return {boolean} true if it is not null/undefined/NaN || false
*/
isValue: function(o) {
// return (o || o === false || o === 0 || o === ''); // Infinity fails
var l = YAHOO.lang;
return (l.isObject(o) || l.isString(o) || l.isNumber(o) || l.isBoolean(o));
}
};
/*
t/TestApp-JiftyJS/share/web/static/js-test/lib/Test/Builder.js view on Meta::CPAN
// Do nothing, since Object.prototype might have been changed.
// Too bad JS doesn't have real hashes!
// Test.Builder.die("plan() doesn't understand "
// + cmd + (arg[cmd] ? (" " + arg[cmd]) : ''));
}
}
};
Test.Builder.prototype.expectedTests = function (max) {
if (max) {
if (isNaN(max)) {
Test.Builder.die(
"Number of tests must be a postive integer. You gave it '"
+ max + "'." + Test.Builder.LF
);
}
this.ExpectedTests = max.valueOf();
this.HavePlan = true;
if (!this.noHeader()) this._print("1.." + max + Test.Builder.LF);
}