ldapsaisie/trunk/includes/js/LSformElement_xmpp.js
Benjamin Renard f691db17c3 - LSformElement_xmpp & LSformElement_url & LSformElement_rss
-> Refonte avec l'utilisation de l'héritage de LSformElement_text
  -> Utilisation d'un fieldTemplate commum : LSformElement_uri_field.tpl
- LSformElement_mail
  -> Utilisation du fieldTemplate commum : LSformElement_uri_field.tpl
- LSformElement : Ajout du paramètre $fetchVariables qui contient les variables
  ajouter au contexte de la méthode fetchTemplate()
2008-10-15 18:29:14 +00:00

50 lines
1.4 KiB
JavaScript

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;
}
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);
},
addBtnAfter: function(el) {
var btn = new Element('img');
btn.setProperties({
src: varLSdefault.imagePath('xmpp.png'),
alt: 'Chat',
title: 'Chat'
});
btn.addClass('btn');
btn.injectAfter(el);
btn.addEvent('click',this.onBtnClick.bind(this,btn));
},
reinitialize: function(el) {
varLSform.initializeModule('LSformElement_text',el);
this.initialiseLSformElement_xmpp(el);
},
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();
});