Sha256: 19e2a1fa13f36b2d974ea77f3dd14e4c84915675bc9edeb7b401ac9275d41f35

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

dojo.provide("dojox.xmpp.widget.ChatSession");
dojo.declare("dojox.xmpp.widget.ChatSession",
	[dijit.layout.LayoutContainer, dijit._Templated],
	{
			templatePath: dojo.moduleUrl("dojox.xmpp.widget", "templates/ChatSession.html"),
			enableSubWidgets: true, 
			widgetsInTemplate: true,
			
			widgetType: "ChatSession",
			chatWith: null,
			instance: null,
			postCreate: function(){
				//console.log("Neato!");
			},
	
			displayMessage: function(message, type) {
				//console.log("displayMessage", this, message);
				if(message) {
					var name =  message.from ? this.chatWith : "me";
					this.messages.domNode.innerHTML += "<b>" + name + ":</b> " +   message.body + "<br/>";
					this.goToLastMessage();
				}
				
			},
			
			goToLastMessage: function() {
				this.messages.domNode.scrollTop = this.messages.domNode.scrollHeight;
			},
			
			onKeyPress: function(e){
				var key = e.keyCode || e.charCode;
				if ((key == dojo.keys.ENTER) && (this.chatInput.value != "")){
					this.instance.sendMessage({body: this.chatInput.value});
					this.displayMessage( {body: this.chatInput.value}, "out");
					this.chatInput.value = "";
				}
			}
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dojo-pkg-1.132.0 data/dojo-release-1.3.2-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.120.0 data/dojo-release-1.2.0-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.121.0 data/dojo-release-1.2.1-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.122.0 data/dojo-release-1.2.2-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.123.0 data/dojo-release-1.2.3-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.130.0 data/dojo-release-1.3.0-src/dojox/xmpp/widget/ChatSession.js
dojo-pkg-1.131.0 data/dojo-release-1.3.1-src/dojox/xmpp/widget/ChatSession.js