aboutsummaryrefslogtreecommitdiffstats
path: root/webclient/lib
diff options
context:
space:
mode:
authorZaran <zaran.krleza@gmail.com>2012-04-06 21:53:52 -0400
committerZaran <zaran.krleza@gmail.com>2012-04-06 21:53:52 -0400
commit8a83f72870bd4a291fdcf78d5ac17727b0a7618b (patch)
treeeafed45b4ed45f38fa307658ec19a8f33fb96e72 /webclient/lib
parent05f8a92e9f90f58a637501b38de7b4c8b6b60619 (diff)
downloadalias-8a83f72870bd4a291fdcf78d5ac17727b0a7618b.tar.gz
Basic style for the roster.
Remove JavascriptMVC code in the angular branch
Diffstat (limited to 'webclient/lib')
-rw-r--r--webclient/lib/alias.js502
-rw-r--r--webclient/lib/config.js.sample2
-rw-r--r--webclient/lib/jquery.dialog.js63
-rw-r--r--webclient/lib/jquery.forms.js71
-rw-r--r--webclient/lib/jquery.tabs.js121
-rw-r--r--webclient/lib/jquery.tipTip.js191
m---------webclient/lib/jsbn0
m---------webclient/lib/sjcl0
m---------webclient/lib/strophe0
9 files changed, 0 insertions, 950 deletions
diff --git a/webclient/lib/alias.js b/webclient/lib/alias.js
deleted file mode 100644
index 5e4714d..0000000
--- a/webclient/lib/alias.js
+++ /dev/null
@@ -1,502 +0,0 @@
-/**
- * Alias namespace
- */
-var Alias = {
-
- /**
- * Status constants
- */
- Status: {
- ONLINE: 2,
- AWAY: 1,
- OFFLINE: 0
- },
-
- /**
- * Strophe xmpp connection
- */
- connection: null,
-
- /**
- * Send registration request to the component
- */
- getRegister: function() {
- var init = $iq({to: server_component, type:'get'});
- init.c('query',{xmlns:'jabber:iq:register'});
- Alias.connection.sendIQ(init, Alias.onRegister);
- },
-
- /**
- * Receive registration data
- */
- onRegister: function(iq) {
- var form = $(iq).find('query x');
- if ($(iq).find('registered').length !== 0){
- // user is registered, get the info from the form
- var pubkey = form.find('field[var="pubkey"] > value').text();
- var privkey = form.find('field[var="privkey"] > value').text();
- privkey = sjcl.decrypt(Alias.connection.pass, privkey);
- pubkey = JSON.parse(pubkey);
- privkey = JSON.parse(privkey);
- var rsa = new RSAKey();
- rsa.setPublic(pubkey.n, pubkey.e);
- rsa.setPrivateEx(pubkey.n, pubkey.e, privkey.d,
- privkey.p, privkey.q, privkey.dp,
- privkey.dq, privkey.c);
- this.rsa = rsa;
- }
- else{
- $('#register').empty();
- //populate the register dialog
- var instructions = $(iq).find('instructions');
- if ( instructions.length !== 0 ){
- $('#register').append('<p>' + instructions.text() + '</p>');
- }
- $('#register').append('<p><a href="#" id="generate-link">Generate</a></p>');
- var result = form.xmppForm('render');
- $('#register').append(result);
- $('#register').append('<input type="button" value="Register" id="register-button"/>');
-
- $('#generate-link').click(function(){
- var rsa = new RSAKey();
- rsa.generate(1024, "10001");
- var pubkey = {
- n: rsa.n.toString(16),
- e: rsa.e.toString(16)
- };
- var privkey = {
- d: rsa.d.toString(16),
- p: rsa.p.toString(16),
- q: rsa.q.toString(16),
- dp: rsa.dmp1.toString(16),
- dq: rsa.dmq1.toString(16),
- c: rsa.coeff.toString(16)
- };
- privkey = sjcl.encrypt(Alias.connection.pass, JSON.stringify(privkey));
- $("#form-pubkey").val(JSON.stringify(pubkey));
- $("#form-privkey").val(privkey);
- });
-
- $('#register-button').click(function(){
- var pubkey = $('<value></value').text($("#form-pubkey").val());
- var privkey = $('<value></value').text($("#form-privkey").val());
- form.find('field[var="privkey"]').append(privkey);
- form.find('field[var="pubkey"]').append(pubkey);
- form.attr('type', 'submit');
- var reg = $iq({to: server_component, type:'set'});
- reg.c('query',{xmlns:'jabber:iq:register'});
- reg.cnode(form.get(0));
- Alias.connection.sendIQ(reg);
- $('#dialogs').dialog('hide', 'register')
- });
- $('#dialogs').dialog('show', 'register');
- }
- },
-
- /**
- * Send a roster request to server
- */
- getRoster: function() {
- var roster = $iq({type : 'get'}).c('query', {xmlns : Strophe.NS.ROSTER});
- Alias.connection.sendIQ(roster, Alias.onRoster);
- },
-
- /**
- * Return the status of a contact
- * @param {jQuery} contact The contact
- * @return {Number} The status' number
- * @see Alias.Status
- */
- getPresence: function(contact) {
- if ( contact.hasClass("online") )
- return Alias.Status["ONLINE"];
- else if ( contact.hasClass("away") )
- return Alias.Status["AWAY"];
- else
- return Alias.Status["OFFLINE"];
- },
-
- /**
- * Convert a jid to an id string suitable for css id
- * @param {String} jid
- * @return {String} id
- */
- jid_to_id: function(jid) {
- return Strophe.getBareJidFromJid(jid).replace(/[@.]/g,'-');
- },
-
- /**
- * Return the id of a contact
- * @param contact jquery object
- * @return {String} id
- */
- getID: function(contact) {
- return contact.find('.roster-jid').text();
- },
-
- /**
- * Return the name of a contact
- */
- getName : function(contact) {
- return contact.find('.roster-name').text();
- },
-
- /**
- * Get the home node of a user
- * @param {String} owner The owner's JID
- */
- getHome: function(owner) {
- //var objectName = MD5.hexdigest(owner);
- var objectName = sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(owner))
- Alias.getObject(objectName, owner);
- },
-
- /**
- * Get the content of an object
- * @param {String} object The hash identifying the requested object
- * @param {String} owner The owner's JID
- */
- getObject: function(object, owner) {
- var name = Base64.encode(owner) + '@' + server_component;
- var iq = $iq({type : 'get', to : name}).c('query', {
- xmlns : 'alias:iq:object',
- type : 'get',
- node : object
- });
- Alias.connection.sendIQ(iq, Alias.onObject);
- },
-
- /**
- * Decrypt and display a received object
- * @param {XMLElement} iq The received iq stanza from the component
- */
- onObject: function(iq) {
- var query = $(iq).find('query');
- var encryptedKey = query.find('key').text();
- var key = this.rsa.decrypt(encryptedKey);
- var encryptedContent = query.find('content').text();
- var content = sjcl.decrypt(sjcl.codec.base64.toBits(key), encryptedContent);
- $('#profile').html(content);
- },
-
- /**
- * Insert a contact keeping the sorting of the roster
- * The contacts are sorted based on their status and on their names
- * @param {jQuery} contact The contact to insert
- */
- insertContact: function(contact) {
- var presence = Alias.getPresence(contact);
- var jid = Alias.getID(contact);
- var contacts = $('#roster li');
- if (contacts.length > 0) {
- var inserted = false;
- contacts.each(function () {
- var locpres = Alias.getPresence($(this));
- var locjid = Alias.getID($(this));
- if (presence > locpres)
- {
- $(this).before(contact);
- inserted = true;
- return false;
- }
- else if ( (presence == locpres) && (jid < locjid) )
- {
- $(this).before(contact);
- inserted = true;
- return false;
- }
- });
-
- if (!inserted)
- $('#roster ul').append(contact);
- }
- else
- $('#roster ul').append(contact);
-
- // init tooltip
- contact.tipTip({
- content: "<ul><li>Jid: " + jid
- + '</li><li><a href="'+ jid
- +'" class="chat-link">Start Chat</a></li></ul>',
- defaultPosition: "right",
- keepAlive: true
- });
- },
-
- /**
- * Update the roster when receiving a presence stanza
- * @param {XMLElement} presence The presence stanza
- * @returns {Boolean}
- */
- onPresence: function(presence) {
- var who = $(presence).attr('from');
- var type = $(presence).attr('type');
- if (type !== 'error')
- {
- var contact = $('#' + Alias.jid_to_id(who));
- contact.removeClass('online away offline');
- if (type === 'unavailable')
- {
- contact.addClass('offline');
- }
- else
- {
- var show = $(presence).find('show').text();
- if (show === '' || show === '')
- {
- contact.addClass('online');
- }
- else
- {
- contact.addClass('away');
- }
- }
- contact.remove();
- Alias.insertContact(contact);
- }
- return true;
- },
-
- /**
- * Rebuild the contact list when receiving a roster iq
- * @param {XMLElement} iq
- * @return {Boolean}
- */
- onRoster: function(iq) {
- $('#roster li').remove();
- var elems = iq.getElementsByTagName('query');
- var query = elems[0];
- Strophe.forEachChild(query, 'item', function(item)
- {
- var jid = item.getAttribute('jid');
- var name = item.getAttribute('name') || jid;
- var id = Alias.jid_to_id(jid);
- var contact = $("<li id='" + id + "' class='roster-contact offline'>"
- + "<div class='roster-name'>" + name + "</div>"
- + "<div class='roster-jid'>" + jid + "</div></li>");
- Alias.insertContact(contact);
- });
- Alias.connection.addHandler(Alias.onPresence,null,'presence', null, null, null, null);
- Alias.connection.send($pres());
- return true;
- },
-
- /**
- * Called when the status of Strophe's connection changes.
- * This function is passed to the Strophe's connect function
- * @param {Int} status The new status
- */
- onStatusChanged: function(status) {
- var jid = $('#jid').get(0).value;
- if ( status == Strophe.Status.CONNECTING ) {
- log('Strophe is connecting.');
- } else if ( status == Strophe.Status.CONNFAIL ) {
- log('Strophe failed to connect.');
- } else if ( status == Strophe.Status.DISCONNECTING ) {
- log('Strophe is disconnecting.');
- } else if ( status == Strophe.Status.DISCONNECTED ) {
- log('Strophe is disconnected.');
- } else if ( status == Strophe.Status.CONNECTED ) {
- log('Strophe is connected.');
- Alias.onConnect();
- }
- },
-
- /**
- * Initialization after connection
- *
- * Set the interface and the handlers
- */
- onConnect: function() {
- Alias.getRoster();
- Alias.getRegister();
-
- // hide the login dialog and load the interface
- $('#login').hide();
- $('#password').val('');
- $('#left').show();
- $('#right').show();
- $('#status').append($('<a href="#" id="disconnect">Disconnect</a>'));
- $('#disconnect').click(function(){
- Alias.connection.disconnect();
- $('#roster ul').empty();
- $('#left').hide();
- $('#right').hide();
- $('#login').hide();
- $(this).remove();
- });
-
- // handlers must be added only after connection is made
- Alias.connection.addHandler(Alias.onMessage, null, "message", "chat");
- },
-
- /**
- * Add a new chat tab
- * @param {String} jid The jid of the contact to chat with
- */
- addChatTab: function(jid) {
- var jid_id = Alias.jid_to_id(jid);
- $('#tabs').tabs('add', jid, 'chat-' + jid_id, true);
- $('#chat-' + jid_id).addClass('chat-tab');
- $('#chat-' + jid_id).append("<div class='chat-messages'></div>"
- + "<input type='text' class='chat-input'>");
- $('#chat-' + jid_id).data({jid: jid});
- },
-
- /**
- * Add a chat message
- * @param {String} chatId The id of the chat tab
- * @param {String} authorId The jid of the message's author
- * @param {String} body The text of the message
- */
- addMessage: function(chatId, authorId, body) {
- var author = Strophe.getNodeFromJid( authorId );
- var message = $('<p class="chat-message"><span class="chat-name">'
- + author + '</span> <span class="chat-text">'
- + body + '</span></p>');
-
- if ( authorId == Alias.connection.jid ) {
- message.find('.chat-name').addClass('me');
- }
-
- var chatArea = $('#chat-' + chatId).find('.chat-messages');
- chatArea.append(message);
- chatArea.scrollTop(chatArea.height());
- },
-
- /**
- * Callback upon receiving a chat message
- * @param {String} message The xml code of the message iq
- * @return {Boolean}
- */
- onMessage: function (message) {
- var full_jid = $(message).attr('from');
- var jid = Strophe.getBareJidFromJid(full_jid);
- var jid_id = Alias.jid_to_id(jid);
-
- if ( !$('#tabs').tabs('exist','#chat-' + jid_id) ) {
- Alias.addChatTab(jid);
- }
-
- $('#chat-' + jid_id).data({jid: full_jid});
- var body = $(message).find("html > body");
-
- if (body.length === 0) {
- body = $(message).find('body');
-
- if (body.length > 0) {
- body = body.text();
- } else {
- body = null;
- }
-
- } else {
- body = body.contents();
- var span = $("<span></span>");
-
- body.each(function () {
-
- if (document.importNode) {
- $(document.importNode(this, true)).appendTo(span);
- } else {
- // IE workaround
- span.append(this.xml);
- }
-
- });
- body = span;
- }
-
- if (body) {
- Alias.addMessage( jid_id, jid , body);
- }
-
- return true;
- }
-
-};
-
-function log(msg, color) {
- $('#log').append($('<div></div>').css('background-color', color).text(msg));
-}
-
-function rawInput(data) {
- log('RECV: ' + data, '#FBB6B4');
-}
-
-function rawOutput(data) {
- log('SENT: ' + data, '#B5BBFB');
-}
-
-jQuery.expr[':'].Contains = function(a,i,m){
- return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;
-};
-
-$(document).ready(function(){
- var connection = new Strophe.Connection(BOSH_SERVICE);
- connection.rawInput = rawInput;
- connection.rawOutput = rawOutput;
- Alias.connection = connection;
-
- $('#connect').click(function () {
- Alias.connection.connect($('#jid').get(0).value,
- $('#pass').get(0).value,
- Alias.onStatusChanged);
- });
-
- $('#pass').keyup(function(event) {
- if(event.keyCode == 13) {
- $('#connect').click()
- }
- });
-
- $('#bottomup').click(function(){
- $(this).next().slideToggle();
- });
-
- $('#tabs').tabs();
-
- $('#rosterfilter').keyup(function() {
- var filter = $(this).val();
- $('#roster ul li div.roster-name:not(:Contains("' + filter + '"))').parent().hide();
- $('#roster ul li div.roster-name:Contains("' + filter + '")').parent().show();
- });
-
- $('.roster-contact').live('click', function(){
- var jid = Alias.getID($(this));
- Alias.getHome(jid);
- });
-
- $('.chat-link').live('click', function(event) {
- event.preventDefault();
- var jid = $(this).attr('href');
- var id = Alias.jid_to_id(jid);
- if ( !$('#tabs').tabs('exist','#chat-' + id) ) {
- Alias.addChatTab(jid);
- }
- $('#tabs').tabs('select', '#chat-' + id );
- $('#chat-' + id + ' input').focus();
- });
-
- $('.chat-input').live('keypress', function (ev) {
- var jid = $(this).parent().data('jid');
- var id = Alias.jid_to_id(jid);
- var me = Alias.connection.jid;
-
- if (ev.which === 13) {
- ev.preventDefault();
-
- var body = $(this).val();
- var message = $msg({to: jid, "type": "chat"})
- .c('body').t(body).up()
- .c('active', {xmlns: "http://jabber.org/protocol/chatstates"});
- Alias.connection.send(message);
- Alias.addMessage(id, me, body);
- $(this).val('');
- }
- });
-
- $('#dialogs').dialog();
-});
-
-
diff --git a/webclient/lib/config.js.sample b/webclient/lib/config.js.sample
deleted file mode 100644
index 9339c27..0000000
--- a/webclient/lib/config.js.sample
+++ /dev/null
@@ -1,2 +0,0 @@
-var BOSH_SERVICE = 'http://alias.im/http-bind';
-var server_component = 'social.alias.im'; \ No newline at end of file
diff --git a/webclient/lib/jquery.dialog.js b/webclient/lib/jquery.dialog.js
deleted file mode 100644
index 1a5679e..0000000
--- a/webclient/lib/jquery.dialog.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * jQuery dialog plugin
- *
- * <div id="dialogs">
- * <div id="#dialog-overlay"></div>
- * <div class="dialog" id="dialog1"></div>
- * <div class="dialog" id="dialog2"></div>
- * </div>
- */
-(function( $ ){
-
- var methods = {
-
- init: function(){
- this.data('dialog', {opened: []});
- this.find('#dialog-overlay').bind('click.dialog', function(){
- $(this).parent().dialog('hide');
- });
- },
-
- show: function(name){
- var maskHeight = $(document).height();
- var maskWidth = $(window).width();
- var overlay = this.find('#dialog-overlay');
- overlay.css({'width':maskWidth,'height':maskHeight});
- var winH = $(window).height();
- var winW = $(window).width();
- var dialog = this.find('#'+name);
- dialog.css('top', winH/2-dialog.height()/2);
- dialog.css('left', winW/2-dialog.width()/2);
- this.data('dialog').opened.push(name);
- overlay.show();
- dialog.show();
- },
-
- hide: function(){
- var name = this.data('dialog').opened.pop();
- var dialog = this.find('#'+name);
- var overlay = this.find('#dialog-overlay');
- dialog.hide();
- if (this.data('dialog').opened.length === 0){
- overlay.hide();
- }
- }
- };
-
- /*
- * Register the 'dialog' method to the jQuery objects
- * the first argument of this method is the submethod
- * you want to call
- */
- $.fn.dialog = function(method) {
- if ( methods[method] ) {
- return methods[method].apply(this, Array.prototype.slice
- .call(arguments, 1));
- } else if ( typeof method === 'object' || !method ) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.dialog');
- }
- };
-
-})(jQuery); \ No newline at end of file
diff --git a/webclient/lib/jquery.forms.js b/webclient/lib/jquery.forms.js
deleted file mode 100644
index e9a5258..0000000
--- a/webclient/lib/jquery.forms.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Form manipulation with jQuery
- */
-(function( $ ){
-
- var methods = {
-
- render: function(){
- var result = $('<form></form>');
- if ( this.find('title').length !== 0 ){
- result.append('<p class="title">' + this.find('title') + '</p>');
- }
-
- if ( this.find('instructions').length !== 0 ){
- result.append('<p class="instructions">'
- + this.find('instructions') + '</p>');
- }
-
- this.find('field').each(function(index){
- var type = $(this).attr("type");
- var name = $(this).attr("var");
- var required = $(this).find('required').length !== 0;
-
- if ( $(this).find('desc').length !== 0 ){
- result.append('<p class="description">'
- + $(this).find('desc').text()
- + '</p>');
- }
-
- if ( $(this).attr('label') !== undefined ){
- result.append('<label for="form-' + name + '">'
- + $(this).attr('label')
- + (required ? ' (*): ' : ': ')
- + '</label>');
- }
-
- switch(type){
- case("text-single"):
- var input = $('<input/>');
- input.attr('type', 'text');
- input.attr('name', name);
- input.attr('id', 'form-' + name);
-
- if ( $(this).find('value').length !== 0 ){
- input.attr('value', $(this).find('value').text());
- }
- result.append(input);
- result.append('<br/>');
- }
- });
- return result;
- }
- };
-
- /*
- * Register the 'xmppForm' method to the jQuery objects
- * the first argument of this method is the submethod
- * you want to call
- */
- $.fn.xmppForm = function(method) {
- if ( methods[method] ) {
- return methods[method].apply(this, Array.prototype.slice
- .call(arguments, 1));
- } else if ( typeof method === 'object' || !method ) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.xmppForm');
- }
- };
-
-})(jQuery); \ No newline at end of file
diff --git a/webclient/lib/jquery.tabs.js b/webclient/lib/jquery.tabs.js
deleted file mode 100644
index 7898afa..0000000
--- a/webclient/lib/jquery.tabs.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Light jQuery tab plugin
- *
- * the html structure is:
- *
- * <div id="generalid">
- * <ul class="tabbar">
- * <li><a href="#tab-1">Title 1</a></li>
- * </ul>
- * <div id="tab-1">
- * Content 1
- * </div>
- * </div>
- */
-(function( $ ){
-
- var methods = {
-
- /**
- * Initialise the general tab area
- * @return this (to preserve chainability)
- */
- init: function() {
- var tabs = this;
- this.find('ul.tabbar li').bind('click.tabs', function(event){
- event.preventDefault();
- tabs.tabs('select',$(this).find('a').attr('href'));
- });
- this.data('tabs',{});
- return this;
- },
-
- /**
- * Select a tab
- * @param {String} id The tab id with #
- * @return this
- */
- select: function(id) {
- var selectedId = this.data('tabs').selected;
-
- if ( selectedId == id) {
- return this;
- }
-
- this.find('ul.tabbar li a[href="' + selectedId + '"]').parent().removeClass('selected');
- this.find('ul.tabbar li a[href="' + id + '"]').parent().addClass('selected');
- $(selectedId).hide();
- $(id).show();
- this.data('tabs').selected = id;
- return this;
- },
-
- /**
- * Add a tab
- * @param {String} name The tab Title
- * @param {String} id The tab id without #
- * @pram {Bool} remove Wether the tab should be closable
- * return this
- */
- add: function(name, id, remove) {
- var tabs = this;
- var li = $('<li><a href="#' + id + '">' + name +'</a></li>');
-
- if ( remove ) {
- li.append('<span class="tab-close"/>');
- li.find('.tab-close').bind('click', function() {
- tabs.tabs('remove', '#'+id);
- });
- }
-
- li.bind('click.tabs',function(event){
- event.preventDefault();
- tabs.tabs('select',$(this).find('a').attr('href'));
- });
- $(this).find('ul.tabbar').append(li);
- $(this).append('<div class="tab" id="' + id + '"></div>');
- return this;
- },
-
- /**
- * Test if a tab exists
- * @param {String} id The tab id with #
- * @return {Bool}
- */
- exist: function(id) {
- return (this.find('ul.tabbar li a[href="' + id + '"]').length != 0);
- },
-
- /**
- * Remove a tab
- * @param {String} id The tab id with #
- * @return this
- */
- remove: function(id) {
- this.find('ul.tabbar li a[href="' + id + '"]').parent().remove();
- $(id).remove();
-
- if (this.data('tabs').selected == id) {
- var first = this.find('ul.tabbar li:first a').attr('href');
- this.tabs('select', first);
- }
- }
- };
-
- /*
- * Register the 'tabs' method to the jQuery objects
- * the first argument of this method is the submethod
- * you want to call
- */
- $.fn.tabs = function(method) {
- if ( methods[method] ) {
- return methods[method].apply(this, Array.prototype.slice
- .call(arguments, 1));
- } else if ( typeof method === 'object' || !method ) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.tabs');
- }
- };
-
-})(jQuery); \ No newline at end of file
diff --git a/webclient/lib/jquery.tipTip.js b/webclient/lib/jquery.tipTip.js
deleted file mode 100644
index 7eacf35..0000000
--- a/webclient/lib/jquery.tipTip.js
+++ /dev/null
@@ -1,191 +0,0 @@
- /*
- * TipTip
- * Copyright 2010 Drew Wilson
- * www.drewwilson.com
- * code.drewwilson.com/entry/tiptip-jquery-plugin
- *
- * Version 1.3 - Updated: Mar. 23, 2010
- *
- * This Plug-In will create a custom tooltip to replace the default
- * browser tooltip. It is extremely lightweight and very smart in
- * that it detects the edges of the browser window and will make sure
- * the tooltip stays within the current window size. As a result the
- * tooltip will adjust itself to be displayed above, below, to the left
- * or to the right depending on what is necessary to stay within the
- * browser window. It is completely customizable as well via CSS.
- *
- * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-(function($){
- $.fn.tipTip = function(options) {
- var defaults = {
- activation: "hover",
- keepAlive: false,
- maxWidth: "200px",
- edgeOffset: 3,
- defaultPosition: "bottom",
- delay: 400,
- fadeIn: 200,
- fadeOut: 200,
- attribute: "title",
- content: false, // HTML or String to fill TipTIp with
- enter: function(){},
- exit: function(){}
- };
- var opts = $.extend(defaults, options);
-
- // Setup tip tip elements and render them to the DOM
- if($("#tiptip_holder").length <= 0){
- var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
- var tiptip_content = $('<div id="tiptip_content"></div>');
- var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
- $("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
- } else {
- var tiptip_holder = $("#tiptip_holder");
- var tiptip_content = $("#tiptip_content");
- var tiptip_arrow = $("#tiptip_arrow");
- }
-
- return this.each(function(){
- var org_elem = $(this);
- if(opts.content){
- var org_title = opts.content;
- } else {
- var org_title = org_elem.attr(opts.attribute);
- }
- if(org_title != ""){
- if(!opts.content){
- org_elem.removeAttr(opts.attribute); //remove original Attribute
- }
- var timeout = false;
-
- if(opts.activation == "hover"){
- org_elem.hover(function(){
- active_tiptip();
- }, function(){
- if(!opts.keepAlive){
- deactive_tiptip();
- }
- });
- if(opts.keepAlive){
- tiptip_holder.hover(function(){}, function(){
- deactive_tiptip();
- });
- }
- } else if(opts.activation == "focus"){
- org_elem.focus(function(){
- active_tiptip();
- }).blur(function(){
- deactive_tiptip();
- });
- } else if(opts.activation == "click"){
- org_elem.click(function(){
- active_tiptip();
- return false;
- }).hover(function(){},function(){
- if(!opts.keepAlive){
- deactive_tiptip();
- }
- });
- if(opts.keepAlive){
- tiptip_holder.hover(function(){}, function(){
- deactive_tiptip();
- });
- }
- }
-
- function active_tiptip(){
- opts.enter.call(this);
- tiptip_content.html(org_title);
- tiptip_holder.hide().removeAttr("class").css("margin","0");
- tiptip_arrow.removeAttr("style");
-
- var top = parseInt(org_elem.offset()['top']);
- var left = parseInt(org_elem.offset()['left']);
- var org_width = parseInt(org_elem.outerWidth());
- var org_height = parseInt(org_elem.outerHeight());
- var tip_w = tiptip_holder.outerWidth();
- var tip_h = tiptip_holder.outerHeight();
- var w_compare = Math.round((org_width - tip_w) / 2);
- var h_compare = Math.round((org_height - tip_h) / 2);
- var marg_left = Math.round(left + w_compare);
- var marg_top = Math.round(top + org_height + opts.edgeOffset);
- var t_class = "";
- var arrow_top = "";
- var arrow_left = Math.round(tip_w - 12) / 2;
-
- if(opts.defaultPosition == "bottom"){
- t_class = "_bottom";
- } else if(opts.defaultPosition == "top"){
- t_class = "_top";
- } else if(opts.defaultPosition == "left"){
- t_class = "_left";
- } else if(opts.defaultPosition == "right"){
- t_class = "_right";
- }
-
- var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
- var left_compare = (tip_w + left) > parseInt($(window).width());
-
- if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
- t_class = "_right";
- arrow_top = Math.round(tip_h - 13) / 2;
- arrow_left = -12;
- marg_left = Math.round(left + org_width + opts.edgeOffset);
- marg_top = Math.round(top + h_compare);
- } else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
- t_class = "_left";
- arrow_top = Math.round(tip_h - 13) / 2;
- arrow_left = Math.round(tip_w);
- marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
- marg_top = Math.round(top + h_compare);
- }
-
- var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
- var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
-
- if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
- if(t_class == "_top" || t_class == "_bottom"){
- t_class = "_top";
- } else {
- t_class = t_class+"_top";
- }
- arrow_top = tip_h;
- marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
- } else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
- if(t_class == "_top" || t_class == "_bottom"){
- t_class = "_bottom";
- } else {
- t_class = t_class+"_bottom";
- }
- arrow_top = -12;
- marg_top = Math.round(top + org_height + opts.edgeOffset);
- }
-
- if(t_class == "_right_top" || t_class == "_left_top"){
- marg_top = marg_top + 5;
- } else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
- marg_top = marg_top - 5;
- }
- if(t_class == "_left_top" || t_class == "_left_bottom"){
- marg_left = marg_left + 5;
- }
- tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
- tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
-
- if (timeout){ clearTimeout(timeout); }
- timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
- }
-
- function deactive_tiptip(){
- opts.exit.call(this);
- if (timeout){ clearTimeout(timeout); }
- tiptip_holder.fadeOut(opts.fadeOut);
- }
- }
- });
- }
-})(jQuery); \ No newline at end of file
diff --git a/webclient/lib/jsbn b/webclient/lib/jsbn
deleted file mode 160000
-Subproject c9d0d1a19fc80565aee9c37eb35dc71c5e082c3
diff --git a/webclient/lib/sjcl b/webclient/lib/sjcl
deleted file mode 160000
-Subproject 933f8f8ec10fd5c305ec83573e4528cbcefd172
diff --git a/webclient/lib/strophe b/webclient/lib/strophe
deleted file mode 160000
-Subproject a8e5e949c6f84db42d1bf9518e4396d42f822db