Author: nbelaevski
Date: 2010-12-23 11:06:35 -0500 (Thu, 23 Dec 2010)
New Revision: 20778
Removed:
trunk/core/impl/src/main/resources/org/richfaces/component/
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/images/bg_shadow.png
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/images/spacer.gif
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/available.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/browser_info.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/events.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/form.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/skinning.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/ui.core.js
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
Log:
Legacy 3.x code removal
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/images/bg_shadow.png
===================================================================
(Binary files differ)
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/images/spacer.gif
===================================================================
(Binary files differ)
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/available.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/available.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/available.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,145 +0,0 @@
-//Requires prototype.js & AJAX script
-if (!document.observe) {
- throw "prototype.js is required!";
-}
-
-if (!A4J || !A4J.AJAX || !A4J.AJAX.AddListener) {
- throw "AJAX script is required!";
-}
-
-if (!window.Richfaces) {
- window.Richfaces = {};
-}
-
-Object.extend(Richfaces, function() {
- var _queueLength = 0;
- var _available = {};
- var _pollingActivated = false;
-
- var _lastEltId = null;
-
- var executeCallback = function(elt, callbacks) {
- if (callbacks instanceof Array) {
- for (var i = 0; i < callbacks.length; i++) {
- callbacks[i](elt);
- }
- } else {
- callbacks(elt);
- }
- };
-
- var stopPolling = function() {
- if (_pollingActivated) {
- Event.stopObserving(document, "mouseover", onEvent, true);
- Event.stopObserving(document, "focus", onEvent, true);
- Event.stopObserving(document, "focusin", onEvent, true);
-
- _pollingActivated = false;
- _lastEltId = null;
- }
- }
-
- var onEvent = function(event) {
- var elt = Event.element(event);
- while (elt) {
- var id = elt.id;
- if (id) {
- if (!_lastEltId) {
- _lastEltId = id;
- } else if (_lastEltId == id) {
- //we can stop now because elements queue hasn't changed since we've checked
this element
- break;
- }
-
- var callbacks = _available[id];
- if (callbacks) {
- try {
- executeCallback(elt, callbacks);
- } catch (e) {
- cleanup();
- throw e;
- }
-
- delete _available[id];
- if (--_queueLength == 0) {
- stopPolling();
- //done all elements for now
- break;
- }
- }
- }
-
- elt = elt.parentNode;
- }
- };
-
- var activatePolling = function() {
- if (!_pollingActivated) {
- Event.observe(document, "mousemove", onEvent, true);
- Event.observe(document, "focus", onEvent, true);
- Event.observe(document, "focusin", onEvent, true);
-
- _pollingActivated = true;
- }
- };
-
- var cleanup = function() {
- try {
- stopPolling();
- _queueLength = 0;
- _available = {};
- } catch (e) {
- LOG.error("Error occured during cleanup: " + e);
- }
- };
-
-
- var onReady = function() {
- try {
- for (var id in _available) {
- var elt = $(id);
- if (elt) {
- executeCallback(elt, _available[id]);
- } else {
- LOG.error("Element with id = " + id + " hasn't been
found!");
- }
- }
- } finally {
- cleanup();
- }
- };
-
- var onAvailable = function(eltId, callback) {
- var elt = $(eltId);
- if (elt) {
- callback(elt);
- } else {
- var a = _available[eltId];
- if (!a) {
- _available[eltId] = callback;
-
- //reset cached element because we've just changed the queue
- _lastEltId = null;
-
- _queueLength++;
- activatePolling();
- } else {
- if (a instanceof Array) {
- a.push(callback)
- } else {
- var ar = new Array();
- ar.push(a);
- ar.push(callback);
- _available[eltId] = ar;
- }
- }
- }
- };
-
- A4J.AJAX.AddListener(onReady);
- document.observe("dom:loaded", onReady);
-
- return {
- onAvailable: onAvailable
- };
-}());
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/browser_info.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/browser_info.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/browser_info.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,56 +0,0 @@
-if (!window.RichFaces) {
- window.RichFaces = {};
-}
-
-RichFaces.MSIE = 0;
-RichFaces.FF = 1;
-RichFaces.OPERA = 2;
-RichFaces.NETSCAPE = 3;
-RichFaces.SAFARI = 4;
-RichFaces.KONQ = 5;
-
-RichFaces.navigatorType = function () {
- var userAgent = navigator.userAgent.toLowerCase();
- if (userAgent.indexOf("msie") >= 0 ||
- userAgent.indexOf("explorer") >= 0)
- return RichFaces.MSIE;
- if (userAgent.indexOf("firefox") >= 0 ||
- userAgent.indexOf("iceweasel") >= 0)
- return RichFaces.FF;
- if (userAgent.indexOf("opera") >= 0)
- return RichFaces.OPERA;
- if (userAgent.indexOf("netscape") >= 0)
- return RichFaces.NETSCAPE;
- if (userAgent.indexOf("safari") >= 0)
- return RichFaces.SAFARI;
- if (userAgent.indexOf("konqueror") >= 0)
- return RichFaces.KONQ;
- return "OTHER";
-}
-
-RichFaces.getOperaVersion = function () {
- var userAgent = navigator.userAgent.toLowerCase();
- var index = userAgent.indexOf("opera");
- if (index == -1) return;
- return parseFloat(userAgent.substring(index+6));
-}
-
-RichFaces.getIEVersion = function () {
- var searchString = "msie";
- var agent = navigator.userAgent.toLowerCase();
- var idx = agent.indexOf(searchString);
- if (idx != -1) {
- var versIdx = agent.indexOf(";", idx);
- var versString;
-
- if (versIdx != -1) {
- versString = agent.substring(idx + searchString.length, versIdx);
- } else {
- versString = agent.substring(idx + searchString.length);
- }
-
- return parseFloat(versString);
- } else {
- return undefined;
- }
-}
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/events.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/events.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/events.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,145 +0,0 @@
-if (!window.Richfaces) {
- window.Richfaces = {};
-}
-Richfaces.SYNTHETIC_EVENT = "Richfaces.SYNTHETIC_EVENT";
-
-Richfaces.createEvent = function (type, component, baseEvent, props) {
- var eventObj;
-
- if (document.createEventObject) {
- if (baseEvent) {
- eventObj = document.createEventObject(baseEvent);
- } else {
- eventObj = document.createEventObject();
- }
- } else {
- var bubbles = baseEvent && baseEvent.bubbles || false;
- var cancelable = baseEvent && baseEvent.cancelable || true;
-
- switch (type) {
- case 'abort':
- case 'blur':
- case 'change':
- case 'error':
- case 'focus':
- case 'load':
- case 'reset':
- case 'resize':
- case 'scroll':
- case 'select':
- case 'submit':
- case 'unload':
-
- eventObj = document.createEvent('HTMLEvents');
- eventObj.initEvent(type, bubbles, cancelable);
-
- break;
-
- case 'DOMActivate':
- case 'DOMFocusIn':
- case 'DOMFocusOut':
- case 'keydown':
- case 'keypress':
- case 'keyup':
-
- eventObj = document.createEvent('UIEvents');
- if (baseEvent) {
- eventObj.initUIEvent(type, bubbles, cancelable, baseEvent.windowObject,
- baseEvent.detail);
- } else {
- eventObj.initEvent(type, bubbles, cancelable);
- }
-
- break;
-
- case 'click':
- case 'mousedown':
- case 'mousemove':
- case 'mouseout':
- case 'mouseover':
- case 'mouseup':
-
- eventObj = document.createEvent('MouseEvents');
- if (baseEvent) {
- eventObj.initMouseEvent(type, bubbles, cancelable,
- baseEvent.windowObject,
- baseEvent.detail,
- baseEvent.screenX,
- baseEvent.screenY,
- baseEvent.clientX,
- baseEvent.clientY,
- baseEvent.ctrlKey,
- baseEvent.altKey,
- baseEvent.shiftKey,
- baseEvent.metaKey,
- baseEvent.button,
- baseEvent.relatedTarget);
- } else {
- eventObj.initEvent(type, bubbles, cancelable)
- }
-
- break;
-
- case 'DOMAttrModified':
- case 'DOMNodeInserted':
- case 'DOMNodeRemoved':
- case 'DOMCharacterDataModified':
- case 'DOMNodeInsertedIntoDocument':
- case 'DOMNodeRemovedFromDocument':
- case 'DOMSubtreeModified':
-
- eventObj = document.createEvent('MutationEvents');
- if (baseEvent) {
- eventObj.initMutationEvent(type, bubbles, cancelable,
- baseEvent.relatedNode,
- baseEvent.prevValue,
- baseEvent.newValue,
- baseEvent.attrName,
- baseEvent.attrChange
- );
- } else {
- eventObj.initEvent(type, bubbles, cancelable)
- }
-
- break;
-
- default:
- eventObj = document.createEvent('Events');
- eventObj.initEvent(type, bubbles, cancelable);
- }
- }
-
- if (props) {
- Object.extend(eventObj, props);
- }
-
- eventObj[Richfaces.SYNTHETIC_EVENT] = true;
-
- return {
- event: eventObj,
-
- fire: function() {
- if (component.fireEvent) {
- component.fireEvent("on" + type, this.event);
- } else {
- component.dispatchEvent(this.event);
- }
- },
-
- destroy: function() {
- if (props) {
- for (var name in props) {
- this.event[name] = undefined;
- }
- }
- }
- };
-}
-
-Richfaces.eventIsSynthetic = function (event) {
- if (event) {
- return new Boolean(event[Richfaces.SYNTHETIC_EVENT]).valueOf();
- }
-
- return false;
-}
\ No newline at end of file
Deleted: trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/form.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/form.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/form.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,19 +0,0 @@
-if (!window.Richfaces) {
- window.Richfaces = {};
-}
-
-Richfaces.jsFormSubmit = function(linkId, formName, target, params) {
- var form = document.getElementById(formName);
- if (form) {
- var formTarget = form.target;
- var paramNames = new Array();
- if (params) {
- for (var n in params) {
- paramNames.push(n);
- }
- }
-
- _JSFFormSubmit(linkId,formName,target,params);
- _clearJSFFormParameters(formName, formTarget, paramNames);
- }
-}
\ No newline at end of file
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,865 +0,0 @@
-/**
- * jCarousel - Riding carousels with jQuery
- *
http://sorgalla.com/jcarousel/
- *
- * Copyright (c) 2006 Jan Sorgalla (
http://sorgalla.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * Built on top of the jQuery library
- *
http://jquery.com
- *
- * Inspired by the "Carousel Component" by Bill Scott
- *
http://billwscott.com/carousel/
- */
-
-(function($) {
- /**
- * Creates a carousel for all matched elements.
- *
- * @example $("#mycarousel").jcarousel();
- * @before <ul id="mycarousel"><li>First
item</li><li>Second item</li></ul>
- * @result
- *
- * <div class="jcarousel-skin-name jcarousel-container">
- * <div disabled="disabled" class="jcarousel-prev
jcarousel-prev-disabled"></div>
- * <div class="jcarousel-next"></div>
- * <div class="jcarousel-clip">
- * <ul class="jcarousel-list">
- * <li class="jcarousel-item-1">First item</li>
- * <li class="jcarousel-item-2">Second item</li>
- * </ul>
- * </div>
- * </div>
- *
- * @name jcarousel
- * @type jQuery
- * @param Hash o A set of key/value pairs to set as configuration properties.
- * @cat Plugins/jCarousel
- */
- $.fn.jcarousel = function(o) {
- return this.each(function() {
- new $jc(this, o);
- });
- };
-
- // Default configuration properties.
- var defaults = {
- vertical: false,
- start: 1,
- offset: 1,
- size: null,
- scroll: 3,
- visible: null,
- animation: 'normal',
- easing: 'swing',
- auto: 0,
- wrap: null,
- initCallback: null,
- reloadCallback: null,
- itemLoadCallback: null,
- itemFirstInCallback: null,
- itemFirstOutCallback: null,
- itemLastInCallback: null,
- itemLastOutCallback: null,
- itemVisibleInCallback: null,
- itemVisibleOutCallback: null,
- buttonNextHTML: '<div></div>',
- buttonPrevHTML: '<div></div>',
- buttonNextEvent: 'click',
- buttonPrevEvent: 'click',
- buttonNextCallback: null,
- buttonPrevCallback: null
- };
-
- /**
- * The jCarousel object.
- *
- * @constructor
- * @name $.jcarousel
- * @param Object e The element to create the carousel for.
- * @param Hash o A set of key/value pairs to set as configuration properties.
- * @cat Plugins/jCarousel
- */
- $.jcarousel = function(e, o) {
- this.options = $.extend({}, defaults, o || {});
-
- this.locked = false;
-
- this.container = null;
- this.clip = null;
- this.list = null;
- this.buttonNext = null;
- this.buttonPrev = null;
-
- this.wh = !this.options.vertical ? 'width' : 'height';
- this.lt = !this.options.vertical ? 'left' : 'top';
-
- if (e.nodeName == 'UL' || e.nodeName == 'OL') {
- this.list = $(e);
- this.container = this.list.parent();
-
- if ($.className.has(this.container[0].className, 'jcarousel-clip'))
{
- if (!$.className.has(this.container[0].parentNode.className,
'jcarousel-container'))
- this.container =
this.container.wrap('<div></div>');
-
- this.container = this.container.parent();
- } else if (!$.className.has(this.container[0].className,
'jcarousel-container'))
- this.container =
this.list.wrap('<div></div>').parent();
-
- // Move skin class over to container
- var split = e.className.split(' ');
-
- for (var i = 0; i < split.length; i++) {
- if (split[i].indexOf('jcarousel-skin') != -1) {
- this.list.removeClass(split[i]);
- this.container.addClass(split[i]);
- break;
- }
- }
- } else {
- this.container = $(e);
- this.list = $(e).children('ul,ol');
- }
-
- this.clip = this.list.parent();
-
- if (!this.clip.length || !$.className.has(this.clip[0].className,
'jcarousel-clip'))
- this.clip = this.list.wrap('<div></div>').parent();
-
- this.buttonPrev = $('.jcarousel-prev', this.container);
-
- if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
- this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();
-
- this.buttonPrev.addClass(this.className('jcarousel-prev'));
-
- this.buttonNext = $('.jcarousel-next', this.container);
-
- if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
- this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();
-
- this.buttonNext.addClass(this.className('jcarousel-next'));
-
- this.clip.addClass(this.className('jcarousel-clip'));
- this.list.addClass(this.className('jcarousel-list'));
- this.container.addClass(this.className('jcarousel-container'));
-
- var di = this.options.visible != null ? Math.ceil(this.clipping() /
this.options.visible) : null;
- var li = this.list.children('li');
-
- var self = this;
-
- if (li.size() > 0) {
- var wh = 0, i = this.options.offset;
- li.each(function() {
- self.format(this, i++);
- wh += self.dimension(this, di);
- });
-
- this.list.css(this.wh, wh + 'px');
-
- // Only set if not explicitly passed as option
- if (!o || o.size == undefined)
- this.options.size = li.size();
- }
-
- // For whatever reason, .show() does not work in Safari...
- this.container.css('display', 'block');
- this.buttonNext.css('display', 'block');
- this.buttonPrev.css('display', 'block');
-
- this.funcNext = function() { self.next(); };
- this.funcPrev = function() { self.prev(); };
-
- $(window).bind('resize', function() { self.reload(); });
-
- if (this.options.initCallback != null)
- this.options.initCallback(this, 'init');
-
- this.setup();
- };
-
- // Create shortcut for internal use
- var $jc = $.jcarousel;
-
- $jc.fn = $jc.prototype = {
- jcarousel: '0.2.2'
- };
-
- $jc.fn.extend = $jc.extend = $.extend;
-
- $jc.fn.extend({
- /**
- * Setups the carousel.
- *
- * @name setup
- * @type undefined
- * @cat Plugins/jCarousel
- */
- setup: function() {
- this.first = null;
- this.last = null;
- this.prevFirst = null;
- this.prevLast = null;
- this.animating = false;
- this.timer = null;
- this.tail = null;
- this.inTail = false;
-
- if (this.locked)
- return;
-
- this.list.css(this.lt, this.pos(this.options.offset) + 'px');
- var p = this.pos(this.options.start);
- this.prevFirst = this.prevLast = null;
- this.animate(p, false);
- },
-
- /**
- * Clears the list and resets the carousel.
- *
- * @name reset
- * @type undefined
- * @cat Plugins/jCarousel
- */
- reset: function() {
- this.list.empty();
-
- this.list.css(this.lt, '0px');
- this.list.css(this.wh, '0px');
-
- if (this.options.initCallback != null)
- this.options.initCallback(this, 'reset');
-
- this.setup();
- },
-
- /**
- * Reloads the carousel and adjusts positions.
- *
- * @name reload
- * @type undefined
- * @cat Plugins/jCarousel
- */
- reload: function() {
- if (this.tail != null && this.inTail)
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
-
- this.tail = null;
- this.inTail = false;
-
- if (this.options.reloadCallback != null)
- this.options.reloadCallback(this);
-
- if (this.options.visible != null) {
- var self = this;
- var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt =
0;
- $('li', this.list).each(function(i) {
- wh += self.dimension(this, di);
- if (i + 1 < self.first)
- lt = wh;
- });
-
- this.list.css(this.wh, wh + 'px');
- this.list.css(this.lt, -lt + 'px');
- }
-
- this.scroll(this.first, false);
- },
-
- /**
- * Locks the carousel.
- *
- * @name lock
- * @type undefined
- * @cat Plugins/jCarousel
- */
- lock: function() {
- this.locked = true;
- this.buttons();
- },
-
- /**
- * Unlocks the carousel.
- *
- * @name unlock
- * @type undefined
- * @cat Plugins/jCarousel
- */
- unlock: function() {
- this.locked = false;
- this.buttons();
- },
-
- /**
- * Sets the size of the carousel.
- *
- * @name size
- * @type undefined
- * @param Number s The size of the carousel.
- * @cat Plugins/jCarousel
- */
- size: function(s) {
- if (s != undefined) {
- this.options.size = s;
- if (!this.locked)
- this.buttons();
- }
-
- return this.options.size;
- },
-
- /**
- * Checks whether a list element exists for the given index (or index range).
- *
- * @name get
- * @type bool
- * @param Number i The index of the (first) element.
- * @param Number i2 The index of the last element.
- * @cat Plugins/jCarousel
- */
- has: function(i, i2) {
- if (i2 == undefined || !i2)
- i2 = i;
-
- for (var j = i; j <= i2; j++) {
- var e = this.get(j).get(0);
- if (!e || $.className.has(e, 'jcarousel-item-placeholder'))
- return false;
- }
-
- return true;
- },
-
- /**
- * Returns a jQuery object with list element for the given index.
- *
- * @name get
- * @type jQuery
- * @param Number i The index of the element.
- * @cat Plugins/jCarousel
- */
- get: function(i) {
- return $('.jcarousel-item-' + i, this.list);
- },
-
- /**
- * Adds an element for the given index to the list.
- * If the element already exists, it updates the inner html.
- * Returns the created element as jQuery object.
- *
- * @name add
- * @type jQuery
- * @param Number i The index of the element.
- * @param String s The innerHTML of the element.
- * @cat Plugins/jCarousel
- */
- add: function(i, s) {
- var e = this.get(i), old = 0;
-
- if (e.length == 0) {
- var c, e = this.create(i), j = $jc.intval(i);
- while (c = this.get(--j)) {
- if (j <= 0 || c.length) {
- j <= 0 ? this.list.prepend(e) : c.after(e);
- break;
- }
- }
- } else
- old = this.dimension(e);
-
- e.removeClass(this.className('jcarousel-item-placeholder'));
- typeof s == 'string' ? e.html(s) : e.empty().append(s);
-
- var di = this.options.visible != null ? Math.ceil(this.clipping() /
this.options.visible) : null;
- var wh = this.dimension(e, di) - old;
-
- if (i > 0 && i < this.first)
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + wh +
'px');
-
- this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh +
'px');
-
- return e;
- },
-
- /**
- * Removes an element for the given index from the list.
- *
- * @name remove
- * @type undefined
- * @param Number i The index of the element.
- * @cat Plugins/jCarousel
- */
- remove: function(i) {
- var e = this.get(i);
-
- // Check if item exists and is not currently visible
- if (!e.length || (i >= this.first && i <= this.last))
- return;
-
- var d = this.dimension(e);
-
- if (i < this.first)
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d +
'px');
-
- e.remove();
-
- this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d +
'px');
- },
-
- /**
- * Moves the carousel forwards.
- *
- * @name next
- * @type undefined
- * @cat Plugins/jCarousel
- */
- next: function() {
- this.stopAuto();
-
- if (this.tail != null && !this.inTail)
- this.scrollTail(false);
- else
- this.scroll(((this.options.wrap == 'both' || this.options.wrap ==
'last') && this.options.size != null && this.last ==
this.options.size) ? 1 : this.first + this.options.scroll);
- },
-
- /**
- * Moves the carousel backwards.
- *
- * @name prev
- * @type undefined
- * @cat Plugins/jCarousel
- */
- prev: function() {
- this.stopAuto();
-
- if (this.tail != null && this.inTail)
- this.scrollTail(true);
- else
- this.scroll(((this.options.wrap == 'both' || this.options.wrap ==
'first') && this.options.size != null && this.first == 1) ?
this.options.size : this.first - this.options.scroll);
- },
-
- /**
- * Scrolls the tail of the carousel.
- *
- * @name scrollTail
- * @type undefined
- * @param Bool b Whether scroll the tail back or forward.
- * @cat Plugins/jCarousel
- */
- scrollTail: function(b) {
- if (this.locked || this.animating || !this.tail)
- return;
-
- var pos = $jc.intval(this.list.css(this.lt));
-
- !b ? pos -= this.tail : pos += this.tail;
- this.inTail = !b;
-
- // Save for callbacks
- this.prevFirst = this.first;
- this.prevLast = this.last;
-
- this.animate(pos);
- },
-
- /**
- * Scrolls the carousel to a certain position.
- *
- * @name scroll
- * @type undefined
- * @param Number i The index of the element to scoll to.
- * @param Bool a Flag indicating whether to perform animation.
- * @cat Plugins/jCarousel
- */
- scroll: function(i, a) {
- if (this.locked || this.animating)
- return;
-
- this.animate(this.pos(i), a);
- },
-
- /**
- * Prepares the carousel and return the position for a certian index.
- *
- * @name pos
- * @type Number
- * @param Number i The index of the element to scoll to.
- * @cat Plugins/jCarousel
- */
- pos: function(i) {
- if (this.locked || this.animating)
- return;
-
- if (this.options.wrap != 'circular')
- i = i < 1 ? 1 : (this.options.size && i > this.options.size
? this.options.size : i);
-
- var back = this.first > i;
- var pos = $jc.intval(this.list.css(this.lt));
-
- // Create placeholders, new list width/height
- // and new list position
- var f = this.options.wrap != 'circular' && this.first <= 1
? 1 : this.first;
- var c = back ? this.get(f) : this.get(this.last);
- var j = back ? f : f - 1;
- var e = null, l = 0, p = false, d = 0;
-
- while (back ? --j >= i : ++j < i) {
- e = this.get(j);
- p = !e.length;
- if (e.length == 0) {
- e =
this.create(j).addClass(this.className('jcarousel-item-placeholder'));
- c[back ? 'before' : 'after' ](e);
- }
-
- c = e;
- d = this.dimension(e);
-
- if (p)
- l += d;
-
- if (this.first != null && (this.options.wrap ==
'circular' || (j >= 1 && (this.options.size == null || j <=
this.options.size))))
- pos = back ? pos + d : pos - d;
- }
-
- // Calculate visible items
- var clipping = this.clipping();
- var cache = [];
- var visible = 0, j = i, v = 0;
- var c = this.get(i - 1);
-
- while (++visible) {
- e = this.get(j);
- p = !e.length;
- if (e.length == 0) {
- e =
this.create(j).addClass(this.className('jcarousel-item-placeholder'));
- // This should only happen on a next scroll
- c.length == 0 ? this.list.prepend(e) : c[back ? 'before' :
'after' ](e);
- }
-
- c = e;
- var d = this.dimension(e);
-
- if (d == 0) {
- alert('jCarousel: No width/height set for items. This will cause
an infinite loop. Aborting...');
- return 0;
- }
-
- if (this.options.wrap != 'circular' && this.options.size
!== null && j > this.options.size)
- cache.push(e);
- else if (p)
- l += d;
-
- v += d;
-
- if (v >= clipping)
- break;
-
- j++;
- }
-
- // Remove out-of-range placeholders
- for (var x = 0; x < cache.length; x++)
- cache[x].remove();
-
- // Resize list
- if (l > 0) {
- this.list.css(this.wh, this.dimension(this.list) + l + 'px');
-
- if (back) {
- pos -= l;
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l +
'px');
- }
- }
-
- // Calculate first and last item
- var last = i + visible - 1;
- if (this.options.wrap != 'circular' && this.options.size
&& last > this.options.size)
- last = this.options.size;
-
- if (j > last) {
- visible = 0, j = last, v = 0;
- while (++visible) {
- var e = this.get(j--);
- if (!e.length)
- break;
- v += this.dimension(e);
- if (v >= clipping)
- break;
- }
- }
-
- var first = last - visible + 1;
- if (this.options.wrap != 'circular' && first < 1)
- first = 1;
-
- if (this.inTail && back) {
- pos += this.tail;
- this.inTail = false;
- }
-
- this.tail = null;
- if (this.options.wrap != 'circular' && last ==
this.options.size && (last - visible + 1) >= 1) {
- var m = $jc.margin(this.get(last), !this.options.vertical ?
'marginRight' : 'marginBottom');
- if ((v - m) > clipping)
- this.tail = v - clipping - m;
- }
-
- // Adjust position
- while (i-- > first)
- pos += this.dimension(this.get(i));
-
- // Save visible item range
- this.prevFirst = this.first;
- this.prevLast = this.last;
- this.first = first;
- this.last = last;
-
- return pos;
- },
-
- /**
- * Animates the carousel to a certain position.
- *
- * @name animate
- * @type undefined
- * @param mixed p Position to scroll to.
- * @param Bool a Flag indicating whether to perform animation.
- * @cat Plugins/jCarousel
- */
- animate: function(p, a) {
- if (this.locked || this.animating)
- return;
-
- this.animating = true;
-
- var self = this;
- var scrolled = function() {
- self.animating = false;
-
- if (p == 0)
- self.list.css(self.lt, 0);
-
- if (self.options.wrap == 'both' || self.options.wrap ==
'last' || self.options.size == null || self.last < self.options.size)
- self.startAuto();
-
- self.buttons();
- self.notify('onAfterAnimation');
- };
-
- this.notify('onBeforeAnimation');
-
- // Animate
- if (!this.options.animation || a == false) {
- this.list.css(this.lt, p + 'px');
- scrolled();
- } else {
- var o = !this.options.vertical ? {'left': p} : {'top':
p};
- this.list.animate(o, this.options.animation, this.options.easing,
scrolled);
- }
- },
-
- /**
- * Starts autoscrolling.
- *
- * @name auto
- * @type undefined
- * @param Number s Seconds to periodically autoscroll the content.
- * @cat Plugins/jCarousel
- */
- startAuto: function(s) {
- if (s != undefined)
- this.options.auto = s;
-
- if (this.options.auto == 0)
- return this.stopAuto();
-
- if (this.timer != null)
- return;
-
- var self = this;
- this.timer = setTimeout(function() { self.next(); }, this.options.auto *
1000);
- },
-
- /**
- * Stops autoscrolling.
- *
- * @name stopAuto
- * @type undefined
- * @cat Plugins/jCarousel
- */
- stopAuto: function() {
- if (this.timer == null)
- return;
-
- clearTimeout(this.timer);
- this.timer = null;
- },
-
- /**
- * Sets the states of the prev/next buttons.
- *
- * @name buttons
- * @type undefined
- * @cat Plugins/jCarousel
- */
- buttons: function(n, p) {
- if (n == undefined || n == null) {
- var n = !this.locked && this.options.size !== 0 &&
((this.options.wrap && this.options.wrap != 'first') || this.options.size
== null || this.last < this.options.size);
- if (!this.locked && (!this.options.wrap || this.options.wrap ==
'first') && this.options.size != null && this.last >=
this.options.size)
- n = this.tail != null && !this.inTail;
- }
-
- if (p == undefined || p == null) {
- var p = !this.locked && this.options.size !== 0 &&
((this.options.wrap && this.options.wrap != 'last') || this.first >
1);
- if (!this.locked && (!this.options.wrap || this.options.wrap ==
'last') && this.options.size != null && this.first == 1)
- p = this.tail != null && this.inTail;
- }
-
- var self = this;
-
- this.buttonNext[n ? 'bind' :
'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' :
'addClass'](this.className('jcarousel-next-disabled')).attr('disabled',
n ? false : true);
- this.buttonPrev[p ? 'bind' :
'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' :
'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled',
p ? false : true);
-
- if (this.buttonNext.length > 0 &&
(this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n)
&& this.options.buttonNextCallback != null) {
- this.buttonNext.each(function() { self.options.buttonNextCallback(self,
this, n); });
- this.buttonNext[0].jcarouselstate = n;
- }
-
- if (this.buttonPrev.length > 0 &&
(this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p)
&& this.options.buttonPrevCallback != null) {
- this.buttonPrev.each(function() { self.options.buttonPrevCallback(self,
this, p); });
- this.buttonPrev[0].jcarouselstate = p;
- }
- },
-
- notify: function(evt) {
- var state = this.prevFirst == null ? 'init' : (this.prevFirst <
this.first ? 'next' : 'prev');
-
- // Load items
- this.callback('itemLoadCallback', evt, state);
-
- if (this.prevFirst != this.first) {
- this.callback('itemFirstInCallback', evt, state, this.first);
- this.callback('itemFirstOutCallback', evt, state,
this.prevFirst);
- }
-
- if (this.prevLast != this.last) {
- this.callback('itemLastInCallback', evt, state, this.last);
- this.callback('itemLastOutCallback', evt, state, this.prevLast);
- }
-
- this.callback('itemVisibleInCallback', evt, state, this.first,
this.last, this.prevFirst, this.prevLast);
- this.callback('itemVisibleOutCallback', evt, state, this.prevFirst,
this.prevLast, this.first, this.last);
- },
-
- callback: function(cb, evt, state, i1, i2, i3, i4) {
- if (this.options[cb] == undefined || (typeof this.options[cb] !=
'object' && evt != 'onAfterAnimation'))
- return;
-
- var callback = typeof this.options[cb] == 'object' ?
this.options[cb][evt] : this.options[cb];
-
- if (!$.isFunction(callback))
- return;
-
- var self = this;
-
- if (i1 === undefined)
- callback(self, state, evt);
- else if (i2 === undefined)
- this.get(i1).each(function() { callback(self, this, i1, state, evt); });
- else {
- for (var i = i1; i <= i2; i++)
- if (!(i >= i3 && i <= i4))
- this.get(i).each(function() { callback(self, this, i, state,
evt); });
- }
- },
-
- create: function(i) {
- return this.format('<li></li>', i);
- },
-
- format: function(e, i) {
- var $e =
$(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-'
+ i));
- $e.attr('jcarouselindex', i);
- return $e;
- },
-
- className: function(c) {
- return c + ' ' + c + (!this.options.vertical ? '-horizontal'
: '-vertical');
- },
-
- dimension: function(e, d) {
- var el = e.jquery != undefined ? e[0] : e;
-
- var old = !this.options.vertical ?
- el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el,
'marginRight') :
- el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el,
'marginBottom');
-
- if (d == undefined || old == d)
- return old;
-
- var w = !this.options.vertical ?
- d - $jc.margin(el, 'marginLeft') - $jc.margin(el,
'marginRight') :
- d - $jc.margin(el, 'marginTop') - $jc.margin(el,
'marginBottom');
-
- $(el).css(this.wh, w + 'px');
-
- return this.dimension(el);
- },
-
- clipping: function() {
- return !this.options.vertical ?
- this.clip[0].offsetWidth -
$jc.intval(this.clip.css('borderLeftWidth')) -
$jc.intval(this.clip.css('borderRightWidth')) :
- this.clip[0].offsetHeight -
$jc.intval(this.clip.css('borderTopWidth')) -
$jc.intval(this.clip.css('borderBottomWidth'));
- },
-
- index: function(i, s) {
- if (s == undefined)
- s = this.options.size;
-
- return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
- }
- });
-
- $jc.extend({
- /**
- * Sets the global default configuration properties.
- *
- * @name defaults
- * @descr Sets the global default configuration properties.
- * @type undefined
- * @param Hash d A set of key/value pairs to set as configuration properties.
- * @cat Plugins/jCarousel
- */
- defaults: function(d) {
- $.extend(defaults, d);
- },
-
- margin: function(e, p) {
- if (!e)
- return 0;
-
- var el = e.jquery != undefined ? e[0] : e;
-
- if (p == 'marginRight' && $.browser.safari) {
- var old = {'display': 'block', 'float':
'none', 'width': 'auto'}, oWidth, oWidth2;
-
- $.swap(el, old, function() { oWidth = el.offsetWidth; });
-
- old['marginRight'] = 0;
- $.swap(el, old, function() { oWidth2 = el.offsetWidth; });
-
- return oWidth2 - oWidth;
- }
-
- return $jc.intval($.css(el, p));
- },
-
- intval: function(v) {
- v = parseInt(v);
- return isNaN(v) ? 0 : v;
- }
- });
-
-})(jQuery);
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.utils.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,83 +0,0 @@
-if (!window.Richfaces) {
- window.Richfaces = {};
-}
-
-Richfaces.jQuery = {};
-
-(function(_r$, jQuery) {
- var PX_REGEX = /^\s*[^\s]*px\s*$/;
-
- var parseToPx = function(value) {
- if (value) {
- if (PX_REGEX.test(value)) {
- try {
- return parseInt(value.replace(PX_REGEX, ""), 10);
- } catch (e) { }
- }
- }
-
- return NaN;
- };
-
- _r$.position = function(rect, element) {
- var jqe = jQuery(element);
- var width = jqe.width();
- var height = jqe.height();
-
- var left = parseToPx(jqe.css('left'));
- if (isNaN(left)) {
- left = 0;
- jqe.css('left', '0px');
- }
-
- var top = parseToPx(jqe.css('top'));
- if (isNaN(top)) {
- top = 0;
- jqe.css('top', '0px');
- }
-
- var elementOffset = jqe.offset();
-
- var jqw = jQuery(window);
-
- var winWidth = jqw.width();
- var winLeft = jqw.scrollLeft();
-
- var winHeight = jqw.height();
- var winTop = jqw.scrollTop();
-
- var newLeft;
- if (rect.left + width > winLeft + winWidth && rect.left + rect.width - width
>= winLeft) {
- newLeft = rect.left + rect.width - width;
- } else {
- newLeft = rect.left;
- }
-
- var newTop;
- if (rect.top + rect.height + height > winTop + winHeight && rect.top -
height >= winTop) {
- newTop = rect.top - height;
- } else {
- newTop = rect.top + rect.height;
- }
-
- left += newLeft - elementOffset.left;
- top += newTop - elementOffset.top;
-
- jqe.css('left', (left + 'px')).css('top', (top +
'px'));
- };
-
- _r$.getPointerRectangle = function(event) {
- var e = jQuery.event.fix(event);
-
- return {width: 0, height: 0, left: e.pageX, top: e.pageY};
- };
-
- _r$.getElementRectangle = function(element) {
- var jqe = jQuery(element);
- var offset = jqe.offset();
-
- return {width: jqe.width(), height: jqe.height(), left: offset.left, top: offset.top};
- };
-
-}(Richfaces.jQuery, jQuery));
-
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/skinning.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/skinning.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/skinning.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,11 +0,0 @@
-(function(jQuery) {
- var userAgent = navigator.userAgent;
- var skipNavigator = window.opera || (userAgent.indexOf('AppleWebKit/') > -1
&& userAgent.indexOf('Chrome/') == -1);
- if (!skipNavigator) {
- var f = function() {
- jQuery("head >
link[media='rich-extended-skinning']").removeAttr('media');
- };
- jQuery(document).ready(f);
- f();
- }
-}(jQuery));
\ No newline at end of file
Deleted:
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/ui.core.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/ui.core.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/ui.core.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,519 +0,0 @@
-/*
- * jQuery UI 1.7.1
- *
- * Copyright (c) 2009 AUTHORS.txt (
http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- *
http://docs.jquery.com/UI
- */
-;jQuery.ui || (function($) {
-
-var _remove = $.fn.remove,
- isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
-
-//Helper functions and ui object
-$.ui = {
- version: "1.7.1",
-
- // $.ui.plugin is deprecated. Use the proxy pattern instead.
- plugin: {
- add: function(module, option, set) {
- var proto = $.ui[module].prototype;
- for(var i in set) {
- proto.plugins[i] = proto.plugins[i] || [];
- proto.plugins[i].push([option, set[i]]);
- }
- },
- call: function(instance, name, args) {
- var set = instance.plugins[name];
- if(!set || !instance.element[0].parentNode) { return; }
-
- for (var i = 0; i < set.length; i++) {
- if (instance.options[set[i][0]]) {
- set[i][1].apply(instance.element, args);
- }
- }
- }
- },
-
- contains: function(a, b) {
- return document.compareDocumentPosition
- ? a.compareDocumentPosition(b) & 16
- : a !== b && a.contains(b);
- },
-
- hasScroll: function(el, a) {
-
- //If overflow is hidden, the element might have extra content, but the user wants to
hide it
- if ($(el).css('overflow') == 'hidden') { return false; }
-
- var scroll = (a && a == 'left') ? 'scrollLeft' :
'scrollTop',
- has = false;
-
- if (el[scroll] > 0) { return true; }
-
- // TODO: determine which cases actually cause this to happen
- // if the element doesn't have the scroll set, see if it's possible to
- // set the scroll
- el[scroll] = 1;
- has = (el[scroll] > 0);
- el[scroll] = 0;
- return has;
- },
-
- isOverAxis: function(x, reference, size) {
- //Determines when x coordinate is over "b" element axis
- return (x > reference) && (x < (reference + size));
- },
-
- isOver: function(y, x, top, left, height, width) {
- //Determines when x, y coordinates is over "b" element
- return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
- },
-
- keyCode: {
- BACKSPACE: 8,
- CAPS_LOCK: 20,
- COMMA: 188,
- CONTROL: 17,
- DELETE: 46,
- DOWN: 40,
- END: 35,
- ENTER: 13,
- ESCAPE: 27,
- HOME: 36,
- INSERT: 45,
- LEFT: 37,
- NUMPAD_ADD: 107,
- NUMPAD_DECIMAL: 110,
- NUMPAD_DIVIDE: 111,
- NUMPAD_ENTER: 108,
- NUMPAD_MULTIPLY: 106,
- NUMPAD_SUBTRACT: 109,
- PAGE_DOWN: 34,
- PAGE_UP: 33,
- PERIOD: 190,
- RIGHT: 39,
- SHIFT: 16,
- SPACE: 32,
- TAB: 9,
- UP: 38
- }
-};
-
-// WAI-ARIA normalization
-if (isFF2) {
- var attr = $.attr,
- removeAttr = $.fn.removeAttr,
- ariaNS = "http://www.w3.org/2005/07/aaa",
- ariaState = /^aria-/,
- ariaRole = /^wairole:/;
-
- $.attr = function(elem, name, value) {
- var set = value !== undefined;
-
- return (name == 'role'
- ? (set
- ? attr.call(this, elem, name, "wairole:" + value)
- : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
- : (ariaState.test(name)
- ? (set
- ? elem.setAttributeNS(ariaNS,
- name.replace(ariaState, "aaa:"), value)
- : attr.call(this, elem, name.replace(ariaState, "aaa:")))
- : attr.apply(this, arguments)));
- };
-
- $.fn.removeAttr = function(name) {
- return (ariaState.test(name)
- ? this.each(function() {
- this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
- }) : removeAttr.call(this, name));
- };
-}
-
-//jQuery plugins
-$.fn.extend({
- remove: function() {
- // Safari has a native remove event which actually removes DOM elements,
- // so we have to use triggerHandler instead of trigger (#3037).
- $("*", this).add(this).each(function() {
- $(this).triggerHandler("remove");
- });
- return _remove.apply(this, arguments );
- },
-
- enableSelection: function() {
- return this
- .attr('unselectable', 'off')
- .css('MozUserSelect', '')
- .unbind('selectstart.ui');
- },
-
- disableSelection: function() {
- return this
- .attr('unselectable', 'on')
- .css('MozUserSelect', 'none')
- .bind('selectstart.ui', function() { return false; });
- },
-
- scrollParent: function() {
- var scrollParent;
- if(($.browser.msie && (/(static|relative)/).test(this.css('position')))
|| (/absolute/).test(this.css('position'))) {
- scrollParent = this.parents().filter(function() {
- return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))
&&
(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
- }).eq(0);
- } else {
- scrollParent = this.parents().filter(function() {
- return
(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
- }).eq(0);
- }
-
- return (/fixed/).test(this.css('position')) || !scrollParent.length ?
$(document) : scrollParent;
- }
-});
-
-
-//Additional selectors
-$.extend($.expr[':'], {
- 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);
- }
-
- var methods = getMethods('getter');
- if (args.length == 1 && typeof args[0] == 'string') {
- methods = methods.concat(getMethods('getterSetter'));
- }
- return ($.inArray(method, methods) != -1);
-}
-
-$.widget = function(name, prototype) {
- var namespace = name.split(".")[0];
- name = name.split(".")[1];
-
- // create plugin method
- $.fn[name] = function(options) {
- var isMethodCall = (typeof options == 'string'),
- args = Array.prototype.slice.call(arguments, 1);
-
- // prevent calls to internal methods
- if (isMethodCall && options.substring(0, 1) == '_') {
- return this;
- }
-
- // handle getter methods
- if (isMethodCall && getter(namespace, name, options, args)) {
- var instance = $.data(this[0], name);
- return (instance ? instance[options].apply(instance, args)
- : undefined);
- }
-
- // handle initialization and non-getter methods
- return this.each(function() {
- var instance = $.data(this, name);
-
- // constructor
- (!instance && !isMethodCall &&
- $.data(this, name, new $[namespace][name](this, options))._init());
-
- // method call
- (instance && isMethodCall && $.isFunction(instance[options])
&&
- instance[options].apply(instance, args));
- });
- };
-
- // create widget constructor
- $[namespace] = $[namespace] || {};
- $[namespace][name] = function(element, options) {
- var self = this;
-
- this.namespace = namespace;
- this.widgetName = name;
- this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
- this.widgetBaseClass = namespace + '-' + name;
-
- this.options = $.extend({},
- $.widget.defaults,
- $[namespace][name].defaults,
- $.metadata && $.metadata.get(element)[name],
- options);
-
- this.element = $(element)
- .bind('setData.' + name, function(event, key, value) {
- if (event.target == element) {
- return self._setData(key, value);
- }
- })
- .bind('getData.' + name, function(event, key) {
- if (event.target == element) {
- return self._getData(key);
- }
- })
- .bind('remove', function() {
- return self.destroy();
- });
- };
-
- // add widget prototype
- $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
-
- // TODO: merge getter and getterSetter properties from widget prototype
- // and plugin prototype
- $[namespace][name].getterSetter = 'option';
-};
-
-$.widget.prototype = {
- _init: function() {},
- destroy: function() {
- this.element.removeData(this.widgetName)
- .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace
+ '-state-disabled')
- .removeAttr('aria-disabled');
- },
-
- option: function(key, value) {
- var options = key,
- self = this;
-
- if (typeof key == "string") {
- if (value === undefined) {
- return this._getData(key);
- }
- options = {};
- options[key] = value;
- }
-
- $.each(options, function(key, value) {
- self._setData(key, value);
- });
- },
- _getData: function(key) {
- return this.options[key];
- },
- _setData: function(key, value) {
- this.options[key] = value;
-
- if (key == 'disabled') {
- this.element
- [value ? 'addClass' : 'removeClass'](
- this.widgetBaseClass + '-disabled' + ' ' +
- this.namespace + '-state-disabled')
- .attr("aria-disabled", value);
- }
- },
-
- enable: function() {
- this._setData('disabled', false);
- },
- disable: function() {
- this._setData('disabled', true);
- },
-
- _trigger: function(type, event, data) {
- var callback = this.options[type],
- eventName = (type == this.widgetEventPrefix
- ? type : this.widgetEventPrefix + type);
-
- event = $.Event(event);
- event.type = eventName;
-
- // copy original event properties over to the new event
- // this would happen if we could call $.event.fix instead of $.Event
- // but we don't have a way to force an event to be fixed multiple times
- if (event.originalEvent) {
- for (var i = $.event.props.length, prop; i;) {
- prop = $.event.props[--i];
- event[prop] = event.originalEvent[prop];
- }
- }
-
- this.element.trigger(event, data);
-
- return !($.isFunction(callback) && callback.call(this.element[0], event, data)
=== false
- || event.isDefaultPrevented());
- }
-};
-
-$.widget.defaults = {
- disabled: false
-};
-
-
-/** Mouse Interaction Plugin **/
-
-$.ui.mouse = {
- _mouseInit: function() {
- var self = this;
-
- this.element
- .bind('mousedown.'+this.widgetName, function(event) {
- return self._mouseDown(event);
- })
- .bind('click.'+this.widgetName, function(event) {
- if(self._preventClickEvent) {
- self._preventClickEvent = false;
- event.stopImmediatePropagation();
- return false;
- }
- });
-
- // Prevent text selection in IE
- if ($.browser.msie) {
- this._mouseUnselectable = this.element.attr('unselectable');
- this.element.attr('unselectable', 'on');
- }
-
- this.started = false;
- },
-
- // TODO: make sure destroying one instance of mouse doesn't mess with
- // other instances of mouse
- _mouseDestroy: function() {
- this.element.unbind('.'+this.widgetName);
-
- // Restore text selection in IE
- ($.browser.msie
- && this.element.attr('unselectable', this._mouseUnselectable));
- },
-
- _mouseDown: function(event) {
- // don't let more than one widget handle mouseStart
- // TODO: figure out why we have to use originalEvent
- event.originalEvent = event.originalEvent || {};
- if (event.originalEvent.mouseHandled) { return; }
-
- // we may have missed mouseup (out of window)
- (this._mouseStarted && this._mouseUp(event));
-
- this._mouseDownEvent = event;
-
- var self = this,
- btnIsLeft = (event.which == 1),
- elIsCancel = (typeof this.options.cancel == "string" ?
$(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
- if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
- return true;
- }
-
- this.mouseDelayMet = !this.options.delay;
- if (!this.mouseDelayMet) {
- this._mouseDelayTimer = setTimeout(function() {
- self.mouseDelayMet = true;
- }, this.options.delay);
- }
-
- if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
- this._mouseStarted = (this._mouseStart(event) !== false);
- if (!this._mouseStarted) {
- event.preventDefault();
- return true;
- }
- }
-
- // these delegates are required to keep context
- this._mouseMoveDelegate = function(event) {
- return self._mouseMove(event);
- };
- this._mouseUpDelegate = function(event) {
- return self._mouseUp(event);
- };
- $(document)
- .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
-
- // preventDefault() is used to prevent the selection of text here -
- // however, in Safari, this causes select boxes not to be selectable
- // anymore, so this fix is needed
- ($.browser.safari || event.preventDefault());
-
- event.originalEvent.mouseHandled = true;
- return true;
- },
-
- _mouseMove: function(event) {
- // IE mouseup check - mouseup happened when mouse was out of window
- if ($.browser.msie && !event.button) {
- return this._mouseUp(event);
- }
-
- if (this._mouseStarted) {
- this._mouseDrag(event);
- return event.preventDefault();
- }
-
- if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
- this._mouseStarted =
- (this._mouseStart(this._mouseDownEvent, event) !== false);
- (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
- }
-
- return !this._mouseStarted;
- },
-
- _mouseUp: function(event) {
- $(document)
- .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
- .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
-
- if (this._mouseStarted) {
- this._mouseStarted = false;
- this._preventClickEvent = (event.target == this._mouseDownEvent.target);
- this._mouseStop(event);
- }
-
- return false;
- },
-
- _mouseDistanceMet: function(event) {
- return (Math.max(
- Math.abs(this._mouseDownEvent.pageX - event.pageX),
- Math.abs(this._mouseDownEvent.pageY - event.pageY)
- ) >= this.options.distance
- );
- },
-
- _mouseDelayMet: function(event) {
- return this.mouseDelayMet;
- },
-
- // These are placeholder methods, to be overriden by extending plugin
- _mouseStart: function(event) {},
- _mouseDrag: function(event) {},
- _mouseStop: function(event) {},
- _mouseCapture: function(event) { return true; }
-};
-
-$.ui.mouse.defaults = {
- cancel: null,
- distance: 1,
- delay: 0
-};
-
-})(jQuery);
Deleted: trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
---
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2010-12-23
16:01:59 UTC (rev 20777)
+++
trunk/core/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2010-12-23
16:06:35 UTC (rev 20778)
@@ -1,519 +0,0 @@
-if (!window.Richfaces) {
- window.Richfaces = {};
-}
-
-Richfaces.mergeStyles = function(userStyles,commonStyles) {
- var i;
- for(i in userStyles) {
- if (typeof userStyles[i] == "object") {
- this.mergeStyles(userStyles[i],commonStyles[i]);
- } else {
- commonStyles[i] += " " + userStyles[i];
- }
- }
- return commonStyles;
-};
-
-Richfaces.getComputedStyle = function(eltId, propertyName) {
- var elt = $(eltId);
-
- if (elt.nodeType != Node.ELEMENT_NODE) {
- return "";
- }
-
- if (elt.currentStyle) {
- return elt.currentStyle[propertyName];
- }
-
- if (document.defaultView && document.defaultView.getComputedStyle) {
-
- var styles = document.defaultView.getComputedStyle(elt, null);
- if (styles) {
- return styles.getPropertyValue(propertyName);
- }
-
- }
-
- return "";
-};
-
-Richfaces.getComputedStyleSize = function(eltId, propertyName) {
- var value = Richfaces.getComputedStyle(eltId, propertyName);
-
- if (value) {
- value = value.strip();
- value = value.replace(/px$/, "");
-
- return parseFloat(value);
- }
-
- return 0;
-};
-
-Richfaces.getWindowSize = function() {
- var myWidth = 0, myHeight = 0;
- if( typeof( window.innerWidth ) == 'number' ) {
- myWidth = window.innerWidth;
- myHeight = window.innerHeight;
- } else if( document.documentElement && ( document.documentElement.clientWidth
|| document.documentElement.clientHeight ) ) {
- myWidth = document.documentElement.clientWidth;
- myHeight = document.documentElement.clientHeight;
- } else if( document.body && ( document.body.clientWidth ||
document.body.clientHeight ) ) {
- myWidth = document.body.clientWidth;
- myHeight = document.body.clientHeight;
- }
- return {"width":myWidth,"height":myHeight};
-};
-
-Richfaces.removePX = function(str) {
- var pxIndex = str.indexOf("px")
- if ( pxIndex == -1 ) return str;
- return str.substr(0,pxIndex);
-};
-
-Richfaces.visitTree = function(root, callback) {
- var node = root;
- if (!node) {
- node = document;
- }
-
- callback.call(this, node);
-
- var child = node.firstChild;
- while (child) {
- Richfaces.visitTree(child, callback);
- child = child.nextSibling;
- }
-};
-
-Richfaces.getNSAttribute = function (name, element) {
- if (element.getAttributeNS) {
- var attr =
element.getAttributeNS('http://richfaces.ajax4jsf.org/rich';, name);
- if (attr) {
- return attr;
- }
- }
-
- var attributes = element.attributes;
- var attrName = "rich:" + name;
- var attr = attributes[attrName];
- if (attr) {
- return attr.nodeValue;
- }
-
-// for (var i = 0; i < attributes.length; i++) {
-// attr = attributes[i];
-// if (attr && attrName == attr.nodeName) {
-// return attr.nodeValue;
-// }
-// }
-
- return null;
-};
-
-Richfaces.VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_\.]*\s*$/;
-
-Richfaces.getObjectValue = function (str, object) {
- var a=str.split(".");
- var value=object[a[0]];
- var c=1;
- while (value && c<a.length) value = value[a[c++]];
- return (value ? value : "");
-}
-
-Richfaces.evalMacro = function(template, object)
-{
- var _value_="";
- // variable evaluation
- if (Richfaces.VARIABLE_NAME_PATTERN.test(template))
- {
- if (template.indexOf('.')==-1) {
- _value_ = object[template];
- if (!_value_) _value_=window[template];
- }
- // object's variable evaluation
- else {
- _value_ = Richfaces.getObjectValue(template, object);
- if (!_value_) _value_=Richfaces.getObjectValue(template, window);
- }
- if (_value_ && typeof _value_=='function') _value_ = _value_(object);
- if (!_value_) _value_="";
- }
- //js string evaluation
- else {
- try {
- if (Richfaces.browser.isObjectEval) {
- _value_ = object.eval(template);
- }
- else with (object) {
- _value_ = eval(template) ;
- }
-
- if (typeof _value_ == 'function') {
- _value_ = _value_(object);
- }
- } catch (e) { LOG.warn("Exception: "+e.Message + "\n[" + template +
"]"); }
- }
- return _value_;
-}
-Richfaces.evalSimpleMacro = function(template, object)
-{
- var value = object[template];
- if (!value) {value=window[template]; if (!value) value="";}
- return value;
-}
-
-Richfaces.getComponent = function(componentType, element)
-{
- var attribute="richfacesComponent";
- var type = "richfaces:"+componentType;
- while (element.parentNode) {
- if (element[attribute] && element[attribute]==type)
- return element.component;
- else
- element = element.parentNode;
- }
-}
-
-Richfaces.browser= {
- isIE: (!window.opera && /MSIE/.test(navigator.userAgent)),
- isIE6: (!window.opera && /MSIE\s*[6][\d,\.]+;/.test(navigator.userAgent)),
- isSafari: /Safari/.test(navigator.userAgent),
- isOpera: !!window.opera,
- isObjectEval: (Richfaces.eval!=undefined),
- isFF2: (!window.opera && /Firefox\s*[\/]2[\.]/.test(navigator.userAgent)),
- isFF3: (!window.opera && /Firefox\s*[\/]3[\.]/.test(navigator.userAgent))
-};
-
-Richfaces.eval = function(template, object) {
- var value = '';
-
- try {
- with (object) {
- value = eval(template) ;
- }
- } catch (e) {
- LOG.warn('Exception: ' + e.message + '\n[' + template + ']');
- }
-
- return value;
-};
-
-Richfaces.interpolate = function (placeholders, context) {
-
- for(var k in context) {
- var v = context[k];
- var regexp = new RegExp("\\{" + k + "\\}", "g");
- placeholders = placeholders.replace(regexp, v);
- }
-
- return placeholders;
-
-};
-
-if (!Richfaces.position) Richfaces.Position={};
-
-Richfaces.Position.setElementPosition = function(element, baseElement, jointPoint,
direction, offset)
-{
- // parameters:
- // jointPoint: {x:,y:} or
('top-left','top-right','bottom'-left,'bottom-right')
- // direction:
('top-left','top-right','bottom'-left,'bottom-right',
'auto')
- // offset: {x:,y:}
-
- var elementDim = Richfaces.Position.getOffsetDimensions(element);
- var baseElementDim = Richfaces.Position.getOffsetDimensions(baseElement);
-
- var windowRect = Richfaces.Position.getWindowViewport();
-
- var baseOffset = Position.cumulativeOffset(baseElement);
-
- // jointPoint
- var ox=baseOffset[0];
- var oy=baseOffset[1];
- var re = /^(top|bottom)-(left|right)$/;
- var match;
-
- if (typeof jointPoint=='object') {ox = jointPoint.x; oy = jointPoint.y}
- else if ( jointPoint && (match=jointPoint.toLowerCase().match(re))!=null )
- {
- if (match[2]=='right') ox+=baseElementDim.width;
- if (match[1]=='bottom') oy+=baseElementDim.height;
- } else
- {
- // ??? auto
- }
-
- // direction
- if (direction && (match=direction.toLowerCase().match(re))!=null )
- {
- var d = direction.toLowerCase().split('-');
- if (match[2]=='left') { ox-=elementDim.width + offset.x; } else ox +=
offset.x;
- if (match[1]=='top') { oy-=elementDim.height + offset.y; } else oy +=
offset.y
- } else
- {
- // auto
- var theBest = {square:0};
- // jointPoint: bottom-right, direction: bottom-left
- var rect = {right: baseOffset[0] + baseElementDim.width, top: baseOffset[1] +
baseElementDim.height};
- rect.left = rect.right - elementDim.width;
- rect.bottom = rect.top + elementDim.height;
- ox = rect.left; oy = rect.top;
- var s = Richfaces.Position.checkCollision(rect, windowRect);
- if (s!=0)
- {
- if (ox>=0 && oy>=0 && theBest.square<s) theBest = {x:ox,
y:oy, square:s};
- // jointPoint: top-right, direction: top-left
- rect = {right: baseOffset[0] + baseElementDim.width, bottom: baseOffset[1]};
- rect.left = rect.right - elementDim.width;
- rect.top = rect.bottom - elementDim.height;
- ox = rect.left; oy = rect.top;
- s = Richfaces.Position.checkCollision(rect, windowRect);
- if (s!=0)
- {
- if (ox>=0 && oy>=0 && theBest.square<s) theBest = {x:ox,
y:oy, square:s};
- // jointPoint: bottom-left, direction: bottom-right
- rect = {left: baseOffset[0], top: baseOffset[1] + baseElementDim.height};
- rect.right = rect.left + elementDim.width;
- rect.bottom = rect.top + elementDim.height;
- ox = rect.left; oy = rect.top;
- s = Richfaces.Position.checkCollision(rect, windowRect);
- if (s!=0)
- {
- if (ox>=0 && oy>=0 && theBest.square<s) theBest = {x:ox,
y:oy, square:s};
- // jointPoint: top-left, direction: top-right
- rect = {left: baseOffset[0], bottom: baseOffset[1]};
- rect.right = rect.left + elementDim.width;
- rect.top = rect.bottom - elementDim.height;
- ox = rect.left; oy = rect.top;
- s = Richfaces.Position.checkCollision(rect, windowRect);
- if (s!=0)
- {
- // the best way selection
- if (ox<0 || oy<0 || theBest.square>s) {ox=theBest.x; oy=theBest.y}
- }
- }
- }
-
- }
- }
-
- element.style.left = ox + 'px';
- element.style.top = oy + 'px';
-};
-
-Richfaces.Position.getOffsetDimensions = function(element) {
- // from prototype 1.5.0 // Pavel Yascenko
- element = $(element);
- var display = $(element).getStyle('display');
- if (display != 'none' && display != null) // Safari bug
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- var originalDisplay = els.display;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = 'block';
- var originalWidth = element.offsetWidth; // was element.clientWidth // Pavel
Yascenko
- var originalHeight = element.offsetHeight; // was element.clientHeight // Pavel
Yascenko
- els.display = originalDisplay;
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
-};
-
-Richfaces.Position.checkCollision = function(elementRect, windowRect, windowOffset)
-{
- if (elementRect.left >= windowRect.left &&
- elementRect.top >= windowRect.top &&
- elementRect.right <= windowRect.right &&
- elementRect.bottom <= windowRect.bottom)
- return 0;
-
- var rect = {left: (elementRect.left>windowRect.left ? elementRect.left :
windowRect.left),
- top: (elementRect.top>windowRect.top ? elementRect.top : windowRect.top),
- right: (elementRect.right<windowRect.right ? elementRect.right :
windowRect.right),
- bottom: (elementRect.bottom<windowRect.bottom ? elementRect.bottom :
windowRect.bottom)};
- return (rect.right-rect.left)* (rect.bottom-rect.top);
-};
-
-
-Richfaces.Position.getWindowDimensions = function() {
- var w = self.innerWidth
- || document.documentElement.clientWidth
- || document.body.clientWidth
- || 0;
- var h = self.innerHeight
- || document.documentElement.clientHeight
- || document.body.clientHeight
- || 0;
- return {width:w, height: h};
-};
-
-Richfaces.Position.getWindowScrollOffset = function() {
- var dx = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- var dy = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- return {left:dx, top: dy};
-};
-
-Richfaces.Position.getWindowViewport = function() {
- var windowDim = Richfaces.Position.getWindowDimensions();
- var windowOffset = Richfaces.Position.getWindowScrollOffset();
- return {left:windowOffset.left, top:windowOffset.top, right:
windowDim.width+windowOffset.left, bottom: windowDim.height+windowOffset.top};
-};
-
-Richfaces.firstDescendant = function(node) {
- var n = node.firstChild;
- while (n && n.nodeType != 1) {
- n = n.nextSibling;
- }
-
- return n;
-};
-
-Richfaces.lastDescendant = function(node) {
- var n = node.lastChild;
- while (n && n.nodeType != 1) {
- n = n.previousSibling;
- }
-
- return n;
-};
-
-Richfaces.next = function(node) {
- var n = node;
- do {
- n = n.nextSibling;
- } while (n && n.nodeType != 1);
-
- return n;
-};
-
-Richfaces.previous = function(node) {
- var n = node;
- do {
- n = n.previousSibling;
- } while (n && n.nodeType != 1);
-
- return n;
-};
-
-Richfaces.removeNode = function(node) {
- if (node) {
- var parentNode = node.parentNode;
- if (parentNode) {
- parentNode.removeChild(node);
- }
- }
-};
-
-Richfaces.readAttribute = function(element, name) {
- var result = null;
-
- var node = element.getAttributeNode(name);
- if (node) {
- result = node.nodeValue;
- }
-
- return result;
-};
-
-Richfaces.writeAttribute = function(element, name, value) {
- var node = element.getAttributeNode(name);
-
- if (value !== null) {
- if (node) {
- node.nodeValue = value;
- } else {
- node = document.createAttribute(name);
- node.nodeValue = value;
- element.setAttributeNode(node);
- }
- } else {
- if (node) {
- element.removeAttributeNode(node);
- }
- }
-};
-
-Richfaces.mergeObjects = function() {
- var target = arguments[0];
- if (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- if (source) {
- for (var name in source) {
- if (!target[name]) {
- target[name] = source[name];
- }
- }
- }
- }
- }
-};
-
-Richfaces.invokeEvent = function(eventFunc, element, eventName, memo) {
- var result;
- if (eventFunc) {
- element = $(element);
- if (element == document && document.createEvent &&
!element.dispatchEvent)
- element = document.documentElement;
-
- var event;
- if (document.createEvent) {
- event = document.createEvent("HTMLEvents");
- event.initEvent("dataavailable", true, true);
- } else {
- event = document.createEventObject();
- event.eventType = "ondataavailable";
- }
-
- event.eventName = eventName;
- event.rich = {component:this};
- event.memo = memo || { };
- try {
- result = eventFunc.call(element,event);
- }
- catch (e) { LOG.warn("Exception: "+e.Message + "\n[on"+eventName +
"]"); }
- }
- if (result!=false) result = true;
- return result;
-};
-
-Richfaces.setupScrollEventHandlers = function(element, handler) {
-
- var elements = []
-
- element = element.parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth ||
element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- Event.observe(element, "scroll", handler, false);
- }
- element = element.parentNode;
- }
-
- return elements;
-};
-
-Richfaces.removeScrollEventHandlers = function(elements, handler) {
- if (elements)
- {
- for (var i=0;i<elements.length;i++)
- {
- Event.stopObserving(elements[i], "scroll", handler, false);
- }
- elements = null;
- }
-};