28/11/2007, 07:33
|
| | | Fecha de Ingreso: mayo-2007 Ubicación: Santiasco CHILE
Mensajes: 300
Antigüedad: 17 años, 8 meses Puntos: 4 | |
Re: Mostrar mensaje oscureciendo pantalla y centrado jcl.js
Código:
// jcl.js: JavaScript Common behaviours Library
// -- OpenAjax hub --
if (typeof(window.OpenAjax) == "undefined") {
// setup the OpenAjax framework - hub
window.OpenAjax = {};
} // if
if (typeof(OpenAjax.hub) == "undefined") {
// a hub implementation
OpenAjax.hub = {
implementer: "http://www.mathertel.de/OpenAjax",
implVersion: "0.4",
specVersion: "0.5",
implExtraData: {},
// ----- library management -----
// the list of libraries that have registered
libraries: {},
// Registers an Ajax library with the OpenAjax Hub.
registerLibrary: function (p, u, v, e) {
var entry = { prefix: p, namespaceURI: u, version: v, extraData:e };
this.libraries[p] = entry;
this.publish("org.openajax.hub.registerLibrary", entry);
},
// Unregisters an Ajax library with the OpenAjax Hub.
unregisterLibrary: function (p) {
var entry = this.libraries[p];
this.publish("org.openajax.hub.unregisterLibrary", entry);
if (entry)
this.libraries[p] = null;
},
// ----- event management -----
_regs: {},
_regsId: 0,
/// name, callback, scope, data, filter
subscribe: function (n, c, s, d, f) {
var h = this._regsId;
s = s || window;
// treating upper/lowercase equal is not clearly defined, but true with domain names.
var rn = n.toLocaleLowerCase();
// build a regexp pattern that will match the event names
rn = rn.replace(/\*\*$/, "\S{0,}").replace(/\./g, "\\.").replace(/\*/g, "[^.]*");
var entry = {id:h, n:rn, c:c, s:s, d:d, f:f};
this._regs[h] = entry;
this._regsId++;
return(h);
}, // subscribe
unsubscribe: function (h) {
this._regs[h] = null;
}, // unsubscribe
publish: function (n, data) {
if ((n) && (n.length > 0)) {
n = n.toLocaleLowerCase();
for (var h in this._regs) {
var r = this._regs[h];
if (r && (n.match(r.n))) {
var ff = r.f; if (typeof(ff) == "string") ff = r.s[ff];
var fc = r.c; if (typeof(fc) == "string") fc = r.s[fc];
if ((!ff) || (ff.call(r.s, n, data, r.d)))
fc.call(r.s, n, data, r.d);
} // if
} // for
} // if
} // publish
}; // OpenAjax.hub
OpenAjax.hub.registerLibrary("aoa", "http://www.mathertel.de/OpenAjax", "0.4", {});
} // if (! hub)
OpenAjax.hub.registerLibrary("jcl", "http://www.mathertel.de/Behavior", "1.2", {});
// -- Javascript Control Library (behaviors) --
var jcl = {
// Detect InternetExplorer for some specific implementation differences.
isIE: (window.navigator.userAgent.indexOf("MSIE") > 0),
/// A list with all objects that are attached to any behaviour
List: [],
// attach events, methods and default-values to a html object (using the english spelling)
LoadBehaviour: function (obj, behaviour) {
if ((obj) && (obj.constructor == String))
obj = document.getElementById(obj);
if (obj == null) {
alert("LoadBehaviour: obj argument is missing.");
} else if (behaviour == null) {
alert("LoadBehaviour: behaviour argument is missing.");
} else {
if (behaviour.inheritFrom) {
this.LoadBehaviour(obj, behaviour.inheritFrom);
this.List.pop();
}
if ((! this.isIE) && (obj.attributes)) {
// copy all attributes to this.properties
for (var n = 0; n < obj.attributes.length; n++)
if (obj[obj.attributes[n].name] == null)
obj[obj.attributes[n].name] = obj.attributes[n].value;
} // if
for (var p in behaviour) {
if (p.substr(0, 2) == "on") {
this.AttachEvent(obj, p, behaviour[p].bind(obj));
} else if ((behaviour[p] == null) || (behaviour[p].constructor != Function)) {
// set default-value
if (obj[p] == null)
obj[p] = behaviour[p];
} else {
// attach method
obj[p] = behaviour[p];
} // if
} // for
obj._attachedBehaviour = behaviour;
} // if
if (obj)
this.List.push(obj);
}, // LoadBehaviour
/// Find the parent node of a given object that has the behavior attached.
FindBehaviourElement: function (obj, behaviourDef) {
while ((obj) && (obj._attachedBehaviour != behaviourDef))
obj = obj.parentNode;
return(obj);
},
/// Find the child elements with a given className contained by obj.
getElementsByClassName: function (obj, cName) {
var ret = new Array();
var allNodes = obj.getElementsByTagName("*");
for (var n = 0; n < allNodes.length; n++) {
if (allNodes[n].className == cName)
ret.push(allNodes[n]);
}
return(ret);
},
/// Find the child elements with a given name contained by obj.
getElementsByName: function (obj, cName) {
var ret = new Array();
var allNodes = obj.getElementsByTagName("*");
for (var n = 0; n < allNodes.length; n++) {
if (allNodes[n].name == cName)
ret.push(allNodes[n]);
}
return(ret);
},
}, // DetachEvent
/// Create a duplicate of a given JavaScript Object.
/// References are not duplicated !
CloneObject: function (srcObject) {
var tarObject = new Object();
for (var p in srcObject)
tarObject[p] = srcObject[p];
return(tarObject);
}, // CloneObject
CONTINUA!!!!!!*******************************************
con esos te puedes hacer algo intentalo yo justo andaba haciendo lo mismo
__________________ Saludos
desde Chile |