From 2f166037d567f7215cb7799419da32a74a5d19fe Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Sun, 24 Oct 2010 20:41:34 -0400 Subject: sostler prod commit --- static/js/fullscreen.js | 8 +- static/js/fullscreenphotobooth.js | 185 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 static/js/fullscreenphotobooth.js (limited to 'static/js') diff --git a/static/js/fullscreen.js b/static/js/fullscreen.js index 808c138..dde23f3 100644 --- a/static/js/fullscreen.js +++ b/static/js/fullscreen.js @@ -1,5 +1,5 @@ -function initFullscreen(){ - Room = "dumpfm"; +function initFullscreen(room){ + Room = room || "dumpfm"; refresh(); ImageCache = []; SeenImages = {}; @@ -56,6 +56,10 @@ function displayImage(){ $('#fav-indicator').show(); else $('#fav-indicator').hide(); + if (DoPrint !== undefined && DoPrint) { + jsPrintSetup.setSilentPrint(true); + jsPrintSetup.print(); + } } function refresh() { diff --git a/static/js/fullscreenphotobooth.js b/static/js/fullscreenphotobooth.js new file mode 100644 index 0000000..29795ee --- /dev/null +++ b/static/js/fullscreenphotobooth.js @@ -0,0 +1,185 @@ +function initFullscreen(){ + Room = "photobooth"; + 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'); + 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('
'); + } + }); + }}); +})(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 -- cgit v1.2.3-70-g09d2