Uncategorized
Remote Slide 1
var fireBaseRef = new Firebase("https://torid-fire-3540.firebaseio.com/heat");
$("#submit-btn").bind("click", function() { var counter = $("#counter"); var counterValue = $.trim(counter.val()); var date = new Date() / 1000; if (counterValue.length === 0) { alert('A Heat Number is required to continue!'); } else { fireBaseRef.update({counter: counterValue}, function(error) { if (error !== null) { alert('Unable to push comments to Firebase!'); } }); fireBaseRef.update({timestamp: date}, function(error2) { if (error2 !== null) { alert('Unable to push comments to Firebase!');
} });
//comment.val(""); }
return false; });
fireBaseRef.on('value', function(snapshot) { var uniqName = snapshot.name(); var counter = snapshot.val().counter; var counterContainer = $('#counters-container');
document.getElementById('counters-container').innerHTML = 'Successfully updated to: ' + counter;
// $('
', {class: 'counter-container'}) // .html(counter).appendTo(counterContainer);// counterContainer.scrollTop(counterContainer.prop('scrollHeight')); });
var fireBaseRef2 = new Firebase("https://torid-fire-3540.firebaseio.com/talk");
$("#submit-btn-comments").bind("click", function() { var comment = $("#comments"); var commentValue = $.trim(comment.val());
if (commentValue.length === 0) { alert('Comments are required to continue!'); } else { fireBaseRef2.push({comment: commentValue}, function(error) { if (error !== null) { alert('Unable to push comments to Firebase!'); } });
comment.val(""); }
return false; });
fireBaseRef2.on('child_added', function(talk) {
var uniqName = talk.name();
var comment = talk.val().comment;
var commentsContainer = $('#comments-container');
document.getElementById('comments-container').innerHTML = 'Comment
' + comment;
// $('