diff options
author | sualko <klaus@jsxc.org> | 2015-06-27 18:05:11 +0300 |
---|---|---|
committer | sualko <klaus@jsxc.org> | 2015-06-27 18:05:11 +0300 |
commit | 835fa8227c6bf95a0e147a79cb499b73fe047e56 (patch) | |
tree | 346194ddbeb2dfa8ed69be060978f291d78ba300 /example | |
parent | 82a28d6aba5f5c121f1435f993dc879b3c83bf34 (diff) |
change loadSettings option
- loadSettings is no longer required
- provide callback method for asynchronous requests
Diffstat (limited to 'example')
-rw-r--r-- | example/dev.html | 1 | ||||
-rw-r--r-- | example/favicon.ico | bin | 0 -> 39315 bytes | |||
-rw-r--r-- | example/index.html | 1 | ||||
-rw-r--r-- | example/js/dev.js | 40 | ||||
-rw-r--r-- | example/js/example.js | 2 | ||||
-rw-r--r-- | example/login.html | 1 |
6 files changed, 37 insertions, 8 deletions
diff --git a/example/dev.html b/example/dev.html index 8af0bc4d..a144c5fa 100644 --- a/example/dev.html +++ b/example/dev.html @@ -5,6 +5,7 @@ <title>JSXC example application</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> <link href="css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" /> diff --git a/example/favicon.ico b/example/favicon.ico Binary files differnew file mode 100644 index 00000000..b7a109b8 --- /dev/null +++ b/example/favicon.ico diff --git a/example/index.html b/example/index.html index 35df943c..b1e8f430 100644 --- a/example/index.html +++ b/example/index.html @@ -5,6 +5,7 @@ <title>JSXC example application</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> <link href="css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" /> diff --git a/example/js/dev.js b/example/js/dev.js index d46e07ef..7acf7c44 100644 --- a/example/js/dev.js +++ b/example/js/dev.js @@ -28,23 +28,49 @@ $(function() { SEND_WHITESPACE_TAG: true, WHITESPACE_START_AKE: true }, - loadSettings: function(username, password) { - return settings; + loadSettings: function(username, password, cb) { + cb(settings); }, xmpp: { url: settings.xmpp.url } }); + var source = '#form'; + $('#form2').submit(function(ev) { ev.preventDefault(); - $(document).on('connectionReady.jsxc', function() { - $('#form2 input').prop('disabled', true); - - $('#logout2').show().click(jsxc.xmpp.logout); - }); + source = $(this); + $('#submit2').button('loading'); jsxc.xmpp.login($('#username2').val() + '@' + settings.xmpp.domain, $('#password2').val()); }); + + $('#form3 .submit').click(jsxc.gui.showLoginBox); + + $(document).on('connecting.jsxc', function() { + $('#form2 input, #form input').prop('disabled', true); + }); + + $(document).on('authfail.jsxc', function() { + $('#form2 input, #form input').prop('disabled', false); + $(source).find('.alert').show(); + $(source).find('.submit').button('reset'); + }); + + $(document).on('connectionReady.jsxc', function() { + $('#form2 input, #form input').prop('disabled', true); + $('.submit').hide(); + $('form .alert').hide(); + + $('.logout').show().click(jsxc.xmpp.logout); + }); + + $(document).on('disconnected.jsxc', function() { + $(source).find('button').button('reset'); + $('#form2 input, #form input').prop('disabled', false); + $('.submit').show(); + $('.logout').hide().off('click'); + }); }); diff --git a/example/js/example.js b/example/js/example.js index 4e4923da..cf97c03e 100644 --- a/example/js/example.js +++ b/example/js/example.js @@ -29,7 +29,7 @@ $(function() { WHITESPACE_START_AKE: true }, loadSettings: function(username, password) { - return settings; + cb(settings); }, xmpp: { url: settings.xmpp.url diff --git a/example/login.html b/example/login.html index 84855d31..7e00233a 100644 --- a/example/login.html +++ b/example/login.html @@ -5,6 +5,7 @@ <title>JSXC example application</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> <link href="css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" /> |