2008-07-31 11:16:25 +02:00
|
|
|
var LSformElement_xmpp = new Class({
|
|
|
|
initialize: function(){
|
|
|
|
this.initialiseLSformElement_xmpp();
|
|
|
|
if (typeof(varLSform) != "undefined") {
|
|
|
|
varLSform.addModule("LSformElement_xmpp",this);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initialiseLSformElement_xmpp: function(el) {
|
|
|
|
if (typeof(el) == 'undefined') {
|
|
|
|
el = document;
|
|
|
|
}
|
2008-09-27 02:55:58 +02:00
|
|
|
el.getElements('input.LSformElement_xmpp').each(function(input) {
|
|
|
|
this.addBtnAfter.bind(this)(input);
|
2008-07-31 11:16:25 +02:00
|
|
|
}, this);
|
2008-09-27 02:55:58 +02:00
|
|
|
el.getElements('a.LSformElement_xmpp').each(function(a) {
|
|
|
|
this.addBtnAfter.bind(this)(a);
|
|
|
|
}, this);
|
|
|
|
},
|
|
|
|
|
|
|
|
addBtnAfter: function(el) {
|
|
|
|
var btn = new Element('img');
|
|
|
|
btn.setProperties({
|
2008-10-09 03:31:33 +02:00
|
|
|
src: varLSdefault.imagePath('xmpp.png'),
|
2008-09-27 02:55:58 +02:00
|
|
|
alt: 'Chat',
|
|
|
|
title: 'Chat'
|
|
|
|
});
|
|
|
|
btn.addClass('btn');
|
|
|
|
btn.injectAfter(el);
|
|
|
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
2008-07-31 11:16:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
reinitialize: function(el) {
|
2008-10-15 20:29:14 +02:00
|
|
|
varLSform.initializeModule('LSformElement_text',el);
|
2008-07-31 11:16:25 +02:00
|
|
|
this.initialiseLSformElement_xmpp(el);
|
|
|
|
},
|
|
|
|
|
|
|
|
onBtnClick: function(btn) {
|
|
|
|
var href = btn.getParent().getFirst().href;
|
|
|
|
if (typeof(href)=="undefined") {
|
|
|
|
href = 'xmpp:'+btn.getParent().getFirst().value;
|
|
|
|
}
|
2008-08-04 12:45:42 +02:00
|
|
|
if ((href!="")&&(href!="xmpp:")) {
|
2008-07-31 11:16:25 +02:00
|
|
|
location.href = href;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
|
|
|
varLSformElement_xmpp = new LSformElement_xmpp();
|
|
|
|
});
|