summaryrefslogtreecommitdiff
path: root/www/static/js/admin.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/static/js/admin.js')
-rwxr-xr-xwww/static/js/admin.js119
1 files changed, 0 insertions, 119 deletions
diff --git a/www/static/js/admin.js b/www/static/js/admin.js
deleted file mode 100755
index 92a0421..0000000
--- a/www/static/js/admin.js
+++ /dev/null
@@ -1,119 +0,0 @@
-var Admin =
- {
- videos: {},
- viewRoom: function ()
- {
- var videoKey = ''
- var hash = document.location.hash
- if (hash.indexOf("#") !== -1)
- hash = hash.substr(1)
- var partz = hash.split("&")
- for (i in partz)
- {
- var pair = partz[i].split("=")
- if (pair[0] === "v")
- videoKey = pair[1]
- }
- d.warn("VIEWING ROOM "+Room.name)
- $.post(API.URL.room.view, {'room':Room.name,'session':Auth.session,}).success(Admin.viewCallback).error(Admin.viewError)
- },
- viewError: function (raw)
- {
- d.warn(raw)
- },
- viewCallback: function (raw)
- {
- var lines = API.parse("/room/view", raw)
- if (! lines)
- return d.error("UNABLE TO LOAD ROOM")
- var ll = lines.shift().split("\t")
- if (ll[0] === '0')
- return d.error(ll[1])
-
- Lastlog.update(lines.shift())
- Admin.storeVideos(lines)
- },
- storeVideos: function (lines)
- {
- var rows = []
- var lastDate = ""
- for (i in lines.reverse())
- {
- var row = lines[i].split("\t")
- if (row[0].indexOf("ROOM") === 0)
- {
- Room.updateSetting(row[1],row[2])
- continue
- }
- if (row[0].indexOf("VIDEO") === 0)
- {
- var type = "??"
- if (row[5].indexOf("youtube") !== -1)
- type = "yt"
- else if (row[5].indexOf("vimeo") !== -1)
- type = "vm"
- else if (row[5].indexOf("soundcloud") !== -1)
- type = "sc"
- else if (row[5].indexOf("mp3") !== -1)
- type = "au"
- // 0 VIDEO 1 id 2 date 3 userid 4 username 5 url 6 title
- var d = new Date(parseInt(row[2])*1000)
- var thisDate = makeClockDate(d)
- if (thisDate === lastDate)
- thisDate = ""
- else
- lastDate = thisDate
- var li = "<li id='video_"+row[1]+"'>"
- li += "<span class='date'>"+thisDate+"</span>"
- li += "<span class='time'>"+makeClockTime(d)+"</span>"
- li += "<a class='user' href='/profile/"+row[4]+"' target='_blank'>"+row[4]+"</a>"
- li += "<span class='type'>"+type+"</span>"
- li += "<a class='title' href='"+row[5]+"' target='_blank'>"+row[6]+"</a>"
- li += "<span class='remove' id='remove_"+row[1]+"'>remove</span>"
- li += "</li>"
- rows.push(li)
- Admin.videos[row[1]] = { id: row[1], title: row[6], username: row[4] }
- }
- }
- $("#videos").css({"display": "inline-block", "vertical-align": "top"})
- $("#videos").html(rows.join(""))
- },
- removeVideoClick: function ()
- {
- var id = $(this).attr("id")
- var idx = id.substr(id.indexOf("_")+1)
- var video = Admin.videos[idx]
- d.act("+ remove video "+idx)
- if (confirm(video.title+"\nposted by "+video.username+"\n\nThis video will be removed from the queue."))
- $.post(API.URL.video.remove, {session:Auth.session, video:idx, room:Room.name}).success(Admin.removeVideoSuccess)
- },
- removeVideoSuccess: function (raw)
- {
- var lines = API.parse("/video/remove", raw)
- if (! lines)
- return d.error("UNABLE TO REMOVE VIDEO")
- var l = lines.shift().split("\t")
- if (l[0] === '0')
- {
- d.error(l[1])
- return
- }
- d.warn(l[1])
- $("#video_"+l[0]).fadeOut(500)
- }
- }
-var months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")
-function makeClockDate(d)
- {
- var date = d.getDate()
- var month = months[d.getMonth()]
- return date+"-"+month
- }
-function makeClockTime(d)
- {
- var h = d.getHours()
- var m = d.getMinutes()
- if (m < 10)
- m = "0" + m
- return h+":"+m
- }