comparison rlgterm.js @ 116:d7d7cdcba3b4

Fix WebSocket support checking. Check for window.WebSocket instead of WebSocket.
author John "Elwin" Edwards <elwin@sdf.org>
date Mon, 16 Jul 2012 14:52:04 -0700
parents 4f2b89e6fde2
children 56a756695740
comparison
equal deleted inserted replaced
115:7ef3a1a084b9 116:d7d7cdcba3b4
415 csize = textsize(true); 415 csize = textsize(true);
416 } 416 }
417 else 417 else
418 break; 418 break;
419 } 419 }
420 if (!WebSocket) { 420 if (!window.WebSocket) {
421 message("Your browser does not support WebSockets. You can still play, " + 421 message("Your browser does not support WebSockets. You can still play, " +
422 "but it will be slower, and may not work in the future.", "warn"); 422 "but it will be slower, and may not work in the future.", "warn");
423 } 423 }
424 return; 424 return;
425 } 425 }
521 } 521 }
522 } 522 }
523 523
524 /* Handles the status socket, opening and closing it when necessary. */ 524 /* Handles the status socket, opening and closing it when necessary. */
525 function wsCurrent() { 525 function wsCurrent() {
526 if (!WebSocket) 526 if (!window.WebSocket)
527 return; 527 return;
528 if (session.id) { 528 if (session.id) {
529 /* Don't bother with status if already playing/watching. */ 529 /* Don't bother with status if already playing/watching. */
530 if (statsock) { 530 if (statsock) {
531 statsock.close(); 531 statsock.close();
559 statsock = null; 559 statsock = null;
560 } 560 }
561 } 561 }
562 562
563 function getcurrent(clear) { 563 function getcurrent(clear) {
564 if (WebSocket) { 564 if (window.WebSocket) {
565 return; 565 return;
566 } 566 }
567 if (session.id || clear) { 567 if (session.id || clear) {
568 if (statInterval) { 568 if (statInterval) {
569 window.clearInterval(statInterval); 569 window.clearInterval(statInterval);
672 } 672 }
673 673
674 function startgame(game) { 674 function startgame(game) {
675 if (session.id != null || !session.lcred) 675 if (session.id != null || !session.lcred)
676 return; 676 return;
677 if (WebSocket) { 677 if (window.WebSocket) {
678 wsStart(game); 678 wsStart(game);
679 return; 679 return;
680 } 680 }
681 var smsg = {}; 681 var smsg = {};
682 smsg["key"] = session.lcred; 682 smsg["key"] = session.lcred;
792 } 792 }
793 793
794 function startwatching(gamenumber) { 794 function startwatching(gamenumber) {
795 if (session.id != null) 795 if (session.id != null)
796 return; 796 return;
797 if (WebSocket) { 797 if (window.WebSocket) {
798 wsWatch(gamenumber); 798 wsWatch(gamenumber);
799 return; 799 return;
800 } 800 }
801 var wmsg = {"n": Number(gamenumber)}; 801 var wmsg = {"n": Number(gamenumber)};
802 var req = new XMLHttpRequest(); 802 var req = new XMLHttpRequest();