summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authortim b <timb@camcompu.home>2010-08-13 12:33:53 -0700
committertim b <timb@camcompu.home>2010-08-13 12:33:53 -0700
commitf031cab0fd7db4ad11ea5b448fa2b4ecdf20ada7 (patch)
tree198608ebef32f706495ce599542f1c866d7195d5 /static
parentdb3d22ba1c1731e873a5a9296aad94071cdd163b (diff)
initial fullscreen image thing
Diffstat (limited to 'static')
-rw-r--r--static/js/fullscreen.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/static/js/fullscreen.js b/static/js/fullscreen.js
new file mode 100644
index 0000000..78ef904
--- /dev/null
+++ b/static/js/fullscreen.js
@@ -0,0 +1,62 @@
+function initFullscreen(){
+ Room = "dumpfm";
+ refresh()
+ ImageCache = []
+ SeenImages = {}
+}
+
+function scanMessagesForImages(messages){
+ for(var m=0; m<messages.length; m++) {
+ var images = getImagesAsArray(messages[m].content)
+ for (var i = 0; i<images.length; i++){
+ NextImage = new Image()
+ NextImage.onload = displayImage
+ NextImage.src = images[i]
+ }
+ }
+}
+
+function displayImage(){
+ $("#big-image").attr("src", this.src)
+}
+
+function refresh() {
+ var onSuccess = function(json) {
+ try {
+ if (json.messages && json.messages.length)
+ scanMessagesForImages(json.messages)
+
+ Timestamp = json.timestamp;
+
+/*
+ var messages = $.grep(
+ json.messages,
+ function(m) { return !isDuplicateMessage(m) });
+ updateUI(messages, json.users, json.favs);
+ if (typeof UnseenMsgCounter !== 'undefined' && !HasFocus) {
+ UnseenMsgCounter += messages.length;
+ }
+*/
+ } catch(e) {
+// if (window.console) {
+// console.error(e);
+// }
+ }
+ setTimeout(refresh, 1000);
+ };
+
+ var onError = function(resp, textStatus, errorThrown) {
+ setTimeout(refresh, 1000);
+ };
+
+ $.ajax({
+ type: 'GET',
+ timeout: 5000,
+ url: '/refresh',
+ data: { 'room': Room, 'since': Timestamp },
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+} \ No newline at end of file