diff mod_admin_web/admin_web/www_files/js/main.js @ 1019:7cba8be42d9e

mod_admin_web: Update to new strophejs location, and jQuery 1.9.1
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 24 May 2013 15:46:05 +0200
parents 1d03dc7cf28f
children 9839198539c8
line wrap: on
line diff
--- a/mod_admin_web/admin_web/www_files/js/main.js	Thu May 23 13:54:08 2013 +0100
+++ b/mod_admin_web/admin_web/www_files/js/main.js	Fri May 24 15:46:05 2013 +0200
@@ -115,6 +115,7 @@
         connection.sendIQ($iq({to: connection.domain, type: 'get', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
             .c('adminfor'), function(e) {
                 var items;
+                var domainpart = Strophe.getDomainFromJid(connection.jid);
                 items = e.getElementsByTagName('item');
                 if (items.length == 0) {
                     alert("You are not an administrator");
@@ -123,11 +124,7 @@
                 }
                 for (i = 0; i < items.length; i++) {
                     var host = $(items[i]).text();
-                    if (host == Strophe.getDomainFromJid(connection.jid)) {
-                        $('#host').append('<option selected>' + host + '</option>');
-                    } else {
-                        $('#host').append('<option>' + host + '</option>');
-                    }
+                    $('<option/>').text(host).prop('selected', host == domainpart).appendTo('#host');
                 }
                 showDisconnect();
                 adminsubHost = $(items[0]).text();