Permalink
Browse files

update

  • Loading branch information...
1 parent 86f0a54 commit d131fa753c808ddd22c78f7e8f84a19eb687a74c @Cosmo committed Oct 21, 2012
View
BIN .DS_Store
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Deleted file not rendered
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Deleted file not rendered
@@ -26,8 +26,6 @@ jQuery.fn.reset = function () {
}
$(function() {
- // Set focus on message field
- $("#log_body").focus();
var socket = new Pusher('9b398a15a5cdeb082e7d');
var presence_channel = socket.subscribe('presence-channel');
@@ -51,9 +49,7 @@ $(function() {
});
channel.bind('comment', function(data) {
- $("<p>["+data.short_time+"] "+data.name+": "+data.body+"</p>").appendTo("#comment-entries");
- $("#log_body").val("");
- $("#log_body").focus();
+ $("<p>["+data.short_time+"] "+data.name+": "+data.body+"</p>").appendTo("#debug-entries");
pushComment({ id: data.id, uid: data.uid, name: data.name, body: data.body, timestamp: data.timestamp, user_id: data.user_id });
});
@@ -76,6 +72,9 @@ $(function() {
send_data = { log: { timestamp: timestamp, body: message } };
$.ajax({ type: "POST", url: "/logs", data: send_data, success: function(data, textStatus, jqXHR) { } });
+ $("#log_body").val("");
+ $("#log_body").focus();
+
});
@@ -25,7 +25,8 @@
player : null, // The flash player
progress : null, // Progress bar
elapsed : null, // The light blue elapsed bar
- onProgressBarAdded: settings.onProgressBarAdded // handler that gets executed once UI is ready
+ onProgressBarAdded: settings.onProgressBarAdded, // handler that gets executed once UI is ready
+ onJump: settings.onJump
};
try{
@@ -124,6 +125,9 @@
elements.elapsed.width(ratio*100+'%');
elements.player.seekTo(Math.round(data.duration*ratio), true);
+
+ elements.onJump(elements.player.getCurrentTime());
+
return false;
});
@@ -1,12 +1,13 @@
var videoDuration = 0;
$(document).ready(function () {
-
+
$("#player").youTubeEmbed({
video: 'http://www.youtube.com/watch?v=p2MKzO9MfrE',
width: 584,
progressBar: true,
- onProgressBarAdded: getComments
+ onProgressBarAdded: getComments,
+ onJump: populateComments
});
});
@@ -23,6 +24,27 @@
});
}
+ function populateComments(timestamp) {
+ entries = $("#comment-entries");
+ $(".comment").each(function(index, element) {
+ element_time = parseInt($(element).attr("data-timestamp"), 10);
+ comment_id = $(element).attr("data-marker-id");
+ if(element_time < timestamp) {
+ if(entries.find("#comment_" + comment_id).length === 0) {
+ $('<div class="comment-entry" id="comment_'+comment_id +'">'+
+ '<span class="image"><img src="https://graph.facebook.com/' +
+ $(element).attr("data-uid") +
+ '/picture/" style="float:left; margin-right:5px;" /></span><span class="name">'+
+ $(element).attr("data-name")+
+ '</span><span class="message">' +
+ $(element).attr("data-text") +
+ '</span></div>').appendTo(entries);
+ }
+ }
+
+ });
+ }
+
function pushComment(data) {
if (console && console.log) {
console.log("Adding comment for user '" + data.uid + "'.");
@@ -37,12 +59,12 @@
var user_type = is_me ? " me" : " notme";
var left = (584 / videoDuration) * timestamp;
- $("<div id='" + uid + "' name='" + name + "' text='" + body +
- "' class='comment" + user_type + "' style='position:absolute; left:" + left + "px;'></div>")
+ $("<div id='marker_" + id + "' data-uid='"+uid+"' data-marker-id='"+id+"' data-name='" + name + "' data-text='" + body +
+ "' data-timestamp='"+timestamp+"' class='comment" + user_type + "' style='position:absolute; left:" + left + "px;'></div>")
.mouseenter(function () {
$("<div id='c" + id + "' style='width:200px; background-color:#eee; padding:4px;'><img src='https://graph.facebook.com/" +
- this.id + "/picture/' style='float:left; margin-right:5px;' />" +
- $(this).attr("name") + "<br />" + $(this).attr("text") + "</div>")
+ uid + "/picture/' style='float:left; margin-right:5px;' />" +
+ $(this).attr("data-name") + "<br /><span class='body'>" + $(this).attr("data-text") + "</span></div>")
.appendTo("body")
.css("position", "absolute")
.css("top", ($(this).offset().top + $(this).height()) + "px")
@@ -11,6 +11,13 @@ $(document).ready(function(){
}
});
+ $("#video-trigger").click(function() {
+ $("#video").animate({"margin-top" : "0"}, 300, 'swing');
+ $("#current-video").slideUp(400);
+ $("#video-trigger-minified-open").css({"background-color" : "#ff4300"});
+ $("#info-trigger-minified-open").css({"background-color" : "#222"});
+ });
+
$("#info-trigger-minified-open").click(function() {
if($("#current-video").is(":hidden")){
$("#current-video").slideDown('fast');
@@ -72,3 +72,34 @@
background-repeat: no-repeat;
background-position: left bottom;
}
+
+#comment_form {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background-color: #222222;
+ padding: 0 10px;
+ height: 44px;
+}
+
+#members {
+}
+
+#members li {
+ width: 44px;
+ height: 44px;
+ background-color: green;
+ margin-right: 4px;
+ display: inline-block;
+ overflow: hidden;
+}
+
+.comment-entry {
+ overflow: hidden;
+}
+
+.comment-entry .name {
+ font-weight: bold;
+ padding-right: 20px;
+}
@@ -8,25 +8,26 @@
@import compass/css3
$orange: #ff4300
+$grey: #222
::-moz-selection
- background: #222
+ background: $grey
color: #fff
text-shadow: none
::selection
- background: #222
+ background: $grey
color: #fff
text-shadow: none
-html
+html, body
width: 100%
height: 100%
+ margin: 0
+ padding: 0
body.ui
background: #444
- width: 100%
- height: 100%
font: 14px/1.2em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif
color: #222
@@ -39,11 +40,49 @@ body.ui
#container
width: 1024px
- height: 100%
+ min-height: 100%
position: relative
left: 50%
margin-left: -512px
+ @include box-shadow(rgba(0,0,0,.8) 0 2px 15px)
+ background: #000
+
+ #wrapper
+ width: 100%
+ padding-bottom: 44px
overflow: hidden
+ float: left
+ border: 2px solid red
+
+ #column_left
+ width: 220px
+ background: #000
+
+ #column_center
+
+ #column_right
+ width: 220px
+ background: #000
+
+ #footer
+ width: 1024px
+ height: 44px
+ position: absolute
+ bottom: 0
+ background: yellow
+
+
+
+
+
+
+
+
+
+
+
+
+
#current
width: 584px
@@ -97,7 +136,6 @@ body.ui
#current-video
@include background-image(linear-gradient(#f6f6f6, #c8c8c8))
- @include box-shadow(rgba(0,0,0,.8) 0 2px 15px)
padding-top: 20px
width: 100%
float: left
@@ -139,6 +177,9 @@ body.ui
strong
font-weight: bold
+ a
+ color: $orange
+
#video
width: 584px
height: 365px
@@ -147,6 +188,13 @@ body.ui
z-index: 10
position: relative
+ .button
+ float: left
+ color: #fff
+ background: $orange
+ margin: 0 16px 16px 16px
+ padding: 6px 10px
+
.sidebar
width: 220px
position: absolute
@@ -164,12 +212,12 @@ body.ui
margin-bottom: 4px
.sidebar-title
- float: left
margin-bottom: 4px
- img
+ .sidebar-image
border: 2px solid #222
margin-bottom: 4px
+ float: left
h3
color: #222
@@ -208,5 +256,18 @@ body.ui
#prev
left: 0
+ #login
+ position: absolute
+ bottom: 0
+ left: 0
+ width: 220px
+ height: 44px
+ background: $orange
+ line-height: 44px
+
+ a
+ color: #fff
+ margin-left: 20px
+
#next
right: 0
@@ -1,13 +1,14 @@
class HomeController < ApplicationController
def index
- schedule_now_and_next_url = "http://www.arte.tv/tvhack/tvguide/epg/live/D/L3/10.json?#{Time.now.to_i}"
+ schedule_now_and_next_url = "http://www.arte.tv/tvhack/tvguide/epg/live/D/L3/10.json"
schedule_now_and_next = parse_json(schedule_now_and_next_url)
@schedule_now = schedule_now_and_next["abstractBroadcastList"][0]
@schedule_next = schedule_now_and_next["abstractBroadcastList"]
- date_today = Time.now.strftime("%Y-%m-%d")
- schedule_url = "http://www.arte.tv/tvhack/tvguide/epg/schedule/D/L3/#{date_today}/#{date_today}.json?#{Time.now.to_i}"
+ date_today = Date.today.strftime("%Y-%m-%d")
+ date_yesterday = Date.yesterday.strftime("%Y-%m-%d")
+ schedule_url = "http://www.arte.tv/tvhack/tvguide/epg/schedule/D/L3/#{date_yesterday}/#{date_today}.json"
schedule_day = parse_json(schedule_url)
schedule_day["abstractBroadcastList"].each_with_index {|program, index|
@@ -41,6 +41,7 @@ def create
render json: @log, status: :created, location: @log
else
flash[:notice] = 'not logged in!'
+ logger.info "something went wrong :( #{current_user.to_json}"
redirect_to new_log_path
end
end
@@ -6,8 +6,10 @@ def create
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
session[:user_id] = user.id
+ logger.info "logged in!"
redirect_to root_url, :notice => "Logged in!"
else
+ logger.info "invalid login!!!"
flash.now.alert = "Invalid email or password"
render "new"
end
Oops, something went wrong.

0 comments on commit d131fa7

Please sign in to comment.