var Keyboard = { enter: false, enteredText: false, altMode: false, focusTextarea: function () { // $("#chat").append("TEXTAREA FOCUS") $(window).unbind("keydown") $("#chat-message").unbind("keydown").bind("keydown", Keyboard.textareaMap) $("#chat-message").unbind("focus").focus().bind("focus", Keyboard.focusTextarea) Search.close () if ($("#chat-message").val().length === 0) Keyboard.enteredText = false }, blurTextarea: function () { // $("#chat").append("TEXTAREA BLUR") $(window).unbind("keydown") if (Viewport.fullscreenMode && Viewport.fullscreenInterface) $(window).bind("keydown", Keyboard.fullscreenInterfaceMap) else if (Viewport.fullscreenMode) $(window).bind("keydown", Keyboard.fullscreenMap) else $(window).bind("keydown", Keyboard.standardMap) $("#chat-message").unbind("keydown") }, textareaMap: function (event) { var kc = event.keyCode if (kc === 8) { var v = $("#chat-message").val() if (v.length < 2) Keyboard.enteredText = false return true } if (kc === 13) { Keyboard.enteredText = false if (Keyboard.enter) Keyboard.enter() if (Chat.callback) { Chat.callback(1) } return false } if (kc === 27) { Menu.close() if (Viewport.fullscreenMode && Viewport.fullscreenInterface) Viewport.fullscreenHideInterface() else if (Viewport.fullscreenMode) Viewport.fullscreenOff() else Viewport.fullscreenOn() return false } if (! Keyboard.enteredText) { if (kc === 37) { Player.playPrev() return } else if (kc === 39) { Player.playNext() return } } if (kc === 33) return d.pageUp("#chat") if (kc === 34) return d.pageDown("#chat") Keyboard.enteredText = true return true }, standardMap: function (event) { kc = event.keyCode if (kc === 91) { Keyboard.altMode = true return true } else if (kc === 27) // && Room.loaded) { Menu.close() Viewport.fullscreenOn() return false } else if (! Menu.isOpen) { if (kc === 37 || kc === 177) Player.playPrev() else if (kc === 39 || kc === 176) Player.playNext() else if (kc === 32 || kc === 179) Player.pause() else if (! Keyboard.altMode && kc === 76) Player.likeClick() } Keyboard.altMode = false return true }, fullscreenInterfaceMap: function (event) { kc = event.keyCode if (kc === 27) Viewport.fullscreenHideInterface() if (kc === 33) d.pageUp("#chat") if (kc === 34) d.pageDown("#chat") if (kc === 32 || kc === 179) Player.pause() if (kc === 37 || kc === 177) Player.playPrev() else if (kc === 39 || kc === 176) Player.playNext() if (! Keyboard.altMode && kc === 76) Player.likeClick() return false }, fullscreenMap: function (event) { kc = event.keyCode if (kc === 27) Viewport.fullscreenOff() if (kc === 37 || kc === 177) Player.playPrev() if (kc === 39 || kc === 176) Player.playNext() if (kc === 32 || kc === 179) Player.pause() if (kc === 76) Player.likeClick() return false } } var Viewport = { focused: true, fullscreenMode: false, fullscreenInterface: false, fullscreenFocusTimer: false, fullscreenOn: function () { var msg = $("#chat-message").val() $(window).unbind("resize") $(window).bind("resize", Viewport.fullscreenResize) $("#chat").unbind("mouseover").unbind("mouseout") $("#chat-message").focus() Keyboard.focusTextarea() $("#chat,#playlist").addClass("fullscreen") $("#bg,#chatbg,#playlistbg,#playlist").hide() $("#faqlink").hide() $("#logobg").css("width",$("#logo").width()+60) $("#like").show() $("#controls").css("position", "fixed") Menu.close () Search.close () $("#fullscreen").unbind("click") $("#fullscreen").bind("click", Viewport.fullscreenOff) $("#video-title").addClass("fullscreen") Viewport.fullscreenInterface = true Viewport.fullscreenMode = true Viewport.fullscreenResize() Viewport.chatMouseOut() $("#chat-message").val(msg) d.scrollToBottom("#chat") }, fullscreenOff: function () { $("#logobg").css("width","100%") $(window).unbind("keydown") // $(window).bind("keydown", Keyboard.standardMap) $(window).unbind("resize") $(window).bind("resize", Viewport.standardResize) $("#chat").bind("mouseover", Viewport.chatMouseOver) $("#chat").bind("mouseout", Viewport.chatMouseLaave) $("#bg,#logo,#logobg,#form,#formbg,#chat,#chatbg,#playlist,#playlistbg,#lastlogbox,#lastlogbg,#sitez,#controls").show() $("#controls").css("position", "absolute") $("#controls").css("min-width", "auto").css('top','auto').css('bottom', 'auto').css('left','auto').css('right','auto') $("#fullscreen").unbind("click") $("#fullscreen").bind("click", Main.fullscreenOn) $("#video-title").removeClass("fullscreen") $("#chat,#playlist").removeClass("fullscreen") $("#controls").css("padding", 0) Viewport.standardResize() setTimeout('d.scrollToBottom("#chat")', 500) Keyboard.focusTextarea() Viewport.fullscreenMode = false clearInterval(Viewport.fullscreenFocusTimer) Viewport.fullscreenFocusTimer = false }, fullscreenHideInterface: function () { Viewport.fullscreenInterface = false Keyboard.blurTextarea() $("#form,#formbg,#chat,#playlist,#lastlogbox,#lastlogbg,#sitez,#controls,#logo,#logobg").hide() }, fullscreenResize: function () { var w = $(window).width() var h = $(window).height() var fw = 4 * w / 7 - 40 var ph = h / 3 - 30 var ch = 2 * h / 3 var fh = 50 var clh = ch - fh - 50 var pw = w * 2 / 3 - 20 var chatwidth = (4*w)/5 - 20 var chatheight = h-fh-5 var fbot = 20 var chatbot = Viewport.chatBottom if (VideoChat.isOpen) { var vch = 150 $("#tokbox-embed").css("width", fw-20) chatheight -= vch chatbot += vch fbot += vch } $("#player").css("top", -10).css("left", -10) $("#screen,#ytscreen").css("width",w).css("height",h) $("#chat").css("left", 0).css("bottom", chatbot).css("width", chatwidth).css("height", chatheight) d.scrollToBottom("#chat") var sendw = $("#chat-send").width() var camw = $("#videochat-toggle").width() $("#chat-message").css("width", fw-sendw-camw-50) $("#form,#formbg").css("left", 0) $("#form").css("bottom", fbot) $("#form,#formbg").css("width", fw) var controlsw = $("#controls").width() var controlsoffset = ( w - fw - controlsw ) / 2 $("#controls").css({ "top": "auto", "bottom": fbot+2, "right": controlsoffset, "background": "black", "padding": 10, }) $("#lastlogbox,#lastlogbg").css("top", h/3).css("left", w*(7/8)-10) $("#lastlogbg").css("height", $("#lastlogbox").height()) }, playerTop: 94, chatWidth: 500, chatBottom: 75, formHeight: 50, standardResize: function () { var w = $(window).width() var h = $(window).height() var ytw = 1 * w / 2 - 90 if (ytw > 500) ytw = 500 var yth = ytw * 9/ 16 var fh = Viewport.formHeight var cw = w - ytw - 80 var ch = 2 * h / 3 var chatheight = h-fh-5 Viewport.chatWidth = cw var pw = cw - 20 var ph = h / 3 - 30 var fbot = 20 var chatbot = Viewport.chatBottom var clw = cw*3/4 var clh = ch - fh - 50 var llw = cw / 4 - 30 var llh = ch - fh - 30 var sendw = $("#chat-send").width() var camw = $("#videochat-toggle").width() $("#chat-message").css("width", pw-sendw-camw-30) if (VideoChat.isOpen) { var vch = chatheight * 1 / 2 if (vch < 280) vch = 280 $("#tokbox-embed").css({"width": cw+20, "height": vch}) $("#tokbox-embedded").css({"height": vch}) chatheight -= vch chatbot += vch fbot += vch } var msgw = 0 var buttonheight = $("#fullscreen").height() $("#bg img").css("width", w) $("#bg img").css("height", h) $("#logo").css("left", 20) if (retrograde) { // PLAYER ON LEFT $("#player").css("left", 20) $("#player").css("top", Viewport.playerTop) $("#player").css("height", yth+buttonheight+20) $("#player,#projector,#screen,#ytscreen").width(ytw) $("#projector,#screen,#ytscreen").height(yth) Player.width = ytw Player.height = yth $("#controls").css("top", yth+10+10) var playerHeight = yth+buttonheight+Viewport.playerTop + 10 $("#playlist,#playlistbg").css("left", 20) $("#playlist,#playlistbg").css("top", playerHeight+30) $("#playlist,#playlistbg").css("width", ytw+19) $("#playlist,#playlistbg,#queue").css("height", h-playerHeight-50) $("#chat,#chatbg").css("left", 60+ytw) $("#chat,#chatbg").css("bottom", chatbot) $("#chat,#chatbg").css("width", cw) $("#chat,#chatbg").css("height", chatheight) // $("#chat").css("overflow-y", "scroll") // $("#chat").css("overflow-x", "hidden") $("#form,#formbg").css("left", 60+ytw) $("#form,#formbg").css("bottom", fbot) $("#form,#formbg").css("width", cw) $("#form,#formbg").css("height", fh-15) $("#formbg").css("opacity", 0.7) $("#lastlogbox,#lastlogbg").css("top", 90) $("#lastlogbox,#lastlogbg").css("left", ytw+60+clw) $("#lastlogbox,#lastlogbg").css("width", llw) $("#lastlogbox").css("max-height", (h-fh-70-40)*3/4) $("#lastlogbox").css("overflow-y", "auto") $("#lastlogbox").css("overflow-x", "hidden") $("#likereport").css("bottom", 90) $("#likereport").css("left", ytw+60+clw) $("#likereport").css("width", llw-20) $("#likereport").css("height", (h-fh-70-40)*1/4) $("#msg").css("max-height", h-130) } else { // PLAYER ON RIGHT $("#player").css("left", 40+pw+20) $("#player").css("top", Viewport.playerTop) $("#player").css("height", yth+buttonheight+20) $("#player,#projector,#screen,#ytscreen").width(ytw) $("#projector,#screen,#ytscreen").height(yth) $("#controls").css("top", yth+10+10) var playerHeight = yth+buttonheight+Viewport.playerTop+10 $("#playlist,#playlistbg").css("left", 40+pw+20) $("#playlist,#playlistbg").css("top", playerHeight+30) $("#playlist,#playlistbg").css("width", ytw+19) $("#playlist,#playlistbg,#queue").css("height", h-playerHeight-50) $("#chat,#chatbg").css("left", 0) $("#chat,#chatbg").css("bottom", chatbot) $("#chat,#chatbg").css("width", cw) $("#chat,#chatbg").css("height", chatheight) // $("#chat").css("overflow-y", "scroll") // $("#chat").css("overflow-x", "hidden") $("#plant").css("left", cw-300) $("#form,#formbg").css("left", 0) $("#form").css("bottom", fbot) $("#form,#formbg").css("width", cw) $("#form,#formbg").css("height", fh-15) $("#formbg").css("opacity", 0.7) $("#lastlogbox,#lastlogbg").css("top", 90) $("#lastlogbox,#lastlogbg").css("left", 10+clw) $("#lastlogbox,#lastlogbg").css("width", llw) $("#lastlogbox").css("max-height", (h-fh-70-40)*3/4) $("#lastlogbox").css("overflow-y", "auto") $("#lastlogbox").css("overflow-x", "hidden") var lrwidth = llw-20 if (lrwidth < 150) lrwidth = 150 $("#likereport").css("bottom", 90) $("#likereport").css("left", cw-lrwidth-90) $("#likereport").css("width", lrwidth) $("#likereport").css("max-height", (h-fh-70-40)*1/4) $("#msg").css("max-height", h-130) } $("#lastlogbg").css("height", $("#lastlogbox").height()) d.scrollToBottom("#chat") }, scrollbarWidth: 16, getScrollbarWidth: function () { var initial = document.body.style.overflow document.body.style.overflow = 'hidden'; var width = document.body.clientWidth; document.body.style.overflow = 'scroll' width -= document.body.clientWidth if (! width) width = document.body.offsetWidth - document.body.clientWidth document.body.style.overflow = initial return width }, focus: function () { d.warn("VIEWPORT FOCUS") if (! Viewport.fullscreenMode || Viewport.fullscreenInterface) Keyboard.focusTextarea() document.body.tabIndex = 0 document.body.focus() Viewport.focused = true // Chat.delay = 1000 if (Like.pending) Like.fire() // Chat.delay = Chat.delayShort }, blur: function () { d.warn("VIEWPORT BLUR") Viewport.focused = false // Chat.delay = Chat.delayLong }, chatMouseOver: function () { $("#chat").css({"overflow-y": "scroll", "width": Viewport.chatWidth + Viewport.scrollbarWidth }) $("#chat").scrollTop( $("#chat").scrollTop() ) }, chatMouseOut: function () { $("#chat").css({"overflow-y": "hidden", "width": Viewport.chatWidth}) }, init: function () { Viewport.scrollbarWidth = Viewport.getScrollbarWidth () $("#chat").bind("mouseover", Viewport.chatMouseOver) $("#chat").bind("mouseout", Viewport.chatMouseOut) } } var Background = { src: "http://scannerjammer.com/static/bgz/jupiteraurora.jpg", srcReset: "http://scannerjammer.com/static/bgz/1302474305250-dumpfm-GucciSoFlosy-pattern4.gif", load: function () { $("#bg").show() //setTimeout(function(){$("#bg img").attr("src", Background.src)}, 2000) }, init: function () { } } var Include = { glitter: function () { Room.ops = {} $("body").append("") $("body").append("") d.enableStylesheet("glitter") }, avatar: function () { Room.ops = {} $("body").append("") $("body").append("") d.enableStylesheet("avatar") }, jonomilo: function () { Room.ops = d.buildLookup(["daytimetelevision"]) d.enableStylesheet("white") $("#heading").remove() $("#topic").remove() $("#likebutton").before("
") Include.middleColumn () }, middleColumn: function () { Chat.previousName = false Chat.containsImage = function (s) { if (s.indexOf("http") === -1) return false var suffixes = ["jpg","jpeg","gif","png"] for (var i = 0; i < suffixes.length; i++) { if (s.indexOf(suffixes[i]) !== -1) { // console.log(suffixes[i] + " " + s) return true } } return false } Chat.parse = function (row) { if (Chat.containsImage(row[3])) { var s = "