jegolize 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
@@ -43,7 +43,7 @@
43
43
  </div>
44
44
 
45
45
  <script>
46
- $(document).ready(function() {
46
+ window.onload = function() {
47
47
  $("#jegol_tabs").tabs();
48
- });
48
+ };
49
49
  </script>
data/jegolize.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jegolize}
8
- s.version = "0.1.11"
8
+ s.version = "0.1.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alemeshet Alemu"]
@@ -454,121 +454,125 @@ var JeGol = {
454
454
  }
455
455
  }
456
456
 
457
- /**
458
- * Bind event: jegol_init
459
- */
460
- $(document).bind('jegol_init', function(e, d){
461
- JeGol.init();
462
- $(document).trigger('connect');
463
- });
464
-
465
-
466
- /**
467
- * On Connect event - initialize a strope connection and login from authenticated session service URL
468
- */
469
- $(document).bind('connect', function(e, d){
470
- Strophe.debug('Getting SID from SID service...');
471
-
472
- var jsonURL = $('#jegol_service_url').val();
473
- $.ajax({
474
- url: jsonURL,
475
- success: function(data) {
476
- Strophe.debug('SID service returned...');
477
- try {
478
- JeGol.room = data.room;
479
- JeGol.nickname = data.nickname;
480
- JeGol.bosh_service = data.bosh_service;
481
-
482
- JeGol.connection = new Strophe.Connection(JeGol.bosh_service);
483
- JeGol.loginSIDFromServer(data);
484
- }
485
- catch(e){
486
- Strophe.error('Login failed: ' + e.message);
487
- }
488
- }
457
+ function bindEvents()
458
+ {
459
+ /**
460
+ * Bind event: jegol_init
461
+ */
462
+ $(document).bind('jegol_init', function(){
463
+ JeGol.init();
464
+ $(document).trigger('connect');
489
465
  });
490
- });
491
-
492
- /**
493
- * After connection is made, initialize properties
494
- */
495
- $(document).bind('connected', function(){
496
- // Chat room is not yet joined
497
- JeGol.joined = false;
498
- // Empty participants list. Haven't gotten them yet.
499
- JeGol.participants = {};
500
- // Make my presence known to XMPP server
501
- JeGol.connection.send($pres().c('priority').t('-1'));
502
466
 
503
- // Register listeners
504
- JeGol.connection.addHandler(JeGol.onPresence, null, 'presence', null, null, null);
505
- // TODO: Private IM is not supported yet
506
- //JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'chat', null, null);
507
- JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'groupchat', null, null);
508
-
509
- // If nickname is known from cookie, pick that up.
510
- if(JeGol.getCookie("nickname") != ''){
511
- JeGol.nickname = JeGol.getCookie("nickname");
512
- }
513
467
 
514
- // Make my presence known to chat room
515
- JeGol.connection.send($pres({to: JeGol.room + '/' + JeGol.nickname}).c('x', {xmlns: Strophe.NS.MUC}));
516
- });
517
-
518
- /**
519
- * On disconnect, clear out UI elements, kill connection and trigger reconnection if specified
520
- */
521
- $(document).bind('disconnected', function(){
522
- JeGol.connection = null;
523
- $('#jegol_topic').empty();
524
- $('#jegol_roster').empty();
525
- $('#jegol_chatlog').empty();
526
-
527
- if(JeGol.autoReconnect == true)
528
- {
529
- JeGol.reconnectionAttempt += 1;
530
- //incrementally delay connection attempt
531
- if (JeGol.reconnectionAttempt < JeGol.reconnectionAttemptLimit) {
532
- setTimeout(function(){
533
- $(document).trigger('connect');
534
- }, JeGol.reconnectionAttempt * JeGol.reconnectionDelay);
535
- }
536
- }
537
- });
538
-
539
- $(document).bind('room_joined', function(){
540
- JeGol.joined = true;
541
- JeGol.addMessage("<div class='jegol_log_i_joined'>*** Room joined.</div>")
542
- });
543
-
544
- $(document).bind('user_joined', function(e, nickname){
545
- JeGol.addMessage("<div class='jegol_log_user_joined'>" + JeGol._stripTimeStampFromNickname(nickname) + " joined.</div>")
546
- });
547
-
548
- $(document).bind('user_left', function(e, nickname){
549
- JeGol.addMessage("<div class='jegol_log_user_left'>" + JeGol._stripTimeStampFromNickname(nickname) + " left.</div>")
550
- });
551
-
552
- /**
553
- * UI action listener - on enter, do post
554
- */
555
- $('#jegol_msgArea').live('keypress', function(e) {
556
- if(e.keyCode == 13) {
557
- e.preventDefault();
558
- JeGol.execCommand($(this).val());
559
- $(this).val('');
560
- }
561
- });
562
-
563
- $('#jegol_postButton').live('click', function(e){
564
- JeGol.execCommand($('#jegol_msgArea').val());
565
- $('#jegol_msgArea').val('');
566
- });
468
+ /**
469
+ * On Connect event - initialize a strope connection and login from authenticated session service URL
470
+ */
471
+ $(document).bind('connect', function(e, d){
472
+ Strophe.debug('Getting SID from SID service...');
473
+
474
+ var jsonURL = $('#jegol_service_url').val();
475
+ $.ajax({
476
+ url: jsonURL,
477
+ success: function(data) {
478
+ Strophe.debug('SID service returned...');
479
+ try {
480
+ JeGol.room = data.room;
481
+ JeGol.nickname = data.nickname;
482
+ JeGol.bosh_service = data.bosh_service;
483
+
484
+ JeGol.connection = new Strophe.Connection(JeGol.bosh_service);
485
+ JeGol.loginSIDFromServer(data);
486
+ }
487
+ catch(e){
488
+ Strophe.error('Login failed: ' + e.message);
489
+ }
490
+ }
491
+ });
492
+ });
493
+
494
+ /**
495
+ * After connection is made, initialize properties
496
+ */
497
+ $(document).bind('connected', function(){
498
+ // Chat room is not yet joined
499
+ JeGol.joined = false;
500
+ // Empty participants list. Haven't gotten them yet.
501
+ JeGol.participants = {};
502
+ // Make my presence known to XMPP server
503
+ JeGol.connection.send($pres().c('priority').t('-1'));
504
+
505
+ // Register listeners
506
+ JeGol.connection.addHandler(JeGol.onPresence, null, 'presence', null, null, null);
507
+ // TODO: Private IM is not supported yet
508
+ //JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'chat', null, null);
509
+ JeGol.connection.addHandler(JeGol.onPublicMessage, null, 'message', 'groupchat', null, null);
510
+
511
+ // If nickname is known from cookie, pick that up.
512
+ if(JeGol.getCookie("nickname") != ''){
513
+ JeGol.nickname = JeGol.getCookie("nickname");
514
+ }
515
+
516
+ // Make my presence known to chat room
517
+ JeGol.connection.send($pres({to: JeGol.room + '/' + JeGol.nickname}).c('x', {xmlns: Strophe.NS.MUC}));
518
+ });
519
+
520
+ /**
521
+ * On disconnect, clear out UI elements, kill connection and trigger reconnection if specified
522
+ */
523
+ $(document).bind('disconnected', function(){
524
+ JeGol.connection = null;
525
+ $('#jegol_topic').empty();
526
+ $('#jegol_roster').empty();
527
+ $('#jegol_chatlog').empty();
528
+
529
+ if(JeGol.autoReconnect == true)
530
+ {
531
+ JeGol.reconnectionAttempt += 1;
532
+ //incrementally delay connection attempt
533
+ if (JeGol.reconnectionAttempt < JeGol.reconnectionAttemptLimit) {
534
+ setTimeout(function(){
535
+ $(document).trigger('connect');
536
+ }, JeGol.reconnectionAttempt * JeGol.reconnectionDelay);
537
+ }
538
+ }
539
+ });
540
+
541
+ $(document).bind('room_joined', function(){
542
+ JeGol.joined = true;
543
+ JeGol.addMessage("<div class='jegol_log_i_joined'>*** Room joined.</div>")
544
+ });
545
+
546
+ $(document).bind('user_joined', function(e, nickname){
547
+ JeGol.addMessage("<div class='jegol_log_user_joined'>" + JeGol._stripTimeStampFromNickname(nickname) + " joined.</div>")
548
+ });
549
+
550
+ $(document).bind('user_left', function(e, nickname){
551
+ JeGol.addMessage("<div class='jegol_log_user_left'>" + JeGol._stripTimeStampFromNickname(nickname) + " left.</div>")
552
+ });
553
+
554
+ /**
555
+ * UI action listener - on enter, do post
556
+ */
557
+ $('#jegol_msgArea').live('keypress', function(e) {
558
+ if(e.keyCode == 13) {
559
+ e.preventDefault();
560
+ JeGol.execCommand($(this).val());
561
+ $(this).val('');
562
+ }
563
+ });
564
+
565
+ $('#jegol_postButton').live('click', function(e){
566
+ JeGol.execCommand($('#jegol_msgArea').val());
567
+ $('#jegol_msgArea').val('');
568
+ });
569
+ }
567
570
 
568
571
  /**
569
572
  * Start connection on HTML page load
570
573
  */
571
574
  window.onload = function() {
575
+ bindEvents();
572
576
  $(document).trigger('jegol_init');
573
577
  };
574
578
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jegolize
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.11
5
+ version: 0.1.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alemeshet Alemu
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- hash: -857693585
160
+ hash: -739886285
161
161
  segments:
162
162
  - 0
163
163
  version: "0"