Skip to content

Commit

Permalink
Support URLs in Join Other Room button
Browse files Browse the repository at this point in the history
Now you can use URLs like http://play.pokemonshowdown.com/help
in addition to roomids like help in the Join Other Rooms button.
  • Loading branch information
Zarel committed Aug 6, 2016
1 parent 7d524d0 commit 0c22a0d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/client-rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
},
joinRoomPopup: function () {
app.addPopupPrompt("Room name:", "Join room", function (room) {
if (room.startsWith('http://')) room = room.slice(7);
if (room.startsWith('https://')) room = room.slice(8);
if (room.startsWith('play.pokemonshowdown.com/')) room = room.slice(25);
if (room.startsWith('psim.us/')) room = room.slice(8);
if (room.startsWith(document.location.hostname + '/')) room = room.slice(document.location.hostname.length + 1);
room = toRoomid(room);
if (!room) return;
app.tryJoinRoom(room);
Expand Down

0 comments on commit 0c22a0d

Please sign in to comment.