JappixMini

Valérian Saliou edited this page Jan 25, 2014 · 17 revisions

The Jappix Mini mini-chat

To provide your users a mini-chat, similar to the one Facebook designed, we built Jappix Mini.

For developers: you may be looking for the Jappix Mini API spec.

## Installation

Notice: an installation assistant is available on the Jappix Mini website. This is based on the Jappix.com service. Don’t use it if you want to use your own node.

To use it on your website, simply put this code on all your page head elements:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script type="text/javascript">
	jQuery.ajaxSetup({cache: true});
	
	jQuery.getScript('http://my.jappix.tld/php/get.php?l=en&t=javascripts&g=mini.xml', function() {
		// Configure application & connect user
		// Notice: exclude "user" and "password" if using anonymous login
		JappixMini.launch({
			connection: {
				user: 'user',
				password: 'password',
				domain: 'jappix.com',
				resource: 'MyOwnResource'
			},
			
			application: {
				network: {
					autoconnect: false
				},

				interface: {
					showpane: true,
					animate: true
				},

				user: {
					random_nickname: true,
					nickname: 'Nickname'
				},

				chat: {
					open: []
				},

				groupchat: {
					open: [],
					open_passwords: []
				}
			}
		});
	});
</script>

If your website is yet using jQuery, you'd better removing the jQuery-related line! Note that we get jQuery from Google's CDN to improve performances, but you can also include jQuery from your own Jappix service by adding &f=jquery.js at the end of the Jappix Mini JS URL.

Replace l=en in the JS (script) URLs with "get.php" with your language. So that, if I am french, I will put l=fr.

Note that the default BOSH server you put in the hosts configuration will be used.

## Configuration

### Account connection Then, simply fill the JappixMini.launch() function with the correct parameters. You can use PHP to fill this in your HTML page, depending on the website user who is logged in. Please note that if you use anonymous login, only put the domain, like this: JappixMini.({ /* options */ });

### User nickname To specify an user nickname (which can be generated with PHP from a database), you can use the MINI_NICKNAME global. Please note that you can safely remove it and the account nick will be used.

Groupchats to join

To automatically join groupchats when logged in, add them in the opts.application.groupchat.open array, like this: opts.application.groupchat.open = ["support@muc.jappix.org", "mini@muc.jappix.com"];

If you want to specify a password for a room to join, use the opts.application.groupchat.open_passwords array, with the elements sorted in the same order as they are in the groupchats array: opts.application.groupchat.open_passwords = ["password_1", "password_2"];

Please note that you can safely remove all these stuffs, it will not hurt Jappix Mini!

### Chats to open As for groupchats, you can make Jappix Mini open chats with some users once connected. Add them in the MINI_CHATS array, like this: opts.application.chat.open = ["valerian@jappix.com", "julien@jappix.com"];

Chats to suggest

To suggest the user a list of chats, add them in the opts.application.chat.suggest array, like this: opts.application.chat.suggest = ["valerian@jappix.com", "julien@jappix.com"];

They will then appear in a list in the Jappix Mini roster, when clicking on the chat join button.

Groupchats to suggest

To suggest the user a list of groupchats, add them in the opts.application.groupchat.suggest array, like this: opts.application.groupchat.suggest = ["support@muc.jappix.org", "mini@muc.jappix.com"];

They will then appear in a list in the Jappix Mini roster, when clicking on the chat join button.

If you want to specify a password for a room to join, use the opts.application.groupchat.suggest_passwords array, with the elements sorted in the same order as they are in the groupchat suggest array: opts.application.groupchat.suggest_passwords = ["password_1", "password_2"];

### Extra-features

You can call the JappixMini.disconnect() function anytime and anywhere to reset Jappix Mini to its initial look and disconnect the user (if logged in).

## Usage

Jappix Mini is pretty simple to use. Here are some tips on how you can use it best.

### Keyboard shortcuts We added some keyboard shortcuts to Jappix Mini to make it as easy to use as possible:

  1. To show the next chat, press the Tabulate key
  2. To close the current chat, press the Escape key
  3. To navigate through buddies when roster is opened, use the Up and Down arrows
  4. To start a new chat with a roster buddy, press Enter on the selected buddy
  5. You can filter roster buddies to make things simpler, start to type the beginning of the buddy name to search for it

Mouse shortcuts

You can easily hide any Jappix Mini element using the mouse:

  1. When the buddy list is opened, click away to hide it
  2. When a chat is opened, double-click away to hide it