Permalink
Browse files

status logs no longer get in the way of ui.

  • Loading branch information...
1 parent fd18d37 commit 5a42f4938c291969ee416de0aa152248b518c9e1 @sherbondy sherbondy committed Apr 14, 2012
Showing with 70 additions and 10 deletions.
  1. +20 −0 public/bubbles.coffee
  2. +27 −1 public/bubbles.js
  3. +2 −0 public/style.css
  4. +10 −0 public/style.styl
  5. +9 −9 swypClient.coffee
  6. +2 −0 views/index.coffee
View
@@ -14,6 +14,8 @@ swyp =
default: "Drag the content onto the person you want to send it to."
drop: "Drop to send."
sending: "Sending now..."
+ pending: [] #any pending content for receipt
+ canSwypIn: true #turn off to disable swyp ins
isTouchDevice = "ontouchstart" of document.documentElement
@@ -168,6 +170,24 @@ swyp.setupBubbles = (json)->
d.y = if @y then d.y + (@y - d.y) * (damper + 0.71) * e.alpha else 400
"translate(#{d.x},#{d.y})"
+# expects an object: {objectID: 1, userName:'Ethan', thumbnailURL: 'http://...', fullURL:
+# 'http://...'}
+swyp.addPending = (item)->
+ # make sure not a duplicate
+ for obj in swyp.pending
+ if obj.objectID is item.objectID
+ false
+
+ swyp.pending.push item
+ $elem = $('<div/>').addClass('swyp_thumb').attr('id', "obj_#{objectID}")
+ $link = $('<a/>').addClass('swyp_link').attr('href', item.fullURL)
+ $img = $('<img/>').attr('src', item.thumbnailURL)
+ $elem.append($link.append($img))
+ $('body').append $elem
+
+swyp.demoObj = (fakeID)->
+ {objectID: fakeID, userName: 'Ethan Sherbondy', thumbnailURL: 'https://www.google.com/logos/2012/doisneau12-sr.png', fullURL: 'https://www.google.com/logos/2012/doisneau12-hp.jpg'}
+
swyp.initialize = (json)->
window.addEventListener "message", @receiveMessage, false
$("#instructions").text @instructions["default"]
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -10,3 +10,5 @@ svg{-webkit-transition:opacity .2s linear}
.hovered .rect{fill:#09c}
#preview{width:50px;height:50px;position:absolute;display:none;z-index:2;top:0;left:0}
#instructions{position:absolute;width:100%;text-align:center;color:#fff;text-shadow:0 1px 0 #000;font-size:32px;font-weight:200;padding:16px;top:0;left:0}
+#swypMessages{position:absolute;top:64px;left:0;width:100%}
+.swypStatusControls,#swypOutControls{position:absolute;z-index:3}
View
@@ -45,3 +45,13 @@ svg
padding: 16px
top: 0px
left: 0px
+
+#swypMessages
+ position absolute
+ top 64px
+ left 0
+ width 100%
+
+.swypStatusControls, #swypOutControls
+ position absolute
+ z-index 3
View
@@ -67,26 +67,26 @@
console.log @data
swypObjByID[@data.id] = @data #{dateCreated: @data.dateCreated, id: @data.id, swypSender: @data.swypSender, availableMimeTypes: @data.availableMIMETypes}
console.log "swyp in available #{@data.id}"
- $('body').append "<br /> @ #{@data.dateCreated} swypIn avail w.ID #{@data.id} from #{@data.swypSender} with types: #{@data.availableMIMETypes} <img src='#{@data.swypSender.userImageURL}' /> <img src='#{@data.previewImageURL}' />"
- $('body').append "<input id= 'button_#{@data.id}', type= 'button', value='swyp in!'>"
+ $('#swypMessages').append "<br /> @ #{@data.dateCreated} swypIn avail w.ID #{@data.id} from #{@data.swypSender} with types: #{@data.availableMIMETypes} <img src='#{@data.swypSender.userImageURL}' /> <img src='#{@data.previewImageURL}' />"
+ $('#swypMessages').append "<input id= 'button_#{@data.id}', type= 'button', value='swyp in!'>"
$("#button_#{@data.id}").bind 'click', =>
makeSwypIn(@data.id)
@on swypOutPending: ->
- $('body').append "<br /> did swypOut @ #{@data.time} w.ID #{@data.id}"
+ $('#swypMessages').append "<br /> did swypOut @ #{@data.time} w.ID #{@data.id}"
@on welcome: ->
- $('body').append "Welcome to swyp, #{@data.time}"
+ $('#swypMessages').append "Welcome to swyp, #{@data.time}"
@on unauthorized: ->
- $('body').append "<br />You're currently not logged in. <a href='/login'>Login here</a>."
+ $('#swypMessages').append "<br />You're currently not logged in. <a href='/login'>Login here</a>."
@on updateGood: ->
- $('body').append "<br />you updated successfully! Cool yo!"
+ $('#swypMessages').append "<br />you updated successfully! Cool yo!"
@on nearbyRefresh: ->
- $('body').append "<br />received a nearby session update! w. nearby: #{JSON.stringify(@data.nearby)}"
+ $('#swypMessages').append "<br />received a nearby session update! w. nearby: #{JSON.stringify(@data.nearby)}"
peers = @data.nearby
graph = {nodes:[{userName:"",userImageURL:"", friend:true}], links:[]}
i = 1
@@ -99,10 +99,10 @@
@on updateRequest: ->
- $('body').append "<br />update requested!"
+ $('#swypMessages').append "<br />update requested!"
makeStatusUpdate()
@on dataAvailable: ->
- $('body').append "<img src='#{@data.contentURL}' alt='imgID#{@data.id} of type #{@data.contentMIME}'/>"
+ $('#swypMessages').append "<img src='#{@data.contentURL}' alt='imgID#{@data.id} of type #{@data.contentMIME}'/>"
@connect()
View
@@ -20,3 +20,5 @@ div 'swypStatusControls', style: 'position: relative; float: right', ->
div 'swypOutControls', ->
input id: 'recipient_input', type: 'text', name: 'recipient_input', placeholder: 'recipient publicID or empty for nearby', size: 50
input id: 'swypOut_button', type: 'button', value: "swyp out!"
+
+div '#swypMessages', ->

0 comments on commit 5a42f49

Please sign in to comment.