ldapsaisie/public_html/includes/js/LSformElement_xmpp.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

var LSformElement_xmpp = new Class({
initialize: function(){
this.initialiseLSformElement_xmpp();
if (typeof(varLSform) != "undefined") {
varLSform.addModule("LSformElement_xmpp",this);
}
},
2020-04-29 15:54:21 +02:00
initialiseLSformElement_xmpp: function(el) {
if (typeof(el) == 'undefined') {
el = document;
}
el.getElements('input.LSformElement_xmpp').each(function(input) {
this.addBtnAfter.bind(this)(input);
}, this);
el.getElements('a.LSformElement_xmpp').each(function(a) {
this.addBtnAfter.bind(this)(a);
}, this);
},
2020-04-29 15:54:21 +02:00
addBtnAfter: function(el) {
var btn = new Element('img');
btn.setProperties({
src: varLSdefault.imagePath('xmpp'),
alt: 'Chat'
});
btn.addClass('btn');
btn.injectAfter(el);
btn.addEvent('click',this.onBtnClick.bind(this,btn));
varLSdefault.addHelpInfo(btn,'LSformElement_xmpp','chat');
},
2020-04-29 15:54:21 +02:00
reinitialize: function(el) {
varLSform.initializeModule('LSformElement_text',el);
this.initialiseLSformElement_xmpp(el);
},
2020-04-29 15:54:21 +02:00
onBtnClick: function(btn) {
var href = btn.getParent().getFirst().href;
if (typeof(href)=="undefined") {
href = 'xmpp:'+btn.getParent().getFirst().value;
}
if ((href!="")&&(href!="xmpp:")) {
location.href = href;
}
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_xmpp = new LSformElement_xmpp();
});