Author: vmolotkov
Date: 2008-03-13 12:39:44 -0400 (Thu, 13 Mar 2008)
New Revision: 6787
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
Log:
Event.onReady was deleted ()
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-03-13
15:47:40 UTC (rev 6786)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ShuttleUtils.js 2008-03-13
16:39:44 UTC (rev 6787)
@@ -1,51 +1,29 @@
-Object.extend(Event, {
- _domReady : function() {
- var domReady = arguments.callee
- if (!domReady.done) {
- domReady.done = true;
-
- Event._readyCallbacks.each(function(f) { f() });
- Event._readyCallbacks = null;
+if (!window.RichShuttleUtils) {
+ window.RichShuttleUtils = {};
+}
- if (Event._timer) {
- clearInterval(Event._timer);
- }
+RichShuttleUtils.execOnLoad = function(func, condition, timeout) {
- if (document.removeEventListener) {
- document.removeEventListener("DOMContentLoaded", domReady, false);
- }
-
- Event.stopObserving(window, 'load', domReady);
- }
- },
-
- onReady : function(f) {
- var domReady = this._domReady;
- if (domReady.done) {
- return f();
- }
+ if (condition()) {
+ func();
+ } else {
+ window.setTimeout(
+ function() {
+ Utils.execOnLoad(func, condition, timeout);
+ },
+ timeout
+ );
+ }
+};
+RichShuttleUtils.Condition = {
+ ElementPresent : function(element) {
+ return function () {
+ var el = $(element);
+ return el && el.offsetHeight > 0;
+ };
+ }
+};
- if (!this._readyCallbacks) {
-
- this._readyCallbacks = [];
-
- if (document.addEventListener) {
- document.addEventListener("DOMContentLoaded", domReady, false);
- }
-
- if (/WebKit/i.test(navigator.userAgent)) {
- this._timer = setInterval(function() {
- if (/loaded|complete/.test(document.readyState)) domReady();
- }, 10);
- }
-
- this.observe(window, 'load', domReady);
- }
-
- this._readyCallbacks.push(f);
- }
-});
-
Array.prototype.remove = function(object) {
var index = this.indexOf(object, 0, this.length);
if (index == -1) return;
Show replies by date