summaryrefslogtreecommitdiff
path: root/photobooth
diff options
context:
space:
mode:
authordumpfmprod <dumpfmprod@ubuntu.(none)>2013-08-09 09:28:41 -0400
committerdumpfmprod <dumpfmprod@ubuntu.(none)>2013-08-09 09:28:41 -0400
commita7cad3dea595698294e55673b10b4380315a8013 (patch)
tree8e33586d86acd62efff419c9fec01fa3c32eb112 /photobooth
parent9c565b805bd0a3315ea56c5e9960f6846fe073be (diff)
Prod commit
Diffstat (limited to 'photobooth')
-rw-r--r--photobooth/fullscreenmgmt.js185
-rw-r--r--photobooth/fullscreenphotobooth.js185
-rw-r--r--photobooth/fullscreenphotobooth.st123
3 files changed, 493 insertions, 0 deletions
diff --git a/photobooth/fullscreenmgmt.js b/photobooth/fullscreenmgmt.js
new file mode 100644
index 0000000..6137238
--- /dev/null
+++ b/photobooth/fullscreenmgmt.js
@@ -0,0 +1,185 @@
+function initFullscreen(){
+ Room = "mgmt";
+ refresh();
+ ImageCache = [];
+ SeenImages = {};
+ FavedMap = {};
+ $('#tools-button').click(toolsToggle);
+}
+function toolsToggle(){
+ if ($("#msgInputDiv").css("display") == "none")
+ toolsShow()
+ else
+ toolsHide()
+}
+function toolsShow(){
+ $("#msgInputDiv").css("display", "block")
+
+}
+function toolsHide(){
+ $("#msgInputDiv").css("display", "none")
+}
+
+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]
+ NextImage.msg_id = messages[m].msg_id;
+ }
+ }
+}
+
+function clickImage(img) {
+ if (!LoggedIn) return;
+ var msg_id = $(img).attr('msg_id');
+ if (!$(img).hasClass('fullscreen-favorite')) {
+ FavedMap[msg_id] = true;
+ $('#fav-indicator').show();
+ Tag.add(msg_id, "favorite");
+ $(img).addClass("fullscreen-favorite");
+ track('UI', 'FullscreenFav');
+ } else {
+ delete FavedMap[msg_id];
+ $('#fav-indicator').hide();
+ Tag.rm(msg_id, "favorite");
+ $(img).removeClass("fullscreen-favorite");
+ track('UI', 'FullscreenDeFav');
+ }
+}
+
+function displayImage(){
+ $("#big-image").html('<img src="'+this.src+'" msg_id = "' + this.msg_id + '" onclick="clickImage(this)">');
+ if (FavedMap[this.msg_id])
+ $('#fav-indicator').show();
+ else
+ $('#fav-indicator').hide();
+}
+
+function refresh() {
+ var onSuccess = function(json) {
+ try {
+ if (json.messages && json.messages.length)
+ scanMessagesForImages(json.messages);
+ Timestamp = json.timestamp;
+ } catch(e) {
+
+ }
+ setTimeout(refresh, 1000);
+ };
+
+ var onError = function(resp, textStatus, errorThrown) {
+ setTimeout(refresh, 4000);
+ };
+
+ $.ajax({
+ type: 'GET',
+ timeout: 5000,
+ url: '/refresh',
+ data: { 'room': Room, 'since': Timestamp },
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+}
+
+function initLogin() {
+ $('#logininner').ridgificate('2px solid #dd0000',
+ '2px solid #fe6230',
+ '2px solid #fef600',
+ '2px solid #00bc00',
+ '2px solid #009bfe',
+ '2px solid #000083',
+ '2px solid #30009b',
+ '2px solid #dd0000',
+ '2px solid #fe6230',
+ '2px solid #fef600',
+ '2px solid #00bc00',
+ '2px solid #009bfe',
+ '2px solid #000083',
+ '2px solid #30009b');
+}
+
+function showLogin() {
+ $('#nickInput').val('');
+ $('#passwordInput').val('');
+ $('#loginbox').show().center().center();
+ $('#username').focus();
+ $('input').removeAttr('disabled');
+}
+
+function login() {
+ $('#spinner').show();
+ $('input').attr('disabled', 'disabled');
+ var nick = $('#nickInput').val();
+ var password = $('#passwordInput').val();
+ var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : '';
+ var hash = hex_sha1(nick + '$' + password + '$dumpfm');
+
+ var onSuccess = function(json) {
+ if (typeof pageTracker !== 'undefined') {
+ pageTracker._setCustomVar(1, "logged-in", nick);
+ }
+ LoggedIn = true;
+ $('#loginbox').hide();
+ $('.sublogo').text('click to fav');
+ };
+
+ var onError = function(resp, textStatus, errorThrown) {
+ $('#spinner').hide();
+ $('input').removeAttr('disabled');
+ $('#errormsg').text("Couldn't log you in :( Bad password?");
+ }
+
+ $.ajax({
+ type: 'POST',
+ timeout: 5000,
+ url: '/login',
+ data: {'nick': nick, ts: '', 'hash': hash, 'rememberme': rememberme},
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+}
+
+// http://plugins.jquery.com/project/autocenter
+(function($){
+ $.fn.extend({
+ center: function () {
+ return this.each(function() {
+ var top = ($(window).height() - $(this).outerHeight()) / 2;
+ var left = ($(window).width() - $(this).outerWidth()) / 2;
+ $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
+ });
+ }
+ });
+})(jQuery);
+
+(function($) {
+ $.fn.extend({
+ ridgificate: function() {
+ var ridges = arguments;
+ return this.each(function() {
+ for (var i = 0; i < ridges.length; i++) {
+ $(this).wrap('<div style="border: ' + ridges[i] + '">');
+ }
+ });
+ }});
+})(jQuery);
+
+var LogoFadeDelay = 3000;
+var PrevMouseCoord = [-1, -1];
+
+$(function() {
+ $(document).mousemove(function(e) {
+ if (e.pageX == PrevMouseCoord[0] && e.pageY == PrevMouseCoord[1])
+ return;
+ PrevMouseCoord = [e.pageX, e.pageY];
+ $('#memelogo').stop(true, false).animate({opacity: 1.0}, "fast").delay(LogoFadeDelay).animate({opacity: 0}, "slow");
+ });
+ $('#memelogo').delay(LogoFadeDelay).animate({opacity: 0}, "slow");
+}); \ No newline at end of file
diff --git a/photobooth/fullscreenphotobooth.js b/photobooth/fullscreenphotobooth.js
new file mode 100644
index 0000000..6137238
--- /dev/null
+++ b/photobooth/fullscreenphotobooth.js
@@ -0,0 +1,185 @@
+function initFullscreen(){
+ Room = "mgmt";
+ refresh();
+ ImageCache = [];
+ SeenImages = {};
+ FavedMap = {};
+ $('#tools-button').click(toolsToggle);
+}
+function toolsToggle(){
+ if ($("#msgInputDiv").css("display") == "none")
+ toolsShow()
+ else
+ toolsHide()
+}
+function toolsShow(){
+ $("#msgInputDiv").css("display", "block")
+
+}
+function toolsHide(){
+ $("#msgInputDiv").css("display", "none")
+}
+
+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]
+ NextImage.msg_id = messages[m].msg_id;
+ }
+ }
+}
+
+function clickImage(img) {
+ if (!LoggedIn) return;
+ var msg_id = $(img).attr('msg_id');
+ if (!$(img).hasClass('fullscreen-favorite')) {
+ FavedMap[msg_id] = true;
+ $('#fav-indicator').show();
+ Tag.add(msg_id, "favorite");
+ $(img).addClass("fullscreen-favorite");
+ track('UI', 'FullscreenFav');
+ } else {
+ delete FavedMap[msg_id];
+ $('#fav-indicator').hide();
+ Tag.rm(msg_id, "favorite");
+ $(img).removeClass("fullscreen-favorite");
+ track('UI', 'FullscreenDeFav');
+ }
+}
+
+function displayImage(){
+ $("#big-image").html('<img src="'+this.src+'" msg_id = "' + this.msg_id + '" onclick="clickImage(this)">');
+ if (FavedMap[this.msg_id])
+ $('#fav-indicator').show();
+ else
+ $('#fav-indicator').hide();
+}
+
+function refresh() {
+ var onSuccess = function(json) {
+ try {
+ if (json.messages && json.messages.length)
+ scanMessagesForImages(json.messages);
+ Timestamp = json.timestamp;
+ } catch(e) {
+
+ }
+ setTimeout(refresh, 1000);
+ };
+
+ var onError = function(resp, textStatus, errorThrown) {
+ setTimeout(refresh, 4000);
+ };
+
+ $.ajax({
+ type: 'GET',
+ timeout: 5000,
+ url: '/refresh',
+ data: { 'room': Room, 'since': Timestamp },
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+}
+
+function initLogin() {
+ $('#logininner').ridgificate('2px solid #dd0000',
+ '2px solid #fe6230',
+ '2px solid #fef600',
+ '2px solid #00bc00',
+ '2px solid #009bfe',
+ '2px solid #000083',
+ '2px solid #30009b',
+ '2px solid #dd0000',
+ '2px solid #fe6230',
+ '2px solid #fef600',
+ '2px solid #00bc00',
+ '2px solid #009bfe',
+ '2px solid #000083',
+ '2px solid #30009b');
+}
+
+function showLogin() {
+ $('#nickInput').val('');
+ $('#passwordInput').val('');
+ $('#loginbox').show().center().center();
+ $('#username').focus();
+ $('input').removeAttr('disabled');
+}
+
+function login() {
+ $('#spinner').show();
+ $('input').attr('disabled', 'disabled');
+ var nick = $('#nickInput').val();
+ var password = $('#passwordInput').val();
+ var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : '';
+ var hash = hex_sha1(nick + '$' + password + '$dumpfm');
+
+ var onSuccess = function(json) {
+ if (typeof pageTracker !== 'undefined') {
+ pageTracker._setCustomVar(1, "logged-in", nick);
+ }
+ LoggedIn = true;
+ $('#loginbox').hide();
+ $('.sublogo').text('click to fav');
+ };
+
+ var onError = function(resp, textStatus, errorThrown) {
+ $('#spinner').hide();
+ $('input').removeAttr('disabled');
+ $('#errormsg').text("Couldn't log you in :( Bad password?");
+ }
+
+ $.ajax({
+ type: 'POST',
+ timeout: 5000,
+ url: '/login',
+ data: {'nick': nick, ts: '', 'hash': hash, 'rememberme': rememberme},
+ cache: false,
+ dataType: 'json',
+ success: onSuccess,
+ error: onError
+ });
+}
+
+// http://plugins.jquery.com/project/autocenter
+(function($){
+ $.fn.extend({
+ center: function () {
+ return this.each(function() {
+ var top = ($(window).height() - $(this).outerHeight()) / 2;
+ var left = ($(window).width() - $(this).outerWidth()) / 2;
+ $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
+ });
+ }
+ });
+})(jQuery);
+
+(function($) {
+ $.fn.extend({
+ ridgificate: function() {
+ var ridges = arguments;
+ return this.each(function() {
+ for (var i = 0; i < ridges.length; i++) {
+ $(this).wrap('<div style="border: ' + ridges[i] + '">');
+ }
+ });
+ }});
+})(jQuery);
+
+var LogoFadeDelay = 3000;
+var PrevMouseCoord = [-1, -1];
+
+$(function() {
+ $(document).mousemove(function(e) {
+ if (e.pageX == PrevMouseCoord[0] && e.pageY == PrevMouseCoord[1])
+ return;
+ PrevMouseCoord = [e.pageX, e.pageY];
+ $('#memelogo').stop(true, false).animate({opacity: 1.0}, "fast").delay(LogoFadeDelay).animate({opacity: 0}, "slow");
+ });
+ $('#memelogo').delay(LogoFadeDelay).animate({opacity: 0}, "slow");
+}); \ No newline at end of file
diff --git a/photobooth/fullscreenphotobooth.st b/photobooth/fullscreenphotobooth.st
new file mode 100644
index 0000000..6e32453
--- /dev/null
+++ b/photobooth/fullscreenphotobooth.st
@@ -0,0 +1,123 @@
+<html>
+ <head>
+
+ <title>dump.fm - fullscreen</title>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+ <script src="$domain$/static/js/pichat.js"></script>
+ <script src="$domain$/static/js/fullscreenphotobooth.js"></script>
+
+ <script type="text/javascript" src="$domain$/static/webcam/webcam.js"></script>
+ <script type="text/javascript" src="$domain$/static/js/ajaxupload.js"></script>
+
+ <script>
+ var LoggedIn = $if(user_nick)$true$else$false$endif$;
+ var Timestamp = $timestamp$;
+ var newwindow;
+ function pop(url) {
+ newwindow=window.open(url,'name','height=50,width=400,left=20,top=20,location=0,status=0,scrollbar=0,resizable=0');
+ if (window.focus) {newwindow.focus()}
+ }
+ jQuery(startChatUpdater);
+ </script>
+
+ <style>
+ html, body, div, img { margin: 0; padding: 0; border: 0; overflow: hidden; font-family: Monaco, "Courier New", Courier, monospace; }
+ input {
+ font-family: Monaco, "Courier New", Courier, monospace;
+ }
+ #big-image img {
+ width: 100%; height: 100%;
+ cursor: pointer;
+ box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box;
+ }
+ #loginbox {
+ background: white;
+ z-index: 999;
+ position: absolute;
+ display: none;
+ }
+ #logininner {
+ width: 30em;
+ height: 20em;
+ position: relative;
+ }
+ #infocol {
+ width: 50%;
+ float: left;
+ position: relative;
+ }
+ #formcontainer {
+ padding: 0;
+ margin-top: 20%;
+ width: 80%;
+ position: relative;
+ }
+ #nickInput, #passwordInput {
+ width: 100%;
+ }
+ #piccol {
+ width: 50%;
+ float: right;
+ position: relative;
+ }
+ #loginimg {
+ width: 75%;
+ margin-top: 20%;
+ }
+ #spinner { display: none; }
+ #forgetpw {
+ position: absolute;
+ left: 5px;
+ bottom: 5px;
+ font-size: 80%;
+ }
+ #fav-indicator {
+ display: none;
+ position: fixed;
+ z-index: 999;
+ height: 150px;
+ width: 150px;
+ left: 20px;
+ top: 20px;
+ }
+ #errormsg {
+ position: relative;
+ color: red;
+ text-align: center;
+ margin-top: 250px;
+ }
+
+ #loginclose {
+ position: absolute;
+ right: 3px;
+ top: 3px;
+ }
+ #big-image{font-size:120px;text-align: justify; text-justify: newspaper; text-shadow: 1px 1px #eee, 2px 2px #f0e, 3px 3px #eee,4px 4px #f0e,5px 5px #eee, 3px 3px #eee,4px 4px #f0e,5px 5px #eee,6px 6px #f0e,6px 6px #eee,7px 7px #f0e,7px 7px #eee,8px 8px #f0e,8px 8px #eee,9px 9px #f0e,9px 9px #eee; color:#fff}
+ #memelogo { position: fixed; z-index: 999; bottom: 30px; right: 80px; }
+ .sublogo { font-family: Monaco, "Courier New", Courier, monospace; }
+ a { color:#000 }
+ </style>
+ <script>jQuery(initLogin)</script>
+ </head>
+ <body>
+
+
+
+
+
+
+ <div id="big-image">
+
+ waiting 4 new image from dump.fm.............
+
+ <input id="webcam-button-upload" value="Webcam" type="submit">
+ <input id="webcam-button-snap" value="Send Pic" type="submit" class="invisible blink">
+
+ </div>
+ <img src="/static/img/thumbs/heartfaved.gif" id="fav-indicator">
+ <script>
+ initFullscreen()
+ </script>
+ $google_analytics()$
+ </body>
+</html>