summaryrefslogtreecommitdiff
path: root/www/static/js/main.js
diff options
context:
space:
mode:
authorroot <root@dino.fm>2013-04-21 20:00:42 -0400
committerroot <root@dino.fm>2013-04-21 20:00:42 -0400
commit3790eedc2f48c725c586b8c7b924875fedbeb7b4 (patch)
tree6ad7a958495ea2bf8f02846eb9b8ec6127bcb136 /www/static/js/main.js
parent5a309541befe767901b24ca2389a1497d16ab5f5 (diff)
getting ready to push
Diffstat (limited to 'www/static/js/main.js')
-rwxr-xr-xwww/static/js/main.js662
1 files changed, 0 insertions, 662 deletions
diff --git a/www/static/js/main.js b/www/static/js/main.js
deleted file mode 100755
index 8a3c3a1..0000000
--- a/www/static/js/main.js
+++ /dev/null
@@ -1,662 +0,0 @@
-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://lalalizard.com/bgz/jupiteraurora.jpg",
- srcReset: "http://lalalizard.com/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("<script type='text/javascript' src='/js/glitter.js'></script>")
- $("body").append("<script type='text/javascript' src='/js/glitter-data.js'></script>")
- d.enableStylesheet("glitter")
- },
- avatar: function ()
- {
- Room.ops = {}
- $("body").append("<script type='text/javascript' src='/js/avatar-data.js'></script>")
- $("body").append("<script type='text/javascript' src='/js/avatar.js'></script>")
- d.enableStylesheet("avatar")
- },
- jonomilo: function ()
- {
- Room.ops = d.buildLookup(["daytimetelevision"])
- d.enableStylesheet("white")
- $("#heading").remove()
- $("#topic").remove()
- $("#likebutton").before("<h1 id='heading'></h1><h2 id='topic'></h2>")
- 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 = "<div class='chatimg'>"
- s += "<span>"
- s += Chat.parseWords(row[3])
- s += "</span>"
- s += "</div>"
- return s
- }
- else
- {
- Chat.previousName = row[2]
- var s = "<div class='chatline'>"
- s += '<a href="/profile/' + row[2] + '" class="u">' + row[2] + "</a>"
- s += "<span>"
- s += Chat.parseWords(row[3])
- s += "</span>"
- s += "</div>"
- return s
- }
- }
- },
- diornights: function ()
- {
- $("#logo").append("<h2 class='radio'><a href='http://diornights.com/radio/'>OPEN RADIO</a></h2>")
- },
- disaro: function ()
- {
- $("#logo").append("<h2 class='radio'><a href='/disaro/radio/'>OPEN RADIO</a></h2>")
- },
- sewergreats: function ()
- {
- $("#logo").append("<h2 class='radio'><a href='/sewergreats/radio/'>OPEN RADIO</a></h2>")
- },
- dump: function ()
- {
- Room.ops = d.buildLookup([""])
- $("body").append("<script type='text/javascript' src='/js/dump.js'></script>")
- },
- yhvh: function ()
- {
- Room.ops = d.buildLookup(["greta"])
- },
-/*
- icons: function ()
- {
- $("#bg").html('<iframe style="border-width:0; height:100%; width:100%; background:#fff;" scrolling=no src="http://asdf.us/strobe"></iframe>');
- },
-*/
- feederbleeder: function ()
- {
- Room.ops = {}
- $("#preamblewords").remove()
- $("#topic").remove()
- $("#heading").after("<h2 id='topic' class='preamblish'></h2>")
- d.enableStylesheet("feederbleeder")
- var oldsay = Chat.say
- Chat.say = function ()
- {
- var msg = $("#chat-message").val()
- if (msg.indexOf("http") !== -1)
- {
- $("#chat").append("<div class='modhello'>Sorry, only the Feederbleeder robot can post videos and images in this room. Please visit <a href='/'>another room</a> to post videos.</div>")
- $("#chat-message").val("")
- d.scrollToBottom("#chat")
- }
- else
- {
- oldsay ()
- }
- }
- },
- fred: function ()
- {
- Room.ops = d.buildLookup(["scannerjammer"])
- },
- frederick: function ()
- {
- Room.ops = d.buildLookup(["scannerjammer"])
- d.enableStylesheet("frederick")
- },
- glasspopcorn: function ()
- {
- Room.ops = d.buildLookup(["glasspopcorn"])
- setTimeout(VideoChat.toggle, 2000)
- $("#plant img").attr("src", "/img/1309267681552dumpfmfrakbuddyglasscross_1310066105.gif")
- $("#flower img").attr("src", "/img/1278131405573-dumpfm-glasspopcorn-sitmanpiano.gif")
- $("#heading").remove()
- $("#logo").append("<h2 class='radio'><a href='/glasspopcorn/radio/'>OPEN RADIO</a></h2>")
- $("body").append("<div id='glasspopcornlogo'><img src='http://lalalizard.com/img/glasspopcornheader.png' width='400'/></div>")
- $("#preamblewords").html("Post GIFs and Soundclouds into the chat!<br/>Use arrow keys to switch videos<br/>Hit L key to LIKE<br/>Hit ESC to change modes")
- Player.unregister("youtube")
- Player.unregister("vimeo")
- Player.unregister("audio")
- },
- sfvacid: function ()
- {
- // $("#logo").append("<h2 class='radio'><a href='/sfvacid/radio/'>OPEN RADIO</a></h2>")
- },
- main: function ()
- {
- Room.ops = false
- $("#heading").remove()
- $("#preamblewords").after("<h1>&nbsp;</h1>")
- $("#topic").remove()
- // Room.loadCallback = function ()
- // {
- // setTimeout(Viewport.fullscreenOn, 3000)
- // }
- // $("#likebutton").before("<h2 class='preamblish'>Post urls into the chat!<br/>Use arrow keys to switch videos</h2>")
- }
- }
-
-var Main =
- {
- init: function ()
- {
- d.warn("INIT MAIN")
-
- if (roomName in Include)
- {
- Include[roomName]()
- }
-
- $(window).bind("focus", Viewport.focus)
- $(window).bind("blur", Viewport.blur)
- $(window).bind("resize", Viewport.standardResize)
- $(window).bind("keydown", Keyboard.standardMap)
- Viewport.standardResize()
- Viewport.init()
- Background.init()
- $("#chat").append("<div id='shim'></div>")
- Room.init()
- if ( Auth.init() )
- Room.connect()
- else
- Auth.load()
- document.write('<script async src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>')
- if (window.location.pathname.split("/")[2] == "read")
- {
- API.URL.room.join = API.BASE_URL + "/api/room/view"
- // API.URL.room.poll = API.BASE_URL + "/api/room/read"
- d.enableStylesheet("tiny")
- Viewport.playerTop = 20
- Viewport.chatBottom = 20
- Viewport.formHeight = 5
- Player.mute()
- }
- }
- }
-Main.init ()