This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>PubNub Messenger</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | |
<link rel="apple-touch-icon href=icon.png"> | |
<link rel="apple-touch-startup-image href=startup.png"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Chat Page --> | |
<div data-role="page" id="chatPage" data-theme="c" class="type-interior"> | |
<div data-role="content"> | |
<div data-role="header" data-position="fixed" data-tap-toggle="false"> | |
<h1>Pub Messenger</h1> | |
</div><!-- /header --> | |
<div data-role="content"> | |
<ul data-role="listview" id="messageList"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Chat List Page --> | |
<div data-role="page" id="chatListPage" data-theme="c" class="type-chat-list"> | |
<div data-role="header"> | |
<h1>Current Chats</h1> | |
</div> | |
<div data-role="content"> | |
<input type="text" name="name" id="chatRoomName" placeholder="Chat Room Name" /> | |
<a href="#" id="newChatButton" data-role="button">Join New Chat</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pubnub.history({ | |
channel: chatChannel, | |
limit: 100 | |
}, function (messages) { | |
messages = messages[0]; | |
messages = messages || []; | |
for(var i = 0; i < messages.length; i++) { | |
handleMessage(messages[i], false); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-role="page" id="chatPage" data-theme="c" class="type-interior"> | |
<div data-role="content"> | |
<div class="content-primary"> | |
<div data-role="header" data-position="fixed" data-tap-toggle="false"> | |
<h1>Pub Messenger</h1> | |
</div><!-- /header --> | |
<div data-role="content"> | |
<ul data-role="listview" id="messageList"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CACHE MANIFEST | |
# 2013-05-13:v1.3.2 | |
# Explicitly cached master entries. | |
CACHE: | |
index.html | |
css/screen.css | |
img/pw_pattern.png | |
js/messenger.js | |
http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pubnub = PUBNUB.init({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
// Here is where you can use PubNub Presence to get the UUID of the other user | |
// var uuid = 'ABC123' | |
pubnub.subscribe({ | |
user: uuid, // This tells PubNub to use WebRTC Data Channel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.geolocation.getCurrentPosition(function (position) { | |
console.log(“I am located at: “ + position.coords.latitude + “, “ + position.coords.longitude); | |
}); | |
navigator.geolocation.watchPosition(function (position) { | |
console.log(“I am now located at: “ + position.coords.latitude + “, “ + position.coords.longitude); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fix Vendor Prefixes | |
var IS_CHROME = !!window.webkitRTCPeerConnection, | |
RTCPeerConnection, | |
RTCIceCandidate, | |
RTCSessionDescription; | |
if (IS_CHROME) { | |
RTCPeerConnection = webkitRTCPeerConnection; | |
RTCIceCandidate = window.RTCIceCandidate; | |
RTCSessionDescription = window.RTCSessionDescription; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyCollection = Backbone.PubNub.Collection.extend({ | |
name: 'MyCollection', | |
pubnub: pubnub | |
}); |
OlderNewer