summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rwxr-xr-xwww/static/js/admin.js119
-rwxr-xr-xwww/static/js/api.js132
-rwxr-xr-xwww/static/js/audio.js142
-rwxr-xr-xwww/static/js/auth.js166
-rwxr-xr-xwww/static/js/avatar-data.js1
-rwxr-xr-xwww/static/js/avatar.js236
-rwxr-xr-xwww/static/js/calendar.js273
-rwxr-xr-xwww/static/js/chat.js280
-rwxr-xr-xwww/static/js/debug.js130
-rwxr-xr-xwww/static/js/dump.js2
-rwxr-xr-xwww/static/js/embed.js142
-rwxr-xr-xwww/static/js/glitter-data.js1
-rwxr-xr-xwww/static/js/glitter.js108
-rwxr-xr-xwww/static/js/jquery-1.5.2.min.js16
-rwxr-xr-xwww/static/js/jquery.md5.js230
-rwxr-xr-xwww/static/js/like.js97
-rwxr-xr-xwww/static/js/main.js662
-rwxr-xr-xwww/static/js/player.js546
-rwxr-xr-xwww/static/js/poll.js53
-rwxr-xr-xwww/static/js/profile.js540
-rwxr-xr-xwww/static/js/register.js292
-rwxr-xr-xwww/static/js/room.js459
-rwxr-xr-xwww/static/js/roomlist.js166
-rwxr-xr-xwww/static/js/search.js191
-rwxr-xr-xwww/static/js/sj6.js6505
-rwxr-xr-xwww/static/js/soundcloud.js157
-rwxr-xr-xwww/static/js/soundmanager2.js2838
-rwxr-xr-xwww/static/js/swfobject.js4
-rwxr-xr-xwww/static/js/test-admin.js93
-rwxr-xr-xwww/static/js/tokbox.js181
-rwxr-xr-xwww/static/js/top.js251
-rwxr-xr-xwww/static/js/vimeo.js100
-rwxr-xr-xwww/static/js/youtube.js177
33 files changed, 0 insertions, 15290 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
- }
diff --git a/www/static/js/api.js b/www/static/js/api.js
deleted file mode 100755
index c6bc082..0000000
--- a/www/static/js/api.js
+++ /dev/null
@@ -1,132 +0,0 @@
-var API =
- {
- HEADER: "#@scanjam 0.3b",
- BASE_URL: "http://"+serverHost+":"+serverPort,
- URL:
- {
- auth:
- {
- login: "/api/auth/login",
- logout: "/api/auth/logout",
- checkin: "/api/auth/checkin",
- sneakin: "/api/auth/sneakin",
- },
- room:
- {
- join: "/api/room/join",
- list: "/api/room/list",
- view: "/api/room/view",
- poll: "/api/room/poll",
- watch: "/api/room/watch",
- say: "/api/room/say",
- settings: "/api/room/settings",
- stats: "/stats",
- },
- video:
- {
- date: "/api/video/date",
- like: "/api/video/like",
- unlike: "/api/video/unlike",
- remove: "/api/video/remove",
- search: "/api/video/search",
- },
- user:
- {
- settings: "/api/user/settings",
- videos: "/api/user/videos",
- likes: "/api/user/likes",
- },
- },
- error: function (s)
- {
- d.error("API: "+s)
- return false
- },
- parse: function (api, raw)
- {
- if (! raw)
- return API.error("no result")
- var lines = raw.split("\n")
- if (lines.shift() !== API.HEADER)
- return API.error("bad header")
- if (! lines.length)
- return API.error("no content")
- return lines
- },
- init: function ()
- {
- d.warn("INIT API")
- for (type in API.URL)
- {
- for (name in API.URL[type])
- {
- API.URL[type][name] = API.BASE_URL + API.URL[type][name]
- }
- }
- // $.ajaxSetup({ timeout: 1000 })
- }
- }
-var Local =
- {
- support: false,
- hash: null,
- get: null,
- set: null,
- _html5_get: function (key)
- {
- var val = localStorage["scanjam."+key]
- if (val === "true") return true
- if (val === "false") return false
- if (val === "undefined") return undefined
- return val
- },
- _html5_set: function (key, val)
- {
- if (val === undefined)
- localStorage["scanjam."+key] = ""
- else
- localStorage["scanjam."+key] = val
- },
- _hash_get: function (key)
- {
- if (key in Local.hash)
- return Local.hash[key]
- },
- _hash_set: function (key, val)
- {
- Local.hash[key] = val
- },
- _supports_html5_storage: function ()
- {
- try
- { return 'localStorage' in window && window['localStorage'] !== null; }
- catch (e)
- { return false }
- },
- like: function (videoid)
- { Local.set("like."+videoid, true) },
- unlike: function (videoid)
- { Local.set("like."+videoid, false) },
- isLiked: function (videoid)
- { return Local.get("like."+videoid) },
- init: function ()
- {
- Local.support = Local._supports_html5_storage()
- if (Local.support)
- {
- d.warn("SUPPORTS LOCAL STORAGE")
- Local.get = Local._html5_get
- Local.set = Local._html5_set
- }
- else
- {
- d.error("NO LOCAL STORAGE")
- Local.hash = {}
- Local.get = Local._hash_get
- Local.set = Local._hash_set
- }
- }
- }
-API.init()
-Local.init()
-
diff --git a/www/static/js/audio.js b/www/static/js/audio.js
deleted file mode 100755
index de33851..0000000
--- a/www/static/js/audio.js
+++ /dev/null
@@ -1,142 +0,0 @@
-var Audio =
- {
- type: "audio",
- loaded: false,
- pending: false,
- playing: false,
- paused: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 100,
- play: function (video)
- {
- d.warn("AUDIO PLAY "+video.key)
- if (video.error)
- return Audio.error()
- if (Audio.playing)
- Audio.stop()
- $("#screen").html("<div id='audio'></div><div id='audio-img'></div><div id='audio-dl'></div>")
- $("#ytscreen").css("z-index", -2)
- Audio.video = video
- Audio.playing = false
-
- var partz = video.src.split(" ")
- var img = partz[0]
- var url = partz[1]
- var title = partz.slice(2).join(" ")
-
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Audio.player = soundManager.createSound
- ({
- id: "player-"+video.id,
- url: url,
- volume: Audio.volume,
- onfinish: Audio.finish,
- onerror: Audio.error,
- onload: Audio.onload,
- })
- if (! Audio.player)
- return Audio.error("no player")
- Audio.player.play()
-
- $("#video-title").html(title)
- $("#video-link").attr("href", url)
- $("#audio-dl").html('<a href="'+url+'" target="_parent">download</a>')
- $("#audio-img").html("<img src='"+img+"' id='audio-art' />")
- $("#audio-art").bind("error", function(){$("#audio-art").hide()})
- },
- onload: function (success)
- {
- if (! success)
- return Audio.error("failed to load")
- },
- toggle: function ()
- {
- d.warn("TOGGLE PLAYBACK")
- if (Audio.paused)
- return Audio.resume()
- else
- return Audio.pause()
- },
- error: function (s)
- {
- if (! s)
- s = "unspecified error"
- Player.error("AUDIO "+s)
- Audio.finish()
- },
- setVolume: function (vol)
- {
- Audio.volume = vol
- if (Audio.player)
- Audio.player.setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Audio.paused = true
- Audio.playing = false
- if (Audio.player)
- Audio.player.pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Audio.paused = false
- Audio.playing = true
- if (Audio.player)
- Audio.player.resume()
- return false
- },
- stop: function ()
- {
- d.warn("AUDIO STOP")
- if (Audio.player)
- Audio.player.stop()
- Audio.playing = false
- },
- finish: function ()
- {
- d.warn("AUDIO FINISH")
- Audio.playing = false
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING AUDIO")
- Audio.loaded = true
- },
- unload: function ()
- {
- d.warn("AUDIO UNLOADED")
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Audio.loaded = false
- Audio.playing = false
- },
- init: function ()
- {
- d.warn("AUDIO INIT")
- }
- }
-Player.register(Audio)
-soundManager.url = '/swf/'
-soundManager.useFlashBlock = false
-soundManager.debugMode = false
diff --git a/www/static/js/auth.js b/www/static/js/auth.js
deleted file mode 100755
index a0c667d..0000000
--- a/www/static/js/auth.js
+++ /dev/null
@@ -1,166 +0,0 @@
-var Auth =
- {
- userid: false,
- username: false,
- session: false,
- loaded: false,
- access: 0,
- login: function ()
- {
- d.warn("LOG IN")
- var username = d.trim( $("#login-username").val() )
- var password = d.trim( $("#login-password").val() )
- var pwhash = $.md5("scanjam"+password)
- if (! username || ! password) return
- Main.enter = false
- d.warn("LOGGING IN")
- $.post(API.URL.auth.login, {'username':username, 'password': pwhash}, Auth.loginCallback)
- $("#chat").hide()
- },
- loginCallback: function (raw)
- {
- var lines = API.parse("/auth/login", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- u = lines[1].split("\t")
-
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.session = u[2]
- Auth.access = u[3]
-
- document.cookie = "session="+Auth.session+";path=/;domain=.scannerjammer.com;max-age=1086400"
- Auth.success()
- },
- checkin: function ()
- {
- d.warn("CHECK IN")
- $.post(API.URL.auth.checkin, {'session':Auth.session}, Auth.checkinCallback)
- },
- checkinCallback: function (raw)
- {
- var lines = API.parse("/auth/checkin", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- u = lines[1].split("\t")
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.success()
- },
- sneakin: function (userid,username)
- {
- d.warn("SNEAK IN")
- $.post(API.URL.auth.sneakin, {'userid':userid,'username':username}).success(Auth.sneakinCallback)
- },
- sneakinCallback: function (raw)
- {
- var lines = API.parse("/auth/sneakin", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- d.joy("snuck in!")
- u = lines[1].split("\t")
-
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.session = u[2]
- Auth.access = u[3]
-
- d.warn(lines[1])
- if (! Auth.session)
- return
- document.cookie = "session="+Auth.session+";path=/;domain=.scannerjammer.com;max-age=1086400"
- Auth.success()
- },
- logout: function ()
- {
- d.warn("LOG OUT")
- clearTimeout(Room.timer)
- Room.unload()
- Auth.userid = false
- Auth.username = false
- Local.set('userid', false)
- Local.set('username', false)
- document.cookie = "session=false;path=/;domain=.scannerjammer.com;max-age=0"
- Auth.session = ""
- Auth.load()
- },
- error: function ()
- {
- Auth.load()
- },
- success: function ()
- {
- d.joy("logged in as "+Auth.username)
- Auth.unload()
- Room.load()
- },
- unload: function ()
- {
- d.warn("AUTH UNLOAD")
- $("#login").hide()
- $("#loading").show()
- Keyboard.enter = false
- Auth.loaded = false
- },
- load: function ()
- {
- d.warn("AUTH LOAD")
- $("#loading").hide()
- $("#login").show()
- $("#login-username").focus()
- $("#login-username").keydown(Keyboard.textareaMap)
- $("#login-password").keydown(Keyboard.textareaMap)
- $("#login-password").val("")
- $("#login-go").click(Auth.login)
- Keyboard.enter = Auth.login
- $("#bg").show()
- Auth.loaded = true
- },
- init: function ()
- {
- d.warn("INIT AUTH")
- if (document.cookie)
- {
- d.warn("got a cookie")
- d.warn(document.cookie)
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("session") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Auth.session = cookie[1]
- break
- }
- }
- }
- d.warn("got sessionid "+Auth.session)
- if (Auth.session)
- return true
- }
- var userid = Local.get('userid')
- var username = Local.get('username')
- if (userid && username)
- {
- d.warn("attempting to sneak in "+username)
- Auth.sneakin(userid,username)
- return true
- }
- return false
- }
- }
-
diff --git a/www/static/js/avatar-data.js b/www/static/js/avatar-data.js
deleted file mode 100755
index 3d18fa7..0000000
--- a/www/static/js/avatar-data.js
+++ /dev/null
@@ -1 +0,0 @@
-AVATARS = ["arcane2.gif", "21.gif", "39.gif", "22.gif", "51.gif", "63.gif", "42.gif", "6.gif", "43.gif", "30.gif", "13.gif", "23.gif", "70.gif", "34.gif", "9.gif", "33.gif", "4.gif", "17.gif", "29.gif", "5.gif", "28.gif", "57.gif", "20.gif", "50.gif", "18.gif", "8.gif", "12.gif", "64.gif", "3.gif", "69.gif", "49.gif", "71.gif", "11.gif", "36.gif", "56.gif", "46.gif", "37.gif", "19.gif", "40.gif", "15.gif", "10.gif", "24.gif", "41.gif", "67.gif", "38.gif", "66.gif", "48.gif", "26.gif", "72.gif", "14.gif", "54.gif", "65.gif", "27.gif", "32.gif", "62.gif", "25.gif", "68.gif", "45.gif", "59.gif", "61.gif", "47.gif", "53.gif", "60.gif", "16.gif", "44.gif", "2.gif", "52.gif", "1.gif", "55.gif", "31.gif", "7.gif", "58.gif", "35.gif"]
diff --git a/www/static/js/avatar.js b/www/static/js/avatar.js
deleted file mode 100755
index 11d39d4..0000000
--- a/www/static/js/avatar.js
+++ /dev/null
@@ -1,236 +0,0 @@
-var Avatar =
- {
- orientation: true,
- loaded: false,
- }
-Room.loadCallback = function () { setTimeout(Viewport.fullscreenOn, 500) }
-Chat.store = function (lines)
- {
- var newVideos = []
- var newChat = []
- var postponeScroll = false
- for (i in lines)
- {
- if (! lines[i])
- continue
- row = lines[i].split("\t")
- if (row[0] === 'VIDEO')
- {
- row.shift()
- if (row[0] in Chat.oldVideo)
- continue
- Chat.oldVideo[row[0]] = row
- Playlist.enqueueOldVideoFormat([row])
- }
- else if (row[0] === 'ROOM')
- {
- Room.updateSetting(row[1],row[2])
- }
- else if (row[0] === 'LIKE')
- {
- username = row[1]
- Like.enqueue(username)
- }
- else if (row[0] === 'CAM')
- {
- VideoChat.updateCount(row[1])
- }
- else
- {
- // 0 id 1 date 2 user 3 msg
- if (row[0] in Chat.oldChat)
- continue
- Chat.oldChat[row[0]] = row
- var c = Chat.parse(row)
- if (c.indexOf("<img") !== -1)
- {
- postponeScroll = true
- d.joy(">> POSTPONING")
- }
- if (row[2] === Auth.username && $.md5(row[3]) in Chat.messages)
- continue
- newChat.push(c)
- }
- }
- if (newChat.length)
- {
- if (Avatar.loaded)
- {
- $("#chat").append(newChat.join(""))
- }
- else
- {
- Avatar.loaded = true
- $("#chat").append(newChat[newChat.length-1])
- }
- if (postponeScroll)
- setTimeout('d.scrollToBottom("#chat")', 2000)
- else
- d.scrollToBottom("#chat")
- }
- }
-Chat.say = function ()
- {
- d.act("+ sent message")
- var msg = d.sanitize( $("#chat-message").val() )
- $("#chat-message").val("")
- if (! msg) return
- if (msg === "debug=1") { $("#msg").show(); d.scrollToBottom("#msg"); return }
- if (msg === "debug=0") { $("#msg").hide(); return }
- if (msg === "poll=0") { d.error("+ DISABLED POLLING"); clearTimeout(Chat.timer); return}
- if (msg.indexOf("bg=") === 0) { Room.setBg( msg.split("=",2)[1] ); return }
- var hash = $.md5(msg)
- Chat.messages[hash] = true
- var newrow = [0, 0, Auth.username, msg]
- // var newdiv = Chat.parse(newrow)
- // $("#chat").append(newdiv)
- // if (newdiv.indexOf("<img") !== -1)
- // setTimeout('d.scrollToBottom("#chat")', 2000)
- if (msg.indexOf("scannerjammer.com/avatar") === -1)
- msg = "http://scannerjammer.com/avatar/" + d.choice(AVATARS) + " " + msg
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: msg}, Room.sayCallback)
- d.scrollToBottom("#chat")
- }
-Chat.parse = function (row)
- {
- return Chat.parseWords(row[3])
- },
-Chat.parseWords = function (raw)
- {
- var words = raw.split(" ")
- var s = ""
- for (i in words)
- {
- var avatar = ""
- var word = words[i]
- if (word.indexOf("http") !== -1)
- {
- if (word.indexOf("scannerjammer.com/avatar") !== -1)
- {
- avatar = word
- }
- else if (word.indexOf("youtube.com/watch?") !== -1)
- {
- var ytid = "youtube_"+Youtube.getYtid(word)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtube.com/v/") !== -1)
- {
- var index = word.indexOf("/v/")
- var ytid = "youtube_"+word.substr(index+3,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtu.be") !== -1)
- {
- var ytid = "youtube_"+word.substr(16,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- // http://www.youtube.com/user/ahchachachacha#p/f/28/1GSBekxLR1E
- else if (word.indexOf("youtube.com/user") !== -1)
- {
- var ytid = "youtube_"+word.substr(-11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("vimeo.com") !== -1)
- {
- var vimeoid = word.replace(VIMEOregexp, "vimeo_$3")
- if (vimeoid in Player.videos)
- txt = Player.videos[vimeoid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+vimeoid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("soundcloud.com") !== -1)
- {
- var scid = "soundcloud_" + $.md5(word)
- if (scid in Player.videos)
- txt = Player.videos[scid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+scid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf(".jpeg") !== -1 ||
- word.indexOf(".JPG") !== -1 ||
- word.indexOf(".GIF") !== -1 ||
- word.indexOf(".PNG") !== -1 ||
- word.indexOf(".JPEG") !== -1 ||
- word.indexOf(".jpg") !== -1 ||
- word.indexOf(".gif") !== -1 ||
- word.indexOf(".png") !== -1)
- {
- s += '<a href="'+word+'" target="_blank" class="pic"><img src="'+word+'" /></a>'
- }
- else if (word.indexOf("scannerjammer.com/profile") !== -1)
- {
- var username = word.substr( word.indexOf("profile")+8 ).replace("/","")
- s += '<a href="'+word+'">ScannerJammer: '+username+'</a>'
- }
- else
- {
- var poffset = word.indexOf('//')
- var linktext = word.substr(poffset+2, word.indexOf('/', poffset+2)).replace("www.","")
- s += '<a href="'+word+'" target="_blank">'+linktext+'</a> '
- }
- }
- else if (word.indexOf(".com") !== -1 ||
- word.indexOf(".net") !== -1 ||
- word.indexOf(".org") !== -1 ||
- word.indexOf(".us") !== -1 ||
- word.indexOf(".nu") !== -1 ||
- word.indexOf(".uk") !== -1 ||
- word.indexOf(".fr") !== -1 ||
- word.indexOf(".de") !== -1 ||
- word.indexOf(".fm") !== -1)
- {
- var txt = word.replace("www.","")
- s += '<a href="http://'+word+'" target="_blank">'+txt+'</a> '
- }
- else
- s += word + " "
- }
- if (! avatar.length)
- avatar = d.choice(AVATARS)
- Avatar.orientation = ! Avatar.orientation
- if (Avatar.orientation)
- {
- var q = '<div class="frame"><table border="0"><tr><td valign="top" class="avatar-left"><img src="'+ avatar +'"/></td>'
- q += '<td valign="top" class="tri"><div class="triangle-left"></div></td><td class="message">'
- q += '<div class="message-blurb">' + s + '</div></td></tr></table></div>'
- return q
- }
- else
- {
- var q = [
- '<div class="frame">',
- '<table border="0"><tr><td valign="top" class="message"><div class="message-blurb">',
- s,
- '</div></td><td valign="top" class="tri"><div class="triangle-right"></div></td><td valign="top" class="avatar-right">',
- '<img src="',
- avatar,
- '" /></td></tr></table></div>'
- ].join("")
- return q
- }
-
- return s
- }
diff --git a/www/static/js/calendar.js b/www/static/js/calendar.js
deleted file mode 100755
index cf70e29..0000000
--- a/www/static/js/calendar.js
+++ /dev/null
@@ -1,273 +0,0 @@
-var Keyboard =
- {
- altMode: false,
- fullscreenKeys: 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.toggle()
- if (kc === 76)
- Player.likeClick()
- return false
- },
- standardKeys: function (event)
- {
- kc = event.keyCode
- if (kc === 91)
- {
- Keyboard.altMode = true
- return true
- }
- if (kc === 27)
- {
- Viewport.fullscreenOn()
- return false
- }
- if (kc === 37 || kc === 177)
- {
- Player.playPrev()
- return false
- }
- else if (kc === 39 || kc === 176)
- {
- Player.playNext()
- return false
- }
- if (! Keyboard.altMode && kc === 76)
- {
- Player.likeClick()
- return false
- }
- if (kc === 32 || kc === 179)
- {
- Player.toggle()
- return false
- }
- Keyboard.altMode = false
- return true
- }
- }
-var Viewport =
- {
- fullscreenMode: false,
- fullscreenOn: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls,#calendar,.furniture").hide()
- $("#settings-container").hide()
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.fullscreenResize)
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.fullscreenKeys)
- Viewport.fullscreenResize()
- Viewport.fullscreenMode = true
- },
- fullscreenResize: function ()
- {
- $("#projector").css({ position: 'fixed', top: 0, left: 0, width: $(window).width(), height: $(window).height() })
- $("#screen,#ytscreen").css({ width: $(window).width(), height: $(window).height() })
- },
- fullscreenOff: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls,#calendar,.furniture").show()
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.standardResize)
- Viewport.standardResize()
- Viewport.fullscreenMode = false
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.standardKeys)
- $("#fullscreen").unbind("click")
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- },
- standardResize: function ()
- {
- var w = $(window).width()
- var h = $(window).height()
-
- var ytw = (w)*1/3
- var yth = ytw * 9/16
-
- var buttonheight = $("#fullscreen").height()
-
- var topoffset = 100
- var rightoffset = 100
-
- $("#player").css("right", rightoffset)
- $("#player").css("top", topoffset)
- $("#player").css("height", yth+buttonheight+20)
- $("#player,#projector,#screen,#ytscreen").width(ytw)
- $("#projector,#screen,#ytscreen").height(yth)
- $("#projector").css("position", "absolute")
-
- $("#controls").css("top", yth+10+10)
- var playerHeight = yth+buttonheight+topoffset+10
-
- $("#playlist,#playlistbg").css("right", rightoffset)
- $("#playlist,#playlistbg").css("top", playerHeight+30)
- $("#playlist,#playlistbg").css("width", ytw+19)
- $("#playlist,#playlistbg,#queue").css("height", h-playerHeight-50)
-
- $("#controls").css({ position: 'absolute', top: yth+20, bottom: 'auto', right: 'auto', })
- $("#calendar").css({ top: playerHeight-63, right: rightoffset+ytw+50 })
- }
- }
-
-var Profile =
- {
- mode: false,
- loadQueue: function (queue)
- {
- if (! queue || ! queue.length)
- return
- Player.clearQueue()
- $("#queue").html("")
- Playlist.enqueueOldVideoFormat(queue)
- },
- init: function ()
- {
- }
- }
-
-var Room =
- {
- }
-var Poll =
- {
- room: "main",
- delay: 5000,
- init: function ()
- {
- if (document.cookie)
- {
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("room") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Poll.room = cookie[1]
- break
- }
- }
- }
- }
- Poll.poll()
- Viewport.standardResize()
- },
- poll: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- }
- }
-
-var Calendar =
- {
- background: "",
- dateLoad: function (y, m, d)
- {
- var data =
- {
- year: y,
- month: m,
- day: d,
- }
- $.post(API.URL.video.date, data).success(Calendar.dateSuccess)
- },
- todayLoad: function ()
- {
- d.warn("today")
- $.post(API.URL.video.date).success(Calendar.dateSuccess)
- },
- dateSuccess: function (raw)
- {
- var lines = API.parse("/video/date", raw)
- if (! lines.length) return
- var videos = []
- for (i in lines)
- {
- var line = lines[i].split("\t")
- if (line[0] === "BG")
- {
- if (Calendar.background === line[1])
- continue
- Calendar.background = line[1]
- $("#bg").fadeOut(1000, function ()
- {
- $("#bg img").attr("src", Calendar.background)
- $("#bg img").bind("load", function ()
- {
- $("#bg").fadeIn(1000)
- $("#bg img").unbind("load")
- })
- })
- }
- if (line[0] === "VIDEO")
- {
- line.shift()
- videos.push(line)
- }
- }
- Player.clearQueue()
- $("#queue").html("")
- Playlist.enqueueOldVideoFormat(videos)
- },
- onSelect: function (dateText, inst)
- {
- var datez = dateText.split("-")
- Calendar.dateLoad(datez[0], datez[1], datez[2])
- },
- init: function ()
- {
- $('#calendar').datepicker({
- inline: true,
- onSelect: Calendar.onSelect,
- dateFormat: "yy-m-d",
- minDate: new Date(2011, 2, 2),
- maxDate: new Date(),
- })
- Calendar.todayLoad()
- $('#calendar').fadeIn(1000)
- }
- }
-
-var Main =
- {
- init: function ()
- {
- $(window).bind("resize", Viewport.standardResize)
- $(window).bind("keydown", Keyboard.standardKeys)
- Playlist.showScores = true
- Auth.success = Poll.init
- if (Auth.init())
- Auth.checkin()
- Profile.init()
- Player.init()
- Like.likeVideoDelay = 6000
- $("#controls").fadeIn(2000)
- $("#contact").fadeIn(2000)
- setTimeout('Viewport.standardResize()', 1000)
- Calendar.init()
- }
- }
-Main.init()
-
diff --git a/www/static/js/chat.js b/www/static/js/chat.js
deleted file mode 100755
index 822e1ee..0000000
--- a/www/static/js/chat.js
+++ /dev/null
@@ -1,280 +0,0 @@
-var VIMEOregexp = /^(\bhttps?:\/\/)(www.)?vimeo.com\/([0-9]+).*$/i
-var Chat =
- {
- timer: null,
- oldChat: {},
- oldVideo: {},
- lastPoll: 0,
- delay: 1000,
- delayShort: 1000,
- delayLong: 5000,
- messages: {},
- callback: false,
- parse: function (row)
- {
- var s = '<a href="/profile/' + row[2] + '" class="u">' + row[2] + "</a> <span>"
- s += Chat.parseWords(row[3])
- s += "</span><br />"
- return s
- },
- parseWords: function (raw)
- {
- if (! raw)
- return ""
- var words = raw.split(" ")
- var s = ""
- for (i in words)
- {
- var word = words[i]
- if (word.indexOf("http") !== -1)
- {
- if (word.indexOf("youtube.com/watch?") !== -1)
- {
- var ytid = "youtube_"+Youtube.getYtid(word)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtube.com/v/") !== -1)
- {
- var index = word.indexOf("/v/")
- var ytid = "youtube_"+word.substr(index+3,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtu.be") !== -1)
- {
- var ytid = "youtube_"+word.substr(16,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- // http://www.youtube.com/user/ahchachachacha#p/f/28/1GSBekxLR1E
- else if (word.indexOf("youtube.com/user") !== -1)
- {
- var ytid = "youtube_"+word.substr(-11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("vimeo.com") !== -1)
- {
- var vimeoid = word.replace(VIMEOregexp, "vimeo_$3")
- if (vimeoid in Player.videos)
- txt = Player.videos[vimeoid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+vimeoid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("soundcloud.com") !== -1)
- {
- var scid = "soundcloud_" + $.md5(word)
- if (scid in Player.videos)
- txt = Player.videos[scid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+scid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf(".jpeg") !== -1 ||
- word.indexOf(".JPG") !== -1 ||
- word.indexOf(".GIF") !== -1 ||
- word.indexOf(".PNG") !== -1 ||
- word.indexOf(".JPEG") !== -1 ||
- word.indexOf(".jpg") !== -1 ||
- word.indexOf(".gif") !== -1 ||
- word.indexOf(".png") !== -1)
- {
- s += '<a href="'+word+'" target="_blank" class="pic"><img src="'+word+'" /></a>'
- }
- else if (word.indexOf("scannerjammer.com/profile") !== -1)
- {
- var username = word.substr( word.indexOf("profile")+8 ).replace("/","")
- s += '<a href="'+word+'">@'+username+'</a>'
- }
- // else if (word.indexOf("@") === 0 && word.length > 2)
- // {
- // }
- else
- {
- var poffset = word.indexOf('//')
- var linktext = word.substr(poffset+2, word.indexOf('/', poffset+2) - 2).replace("www.","").replace(/\/+$/,"")
- s += '<a href="'+word+'" target="_blank">'+linktext+'</a> '
- }
- }
- else if (word.indexOf(".com") !== -1 ||
- word.indexOf(".net") !== -1 ||
- word.indexOf(".org") !== -1 ||
- word.indexOf(".us") !== -1 ||
- word.indexOf(".nu") !== -1 ||
- word.indexOf(".uk") !== -1 ||
- word.indexOf(".fr") !== -1 ||
- word.indexOf(".de") !== -1 ||
- word.indexOf(".fm") !== -1)
- {
- var txt = word.replace("www.","")
- s += '<a href="http://'+word+'" target="_blank">'+txt+'</a> '
- }
- else
- s += word + " "
- }
- return s
- },
- store: function (lines)
- {
- var newVideos = []
- var newChat = []
- var postponeScroll = false
- for (i in lines)
- {
- if (! lines[i])
- continue
- row = lines[i].split("\t")
- if (row[0] === 'VIDEO')
- {
- row.shift()
- if (row[0] in Chat.oldVideo)
- continue
- Chat.oldVideo[row[0]] = row
- Playlist.enqueueOldVideoFormat([row])
- }
- else if (row[0] === 'ROOM')
- {
- Room.updateSetting(row[1],row[2])
- }
- else if (row[0] === 'LIKE')
- {
- username = row[1]
- Like.enqueue(username)
- }
- else if (row[0] === 'CAM')
- {
- VideoChat.updateCount(row[1])
- }
- else
- {
- // 0 id 1 date 2 user 3 msg
- if (row[0] in Chat.oldChat)
- continue
- Chat.oldChat[row[0]] = row
- var c = Chat.parse(row)
- if (c.indexOf("<img") !== -1)
- {
- postponeScroll = true
- d.joy(">> POSTPONING")
- }
- if (row[2] === Auth.username && $.md5(row[3]) in Chat.messages)
- continue
- newChat.push(c)
- }
- }
- if (newChat.length)
- {
- $("#chat").append(newChat.join(""))
- if (postponeScroll)
- setTimeout('d.scrollToBottom("#chat")', 2000)
- else
- d.scrollToBottom("#chat")
- }
- },
- say: function ()
- {
- d.act("+ sent message")
- var msg = d.sanitize( $("#chat-message").val() )
- $("#chat-message").val("")
- if (! msg) return
- if (msg === "debug=1") { $("#msg").show(); d.scrollToBottom("#msg"); return }
- if (msg === "debug=0") { $("#msg").hide(); return }
- if (msg === "poll=0") { d.error("+ DISABLED POLLING"); clearTimeout(Chat.timer); return}
- var hash = $.md5(msg)
- Chat.messages[hash] = true
- var newrow = [0, 0, Auth.username, msg]
- var newdiv = Chat.parse(newrow)
- $("#chat").append(newdiv)
- // if (Chat.callback)
- // Chat.callback(1)
- if (newdiv.indexOf("<img") !== -1)
- setTimeout('d.scrollToBottom("#chat")', 2000)
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: msg}, Room.sayCallback)
- d.scrollToBottom("#chat")
- },
- send: function (msg)
- {
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: msg}, Room.sayCallback)
- // var hash = $.md5(msg)
- // Chat.messages[hash] = true
- // var newrow = [0, 0, Auth.username, msg]
- // var newdiv = Chat.parse(newrow)
- // $("#chat").append(newdiv)
- // if (newdiv.indexOf("<img") !== -1)
- // setTimeout('d.scrollToBottom("#chat")', 2000)
- // d.scrollToBottom("#chat")
- },
- sayCallback: function (raw)
- {
- var lines = API.parse("/room/say", raw)
- if (! lines) return
- var newid = lines.split("\t")[0]
- Chat.oldChat[newid] = true
- // Room.store(lines)
- d.joy("MESSAGE SENT")
- },
- poll: function ()
- {
- // d.warn("Polling")
- $.post(API.URL.room.poll,
- {
- room: Room.name,
- session: Auth.session,
- last: Chat.lastPoll,
- cam: VideoChat.isOpen,
- }).success(Chat.pollCallback).error(Chat.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- d.error("Poll failed, waiting "+Math.floor(Chat.delayLong)+"s...")
- Chat.timer = setTimeout(Chat.poll, Chat.delayLong)
- },
- pollCallback: function (raw)
- {
- // d.warn("Poll successful")
- Chat.timer = setTimeout(Chat.poll, Chat.delay)
- var lines = API.parse("/room/poll", raw)
- if (! lines)
- return d.error("Poll failed")
- Chat.lastPoll = parseInt(lines.shift()) - 1
- Lastlog.update(lines.shift())
- Chat.store(lines)
- }
- }
-
-var Lastlog =
- {
- old: "",
- update: function (lastlog)
- {
- if (Lastlog.old === lastlog)
- return
- Lastlog.old = lastlog
- var names = lastlog.split("\t")
- var s = ""
- for (i in names.sort())
- {
- s += "<li class='ll'><a href='/profile/"+names[i]+"'>"+names[i]+"</a></li>"
- }
- $("#lastlog").html(s)
- $("#lastlogbg").css("height", $("#lastlogbox").height())
- }
- }
diff --git a/www/static/js/debug.js b/www/static/js/debug.js
deleted file mode 100755
index 1a3339f..0000000
--- a/www/static/js/debug.js
+++ /dev/null
@@ -1,130 +0,0 @@
-var d =
- {
- DEBUG: false,
- act: function (s)
- {
- // $('#msg').append('<strong>'+s+'</strong><br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- joy: function (s)
- {
- // $('#msg').append('<b>'+s+'</b><br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- warn: function (s)
- {
- // $('#msg').append(s+'<br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- error: function (s)
- {
- // $('#msg').append('<em>ERROR: '+s+'</em><br/>')
- // d.scrollToBottom("#msg")
- // console.log(s)
- return false
- },
- noop: function () {},
- scrollToTop: function (elem)
- {
- $(elem).scrollTop( 0 )
- },
- scrollToBottom: function (elem)
- {
- try
- {
- $(elem).scrollTop( $(elem)[0].scrollHeight )
- }
- catch (err)
- {
- }
- },
- pageUp: function (div)
- {
- var st = $(div).scrollTop()
- var h = $(window).height()
- d.warn("PAGEUP: "+st+" "+h)
- $(div).scrollTop( st - (2/3) * h )
- var st = $(div).scrollTop()
- d.warn("ST NOW: "+st+" "+h)
- },
- pageDown: function (div)
- {
- var st = $(div).scrollTop()
- var h = $(window).height()
- $(div).scrollTop( st + (2/3) * h )
- },
- choice: function (list)
- {
- return list[Math.floor (Math.random () * list.length)]
- },
- trim: function (s)
- {
- if (s)
- return s.replace(/^\s+|\s+$/g,"")
- else
- return ""
- },
- sanitizeWithNewlines: function (s)
- {
- if (s)
- return d.trim( s ).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\0/g,"")
- return ""
- },
- sanitize: function (s)
- {
- if (s)
- return d.trim( s ).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\n/g,"").replace(/\r/g,"").replace(/\0/g,"")
- return ""
- },
- linkify: function (s)
- {
- var words = s.split(" ")
- var checked = []
- for (i in words)
- {
- var word = words[i]
- if (words[i].indexOf("http") === 0)
- {
- var poffset = word.indexOf('//')
- var linktext = word.substr(poffset+2, word.indexOf('/', poffset+2))
- checked.push('<a href="'+word+'" target="_blank">'+linktext+'</a>')
- }
- else
- checked.push(word)
- }
- return checked.join(" ")
- },
- enableStylesheet: function (style)
- {
- $("link[@rel*=style][title]").each(function (i)
- {
- if (this.getAttribute('title') == style)
- this.disabled = false
- })
- },
- disableStylesheet: function (style)
- {
- $("link[@rel*=style][title]").each(function (i)
- {
- if (this.getAttribute('title') == style)
- this.disabled = true
- })
- },
- buildLookup: function (list)
- {
- var lookup = {}
- for (var i = 0; i < list.length; i++)
- lookup[list[i]] = true
- return lookup
- }
- }
-
diff --git a/www/static/js/dump.js b/www/static/js/dump.js
deleted file mode 100755
index d6ca3c1..0000000
--- a/www/static/js/dump.js
+++ /dev/null
@@ -1,2 +0,0 @@
-$("#bg").html('<iframe style="border-width:0; height:100%; width:100%; background:#fff;" scrolling=no src="http://dump.fm/fullscreen"></iframe>')
-// $("#chatbg,#playlistbg").css({ 'background-color': '#fff' })
diff --git a/www/static/js/embed.js b/www/static/js/embed.js
deleted file mode 100755
index d52c7a0..0000000
--- a/www/static/js/embed.js
+++ /dev/null
@@ -1,142 +0,0 @@
-var VIMEOregexp = /^(\bhttps?:\/\/)(www.)?vimeo.com\/([0-9]+).*$/i
-var stWidget = {addEntry:function(){}}
-var Room =
- {
- load: function ()
- {
- }
- }
-var Keyboard =
- {
- standardMap: function (event)
- {
- kc = event.keyCode
- if (kc === 27) // && Room.loaded)
- {
- Menu.close()
- Viewport.fullscreenOn()
- return false
- }
- 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()
- event.preventDefault()
- }
- }
-var Viewport =
- {
- resize: function ()
- {
- var w = $(window).width()
- var h = $(window).height()
- var ytw = w
- var yth = ytw * 3/4
-
- var conheight = $("#controls").height()
- $("#player").css("height", yth+conheight+40)
- $("#player").css("top", 0).css("left", 0)
- $("#player,#projector,#screen,#ytscreen").width(ytw)
- $("#projector,#screen,#ytscreen").height(yth)
-
- $("#controls").css("top", yth)
- var playerTop = yth+15
-
- $("#playlist,#playlistbg").css("top", playerTop+20)
- $("#playlist,#playlistbg").css("width", '100%')
- $("#playlist,#playlistbg,#queue").css("height", h-playerTop-20)
- }
- }
-var Poll =
- {
- room: roomName,
- last: "1",
- delay: 60 * 1000,
- init: function ()
- {
- if (Auth.init())
- {
- Poll.poll = Poll.pollAuth
- Poll.delay = 3 * 1000
- Auth.success = Poll.poll
- Auth.checkin ()
- }
- else
- {
- Poll.poll = Poll.pollFree
- Poll.poll()
- }
- },
- poll: function () {},
- pollAuth: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollFree: function ()
- {
- $.post(API.URL.room.watch,
- {
- room: Poll.room,
- last: Poll.last,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- var lines = raw.split("\n")
- lines.shift()
- Poll.last = d.trim( lines.shift() )
- var videos = []
- for (i in lines)
- {
- if (lines[i].indexOf("VIDEO") === 0)
- {
- var row = lines[i].split("\t")
- row.shift()
- videos.push(row)
- }
- }
- if (videos.length)
- {
- Playlist.enqueueOldVideoFormat(videos)
- }
- }
- }
-
-var Main =
- {
- init: function ()
- {
- if (roomName === "disaro")
- $("title").html("DISARO 20†† RADIO")
- else if (roomName === "main")
- $("title").html("SCANNERJAMMER RADIO")
- else if (roomName === "sewergreats")
- $("title").html("SEWER GREATS RADIO")
- else
- $("title").html(roomName.toUpperCase()+" RADIO")
- $(window).bind("resize", Viewport.resize)
- Viewport.resize()
- $(window).bind("keydown", Keyboard.standardMap)
- Poll.init()
- Player.init()
- Playlist.init()
- $("#mute").bind("click", Player.muteClick)
- setTimeout('Player.start()', 2000)
- Player.queueOffset = 0
- }
- }
-Main.init()
diff --git a/www/static/js/glitter-data.js b/www/static/js/glitter-data.js
deleted file mode 100755
index 56787f2..0000000
--- a/www/static/js/glitter-data.js
+++ /dev/null
@@ -1 +0,0 @@
-GLITTER_DATA = ["Young-Red-Witch.gif", "You-Want-It-Come-and-Get-It.gif", "Winnie-Glitter-2.gif", "XoXo-Hearts.gif", "Winnie-Glitter.gif", "woman-style-lipstick-makeup.gif", "Yellow-Bird.gif", "Wings-2.gif", "Wings-5.gif", "Washington-Redskins.gif", "Vibrate-Me.gif", "Tweety-Bird-Dancing.gif", "Two-Sexy-Gals.gif", "Vibrate-Me-1.gif", "Tinkerbell.gif", "Tired-Puppy.gif", "Tinkerbell-Green-Dress.gif", "Tinkerbell-Flying.gif", "tiger_eye_sparkle.gif", "thanksc.gif", "Tinkerbell-Dreamy.gif", "Thank-You-Friend.gif", "Tear-Drop-Fairy.gif", "Texas-Rangers.gif", "Teddy-Bear-Glitter.gif", "Tampa-Bay-Devilrays.gif", "St-Louis-Rams.gif", "Tear-Drop-Fairy-1.gif", "staypunk-sparkle-cross.gif", "Sucker.gif", "sparkle-logo.gif", "Spanish-Beauty.gif", "Spank-Me.gif", "Spank-Me-1.gif", "Silver-Flower-Face.gif", "Sleek-Red.gif", "Simply-Pink.gif", "Some-Like-It-hot.gif", "Soft-Ice-Cream.gif", "Showing-Sexy-Luv.gif", "Silver-Cross.gif", "Sharing-Fruit.gif", "Sexy-White-Hair.gif", "Show-It-To-Me.gif", "showin_some_love_reflecting_rosebud.gif", "Sexy-Cape.gif", "Sexy-Flower-Bed.gif", "Sexy-Silver.gif", "Sexy-Star.gif", "sexy-100.gif", "Sexy-Blue-Hearts.gif", "Sexy-Bitch-Leoppard-1.gif", "Sexy-Bitch-Leoppard.gif", "Sexy-Black-White.gif", "Set-Me-free.gif", "Riding-Roses.gif", "Rose.gif", "Samurai-Chick.gif", "Red-Umbrella.gif", "Res-Fantasy-Sky.gif", "Red-Haze-Fairy.gif", "Red-Rose-Glitter.gif", "Red-Hair-Glitter.gif", "Red-Head-Goth.gif", "Purple-Flower-and-Butterfly.gif", "proud-mom-aunt.gif", "Red-Flower.gif", "Purple-Gal.gif", "Purple-Glitter-Flower.gif", "Powerpuff-Blossom.gif", "Princess-Fairy.gif", "Potty-Head-Care-Bear.gif", "Playboy-Purple.gif", "Playboy-Pink.gif", "Playboy-Silver.gif", "Playboy-Bunny-Pink.gif", "Playboy-Orange.gif", "Playboy-24.gif", "Playboy-4.gif", "Playboy-047.gif", "Playboy-Blue.gif", "Playboy-9.gif", "Playboy-5.gif", "Pittsburgh-Penguins.gif", "Playboy-032.gif", "Playboy-029.gif", "Playboy-036.gif", "Playboy-045.gif", "Pink-Lips-High-Heals.gif", "Pink-Shoe.gif", "Pink-Godess.gif", "pinkcowgirl.gif", "Pink-Heart-Dolphins.gif", "Pink-Glitter-Star.gif", "Pink-Bitches.gif", "Pink-Fantashy-Hearts.gif", "Philadelphia-Phillies.gif", "Philadelphia-Eagles.gif", "Phoenix-Coyotes.gif", "Overlooking-Fairy.gif", "Philadelphia-Eagles-1.gif", "Parental-Advisor.gif", "Palm-Tree.gif", "penis.gif", "Orange-Love.gif", "Orange-Eyes.gif", "Ninja-Turtle.gif", "Oh-My.gif", "Nice-Brow.gif", "New-York-Yankees.gif", "never-give-up.gif", "new-year-29.gif", "New-England-Patriots.gif", "myspace-flower-rose.gif", "Naughty-Pink.gif", "Naught-Girl-Grey.gif", "Music-Note-Glitter.gif", "Marilyn-Silver-Sparkle.gif", "Mushroom-Fairy.gif", "Muscle-Legs.gif", "Mickey.gif", "Minnesota-Wild.gif", "Long-Legs.gif", "Los-Angeles-Dodgers.gif", "Love-The-Lord.gif", "Marilyn-Silver-Sparkle-1.gif", "Live-For-Jesus.gif", "lindsay-lohan.gif", "Leopard-Legs.gif", "LETS-KISS.gif", "Kumba.gif", "Kansas-City-Chiefs.gif", "kisses-for-my-valentine-glitter.gif", "Kinky-Care-Bear.gif", "Kite-Care-Bear.gif", "ice-cream-cone-dessert-sweet-smile.gif", "Im-such-a-Bad-Girl.gif", "I-Love-Mickey.gif", "Jazz.gif", "Hot-Stuff.gif", "Hot-Pink-Bikini.gif", "Houston-Texans.gif", "Hot-Pink-Lady.gif", "Howdy-Hat.gif", "Hot-Long-Hair.gif", "Honey.gif", "Hot-Jail-Babe.gif", "Here-Big-Boy.gif", "Hello-Blue-Roses.gif", "Hello-Rose.gif", "Hi-Sexy-Red.gif", "Hollow-Heart-Red.gif", "Heart-Underwear.gif", "Have-Dreams.gif", "He-Died-For-you.gif", "Have-A-Beautiful-Day.gif", "happy-new-year.gif", "happy-new-year-computer.gif", "happy-new-year-524.gif", "happy-new-year-527.gif", "gtmc048.gif", "gtmc058.gif", "Happy-Feb-14th-Arrow-Heart.gif", "gtmc079.gif", "gtmc072.gif", "gtmc067.gif", "gtmc034.gif", "gtmc039.gif", "gtmc037.gif", "gtmc041.gif", "Green-Palm-Tree.gif", "Gorgeous-Pink-Flowers.gif", "goodbye7(combine).gif", "Gorgeous-Fairy.gif", "Ghetto-Booty.gif", "Getting-Ready.gif", "glitterfriend38.gif", "flirting-my-way-to-the-top.gif", "flowers.gif", "Fur-Cowgirl.gif", "Florida-Marlins.gif", "Fantasy-Fairy.gif", "Fantasy-Fairy-5.gif", "Fendi-Yellow.gif", "Fantasy-Fairy-8.gif", "Fairy-Wings-5.gif", "Fantasy-Fairy-4.gif", "Fairy-Wings-4.gif", "Fantasy-Fairy-10.gif", "Fairy-Waterfalls.gif", "Fairy-Fantasy-5.gif", "Fairy-Chest.gif", "Fairy-Caught-in-Jar.gif", "Fairy-23.gif", "Fairy-18.gif", "egypt_320_320_256_9223372036854775000_0_1_0.gif", "eye-glitter.gif", "egypt_320_256_9223372036854775000_0_1_0.gif", "Drppin-By-To-Say-hellow.gif", "Droppin-In-To-Say-Hello.gif", "egypt.gif", "Eeyore-Angel.gif", "dreamer.gif", "Dirty-Little-Secret.gif", "Dolphin-Animated.gif", "Cuban-Babe.gif", "Cupid-Just-Struck.gif", "date13.gif", "Colour-My-World.gif", "Cone-Get-It.gif", "Close-Girlfriends.gif", "Colorado-Rockies.gif", "cleopatra-elizabeth-liz-taylor-dress-babe.gif", "Cleveland-Indians.gif", "christmas-sexy6.gif", "christian_symbol07.gif", "christmas-sexy11.gif", "Chicago-Whitesox.gif", "Chicago-Cubs.gif", "Cherries.gif", "Chicago-Bears.gif", "Cat-Fairy.gif", "Cheetah-Chick.gif", "Cherries-Glittler.gif", "Cell-Phone-Glitter.gif", "Butterfly-Girl.gif", "California-Angels.gif", "Blue-Purple-Shoe.gif", "Buffalo-Bills.gif", "Bulls.gif", "Broken-heart-Pink.gif", "Burger-King-Glitter.gif", "Booty-Call.gif", "Blue-Care-Bear.gif", "Blue-Dolphin.gif", "Blue-Flower-03.gif", "Blue-Flower-02.gif", "Blue-Cape-Fairy.gif", "Blue-Butterfly-Heaven.gif", "Bloody-Vampire.gif", "Black-Kisses.gif", "Black-Razzers.gif", "blonde_gold_sparkle.gif", "Belly-Dnacer.gif", "Belly-Dancer.gif", "Belle-Glitter.gif", "beauty-red-rose-sparkle.gif", "Bible-Diet.gif", "beautiful-unicorn-magical-sparkle.gif", "Beautiful-Friendship.gif", "Beat-Hell.gif", "Baltimore-Orioles.gif", "Baltimore-Ravens.gif", "Atlanta-Falcons.gif", "awkward_pink_purple_glitter_wiggle.gif", "babe-bikini-butt-ass-face.gif", "Atlanta-Braves.gif", "Arizona-Cardinals.gif", "Arizona-Diamondbacks.gif", "ani-sparkle-fountain.gif", "American-Sexy-Thing.gif", "Aloha-Girl.gif", "American-Sexy-Thing-1.gif", "American-Flag-Heart.gif", "Air-Plane.gif", "1292462203316-dumpfm-yrmomvsmymom-sparkle.gif", "aaliyah.gif", "99-percent-tejana-and-1-percent-floridian.gif", "100-Percent-Sexy-Cowgirl.gif"]
diff --git a/www/static/js/glitter.js b/www/static/js/glitter.js
deleted file mode 100755
index 9aed159..0000000
--- a/www/static/js/glitter.js
+++ /dev/null
@@ -1,108 +0,0 @@
-var Glitter =
- {
- path: "/img/glitter/",
- delay: 50,
- count: 0,
- radius: $(window).height() / 3,
- direction: false,
- centerX: $(window).width() * 2 / 7,
- centerY: $(window).height() / 3,
- loopTimer: false,
- loopers: [],
- rotate: function (id, angle, radius, direction, opacity)
- {
- if (direction)
- angle += 2
- else
- angle -= 2
- radians = angle * Math.PI / 180
- newX = Math.sin(radians) * radius + Glitter.centerX
- newY = Math.cos(radians) * radius + Glitter.centerY
- $(id).css({ "left": newX, "top": newY, "opacity": opacity/100 })
- opacity -= 1
- if (opacity === 0)
- {
- $(id).remove()
- return false
- }
- return [id, angle, radius, direction, opacity]
- },
- loop: function ()
- {
- var newLoopers = []
- for (i in Glitter.loopers)
- {
- var l = Glitter.loopers[i]
- var r = Glitter.rotate(l[0], l[1], l[2], l[3], l[4])
- if (r)
- newLoopers.push(r)
- }
- Glitter.loopers = newLoopers
- Glitter.loopTimer = setTimeout(Glitter.loop, Glitter.delay)
- },
- go: function ()
- {
- Glitter.count += 1
- // if (Glitter.count % 20 === 0)
- // Glitter.direction = ! Glitter.direction
- var index = Math.floor( Math.random() * GLITTER_DATA.length )
- var radius = Glitter.radius + Math.floor( Math.random() * 100 )
- var angle = Math.floor( Math.random() * 360 )
- var opacity = 100
- var newsrc = GLITTER_DATA[index]
- var newid = "glitter_" + Glitter.count
- var newdiv = "<div id='"+newid+"' class='glitter'><img src='"+Glitter.path+newsrc+"'/></div>"
- // console.log(newdiv)
- $("body").append(newdiv)
- Glitter.loopers.push(["#"+newid, angle, radius, Glitter.direction, opacity])
- if (! Glitter.loopTimer)
- Glitter.loop()
- },
- generate: function (count)
- {
- if (count > 1)
- count = 1
- for (var i = 0; i < count; i++)
- setTimeout(Glitter.go, 50)
- },
- oldTextareaMap: Keyboard.textareaMap,
- oldStandardMap: Keyboard.standardMap,
- oldFullscreenMap: Keyboard.fullscreenMap,
- fullscreenMap: function (event)
- {
- Chat.callback(1)
- return Glitter.oldFullscreenMap(event)
- },
- standardMap: function (event)
- {
- Chat.callback(1)
- return Glitter.oldStandardMap(event)
- },
- textareaMap: function (event)
- {
- Chat.callback(1)
- return Glitter.oldTextareaMap(event)
- },
- init: function ()
- {
- $("#glitter-go").bind("click", Glitter.go)
- $("#flower img").attr("src", "/img/glitter_flower.gif")
- Chat.callback = Glitter.generate
- Like.likeVideoDelay = 10000
- var newtitle = "<img src='/img/glitter_scannerjammer.gif' />"
- setTimeout('$("#heading").html("'+newtitle+'")', 6000)
- $("#topic").css({position:"fixed", top: 40, left: 750})
- Room.loadCallback = function ()
- {
- setTimeout(Viewport.fullscreenOn, 500)
- setTimeout('$("#logobg").css({width: "100%"})', 1000)
- Keyboard.textareaMap = Glitter.textareaMap
- Keyboard.standardMap = Glitter.standardMap
- Keyboard.fullscreenMap = Glitter.fullscreenMap
- Keyboard.focusTextarea()
- }
- },
- }
-Glitter.init()
-
-
diff --git a/www/static/js/jquery-1.5.2.min.js b/www/static/js/jquery-1.5.2.min.js
deleted file mode 100755
index f78f96a..0000000
--- a/www/static/js/jquery-1.5.2.min.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.5.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Thu Mar 31 15:28:23 2011 -0400
- */
-(function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bR(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bQ(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bs.test(a)?e(a,f):bQ(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bQ(a+"["+f+"]",b[f],c,e)}function bP(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bJ,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bP(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bP(a,c,d,e,"*",g));return l}function bO(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bD),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bq(a,b,c){var e=b==="width"?bk:bl,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function bc(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bb(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function ba(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function _(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function $(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Q(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(L.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(r,"")===a.type?q.push(g.selector):t.splice(i--,1);f=d(a.target).closest(q,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){f=p[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:D?function(a){return a==null?"":D.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?B.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){F["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),E&&(d.inArray=function(a,b){return E.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?y=function(){c.removeEventListener("DOMContentLoaded",y,!1),d.ready()}:c.attachEvent&&(y=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",y),d.ready())});return d}(),e="then done fail isResolved isRejected promise".split(" "),f=[].slice;d.extend({_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(d,f)}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),f;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(f)return f;f=a={}}var c=e.length;while(c--)a[e[c]]=b[e[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&&a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c<e;c++)b[c]&&d.isFunction(b[c].promise)?b[c].promise().then(i(c),h.reject):--g;g||h.resolveWith(h,b)}else h!==a&&h.resolveWith(h,e?[a]:[]);return h.promise()}}),function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i<j;i++)g=f[i].name,g.indexOf("data-")===0&&(g=g.substr(5),h(this[0],g,e[g]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=h(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var j=/[\n\t\r]/g,k=/\s+/,l=/\r/g,m=/^(?:href|src|style)$/,n=/^(?:button|input)$/i,o=/^(?:button|input|object|select|textarea)$/i,p=/^a(?:rea)?$/i,q=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(k);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(k);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(j," ");for(var i=0,l=c.length;i<l;i++)h=h.replace(" "+c[i]+" "," ");g.className=d.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),i=b,j=a.split(k);while(f=j[g++])i=e?i:!h.hasClass(f),h[i?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(j," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j<k;j++){var m=h[j];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(q.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(l,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&q.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,H(a.origType,a.selector),d.extend({},a,{handler:G,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,H(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?y:x):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=y;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=y;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=y,this.stopPropagation()},isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x};var z=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},A=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?A:z,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?A:z)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&E("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&E("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var B,C=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var F={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=r.exec(h),k="",j&&(k=j[0],h=h.replace(r,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(F[h]+k),h=h+k):h=(F[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)d.event.add(n[p],"live."+H(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+H(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"text"===c&&(b===c||b===null)},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var I=/Until$/,J=/^(?:parents|prevUntil|prevAll)/,K=/,/,L=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,N=d.expr.match.POS,O={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(Q(this,a,!1),"not",a)},filter:function(a){return this.pushStack(Q(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/<tbody/i,W=/<|&#?\w+;/,X=/<(?:script|object|embed|option|style)/i,Y=/checked\s*(?:[^=]|=\s*.checked.)/i,Z={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.length?this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&Y.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?$(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,bc)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!X.test(a[0])&&(d.support.checkClone||!Y.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1></$2>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cf(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ce("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(ce("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cf(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(ca.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=cb.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(cc),cc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var cg=/^t(?:able|d|h)$/i,ch=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=ci(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!cg.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file
diff --git a/www/static/js/jquery.md5.js b/www/static/js/jquery.md5.js
deleted file mode 100755
index 0333717..0000000
--- a/www/static/js/jquery.md5.js
+++ /dev/null
@@ -1,230 +0,0 @@
-
- /**
- * jQuery MD5 hash algorithm function
- *
- * <code>
- * Calculate the md5 hash of a String
- * String $.md5 ( String str )
- * </code>
- *
- * Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash.
- * MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of data. The generated hash is also non-reversable. Data cannot be retrieved from the message digest, the digest uniquely identifies the data.
- * MD5 was developed by Professor Ronald L. Rivest in 1994. Its 128 bit (16 byte) message digest makes it a faster implementation than SHA-1.
- * This script is used to process a variable length message into a fixed-length output of 128 bits using the MD5 algorithm. It is fully compatible with UTF-8 encoding. It is very useful when u want to transfer encrypted passwords over the internet. If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
- * This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
- *
- * Example
- * Code
- * <code>
- * $.md5("I'm Persian.");
- * </code>
- * Result
- * <code>
- * "b8c901d0f02223f9761016cfff9d68df"
- * </code>
- *
- * @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
- * @link http://www.semnanweb.com/jquery-plugin/md5.html
- * @see http://www.webtoolkit.info/
- * @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
- * @param {jQuery} {md5:function(string))
- * @return string
- */
-
- (function($){
-
- var rotateLeft = function(lValue, iShiftBits) {
- return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
- }
-
- var addUnsigned = function(lX, lY) {
- var lX4, lY4, lX8, lY8, lResult;
- lX8 = (lX & 0x80000000);
- lY8 = (lY & 0x80000000);
- lX4 = (lX & 0x40000000);
- lY4 = (lY & 0x40000000);
- lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
- if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
- if (lX4 | lY4) {
- if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
- else return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
- } else {
- return (lResult ^ lX8 ^ lY8);
- }
- }
-
- var F = function(x, y, z) {
- return (x & y) | ((~ x) & z);
- }
-
- var G = function(x, y, z) {
- return (x & z) | (y & (~ z));
- }
-
- var H = function(x, y, z) {
- return (x ^ y ^ z);
- }
-
- var I = function(x, y, z) {
- return (y ^ (x | (~ z)));
- }
-
- var FF = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var GG = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var HH = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var II = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var convertToWordArray = function(string) {
- var lWordCount;
- var lMessageLength = string.length;
- var lNumberOfWordsTempOne = lMessageLength + 8;
- var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;
- var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;
- var lWordArray = Array(lNumberOfWords - 1);
- var lBytePosition = 0;
- var lByteCount = 0;
- while (lByteCount < lMessageLength) {
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
- lByteCount++;
- }
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
- lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
- lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
- return lWordArray;
- };
-
- var wordToHex = function(lValue) {
- var WordToHexValue = "", WordToHexValueTemp = "", lByte, lCount;
- for (lCount = 0; lCount <= 3; lCount++) {
- lByte = (lValue >>> (lCount * 8)) & 255;
- WordToHexValueTemp = "0" + lByte.toString(16);
- WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);
- }
- return WordToHexValue;
- };
-
- var uTF8Encode = function(string) {
- string = string.replace(/\x0d\x0a/g, "\x0a");
- var output = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- output += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- output += String.fromCharCode((c >> 6) | 192);
- output += String.fromCharCode((c & 63) | 128);
- } else {
- output += String.fromCharCode((c >> 12) | 224);
- output += String.fromCharCode(((c >> 6) & 63) | 128);
- output += String.fromCharCode((c & 63) | 128);
- }
- }
- return output;
- };
-
- $.extend({
- md5: function(string) {
- var x = Array();
- var k, AA, BB, CC, DD, a, b, c, d;
- var S11=7, S12=12, S13=17, S14=22;
- var S21=5, S22=9 , S23=14, S24=20;
- var S31=4, S32=11, S33=16, S34=23;
- var S41=6, S42=10, S43=15, S44=21;
- string = uTF8Encode(string);
- x = convertToWordArray(string);
- a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
- for (k = 0; k < x.length; k += 16) {
- AA = a; BB = b; CC = c; DD = d;
- a = FF(a, b, c, d, x[k+0], S11, 0xD76AA478);
- d = FF(d, a, b, c, x[k+1], S12, 0xE8C7B756);
- c = FF(c, d, a, b, x[k+2], S13, 0x242070DB);
- b = FF(b, c, d, a, x[k+3], S14, 0xC1BDCEEE);
- a = FF(a, b, c, d, x[k+4], S11, 0xF57C0FAF);
- d = FF(d, a, b, c, x[k+5], S12, 0x4787C62A);
- c = FF(c, d, a, b, x[k+6], S13, 0xA8304613);
- b = FF(b, c, d, a, x[k+7], S14, 0xFD469501);
- a = FF(a, b, c, d, x[k+8], S11, 0x698098D8);
- d = FF(d, a, b, c, x[k+9], S12, 0x8B44F7AF);
- c = FF(c, d, a, b, x[k+10], S13, 0xFFFF5BB1);
- b = FF(b, c, d, a, x[k+11], S14, 0x895CD7BE);
- a = FF(a, b, c, d, x[k+12], S11, 0x6B901122);
- d = FF(d, a, b, c, x[k+13], S12, 0xFD987193);
- c = FF(c, d, a, b, x[k+14], S13, 0xA679438E);
- b = FF(b, c, d, a, x[k+15], S14, 0x49B40821);
- a = GG(a, b, c, d, x[k+1], S21, 0xF61E2562);
- d = GG(d, a, b, c, x[k+6], S22, 0xC040B340);
- c = GG(c, d, a, b, x[k+11], S23, 0x265E5A51);
- b = GG(b, c, d, a, x[k+0], S24, 0xE9B6C7AA);
- a = GG(a, b, c, d, x[k+5], S21, 0xD62F105D);
- d = GG(d, a, b, c, x[k+10], S22, 0x2441453);
- c = GG(c, d, a, b, x[k+15], S23, 0xD8A1E681);
- b = GG(b, c, d, a, x[k+4], S24, 0xE7D3FBC8);
- a = GG(a, b, c, d, x[k+9], S21, 0x21E1CDE6);
- d = GG(d, a, b, c, x[k+14], S22, 0xC33707D6);
- c = GG(c, d, a, b, x[k+3], S23, 0xF4D50D87);
- b = GG(b, c, d, a, x[k+8], S24, 0x455A14ED);
- a = GG(a, b, c, d, x[k+13], S21, 0xA9E3E905);
- d = GG(d, a, b, c, x[k+2], S22, 0xFCEFA3F8);
- c = GG(c, d, a, b, x[k+7], S23, 0x676F02D9);
- b = GG(b, c, d, a, x[k+12], S24, 0x8D2A4C8A);
- a = HH(a, b, c, d, x[k+5], S31, 0xFFFA3942);
- d = HH(d, a, b, c, x[k+8], S32, 0x8771F681);
- c = HH(c, d, a, b, x[k+11], S33, 0x6D9D6122);
- b = HH(b, c, d, a, x[k+14], S34, 0xFDE5380C);
- a = HH(a, b, c, d, x[k+1], S31, 0xA4BEEA44);
- d = HH(d, a, b, c, x[k+4], S32, 0x4BDECFA9);
- c = HH(c, d, a, b, x[k+7], S33, 0xF6BB4B60);
- b = HH(b, c, d, a, x[k+10], S34, 0xBEBFBC70);
- a = HH(a, b, c, d, x[k+13], S31, 0x289B7EC6);
- d = HH(d, a, b, c, x[k+0], S32, 0xEAA127FA);
- c = HH(c, d, a, b, x[k+3], S33, 0xD4EF3085);
- b = HH(b, c, d, a, x[k+6], S34, 0x4881D05);
- a = HH(a, b, c, d, x[k+9], S31, 0xD9D4D039);
- d = HH(d, a, b, c, x[k+12], S32, 0xE6DB99E5);
- c = HH(c, d, a, b, x[k+15], S33, 0x1FA27CF8);
- b = HH(b, c, d, a, x[k+2], S34, 0xC4AC5665);
- a = II(a, b, c, d, x[k+0], S41, 0xF4292244);
- d = II(d, a, b, c, x[k+7], S42, 0x432AFF97);
- c = II(c, d, a, b, x[k+14], S43, 0xAB9423A7);
- b = II(b, c, d, a, x[k+5], S44, 0xFC93A039);
- a = II(a, b, c, d, x[k+12], S41, 0x655B59C3);
- d = II(d, a, b, c, x[k+3], S42, 0x8F0CCC92);
- c = II(c, d, a, b, x[k+10], S43, 0xFFEFF47D);
- b = II(b, c, d, a, x[k+1], S44, 0x85845DD1);
- a = II(a, b, c, d, x[k+8], S41, 0x6FA87E4F);
- d = II(d, a, b, c, x[k+15], S42, 0xFE2CE6E0);
- c = II(c, d, a, b, x[k+6], S43, 0xA3014314);
- b = II(b, c, d, a, x[k+13], S44, 0x4E0811A1);
- a = II(a, b, c, d, x[k+4], S41, 0xF7537E82);
- d = II(d, a, b, c, x[k+11], S42, 0xBD3AF235);
- c = II(c, d, a, b, x[k+2], S43, 0x2AD7D2BB);
- b = II(b, c, d, a, x[k+9], S44, 0xEB86D391);
- a = addUnsigned(a, AA);
- b = addUnsigned(b, BB);
- c = addUnsigned(c, CC);
- d = addUnsigned(d, DD);
- }
- var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
- return tempValue.toLowerCase();
- }
- });
- })(jQuery); \ No newline at end of file
diff --git a/www/static/js/like.js b/www/static/js/like.js
deleted file mode 100755
index f564f4c..0000000
--- a/www/static/js/like.js
+++ /dev/null
@@ -1,97 +0,0 @@
-var Like =
- {
- timeout: false,
- likeVideoDelay: 1000,
- likeMessageDelay: 10000,
- favewords:
- [
- 'dazzled', 'dangled', 'amazed', 'shocked', 'wowed',
- 'spangled', 'glittered', 'blinged', 'jazzed', 'smoked',
- 'rocked', 'jammed', 'stoked', 'blazed', 'pringled', 'engulfed',
- ],
- colors:
- [
- "#ffa1b8","#ffb9a1","#ffe8a1","#ffa1e7","#a1a4ff","#cda1ff","#fca1ff","#a1d3ff","#e8a1ff","#a1f6ff","#a1ffaa","#c7ffa1"
- ],
- enqueue: function (username)
- {
- d.joy("liked by "+username)
- $("#likereport").append(
- $("<a>").attr("href","/profile/"+username).html(username+" was "+d.choice(Like.favewords)+"!").attr("style","color:"+d.choice(Like.colors)))
- if (Viewport.focused)
- Like.fire()
- else
- Like.pending = true
- },
- fire: function ()
- {
- d.joy("LIKE ANIMATION GO")
- Like.pending = false
- $("#likereport").stop(false,false).show()
- d.scrollToBottom("#likereport")
- $("#plant").stop(true, true).show()
- $("#flower").stop(true, true).show()
- if (Like.timeout)
- clearTimeout(Like.timeout)
- Like.timeout = setTimeout(Like.queueFade, 1000)
- },
- queueFade: function timeout()
- {
- d.joy("LIKE ANIMATION FADE")
- Like.timeout = false
- $("#plant").fadeOut(Like.likeVideoDelay)
- $("#flower").fadeOut(Like.likeVideoDelay)
- $("#likereport").fadeOut(Like.likeMessageDelay, function(){$("#likereport").html("")})
- },
- likeVideo: function (video)
- {
- if (! Auth.session)
- return d.error("like: not logged in")
- if (video.username === Auth.username)
- return d.error("like: that's you")
- var data = { video: video.id, session: Auth.session, }
- if (Local.isLiked(video.id))
- {
- d.joy("unliking "+video.key)
- if (Player.currentKey === video.key)
- $("#like").removeClass("liked")
- $("#like_"+video.id).removeClass("liked").html("&nbsp;&nbsp;like")
- video.liked = false
- Local.unlike(video.id)
- if (video.score)
- {
- video.score -= 1
- if (video.score < 0)
- {
- video.score = 0
- $("#score_"+video.id).html('&nbsp;')
- }
- else
- {
- $("#score_"+video.id).html(video.score)
- }
- }
- $.post(API.URL.video.unlike, data)
- }
- else
- {
- d.joy("liking "+video.key)
- if (Player.currentKey === video.key)
- $("#like").addClass("liked")
- $("#like_"+video.id).addClass("liked").html("liked")
- $("#flower").show().fadeOut(Like.likeVideoDelay)
- video.liked = true
- Local.like(video.id)
- if (video.score)
- {
- video.score += 1
- $("#score_"+video.id).html(video.score)
- }
- $.post(API.URL.video.like, data)
- }
- },
- init: function ()
- {
- }
- }
-
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 ()
diff --git a/www/static/js/player.js b/www/static/js/player.js
deleted file mode 100755
index 87973a4..0000000
--- a/www/static/js/player.js
+++ /dev/null
@@ -1,546 +0,0 @@
-var VIMEOregexp = /^(\bhttps?:\/\/)(www.)?vimeo.com\/([0-9]+).*$/i
-var PLAY_BUTTONS =
- {
- prev: "<div class='arrow-prev'></div> <div class='arrow-prev'></div>",
- next: "<div class='arrow-next'></div> <div class='arrow-next'></div>",
- pause: "<div class='arrow-pause'></div> <div class='arrow-pause'></div>",
- play: "<div class='arrow-play'></div>",
- }
-var Player =
- {
- videos: {},
- queue: [],
- projectors: {},
- projector: null,
- newVideos: false,
- currentIdx: 0,
- video: false,
- errors: 0,
- width: '100%',
- height: '100%',
- playlistOffset: 30,
- queueOffset: 60,
- paused: false,
- muted: false,
- enqueue: function (video)
- {
- if (! (video.type in Player.projectors))
- return d.error("unknown video type "+video.type)
- var key = video.type+"_"+video.name
- if (key in Player.videos)
- {
- Player.videos[key].idx = Player.queue.length
- Player.videos[key].seen = false
- if (video.offset)
- Player.videos[key].offset = video.offset
- d.warn("bumped "+key)
- }
- else
- {
- video.key = key
- video.idx = Player.queue.length
- Player.videos[key] = video
- Player.newVideos = true
- d.warn("enqueued "+key)
- }
- $("#"+video.key).html(video.title)
- Player.queue.push(key)
- return true
- },
- clearQueue: function ()
- {
- Player.queue = []
- Player.currentIdx = 0
- Playlist.count = 0
- },
- register: function (projector)
- {
- d.warn("registered "+projector.type)
- Player.projectors[projector.type] = projector
- },
- unregister: function (projectortype)
- {
- d.warn("unregistered "+projectortype)
- delete Player.projectors[projectortype]
- },
- start: function ()
- {
- d.warn("PLAYER START")
- Player.currentIdx = Player.queue.length - 1
- if (! Player.queue.length)
- return d.error("empty queue")
- Player.playLatest()
- },
- finish: function ()
- {
- d.warn("PLAYER FINISH")
- d.warn("____________")
- Player.playLatest()
- },
- error: function (s)
- {
- if (s)
- d.error(Player.errors+" "+s)
- else
- d.error("PLAYER ERROR "+Player.errors)
- $("li#queue_"+Player.video.idx+" span.title").html("<i>This video cannot be embedded</i>")
- Player.video.error = true
- },
- playLatest: function ()
- {
- d.warn("PLAY LATEST")
- var idx = Player.currentIdx
- var len = Player.queue.length
- if (Player.newVideos)
- {
- for (i = idx; i < len; i++)
- {
- var video = Player.videos[Player.queue[i]]
- d.warn("check "+Player.queue[i])
- if (video.seen)
- continue
- Player.currentIdx = i
- d.joy("new video! "+video.key+" at "+i)
- Player.queueJumpToCurrentVideo(Player.currentIdx)
- Player.playVideo(video)
- return
- }
- for (i = idx - 1; i >= 0; i--)
- {
- var video = Player.videos[Player.queue[i]]
- d.warn("check "+Player.queue[i])
- if (video.seen)
- continue
- Player.currentIdx = i
- d.joy("new video! "+video.key+" at "+i)
- Player.queueJumpToCurrentVideo(Player.currentIdx)
- Player.playVideo(video)
- return
- }
- Player.newVideos = false
- d.warn("no new videos")
- }
- Player.playNext()
- },
- playNext: function ()
- {
- d.warn("____________")
- d.warn("PLAY NEXT")
- var idx = Player.currentIdx
- do
- {
- idx -= 1
- if (Player.queue[idx] === Player.video.key)
- idx -= 1
- if (idx < 0)
- idx = Player.queue.length - 1
- }
- while (Player.videos[ Player.queue[idx] ].error === true)
- Player.queueJumpToCurrentVideo(idx)
- Player.playIdx(idx)
- },
- playPrev: function ()
- {
- d.warn("____________")
- d.warn("PLAY PREV")
- var idx = Player.currentIdx
- do
- {
- idx = (idx + 1) % Player.queue.length
- if (Player.queue[idx] === Player.video.key)
- continue
- }
- while (Player.videos[ Player.queue[idx] ].error === true)
- Player.queueJumpToCurrentVideo(idx)
- Player.playIdx(idx)
- },
- playKey: function (key)
- {
- Player.playVideo( Player.videos[key] )
- },
- playIdx: function (idx)
- {
- d.warn("play idx: "+idx)
- Player.currentIdx = idx
- Player.playVideo( Player.videos[Player.queue[idx]] )
- },
- throttle: function ()
- {
- d.error("THROTTLED")
- Player.stop()
- Player.errors = 0
- },
- stop: function ()
- {
- Player.projector.stop()
- },
- playVideo: function (video)
- {
- if (! video)
- {
- d.error("GOT EMPTY VIDEO")
- d.warn(Player.currentIdx)
- d.warn(Player.queue[ Player.currentIdx ])
- d.warn(Player.videos[ Player.queue[ Player.currentIdx ] ])
- return
- }
- if (video.error === true)
- {
- Player.errors += 1
- d.error(video.key)
- if (Player.errors > Player.queue.length)
- return Player.throttle()
- return Player.finish()
- }
- d.warn("PLAY VIDEO: "+video.key)
- if (video.type !== Player.projector.type)
- {
- d.warn("SWITCHING PROJECTORS")
- d.warn([Player.projector.type, video.type].join(" &rarr; "))
- Player.projector.unload()
- Player.projector = Player.projectors[video.type]
- Player.projector.load()
- if (Player.muted)
- Player.projector.setVolume(0)
- }
- video.seen = true
- if (! Player.fullscreenMode)
- {
- $("#video-title").hide().html(video.title).fadeIn(100, function () {
- setTimeout("$('#video-title').fadeOut(2000)", 4000)
- })
- }
-
- Player.errors = 0
- Player.video = video
- Player.projector.play(video)
- Player.linkUpdate(video)
- Player.currentIdx = video.idx
- $("#queue li.playing").removeClass("playing")
- $("#chat a.ytlink.playing").removeClass("playing")
- $("#queue li").removeClass("playing")
- $("li#queue_"+video.idx).addClass("playing")
- $("#"+video.key).addClass("playing")
- $("#"+video.key).html(video.title)
- $("#like").removeClass("liked").html("LIKE")
- $("#pause").html(PLAY_BUTTONS.pause)
- if (Local.isLiked(video.id))
- {
- $("#like").addClass("liked").html("LIKED")
- }
- },
- queueJumpToCurrentVideo: function (idx)
- {
- $("#playlist").scrollTop( $("li#queue_"+idx)[0].offsetTop - Player.playlistOffset )
- $("#queue").scrollTop( $("li#queue_"+idx)[0].offsetTop - Player.queueOffset )
- },
- toggle: function ()
- {
- Player.projector.toggle()
- },
- pause: function ()
- {
- Player.projector.pause()
- $("#pause").html(PLAY_BUTTONS.play)
- },
- mute: function ()
- {
- if (Player.projector)
- {
- if (Player.muted)
- Player.projector.setVolume(100)
- else
- Player.projector.setVolume(0)
- }
- Player.muted = ! Player.muted
- },
- muteClick: function ()
- {
- if (Player.muted)
- $("#mute").removeClass("muted")
- else
- $("#mute").addClass("muted")
- Player.mute()
- },
- prevClick: function ()
- {
- d.act("+ clicked prev")
- Player.playPrev()
- },
- pauseClick: function ()
- {
- d.act("+ clicked pause")
- Player.errors = 0
- if (Player.projector.toggle())
- {
- $("#pause").html(PLAY_BUTTONS.play)
- d.warn("set to play")
- }
- else
- {
- $("#pause").html(PLAY_BUTTONS.pause)
- d.warn("set to pause")
- }
- },
- nextClick: function ()
- {
- d.act("+ clicked next")
- Player.playNext()
- },
- scanClick: function ()
- {
- d.act("+ clicked scan")
- Scanner.scan()
- },
- likeClick: function ()
- {
- d.act("+ clicked player like")
- Like.likeVideo(Player.video)
- },
- linkClick: function ()
- {
- d.act("+ clicked permalink")
- Player.pause()
- },
- linkUpdate: function (video)
- {
- d.warn("UPDATING LINK")
- $("#video-link").attr("href", video.src)
- var vidurl = "http://scannerjammer.com/"
- if (Room.name !== "main")
- vidurl += Room.name+"/"
- vidurl += "#v="+video.id
- $("#sharebutton").attr("st_url", vidurl).attr("st_title", video.title)
-/*
- stWidget.addEntry({
- service: "sharethis",
- element: document.getElementById("sharebutton"),
- url: vidurl,
- title: video.title,
- summary: "ScannerJammer: Youtube video chat",
- })
-*/
- },
-
- fullscreenClick: function ()
- {
- d.act("+ clicked fullscreen")
- },
- setVolume: function (vol)
- {
- if (Player.projector && Player.projector.type !== 'null')
- {
- // alert(Player.projector.type)
- Player.projector.setVolume(vol)
- }
- },
- init: function ()
- {
- d.warn("PLAYER INIT")
- $("#prev").html(PLAY_BUTTONS.prev)
- $("#pause").html(PLAY_BUTTONS.play)
- $("#next").html(PLAY_BUTTONS.next)
- $("#prev").bind("click", Player.prevClick)
- $("#pause").bind("click", Player.pauseClick)
- $("#next").bind("click", Player.nextClick)
- $("#scan").bind("click", Player.scanClick)
- $("#like").bind("click", Player.likeClick)
- $("#video-link").bind("click", Player.linkClick)
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- Player.projector = {type:"null",load:d.noop,unload:Youtube.unload,}
- for (i in Player.projectors)
- Player.projectors[i].init()
- if (Player.queue.length > 0)
- Player.currentIdx = Player.queue.length
- Playlist.init()
- }
- }
-
-var Playlist =
- {
- count: 0,
- showScores: false,
- enqueue: function (videos)
- {
- if (! (videos instanceof Array))
- videos = [videos]
- // d.warn("PLAYLIST ENQUEUE "+videos.length)
- var rows = []
- var clickables = []
- for (i in videos)
- {
- var video = videos[i]
- $("#"+video.key).html(video.title)
- if (Player.enqueue(video))
- {
- rows.push(Playlist.display(video))
- Playlist.count += 1
- }
- }
- $("#queue").prepend(rows.reverse().join(""))
- },
- enqueueOldVideoFormat: function (videos)
- {
- // d.warn("ENQUEUING "+videos.length+" OLD FORMAT")
- for (i in videos)
- {
- // 0 id 1 date 2 userid 3 user 4 url 5 title
- var row = videos[i]
- var video =
- {
- id: row[0],
- date: row[1],
- userid: row[2],
- username: row[3],
- src: row[4],
- title: row[5] || '___',
- seen: false,
- error: false,
- }
- if (row.length > 6)
- {
- video.score = parseInt(row[6]) || 0
- // block video if it's a duplicate
- }
- var url = row[4]
- if (url.indexOf("youtube.com") !== -1)
- {
- var ytid = Youtube.getYtid(url)
- video.type = "youtube"
- video.name = ytid
- }
- else if (url.indexOf("vimeo.com") !== -1)
- {
- var vimeoid = url.replace(VIMEOregexp, "$3")
- video.type = "vimeo"
- video.name = vimeoid
- }
- else if (url.indexOf("soundcloud.com") !== -1)
- {
- video.type = "soundcloud"
- video.name = $.md5(video.src)
- }
- else if (url.indexOf("mp3") !== -1)
- {
- video.type = "audio"
- video.name = $.md5(video.src)
- }
- else
- {
- d.error("bad video id in "+url)
- continue
- }
- video.key = video.type + "_" + video.name
- Playlist.enqueue(video)
- // d.joy("GOT VIDEO: "+key)
- }
- },
- clickTitle: function (e)
- {
- var id = $(this).parent().attr("id")
- var idx = id.substr(id.indexOf("_")+1)
- d.act("+ clicked playlist "+idx)
- Player.playIdx(parseInt(idx))
- },
- clickLike: function (e)
- {
- var id = $(this).parent().attr("id")
- var idx = id.substr(id.indexOf("_")+1)
- var videokey = Player.queue[idx]
- var video = Player.videos[videokey]
- d.act("+ clicked playlist like "+video.key)
- Like.likeVideo(video)
- },
- clickChatlink: function (e)
- {
- e.preventDefault()
- var key = $(this).attr("id")
- var video = Player.videos[key]
- d.act("+ clicked link "+video.key)
- Player.playVideo(video)
- },
- display: function (video)
- {
- var likeClass = ''
- var likeWord = "&nbsp;&nbsp;like"
- if (video.username === Auth.username)
- {
- likeClass = "you"
- }
- else if (Local.isLiked(video.id))
- {
- likeClass = 'liked'
- likeWord = 'liked'
- }
- var s = "<li id='queue_"+Playlist.count+"'>"
- if (Playlist.showScores)
- {
- score = video.score
- if (score < 1)
- score = '&nbsp;'
- s += "<span class='score' id='score_"+video.id+"'>"+score+"</span>"
- }
- s += "<span id='like_"+video.id+"' class='like "+likeClass+"'>"+likeWord+"</span>"
- s += "<a class='user' href='/profile/"+video.username+"'>"+video.username+"</a>"
- s += "<span class='title'>"+video.title+"</span>"
- s += "</li>"
- return s
- },
- init: function ()
- {
- d.warn("PLAYLIST INIT")
- $("#queue li span.title").live("click", Playlist.clickTitle)
- $("#queue li span.like").live("click", Playlist.clickLike)
- $("#chat a.ytlink").live("click", Playlist.clickChatlink)
- }
- }
-
-var Scanner =
- {
- scanMode: false,
- scanTimeout: false,
- scanBlinkTimeout: false,
- scanBlinkState: false,
- scanBlinkRate: 200,
- scanRate: 9000,
- scanBlink: function ()
- {
- if (Scanner.scanBlinkState)
- {
- $("#scan").addClass("blinkOff")
- $("#scan").removeClass("blinkOn")
- Scanner.scanBlinkState = false
- }
- else
- {
- $("#scan").addClass("blinkOn")
- $("#scan").removeClass("blinkOff")
- Scanner.scanBlinkState = true
- }
- Scanner.scanBlinkTimeout = setTimeout(Scanner.scanBlink, Scanner.scanBlinkRate)
- },
- scanGo: function ()
- {
- Player.playNext()
- Scanner.scanTimeout = setTimeout(Scanner.scanGo, Scanner.scanRate)
- },
- scan: function ()
- {
- if (Scanner.scanMode)
- {
- d.warn("SCANNER ON")
- Scanner.scanMode = false
- clearTimeout(Scanner.scanTimeout)
- clearTimeout(Scanner.scanBlinkTimeout)
- $("#scan").removeClass("blinkOn")
- $("#scan").removeClass("blinkOff")
- }
- else
- {
- d.warn("SCANNER OFF")
- Scanner.scanMode = true
- Scanner.scanBlink()
- Scanner.scanGo()
- }
- }
- }
diff --git a/www/static/js/poll.js b/www/static/js/poll.js
deleted file mode 100755
index 01f480b..0000000
--- a/www/static/js/poll.js
+++ /dev/null
@@ -1,53 +0,0 @@
-var Poll =
- {
- room: "main",
- delay: 5000,
- init: function ()
- {
- if (document.cookie)
- {
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("room") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Poll.room = cookie[1]
- break
- }
- }
- }
- }
- Poll.poll()
- },
- poll: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- }
- }
-var Main =
- {
- init: function ()
- {
- Auth.success = Poll.init
- if (Auth.init())
- Auth.checkin()
- }
- }
-Main.init()
-
diff --git a/www/static/js/profile.js b/www/static/js/profile.js
deleted file mode 100755
index 6005e79..0000000
--- a/www/static/js/profile.js
+++ /dev/null
@@ -1,540 +0,0 @@
-var Keyboard =
- {
- altMode: false,
- fullscreenKeys: 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.toggle()
- if (kc === 76)
- Player.likeClick()
- return false
- },
- standardKeys: function (event)
- {
- kc = event.keyCode
- if (kc === 91)
- {
- Keyboard.altMode = true
- return true
- }
- if (kc === 27)
- {
- Viewport.fullscreenOn()
- return false
- }
- if (kc === 37 || kc === 177)
- {
- Player.playPrev()
- return false
- }
- else if (kc === 39 || kc === 176)
- {
- Player.playNext()
- return false
- }
- if (! Menu.isOpen && ! Keyboard.altMode && kc === 76)
- {
- Player.likeClick()
- return false
- }
- if (kc === 32 || kc === 179)
- {
- Player.toggle()
- return false
- }
- Keyboard.altMode = false
- return true
- }
- }
-var Viewport =
- {
- fullscreenMode: false,
- fullscreenOn: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls").hide()
- $("#settings-container").hide()
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.fullscreenResize)
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.fullscreenKeys)
- // 1) HIDDEN
- // $("body").css("overflow-y", "hidden")
- d.scrollToTop("body")
- Viewport.fullscreenResize()
- Viewport.fullscreenMode = true
- // $("#fullscreen").unbind("click")
- // $("#fullscreen").bind("click", Viewport.fullscreenOff)
- $("#fullscreen-warning").show().fadeOut(3000)
- $("#video-title").addClass("fullscreen")
- },
- fullscreenResize: function ()
- {
- // 2) FIXED
- // $("#projector").css({ position: 'fixed', top: 0, left: 0, width: $(window).width(), height: $(window).height() })
- $("#player").css({ top: 0, left: 0, width: $(window).width(), height: $(window).height() })
- $("#screen,#ytscreen").css({ width: $(window).width(), height: $(window).height() })
- },
- fullscreenOff: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls").show()
- // $("body").css("overflow-y", "scroll")
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.standardResize)
- Viewport.standardResize()
- Viewport.fullscreenMode = false
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.standardKeys)
- $("#fullscreen").unbind("click")
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- $("#video-title").removeClass("fullscreen")
- },
- standardResize: function ()
- {
- var w = $(window).width()
- var h = $(window).height()
- var contact = w * 200 / 1425
- var ytw = (w-contact-40)*4/7
- var yth = ytw * 9/16
- var plw = (w-contact-40)*3/7
-
- $("#contact img").css("max-width", contact)
- var conheight = $("#controls").height()
- var contactheight = $("#contact").height()
- var qheight = Math.max(yth+conheight+40, h - 94 - 60) // Math.max(yth+conheight+40, contactheight)
-
- $("#playlist").css("top", 94).css("left", contact+40)
- $("#playlist,#playlistbg").css("width", plw-20)
- $("#playlist,#playlistbg").css("height", qheight)
- $("#queue").css("height", qheight)
- var queuetop = $("#queue").offset().top
- $("#playlistbg").css("top", queuetop).css("left", contact+40)
-
- $("#contact").css("width", contact).css("top", 94).css("left", 20)
-
- $("#projector").css({ position: 'absolute', })
- $("#player").css("height", yth+conheight+10)
- $("#player").css("top", queuetop).css("left", plw+contact+40)
- $("#projector").css("left", 0)
- $("#player,#projector,#screen,#ytscreen").width(ytw-40)
- $("#projector,#screen,#ytscreen").height(yth)
-
- $("#controls").css({ position: 'absolute', top: yth+20, bottom: 'auto', right: 'auto', })
-
- $("#gif-container").css("top", qheight+30+134)
- },
- 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
- }
- }
-var Room =
- {
- load: function ()
- {
- Settings.open()
- }
- }
-var Settings =
- {
- bio: "",
- data: {},
- eventSet: false,
- defaults:
- {
- avatar: "http://scannerjammer.com/img/runner.gif",
- bg: "http://scannerjammer.com/bgz/scannerjammer_cyberspace.jpg",
- },
- open: function ()
- {
- if (parseInt(Auth.userid) !== userProfile[0])
- return
- $("#settings-hook").show()
- $("#profile-avatar").val(Settings.data.avatar)
- $("#profile-bg").val(Settings.data.bg)
- $("#profile-bio").html(Settings.bio)
- if (! Profile.eventSet)
- {
- $("#profile-settings-save").bind("click", Settings.save)
- Profile.eventSet = true
- }
- },
- save: function ()
- {
- d.warn("saving profile")
- var avatar = d.sanitize( $("#profile-avatar").val() )
- Settings.data.avatar = avatar
- var bg = d.sanitize( $("#profile-bg").val() )
- Settings.data.bg = bg
- var bio = d.sanitizeWithNewlines( $("#profile-bio").val() )
- Settings.bio = bio
- Settings.load()
- var s = "avatar\t"+avatar+"\n"
- s += "bg\t"+bg+"\n"
- var data = {
- userid: userProfile[0],
- settings: s,
- bio: bio,
- session: Auth.session,
- }
- $.post(API.URL.user.settings, data).success(Settings.saveCallback).error(Settings.errorCallback)
- },
- errorCallback: function (raw)
- {
- },
- saveCallback: function (raw)
- {
- Menu.settings.close()
- },
- load: function ()
- {
- if (Settings.data.avatar.indexOf("http://") === 0)
- $(".avatar").attr("src", Settings.data.avatar).show()
- else
- $(".avatar").hide()
- if (Settings.data.bg.indexOf("http://") === 0)
- {
- $("#bg img").attr("src", Settings.data.bg)
- $("#bg").show()
- }
- else
- $("#bg").hide()
- var bio = ''
- if (! Settings.bio.length)
- {
- bio = "<img src='/img/playlist.gif' />"
- }
- var lines = d.trim( Settings.bio ).split("\n")
- for (i in lines)
- {
- if (lines[i].length === 0)
- continue
- var s = Chat.parseWords(lines[i])
- if (s.indexOf("<img") !== -1)
- bio += s
- else
- bio += "<p>"+s+"</p>"
- }
- $("#bio").html(bio)
- Settings.open()
- Viewport.standardResize()
- },
- init: function ()
- {
- if (userProfile[6])
- {
- Settings.bio = userProfile[6]
- }
- if (userProfile[7])
- {
- var lines = userProfile[7].split("\n")
- for (i in lines)
- {
- var pair = lines[i].split("\t")
- Settings.data[pair[0]] = pair[1]
- }
- }
- for (i in Settings.defaults)
- {
- if (! (i in Settings.data))
- Settings.data[i] = Settings.defaults[i]
- }
- Settings.load()
- }
- }
-function menu (key, loadCallback)
- {
- d.warn("MENU INIT "+key)
- this.show = function ()
- {
- if (! Menu.isOpen)
- {
- $("#"+key+"-container").show()
- Menu.current = key
- loadCallback()
- }
- }
- this.hide = function ()
- {
- if (! Menu.isOpen)
- $("#"+key+"-container").hide()
- }
- this.close = function ()
- {
- $("#"+key+"-container").hide()
- $(".opened").removeClass("opened")
- Menu.isOpen = false
- }
- this.click = function ()
- {
- for (i in Menu.keys)
- {
- $("#"+Menu.keys[i]+"-container").hide()
- }
- $("#"+key+"-container").show()
- if (Menu.current !== key)
- loadCallback()
- Menu.current = key
- $(".opened").removeClass("opened")
- $("#"+key+"-hook").addClass("opened")
- Menu.isOpen = true
- }
- $("#"+key+"-hook").hover(this.show, this.hide).click(this.click)
- $("#"+key+"-close").click(this.close)
- $("#"+key+"-container").hover(this.click, function(){})
- }
-var Menu =
- {
- isOpen: false,
- current: false,
- keys: ["settings"],
- close: function ()
- {
- if (Menu.current)
- Menu[Menu.current].close()
- },
- settings: new menu("settings", Settings.open)
- }
-var Profile =
- {
- mode: false,
- page: 0,
- pages: [],
- loadMore: function ()
- {
- var api = ""
- // console.log(Profile.mode)
- if (Profile.mode === "user")
- api = API.URL.user.videos
- else if (Profile.mode === "like")
- api = API.URL.user.likes
- else
- return
- var data =
- {
- user: userProfile[1],
- start: Player.videos[Player.queue[0]].date,
- }
- d.scrollToTop(window)
- $("#queueMore").unbind("click")
- $("#queue").html("<li id='queueLoading'>LOADING<br/><img src='/img/loading2.gif'/></li>")
- $.post(api, data).success(Profile.loadMoreCallback)
- },
- loadMoreCallback: function (raw)
- {
- var lines = API.parse("/user/load", raw)
- if (! lines) return
- if (lines[0].indexOf("0\t") === 0)
- return // console.log(lines.split("\t")[1])
- queue = []
- for (i in lines)
- {
- if (lines[i].length < 2)
- continue
- line = lines[i].split("\t")
- queue.push(line)
- }
- Profile.page += 1
- Profile.pages[Profile.page] = queue
- Profile.loadQueue(queue)
- $("#queue").prepend("<li id='queueLess'>Go Back</li>")
- $("#queueLess").unbind("click")
- $("#queueLess").bind("click", Profile.loadLess)
- if (queue.length < 50)
- $("#queue").append("<li id='queueDone'>That's all the videos!</li>")
- },
- loadLess: function ()
- {
- Profile.page -= 1
- Profile.loadQueue(Profile.pages[Profile.page])
- if (Profile.page !== 0)
- {
- $("#queue").prepend("<li id='queueLess'>Go Back</li>")
- $("#queueLess").unbind("click")
- $("#queueLess").bind("click", Profile.loadLess)
- return
- }
- },
- loadQueue: function (queue)
- {
- if (! queue || ! queue.length)
- return
- Player.clearQueue()
- $("#queueMore").unbind("click")
- $("#queue").html("")
- Playlist.enqueueOldVideoFormat(queue)
- d.scrollToTop("#queue")
- if (Profile.mode !== "top")
- {
- if (queue.length > 49)
- {
- $("#queue").append("<li id='queueMore'>Load More Videos</li>")
- $("#queueMore").bind("click", Profile.loadMore)
- }
- }
- },
- loadLikeQueue: function ()
- {
- if (Profile.mode === "like")
- return
- Profile.page = 0
- Profile.pages = [likeVideoQueue]
- Profile.mode = "like"
- $(".mode").removeClass("mode")
- $("#likeQueue").addClass("mode")
- Profile.loadQueue(likeVideoQueue)
- },
- loadTopQueue: function ()
- {
- if (Profile.mode === "top")
- return
- Profile.mode = "top"
- $(".mode").removeClass("mode")
- $("#topQueue").addClass("mode")
- Profile.loadQueue(topVideoQueue)
- },
- loadUserQueue: function ()
- {
- if (Profile.mode === "user")
- return
- Profile.page = 0
- Profile.pages = [userVideoQueue]
- Profile.mode = "user"
- $(".mode").removeClass("mode")
- $("#userQueue").addClass("mode")
- Profile.loadQueue(userVideoQueue)
- },
- loadImages: function ()
- {
- var lastDate = imageQueue[0][0]
- var bars = []
- var s = ""
-
- for (i in imageQueue)
- {
- img = imageQueue[i]
- if (img[0] !== lastDate)
- {
- bars.push('<div>'+s+'</div>')
- s = ""
- lastDate = img[0]
- }
- s += '<img src="'+img[1]+'"/>'
- }
- bars.push('<div>'+s+'</div>')
- $("#gifs").html(bars.join(""))
- },
- init: function ()
- {
- if (userVideoQueue && userVideoQueue.length && userVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="userQueue">'+userVideoQueueTitle+'</li>')
- $("#userQueue").bind("click", Profile.loadUserQueue)
- }
- if (likeVideoQueue && likeVideoQueue.length && likeVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="likeQueue">'+likeVideoQueueTitle+'</li>')
- $("#likeQueue").bind("click", Profile.loadLikeQueue)
- likeVideoQueue.reverse()
- }
- if (topVideoQueue && topVideoQueue.length && topVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="topQueue">'+topVideoQueueTitle+'</li>')
- $("#topQueue").bind("click", Profile.loadTopQueue)
- topVideoQueue.reverse()
- }
- if (userVideoQueue && userVideoQueue.length)
- Profile.loadUserQueue()
- else if (likeVideoQueue && likeVideoQueue.length)
- Profile.loadLikeQueue()
- // if (imageQueue && imageQueue.length)
- // Profile.loadImages()
- }
- }
-var Poll =
- {
- room: "main",
- delay: 5000,
- init: function ()
- {
- if (document.cookie)
- {
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("room") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Poll.room = cookie[1]
- break
- }
- }
- }
- }
- Poll.poll()
- Settings.open()
- },
- poll: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- }
- }
-
-var Main =
- {
- init: function ()
- {
- $(window).bind("focus", Viewport.focus)
- $(window).bind("blur", Viewport.blur)
- $(window).bind("resize", Viewport.standardResize)
- $(window).bind("keydown", Keyboard.standardKeys)
- Playlist.showScores = true
- Auth.success = Poll.init
- if (Auth.init())
- Auth.checkin()
- Profile.init()
- Player.init()
- Settings.init()
- $("#controls").fadeIn(2000)
- $("#contact").fadeIn(2000)
- setTimeout('Viewport.standardResize()', 1000)
- }
- }
-Main.init()
-
diff --git a/www/static/js/register.js b/www/static/js/register.js
deleted file mode 100755
index 5dc72b2..0000000
--- a/www/static/js/register.js
+++ /dev/null
@@ -1,292 +0,0 @@
-function warn (s)
- {
- $('#msg').append(s+"<br/>")
- scrollToBottom('#msg')
- }
-function scrollToTop (div)
- { $(div).scrollTop( 0 ) }
-function scrollToBottom (div)
- { $(div).scrollTop( $(div)[0].scrollHeight ) }
-function trim (s)
- { if (s) { return s.replace(/^\s+|\s+$/g,"") } else { return s } }
-function supports_html5_storage ()
- {
- try
- { return 'localStorage' in window && window['localStorage'] !== null; }
- catch (e)
- { return false }
- }
-function noop() { return false }
-var API =
- {
- HEADER: "#@scanjam 0.3b",
- LIKE_STRING: "like",
- HAS_LOCAL_STORAGE: supports_html5_storage(),
- BASE_URL: "http://scannerjammer.com:19898",
- URL:
- {
- auth:
- {
- register: "/api/auth/register",
- available: "/api/auth/available",
- login: "/api/auth/login",
- logout: "/api/auth/logout",
- },
- room:
- {
- join: "/api/room/join",
- poll: "/api/room/poll",
- say: "/api/room/say",
- },
- video:
- {
- like: "/api/video/like",
- unlike: "/api/video/unlike",
- },
- },
- parse: function (api,raw)
- {
- if (! raw)
- { warn(api+": no result"); return false }
- var lines = raw.split("\n")
- if (lines.shift() !== API.HEADER)
- { warn(api+": no header"); return false }
- if (! lines.length)
- { warn(api+": no content"); return false }
- return lines
- },
- init: function ()
- {
- for (type in API.URL)
- {
- for (name in API.URL[type])
- {
- API.URL[type][name] = API.BASE_URL + API.URL[type][name]
- }
- }
- },
- }
-var Local = API.HAS_LOCAL_STORAGE ?
- {
- getOrSet: function (key, value)
- {
- if (value)
- localStorage["scanjam."+key] = value
- else
- return localStorage.getItem("scanjam."+key)
- },
- userid: function (id)
- { return Local.getOrSet("userid", id) },
- username: function (name)
- { return Local.getOrSet("username", name) },
- isLiked: function (videoid)
- { return localStorage.getItem("scanjam.like."+videoid) === "true" },
- unlike: function (videoid)
- { localStorage["scanjam.like."+videoid] = false },
- like: function (videoid)
- { localStorage["scanjam.like."+videoid] = true },
- } : { isLiked: noop, unlike: noop, like: noop, getOrSet: noop, username: noop, userid: noop, }
-var Register =
- {
- userok: false,
- pwok: false,
- username: false,
- pwtimeout: false,
- activated: false,
- submit: function ()
- {
- if (! Register.userok || ! Register.pwok)
- return
- $("#register-go").unbind("click")
- var username = $("#register-username").val()
- var password = $("#register-pw2").val()
- var pwhash = $.md5("scanjam"+password)
- Register.username = username
- var data =
- {
- 'username': username,
- 'password': pwhash,
- }
- $("#success-username").html(username)
- $.post(API.URL.auth.register, data).success(Register.submitCallback).error(Register.errorCallback)
- },
- errorCallback: function (raw)
- {
- Register.error("#username-available","weird problem, err try again")
- Register.error("#password-match", "")
- Register.deactivateGoButton()
- Register.activateGoButton()
- return
- },
- submitCallback: function (raw)
- {
- lines = API.parse("/api/register",raw)
- if (! lines || lines[0] !== "OK")
- return Register.errorCallback()
- var u = lines[1].split("\t")
- Local.userid(u[0])
- Local.username(u[1])
- document.cookie = "session="+u[2]+";path=/;domain=.scannerjammer.com;max-age=1086400"
-
- $("#register").fadeOut(1000, function ()
- {
- $("#success").fadeIn(1000, function()
- {
- $("#bg").fadeIn(700, 'linear')
- })
- })
- },
- checkPassword: function ()
- {
- var pw1 = $("#register-pw").val()
- var pw2 = $("#register-pw2").val()
- if (! pw1 && ! pw2)
- return
- if (pw1 && ! pw2)
- return
- if (pw1 !== pw2)
- {
- Register.error("#password-match", "passwords don't match..")
- Register.pwok = false
- return
- }
- $("#password-match").removeClass("error")
- $("#password-match").html("passwords match!")
- Register.pwok = true
- if (Register.userok)
- Register.activateGoButton()
- },
- deactivateGoButton: function ()
- {
- $("#register-go").css("color", "#000")
- $("#register-go").animate({opacity: 0.2}, 500)
- Register.activated = false
- },
- activateGoButton: function ()
- {
- $("#register-go").css("color", "#00f")
- $("#register-go").animate({opacity: 1.0}, 500)
- if (! Register.activated)
- {
- Register.activated = true
- $("#register-go").bind("click", Register.submit)
- }
- },
- error: function (id, msg)
- {
- $(id).addClass("error")
- $(id).html(msg)
- Register.deactivateGoButton()
- },
- checkAvailability: function ()
- {
- var isalphanumeric = /^[a-zA-Z0-9]+$/
- var username = $("#register-username").val()
- if (! username)
- {
- Register.error("#username-available", "please enter a username..")
- Register.userok = false
- return
- }
- if (isalphanumeric.test(username) === false)
- {
- Register.error("#username-available", "just letters/numbers plz..")
- Register.userok = false
- return
- }
- $.post(API.URL.auth.available, {'username':username}, Register.checkAvailabilityCallback)
- },
- checkAvailabilityCallback: function (raw)
- {
- lines = API.parse("/user/register", raw)
- if (! lines || lines[0] !== "OK")
- {
- alert(raw)
- Register.error("#username-available", "name already taken..")
- Register.userok = false
- return
- }
- $("#username-available").removeClass("error")
- $("#username-available").html("available!")
- Register.userok = true
- if (Register.pwok)
- Register.activateGoButton()
- },
- usernameUpdate: function (event)
- {
- Register.userok = false
- return true
- },
- pwUpdate: function (event)
- {
- // if (event.keyCode === 13)
- // {
- // Register.submit()
- // return false
- // }
- if (Register.pwtimeout)
- clearTimeout(Register.pwtimeout)
- Register.pwtimeout = setTimeout(Register.checkPassword, 100)
- return true
- },
- init: function ()
- {
- $("#register-username").val("")
- $("#register-pw").val("")
- $("#register-pw2").val("")
- $("#register-username").bind("blur", Register.checkAvailability)
- $("#register-pw2").bind("blur", Register.checkPassword)
- $("#register-username").bind("keydown", Register.usernameUpdate)
- $("#register-pw").bind("keydown", Register.pwUpdate)
- $("#register-pw2").bind("keydown", Register.pwUpdate)
- $("#register").fadeIn(1000, function ()
- {
- $("#plant").fadeIn(1000)
- })
- $("#register-username").focus()
- },
- }
-var Main =
- {
- roomName: false,
- enter: false,
- resize: function ()
- {
- var w = $(window).width()
- var h = $(window).height()
-
- $("#bg img").css("width", w)
- $("#bg img").css("height", h)
-
- $("#msg").css("max-height", h-130)
- },
- kp: function (event)
- {
- if (event.keyCode === 13)
- {
- if (Main.enter)
- Main.enter()
- return false
- }
- return true
- },
- init: function ()
- {
- warn("INIT")
- $("#msg").hide()
-
- $(window).resize(Main.resize)
- Main.resize()
-
- API.init()
- $(window).load(Register.init)
-
- if (window.location.hash)
- {
- Main.roomName = window.location.hash.replace("#","")
- $("#sj-link").attr("href", "/"+Main.roomName+"/")
- }
- },
- }
-Main.init()
-
diff --git a/www/static/js/room.js b/www/static/js/room.js
deleted file mode 100755
index 48924d9..0000000
--- a/www/static/js/room.js
+++ /dev/null
@@ -1,459 +0,0 @@
-var Menu = {}
-var Room =
- {
- loaded: false,
- ops: {},
- settings: {},
- settingsButtonBound: false,
- updateSettingMethods:
- {
- bg: function (url)
- {
- if (url === Room.settings.bg)
- return
- d.warn("clearing bg")
- $("#bg").fadeOut(500, function ()
- {
- if (url)
- {
- d.warn("updating bg to "+url)
- $("#bg img").attr('src', url).bind("load", function(){$("#bg").fadeIn(2000);d.warn("bg updated")})
- }
- })
- },
- title: function (s)
- {
- if (s.length === 0)
- s = "&nbsp;"
- $("#heading").html( s.replace(">","&gt;").replace("<","&lt;") )
- },
- topic: function (s)
- {
- if (s.length === 0)
- s = "&nbsp;"
- $("#topic").html( d.linkify(s.replace(">","&gt;").replace("<","&lt;")) )
- },
- phase: function (s)
- {
- if (s === 'light')
- {
- // turn on lookit stylesheet
- }
- else
- {
- // turn off lookit stylesheet
- }
- },
- bgcolor: function (s)
- {
- if (s)
- $('body').css("background-color", s)
- }
- },
- updateSetting: function (k, v)
- {
- d.warn( "update setting: "+k )
- $("room-"+k).val(v)
- if (k in Room.updateSettingMethods)
- var f = Room.updateSettingMethods[k](v)
- Room.settings[k] = v
- },
- settingsOpen: function ()
- {
- d.warn("ROOM SETTINGS LOAD")
- $("#room-id").html(Room.id)
- $("#room-name").html(Room.name)
- $("#room-path").html(Room.path)
- $("#room-title").val(Room.settings['title'])
- $("#room-topic").val(Room.settings['topic'])
- $("#room-phase").val(Room.settings['phase'])
- $("#room-bg").val(Room.settings['bg'])
- $("#room-bgcolor").val(Room.settings['bgcolor'])
- $("#room-plant").val(Room.settings['plant'])
- $("#room-flower").val(Room.settings['flower'])
- $("#room-updater").html(Room.settings['updater'])
- if (! Room.settingsButtonBound)
- {
- Room.settingsButtonBound = true
- $("#room-settings-save").bind("click", Room.settingsSaveClick)
- }
- $("#room-settings-unload").bind("click", Room.settingsClose)
- if (Auth.access > 0)
- $("#room-mod-tag").html("<a href='/"+Room.name+"/admin'>Moderate room</a>")
- else
- $("#room-mod-tag").html("")
- d.warn("LOADED")
- },
- settingsClose: function ()
- {
- d.warn("ROOM SETTINGS UNLOAD")
- Room.settingsButtonBound = false
- $("#room-settings-save").unbind("click")
- },
- settingsKeys: ["title","topic","bg"],
- last_bg: "",
- settingsSaveClick: function ()
- {
- $("#room-settings-save").unbind("click")
- var set = []
- if (Room.ops !== false)
- {
- if (Auth.access < 1 && !(Auth.username in Room.ops))
- {
- Menu.settings.close()
- return
- }
- }
- Room.last_bg = Room.settingsKeys['bg']
- for (i in Room.settingsKeys)
- {
- var k = Room.settingsKeys[i]
- var v = d.sanitize( $("#room-"+k).val() )
- Room.updateSetting(k, v)
- set.push(k+"\t"+v)
- }
- set.push("updater\t"+Auth.username)
- var s = set.join("\n")
- $.post(API.URL.room.settings, {room: Room.name, session: Auth.session, settings: s}, Room.settingsCallback)
- Menu.settings.close()
- },
- settingsCallback: function (raw)
- {
- var lines = API.parse("/room/say", raw)
- if (! lines)
- return
- if (lines[0].indexOf("OK") !== -1)
- {
- d.warn("settings updated: "+lines.shift())
- $("#room-updater").hide().html("you!").fadeIn(500)
- }
- else if (lines[0].indexOf("BG_SIZE") !== -1)
- {
- var partz = lines[0].split("\t")
- setTimeout('Room.updateSettingMethods.bg(Room.last_bg)', 2000)
- alert("Background too large!\n\nYour image: "+ partz[2]+" bytes\nMax size: " + partz[3] + " bytes")
- }
- else if (lines[0].indexOf("BG_DATA") !== -1)
- {
- setTimeout('Room.updateSettingMethods.bg(Room.last_bg)', 2000)
- alert("Unable to retrieve background image")
- }
- $("#room-settings-save").bind("click", Room.settingsSaveClick)
- },
- connect: 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("JOINING ROOM "+Room.name)
- $.ajax({
- type: 'POST',
- url: API.URL.room.join,
- data: {'room':Room.name,'session':Auth.session,'enqueue':videoKey},
- timeout: 2000,
- }).success(Room.joinCallback).error(Room.joinErrorCallback)
- },
- joinErrorCallback: function (jqXHR, textStatus, errorThrown)
- {
- d.warn("JOIN ERROR")
- if (Room.loaded)
- return
- if (textStatus === "timeout")
- Room.connect()
- else
- Auth.load()
- },
- joinCallback: function (raw)
- {
- var lines = API.parse("/room/join", raw)
- if (!lines){
- d.error("UNABLE TO LOAD ROOM");
- setTimeout(Room.load, 500);
- return;
- }
- var u = lines.shift().split("\t")
-
- if (u[0] === '0')
- return Auth.load()
- d.warn("JOINED ROOM")
- Auth.unload()
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.access = u[2]
- d.joy("logged in as "+Auth.username)
-
- Lastlog.update(lines.shift())
- Chat.store(lines)
-
- d.warn("__________")
- d.warn("__________")
- d.warn("__________")
- Room.load()
- d.warn("__________")
- d.warn("__________")
- d.warn("__________")
- },
- load: function ()
- {
- d.warn("LOAD ROOM")
- $("#loading").fadeOut(500, function()
- {
- Background.load()
- Player.init()
- VideoChat.init()
- Chat.poll()
- })
- $("#loading").fadeOut(1500, Room.loadFinish)
- },
- loadFinish: function ()
- {
- setTimeout("d.scrollToBottom('#chat')", 500)
- $("#logo").show()
- $("#logobg,#logobar").show()
- $("#likebutton").css("display", "inline-block")
-
- $("#player").show()
- $("#playlist").show()
- $("#playlistbg").show()
-
- $("#form").show()
- $("#formbg").show()
- $("#chat").fadeIn(200)
- d.scrollToBottom("#chat")
- $("#chatbg").show()
- $("#lastlogbox").show()
- $("#lastlogbg").show()
-
- Keyboard.enter = Chat.say
- $("#chat-message").bind("focus", Keyboard.focusTextarea)
- $("#chat-message").bind("blur", Keyboard.blurTextarea)
- $("#chat-message").focus()
- Keyboard.focusTextarea()
- $("#chat-send").bind("click", Chat.say)
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- $("#sitez").show()
- $("#logout").click(Auth.logout)
- if (Room.name === "feederbleeder")
- {
- $("#heading").css({ "color": "#ff3333" })
- // Viewport.fullscreenOn()
- }
- //else
- Viewport.standardResize()
- // $(".ytlink").live("click", Player.ytLinkClick, false)
-
- if (Auth.access > 0)
- {
- // var div = $("<div>").addClass("modhello").html("Congratulations new moderator! Click on the cube icon in the upper right corner and you will see the MODERATE ROOM link.").click(function(){$(this).fadeOut(1000)})
- // $("#chat").append(div)
- }
- // var div = $("<div>").addClass("modhello").html("Hey! You can now use the LEFT AND RIGHT ARROW KEYS to browse the playlist, and the L key to like a video!").click(function(){$(this).fadeOut(1000)})
- // $("#chat").append(div)
- setTimeout(Player.start, 2000)
- Room.loaded = true
- document.cookie = "room="+Room.name+";path=/;domain=.scannerjammer.com;max-age=86400"
- if (Room.loadCallback)
- Room.loadCallback()
- },
- loadCallback: false,
- unload: function ()
- {
- $("#logo,#logobg,#player,#playlist,#playlistbg,#form,#formbg,#chat,#chatbg,#lastlogbox,#lastlogbg,#sitez").hide()
- Menu.close()
- },
- init: function ()
- {
- d.warn("INIT ROOM")
- if (roomName !== undefined)
- Room.name = roomName
- else
- Room.name = "main"
- d.warn("room: "+Room.name)
- // $("#chat").show()
- }
- }
-
-var Rooms =
- {
- loaded: false,
- queue: [
- [0, "rooms", "/", "http://scannerjammer.com/bgz/gridzy9.jpg", "<span style='color: #fff;'>&rarr; SEE ALL <span style='text-decoration: underline;'>OPEN ROOMS</span></span>"],
- [1, "main", "/main", "http://scannerjammer.com/bgz/1302474305250-dumpfm-GucciSoFlosy-pattern4.gif", "MAIN ROOM"],
- [12, "FEEDERBLEEDER", "/feederbleeder", "http://scannerjammer.com/img/Tropic_Of_Cancer__The_Sorrow_Of_Two_Blooms_1308602037.jpg", "FEEDERBLEEDER"],
- [2, "avatar", "/avatar", "http://scannerjammer.com/img/avatar2.png", "avatar"],
- [3, "glitter", "/glitter", "http://scannerjammer.com/bgz/argus.gif", "glitter"],
- [10, 'jono', '/jonomilo', 'http://scannerjammer.com/bgz/whitesquare.gif', 'j&ograve;n&ograve; m&igrave; l&ograve;'],
- //[11, 'SJD', 'http://lolz.biz/sjd', 'http://scannerjammer.com/img/idgiguy2.png', 'SJD'],
- [4, "waterfall", "/waterfall", "http://i.imgur.com/QEZRF.gif", "waterfall"],
- ],
- list: function ()
- {
- if (Rooms.loaded)
- return
- Rooms.listDisplay(Rooms.queue)
- // $.post(API.URL.room.list, {session:Auth.session}).success(Rooms.listCallback).error(Rooms.listError)
- },
- listCallback: function (raw)
- {
- // parse API
- Rooms.listDisplay(lines)
- },
- listError: function ()
- {
- Rooms.listDisplay(Rooms.queue)
- },
- listDisplay: function (rooms)
- {
- $("#rooms-loading").hide()
- var divz = []
- for (i in rooms)
- {
- var r = rooms[i]
- var s = "<a href='"+r[2]+"'><li style='background-image: url("+r[3]+")'>"+r[4]
- if (r[1] === Room.name)
- s += " &lt; YOU ARE HERE"
- s += "</li></a>"
- divz.push(s)
- }
- $("#rooms-list").html(divz.join(''))
- Rooms.loaded = true
- }
- }
-var About =
- {
- loaded: false,
- init: function ()
- {
- $("#your-profile").attr('href', 'http://scannerjammer.com/profile/'+Auth.username)
- About.loaded = true
- }
- }
-function menu (key, loadCallback)
- {
- d.warn("MENU INIT "+key)
- this.appear = function ()
- {
- if (! Menu.isOpen)
- {
- $("#"+key+"-container").show()
- Menu.current = key
- loadCallback()
- $("#chat-message").blur()
- Keyboard.blurTextarea()
- }
- }
- this.disappear = function ()
- {
- if (! Menu.isOpen)
- $("#"+key+"-container").hide()
- }
- this.close = function ()
- {
- $("#"+key+"-container").hide()
- $(".opened").removeClass("opened")
- Menu.isOpen = false
- }
- this.click = function ()
- {
- for (i in Menu.keys)
- {
- $("#"+Menu.keys[i]+"-container").hide()
- }
- $("#"+key+"-container").show()
- if (Menu.current !== key)
- loadCallback()
- Menu.current = key
- $(".opened").removeClass("opened")
- $("#"+key+"-hook").addClass("opened")
- Menu.isOpen = true
- }
- $("#"+key+"-hook").hover(this.appear, this.disappear).click(this.click)
- $("#"+key+"-close").click(this.close)
- $("#"+key+"-container").hover(this.click, this.close)
- }
-var VideoChat =
- {
- isOpen: false,
- badgePositioned: false,
- suppressBadge: 0,
- updateCount: function (count)
- {
- /*
- if (VideoChat.suppressBadge > 0)
- {
- VideoChat.suppressBadge -= 1
- return
- }
- */
- if (parseInt(count) > 0)
- {
- if (! VideoChat.badgePositioned)
- {
- VideoChat.badgePositioned = true
- $("#videochat-badge").css({
- right: 5,
- top: 5,
- }).show()
- }
- $("#videochat-badge").html(count).show()
- }
- else
- {
- $("#videochat-badge").hide()
- }
- },
- open: function ()
- {
- // $("#tokbox-embed").html('<iframe id="tokbox-embedded" src="http://scannerjammer.com/tokbox/" style="border:none"></iframe>')
- // $("#tokbox-embed").show()
- // $(window).trigger('resize')
- VideoChat.isOpen = true
- // Webcam.load()
- Tokbox.load()
- },
- close: function ()
- {
- // $("#tokbox-embed").hide().html("")
- // $("#tokbox-close").hide()
- // $(window).trigger('resize')
- VideoChat.isOpen = false
- VideoChat.suppressBadge = 20
- // Webcam.unload()
- Tokbox.unload()
- },
- toggle: function ()
- {
- if (VideoChat.isOpen)
- VideoChat.close()
- else
- VideoChat.open()
- },
- init: function ()
- {
- // Webcam.init()
- $("#tokbox").show()
- $("#videochat-toggle").click(VideoChat.toggle)
- }
- }
-var Menu =
- {
- isOpen: false,
- current: false,
- keys: ["settings","about","rooms"],
- close: function ()
- {
- if (Menu.current)
- Menu[Menu.current].close()
- },
- settings: new menu("settings", Room.settingsOpen),
- rooms: new menu("rooms", Rooms.list),
- about: new menu("about", About.init),
- }
diff --git a/www/static/js/roomlist.js b/www/static/js/roomlist.js
deleted file mode 100755
index 1b6c6d8..0000000
--- a/www/static/js/roomlist.js
+++ /dev/null
@@ -1,166 +0,0 @@
-var Keyboard =
- {
- enter: false,
- textareaMap: function (event)
- {
- var kc = event.keyCode
- if (kc === 13)
- {
- if (Keyboard.enter)
- Keyboard.enter()
- return false
- }
- return true
- },
- }
-var Poll =
- {
- room: "main",
- delay: 5000,
- init: function ()
- {
- if (document.cookie)
- {
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("room") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Poll.room = cookie[1]
- break
- }
- }
- }
- }
- Poll.poll()
- },
- poll: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- }
-var Roomlist =
- {
- minwidth: 200,
- width: 200,
- list: function ()
- {
- var roomz = {}
- var keys = []
- var sorted = []
- var presortOrder =
- [
- "main",
- "nightschool",
- "waterfall",
- "feederbleeder",
- "diornights",
- "classical",
- "jonomilo",
- "dump",
- "tang",
- "avatar",
- "glitter",
- "yhvh",
- "los7angele55",
- //"sjd",
- "frederick",
- "icons",
- // "gorgeoustaps", "psychichandbook",
- // "tense",
- ]
- var presortMap = {}
- for (var i = 0; i < presortOrder.length; i++)
- presortMap[presortOrder[i]] = true
- //roomz['sjd'] = Roomlist.newRecord([0,"sjd",0,0,"http://scannerjammer.com/img/sjd.jpg"])
- for (var i = 0; i < ROOM_LIST.length; i++)
- {
- var row = ROOM_LIST[i]
- if (row.length < 4)
- continue
- roomz[row[1]] = Roomlist.newRecord(row)
- if (! (presortMap.hasOwnProperty(row[1])))
- keys.push(row[1])
- }
- for (var i = 0; i < presortOrder.length; i++)
- {
- sorted.push(roomz[presortOrder[i]])
- }
- for (i in keys.sort())
- {
- // console.log(keys[i])
- sorted.push(roomz[keys[i]])
- }
- $("#roomlist").html(sorted.join(""))
- },
- newRecord: function (row)
- {
- var rotation = function(x) {
- var pre = " -moz- -webkit- -o-".split(" ");
- var r = "";
- var d = Math.floor(Math.random()*2 * x - x);
- //console.log(d);
- for (var i in pre) {
- r += pre[i] + "transform:rotate(" + d + "deg);"
- }
- r += "\">";
- return r;
- };
- //console.log(rotation);
- var s = ""
- //if (row[1] === "sjd")
- // s += "<a href='http://lolz.biz/sjd/' class='roomdiv' style=\"width: "+Roomlist.width+"px;" + rotation(5);
- if (row[1] === "main")
- s += "<a href='/"+row[1]+"' class='roomdiv' style=\"width: "+Roomlist.width*2+"px;" + rotation(5);
- else
- s += "<a href='/"+row[1]+"' class='roomdiv' style=\"width: "+Roomlist.width+"px;" + rotation(5);
- if (parseInt(row[3]) > 0)
- s += "<span class='count'>" + row[3] + "</span>"
- s += "<span class='roomname'>" + row[1] + "</span>"
- s += "<div class=\"roombg\" style=\"background-image: url('"+row[4]+"'); " + rotation(5) + "</div>"
- s += "</a>"
- return s
- },
- init: function ()
- {
- if (Auth.loaded)
- Auth.unload()
- Poll.init()
- },
- }
-var Main =
- {
- resize: function ()
- {
- var w = $(window).width()
- var cols = 4 // Math.floor(w / Roomlist.minwidth)
- Roomlist.width = Math.floor(w / cols)
- },
- init: function ()
- {
- $(window).resize(Main.resize)
- Main.resize()
- Roomlist.list()
- Auth.success = Roomlist.init
- if (! Auth.init())
- Auth.load()
- },
- }
-Main.init()
-
diff --git a/www/static/js/search.js b/www/static/js/search.js
deleted file mode 100755
index e644026..0000000
--- a/www/static/js/search.js
+++ /dev/null
@@ -1,191 +0,0 @@
-YOUTUBE_SEARCH_URL = "https://gdata.youtube.com/feeds/api/videos"
-YOUTUBE_URL_PREFIX = "http://youtube.com/watch?v="
-function courtesy_s (quantity, noun)
- {
- if (quantity > 1)
- return quantity + " " + noun + "s"
- return quantity + " " + noun
- }
-var Search =
- {
- start: 0,
- limit: 20,
- sj: function ()
- {
- Search.start = 0
- Search.terms = $("#search-terms").val()
- Search.sjSearch (Search.terms, Search.start)
- },
- sjSearch: function (terms, start)
- {
- var params =
- {
- "q": terms,
- "start": Search.start,
- "limit": Search.limit,
- "session": Auth.session,
- }
- $.post(API.URL.video.search, params, Search.sjCallback)
- $("#search-instructions").hide()
- $("#search-results").html("").hide()
- $("#search-loading").show()
- $("#search-results-container").show()
- },
- sjCallback: function (raw)
- {
- var lines = API.parse ("/video/search", raw)
- var items = []
- for (var i = 0; i < lines.length; i++)
- {
- // 0 id 1 score 2 user 3 usercount 4 title 5 url 6 thumbnail
- var line = lines[i].split("\t")
- if (line.length < 7)
- continue
- var video =
- {
- url: line[5],
- thumbnail: line[6],
- title: line[4],
- user: line[2],
- quantify: "",
- }
- if (parseInt(line[3]) > 1)
- video['user'] += " + " + courtesy_s (parseInt(line[3])-1, "other")
- if (parseInt(line[1]) > 0)
- video['quantify'] = courtesy_s (parseInt(line[1]), "like")
- var tag = Search.resultTag (video)
- items.push(tag)
- }
- if (items.length === Search.limit)
- {
- Search.start += Search.limit
- $("#search-next-page").show()
- }
- else
- {
- $("#search-next-page").hide()
- }
- $("#search-loading").hide()
- $("#search-results").html(items.join("")).show()
- $("#search-instructions").show()
- $("#curtain").bind("click", Search.close).css({"background-color": "transparent", "z-index": 99}).show()
- },
- youtube: function ()
- {
- var terms = $("#search-terms").val()
- var params =
- {
- "q": terms,
- "v": 2,
- "alt": "jsonc",
- }
- $.get(YOUTUBE_SEARCH_URL, params, Search.youtubeCallback, "jsonp")
- $("#search-results-container").show()
- $("#search-results").html("").hide()
- $("#search-loading").show()
- },
- durationToString: function (duration)
- {
- return Math.floor(duration / 60) + ":" + (duration % 60)
- },
- viewCountToString: function (viewCount)
- {
- if (! viewCount)
- return '0'
- var vc = viewCount.toString ()
- var commas = /(\d+)(\d{3})/;
- while (commas.test(vc))
- {
- vc = vc.replace(commas, '$1' + ',' + '$2');
- }
- return vc
- },
- resultTag: function (video)
- {
- var tag = "<li data-url='"+video['url']+"'>"
- tag += "<div class='thumb' style='background-image: url(" + video['thumbnail'] + ")'></div>"
- tag += "<h4>" + video['title'] + "</h4>"
- tag += "<span class='metadata'>"
- tag += video['user']
- tag += "<br/>"
- tag += video['quantify']
- tag += "</span>"
- tag += "<a href='"+video['url']+"' target='_blank' class='preview'>Preview</a>"
- tag += "</li>"
- return tag
- },
- youtubeCallback: function (data)
- {
- var items = []
- for (var i = 0; i < data['data']['items'].length; i++)
- {
- var item = data['data']['items'][i]
- var video =
- {
- url: YOUTUBE_URL_PREFIX+item['id'],
- thumbnail: item['thumbnail']['sqDefault'],
- title: item['title'],
- user: item['uploader'],
- quantify: Search.viewCountToString(item['viewCount']) + "views",
- }
- var tag = Search.resultTag (video)
- items.push(tag)
- }
- $("#search-loading").hide()
- $("#search-results").html(items.join("")).show()
- },
- keydown: function (e)
- {
- if (e.keyCode === 13)
- {
- Search.sj ()
- }
- if (e.keyCode === 27)
- {
- Search.close ()
- Keyboard.focusTextarea ()
- }
- },
- nextPage: function ()
- {
- Search.sjSearch (Search.terms, Search.start)
- },
- loadResult: function ()
- {
- var url = $(this).parent().data("url")
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: url})
- Search.close ()
- },
- close: function ()
- {
- $("#curtain").unbind("click", Search.close).hide()
- $("#search-results-container").hide()
- $("#search-terms").val("")
- },
- blurSearchTextarea: function ()
- {
- $(window).unbind("keydown")
- $("#chat-message").unbind("keydown").bind("keydown", Keyboard.textareaMap)
- $("#chat-message").unbind("focus").focus().bind("focus", Keyboard.focusTextarea)
- if ($("#chat-message").val().length === 0)
- Keyboard.enteredText = false
- },
- focusSearchTextarea: function ()
- {
- $(window).unbind("keydown")
- $("#chat-message").unbind("keydown")
- },
- init: function ()
- {
- $("#search-results li div").live("click", Search.loadResult)
- $("#search-results li h4").live("click", Search.loadResult)
- $("#search-results li span").live("click", Search.loadResult)
- $("#search-terms").bind("keydown", Search.keydown)
- $("#search-terms").bind("focus", Search.focusSearchTextarea)
- $("#search-terms").bind("blur", Search.blurSearchTextarea)
- // $("#search-terms").val("glock n my hand")
- // Search.sj ()
- }
- }
-Search.init ()
-
diff --git a/www/static/js/sj6.js b/www/static/js/sj6.js
deleted file mode 100755
index 03f90dc..0000000
--- a/www/static/js/sj6.js
+++ /dev/null
@@ -1,6505 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.5.2
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Thu Mar 31 15:28:23 2011 -0400
- */
-(function(a,b){function ci(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cf(a){if(!b_[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";b_[a]=c}return b_[a]}function ce(a,b){var c={};d.each(cd.concat.apply([],cd.slice(0,b)),function(){c[this]=a});return c}function b$(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bZ(){try{return new a.XMLHttpRequest}catch(b){}}function bY(){d(a).unload(function(){for(var a in bW)bW[a](0,1)})}function bS(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bR(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bQ(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bs.test(a)?e(a,f):bQ(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bQ(a+"["+f+"]",b[f],c,e)}function bP(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bJ,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bP(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bP(a,c,d,e,"*",g));return l}function bO(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bD),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bq(a,b,c){var e=b==="width"?bk:bl,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function bc(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function bb(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function ba(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function _(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function $(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Q(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(L.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function P(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function H(a,b){return(a&&a!=="*"?a+".":"")+b.replace(t,"`").replace(u,"&")}function G(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,p=[],q=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(r,"")===a.type?q.push(g.selector):t.splice(i--,1);f=d(a.target).closest(q,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){f=p[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function E(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function y(){return!0}function x(){return!1}function i(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function h(a,c,e){if(e===b&&a.nodeType===1){e=a.getAttribute("data-"+c);if(typeof e==="string"){try{e=e==="true"?!0:e==="false"?!1:e==="null"?null:d.isNaN(e)?g.test(e)?d.parseJSON(e):e:parseFloat(e)}catch(f){}d.data(a,c,e)}else e=b}return e}var c=a.document,d=function(){function G(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(G,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.2",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;x.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&G()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:D?function(a){return a==null?"":D.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?B.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){F["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),E&&(d.inArray=function(a,b){return E.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?y=function(){c.removeEventListener("DOMContentLoaded",y,!1),d.ready()}:c.attachEvent&&(y=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",y),d.ready())});return d}(),e="then done fail isResolved isRejected promise".split(" "),f=[].slice;d.extend({_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(d,f)}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),f;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(f)return f;f=a={}}var c=e.length;while(c--)a[e[c]]=b[e[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?f.call(arguments,0):c,--g||h.resolveWith(h,f.call(b,0))}}var b=arguments,c=0,e=b.length,g=e,h=e<=1&&a&&d.isFunction(a.promise)?a:d.Deferred();if(e>1){for(;c<e;c++)b[c]&&d.isFunction(b[c].promise)?b[c].promise().then(i(c),h.reject):--g;g||h.resolveWith(h,b)}else h!==a&&h.resolveWith(h,e?[a]:[]);return h.promise()}}),function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0,reliableMarginRight:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e)}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(a.style.width="1px",a.style.marginRight="0",d.support.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(a,null).marginRight,10)||0)===0),b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function");return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}}();var g=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!i(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,j=g?b[d.expando]:d.expando;if(!h[j])return;if(c){var k=e?h[j][f]:h[j];if(k){delete k[c];if(!i(k))return}}if(e){delete h[j][f];if(!i(h[j]))return}var l=h[j][f];d.support.deleteExpando||h!=a?delete h[j]:h[j]=null,l?(h[j]={},g||(h[j].toJSON=d.noop),h[j][f]=l):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var f=this[0].attributes,g;for(var i=0,j=f.length;i<j;i++)g=f[i].name,g.indexOf("data-")===0&&(g=g.substr(5),h(this[0],g,e[g]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=h(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var j=/[\n\t\r]/g,k=/\s+/,l=/\r/g,m=/^(?:href|src|style)$/,n=/^(?:button|input)$/i,o=/^(?:button|input|object|select|textarea)$/i,p=/^a(?:rea)?$/i,q=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(k);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(k);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(j," ");for(var i=0,l=c.length;i<l;i++)h=h.replace(" "+c[i]+" "," ");g.className=d.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),i=b,j=a.split(k);while(f=j[g++])i=e?i:!h.hasClass(f),h[i?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(j," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var j=i?f:0,k=i?f+1:h.length;j<k;j++){var m=h[j];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(q.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(l,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&q.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=m.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&n.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var k=a.getAttributeNode("tabIndex");return k&&k.specified?k.value:o.test(a.nodeName)||p.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var l=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return l===null?b:l}h&&(a[c]=e);return a[c]}});var r=/\.(.*)$/,s=/^(?:textarea|input|select)$/i,t=/\./g,u=/ /g,v=/[^\w\s.|`]/g,w=function(a){return a.replace(v,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=x;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(a){return typeof d!=="undefined"&&d.event.triggered!==a.type?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=x);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),w).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(r,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=a.type,l[m]())}catch(p){}k&&(l["on"+m]=k),d.event.triggered=b}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,H(a.origType,a.selector),d.extend({},a,{handler:G,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,H(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?y:x):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=y;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=y;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=y,this.stopPropagation()},isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x};var z=function(a){var b=a.relatedTarget;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},A=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?A:z,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?A:z)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&E("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&E("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var B,C=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},D=function D(a){var c=a.target,e,f;if(s.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=C(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:D,beforedeactivate:D,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&D.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&D.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",C(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in B)d.event.add(this,c+".specialChange",B[c]);return s.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return s.test(this.nodeName)}},B=d.event.special.change.filters,B.focus=B.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function f(a){var c=d.event.fix(a);c.type=b,c.originalEvent={},d.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var e=0;d.event.special[b]={setup:function(){e++===0&&c.addEventListener(a,f,!0)},teardown:function(){--e===0&&c.removeEventListener(a,f,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var F={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=r.exec(h),k="",j&&(k=j[0],h=h.replace(r,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(F[h]+k),h=h+k):h=(F[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)d.event.add(n[p],"live."+H(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+H(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return"text"===c&&(b===c||b===null)},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var I=/Until$/,J=/^(?:parents|prevUntil|prevAll)/,K=/,/,L=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,N=d.expr.match.POS,O={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(Q(this,a,!1),"not",a)},filter:function(a){return this.pushStack(Q(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=N.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(P(c[0])||P(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=M.call(arguments);I.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!O[a]?d.unique(f):f,(this.length>1||K.test(e))&&J.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var R=/ jQuery\d+="(?:\d+|null)"/g,S=/^\s+/,T=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,U=/<([\w:]+)/,V=/<tbody/i,W=/<|&#?\w+;/,X=/<(?:script|object|embed|option|style)/i,Y=/checked\s*(?:[^=]|=\s*.checked.)/i,Z={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Z.optgroup=Z.option,Z.tbody=Z.tfoot=Z.colgroup=Z.caption=Z.thead,Z.th=Z.td,d.support.htmlSerialize||(Z._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(R,""):null;if(typeof a!=="string"||X.test(a)||!d.support.leadingWhitespace&&S.test(a)||Z[(U.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(T,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.length?this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&Y.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?$(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,bc)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!X.test(a[0])&&(d.support.checkClone||!Y.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){ba(a,e),f=bb(a),g=bb(e);for(h=0;f[h];++h)ba(f[h],g[h])}if(b){_(a,e);if(c){f=bb(a),g=bb(e);for(h=0;f[h];++h)_(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||W.test(i)){if(typeof i==="string"){i=i.replace(T,"<$1></$2>");var j=(U.exec(i)||["",""])[1].toLowerCase(),k=Z[j]||Z._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=V.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&S.test(i)&&m.insertBefore(b.createTextNode(S.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bd=/alpha\([^)]*\)/i,be=/opacity=([^)]*)/,bf=/-([a-z])/ig,bg=/([A-Z]|^ms)/g,bh=/^-?\d+(?:px)?$/i,bi=/^-?\d/,bj={position:"absolute",visibility:"hidden",display:"block"},bk=["Left","Right"],bl=["Top","Bottom"],bm,bn,bo,bp=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bm(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bm)return bm(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bf,bp)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bq(a,b,e):d.swap(a,bj,function(){f=bq(a,b,e)});if(f<=0){f=bm(a,b,b),f==="0px"&&bo&&(f=bo(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bh.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return be.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bd.test(f)?f.replace(bd,e):c.filter+" "+e}}),d(function(){d.support.reliableMarginRight||(d.cssHooks.marginRight={get:function(a,b){var c;d.swap(a,{display:"inline-block"},function(){b?c=bm(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bn=function(a,c,e){var f,g,h;e=e.replace(bg,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bo=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bh.test(d)&&bi.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bm=bn||bo,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var br=/%20/g,bs=/\[\]$/,bt=/\r?\n/g,bu=/#.*$/,bv=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bw=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bx=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,by=/^(?:GET|HEAD)$/,bz=/^\/\//,bA=/\?/,bB=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bC=/^(?:select|textarea)/i,bD=/\s+/,bE=/([?&])_=[^&]*/,bF=/(^|\-)([a-z])/g,bG=function(a,b,c){return b+c.toUpperCase()},bH=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bI=d.fn.load,bJ={},bK={},bL,bM;try{bL=c.location.href}catch(bN){bL=c.createElement("a"),bL.href="",bL=bL.href}bM=bH.exec(bL.toLowerCase())||[],d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bI)return bI.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bB,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bC.test(this.nodeName)||bw.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bt,"\r\n")}}):{name:b.name,value:c.replace(bt,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bL,isLocal:bx.test(bM[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bO(bJ),ajaxTransport:bO(bK),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bR(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bS(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bF,bG)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bv.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bu,"").replace(bz,bM[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bD),e.crossDomain==null&&(q=bH.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bM[1]||q[2]!=bM[2]||(q[3]||(q[1]==="http:"?80:443))!=(bM[3]||(bM[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bP(bJ,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!by.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bA.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bE,"$1_="+w);e.url=x+(x===e.url?(bA.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bP(bK,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bQ(g,a[g],c,f);return e.join("&").replace(br,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bT=d.now(),bU=/(\=)\?(&|$)|\?\?/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bT++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bU.test(b.url)||f&&bU.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bU,l),b.url===j&&(f&&(k=k.replace(bU,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bV=d.now(),bW,bX;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bZ()||b$()}:bZ,bX=d.ajaxSettings.xhr(),d.support.ajax=!!bX,d.support.cors=bX&&"withCredentials"in bX,bX=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bW[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bW||(bW={},bY()),h=bV++,g.onreadystatechange=bW[h]=c):c()},abort:function(){c&&c(0,1)}}}});var b_={},ca=/^(?:toggle|show|hide)$/,cb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cc,cd=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(ce("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cf(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ce("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(ce("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cf(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(ca.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=cb.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:ce("show",1),slideUp:ce("hide",1),slideToggle:ce("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!cc&&(cc=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(cc),cc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var cg=/^t(?:able|d|h)$/i,ch=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=ci(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!cg.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=(e==="absolute"||e==="fixed")&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=ch.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!ch.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=ci(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=ci(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);
- /**
- * jQuery MD5 hash algorithm function
- *
- * <code>
- * Calculate the md5 hash of a String
- * String $.md5 ( String str )
- * </code>
- *
- * Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash.
- * MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of data. The generated hash is also non-reversable. Data cannot be retrieved from the message digest, the digest uniquely identifies the data.
- * MD5 was developed by Professor Ronald L. Rivest in 1994. Its 128 bit (16 byte) message digest makes it a faster implementation than SHA-1.
- * This script is used to process a variable length message into a fixed-length output of 128 bits using the MD5 algorithm. It is fully compatible with UTF-8 encoding. It is very useful when u want to transfer encrypted passwords over the internet. If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
- * This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
- *
- * Example
- * Code
- * <code>
- * $.md5("I'm Persian.");
- * </code>
- * Result
- * <code>
- * "b8c901d0f02223f9761016cfff9d68df"
- * </code>
- *
- * @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
- * @link http://www.semnanweb.com/jquery-plugin/md5.html
- * @see http://www.webtoolkit.info/
- * @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
- * @param {jQuery} {md5:function(string))
- * @return string
- */
-
- (function($){
-
- var rotateLeft = function(lValue, iShiftBits) {
- return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
- }
-
- var addUnsigned = function(lX, lY) {
- var lX4, lY4, lX8, lY8, lResult;
- lX8 = (lX & 0x80000000);
- lY8 = (lY & 0x80000000);
- lX4 = (lX & 0x40000000);
- lY4 = (lY & 0x40000000);
- lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
- if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
- if (lX4 | lY4) {
- if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
- else return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
- } else {
- return (lResult ^ lX8 ^ lY8);
- }
- }
-
- var F = function(x, y, z) {
- return (x & y) | ((~ x) & z);
- }
-
- var G = function(x, y, z) {
- return (x & z) | (y & (~ z));
- }
-
- var H = function(x, y, z) {
- return (x ^ y ^ z);
- }
-
- var I = function(x, y, z) {
- return (y ^ (x | (~ z)));
- }
-
- var FF = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var GG = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var HH = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var II = function(a, b, c, d, x, s, ac) {
- a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
- return addUnsigned(rotateLeft(a, s), b);
- };
-
- var convertToWordArray = function(string) {
- var lWordCount;
- var lMessageLength = string.length;
- var lNumberOfWordsTempOne = lMessageLength + 8;
- var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;
- var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;
- var lWordArray = Array(lNumberOfWords - 1);
- var lBytePosition = 0;
- var lByteCount = 0;
- while (lByteCount < lMessageLength) {
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
- lByteCount++;
- }
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
- lBytePosition = (lByteCount % 4) * 8;
- lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
- lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
- lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
- return lWordArray;
- };
-
- var wordToHex = function(lValue) {
- var WordToHexValue = "", WordToHexValueTemp = "", lByte, lCount;
- for (lCount = 0; lCount <= 3; lCount++) {
- lByte = (lValue >>> (lCount * 8)) & 255;
- WordToHexValueTemp = "0" + lByte.toString(16);
- WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);
- }
- return WordToHexValue;
- };
-
- var uTF8Encode = function(string) {
- string = string.replace(/\x0d\x0a/g, "\x0a");
- var output = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- output += String.fromCharCode(c);
- } else if ((c > 127) && (c < 2048)) {
- output += String.fromCharCode((c >> 6) | 192);
- output += String.fromCharCode((c & 63) | 128);
- } else {
- output += String.fromCharCode((c >> 12) | 224);
- output += String.fromCharCode(((c >> 6) & 63) | 128);
- output += String.fromCharCode((c & 63) | 128);
- }
- }
- return output;
- };
-
- $.extend({
- md5: function(string) {
- var x = Array();
- var k, AA, BB, CC, DD, a, b, c, d;
- var S11=7, S12=12, S13=17, S14=22;
- var S21=5, S22=9 , S23=14, S24=20;
- var S31=4, S32=11, S33=16, S34=23;
- var S41=6, S42=10, S43=15, S44=21;
- string = uTF8Encode(string);
- x = convertToWordArray(string);
- a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
- for (k = 0; k < x.length; k += 16) {
- AA = a; BB = b; CC = c; DD = d;
- a = FF(a, b, c, d, x[k+0], S11, 0xD76AA478);
- d = FF(d, a, b, c, x[k+1], S12, 0xE8C7B756);
- c = FF(c, d, a, b, x[k+2], S13, 0x242070DB);
- b = FF(b, c, d, a, x[k+3], S14, 0xC1BDCEEE);
- a = FF(a, b, c, d, x[k+4], S11, 0xF57C0FAF);
- d = FF(d, a, b, c, x[k+5], S12, 0x4787C62A);
- c = FF(c, d, a, b, x[k+6], S13, 0xA8304613);
- b = FF(b, c, d, a, x[k+7], S14, 0xFD469501);
- a = FF(a, b, c, d, x[k+8], S11, 0x698098D8);
- d = FF(d, a, b, c, x[k+9], S12, 0x8B44F7AF);
- c = FF(c, d, a, b, x[k+10], S13, 0xFFFF5BB1);
- b = FF(b, c, d, a, x[k+11], S14, 0x895CD7BE);
- a = FF(a, b, c, d, x[k+12], S11, 0x6B901122);
- d = FF(d, a, b, c, x[k+13], S12, 0xFD987193);
- c = FF(c, d, a, b, x[k+14], S13, 0xA679438E);
- b = FF(b, c, d, a, x[k+15], S14, 0x49B40821);
- a = GG(a, b, c, d, x[k+1], S21, 0xF61E2562);
- d = GG(d, a, b, c, x[k+6], S22, 0xC040B340);
- c = GG(c, d, a, b, x[k+11], S23, 0x265E5A51);
- b = GG(b, c, d, a, x[k+0], S24, 0xE9B6C7AA);
- a = GG(a, b, c, d, x[k+5], S21, 0xD62F105D);
- d = GG(d, a, b, c, x[k+10], S22, 0x2441453);
- c = GG(c, d, a, b, x[k+15], S23, 0xD8A1E681);
- b = GG(b, c, d, a, x[k+4], S24, 0xE7D3FBC8);
- a = GG(a, b, c, d, x[k+9], S21, 0x21E1CDE6);
- d = GG(d, a, b, c, x[k+14], S22, 0xC33707D6);
- c = GG(c, d, a, b, x[k+3], S23, 0xF4D50D87);
- b = GG(b, c, d, a, x[k+8], S24, 0x455A14ED);
- a = GG(a, b, c, d, x[k+13], S21, 0xA9E3E905);
- d = GG(d, a, b, c, x[k+2], S22, 0xFCEFA3F8);
- c = GG(c, d, a, b, x[k+7], S23, 0x676F02D9);
- b = GG(b, c, d, a, x[k+12], S24, 0x8D2A4C8A);
- a = HH(a, b, c, d, x[k+5], S31, 0xFFFA3942);
- d = HH(d, a, b, c, x[k+8], S32, 0x8771F681);
- c = HH(c, d, a, b, x[k+11], S33, 0x6D9D6122);
- b = HH(b, c, d, a, x[k+14], S34, 0xFDE5380C);
- a = HH(a, b, c, d, x[k+1], S31, 0xA4BEEA44);
- d = HH(d, a, b, c, x[k+4], S32, 0x4BDECFA9);
- c = HH(c, d, a, b, x[k+7], S33, 0xF6BB4B60);
- b = HH(b, c, d, a, x[k+10], S34, 0xBEBFBC70);
- a = HH(a, b, c, d, x[k+13], S31, 0x289B7EC6);
- d = HH(d, a, b, c, x[k+0], S32, 0xEAA127FA);
- c = HH(c, d, a, b, x[k+3], S33, 0xD4EF3085);
- b = HH(b, c, d, a, x[k+6], S34, 0x4881D05);
- a = HH(a, b, c, d, x[k+9], S31, 0xD9D4D039);
- d = HH(d, a, b, c, x[k+12], S32, 0xE6DB99E5);
- c = HH(c, d, a, b, x[k+15], S33, 0x1FA27CF8);
- b = HH(b, c, d, a, x[k+2], S34, 0xC4AC5665);
- a = II(a, b, c, d, x[k+0], S41, 0xF4292244);
- d = II(d, a, b, c, x[k+7], S42, 0x432AFF97);
- c = II(c, d, a, b, x[k+14], S43, 0xAB9423A7);
- b = II(b, c, d, a, x[k+5], S44, 0xFC93A039);
- a = II(a, b, c, d, x[k+12], S41, 0x655B59C3);
- d = II(d, a, b, c, x[k+3], S42, 0x8F0CCC92);
- c = II(c, d, a, b, x[k+10], S43, 0xFFEFF47D);
- b = II(b, c, d, a, x[k+1], S44, 0x85845DD1);
- a = II(a, b, c, d, x[k+8], S41, 0x6FA87E4F);
- d = II(d, a, b, c, x[k+15], S42, 0xFE2CE6E0);
- c = II(c, d, a, b, x[k+6], S43, 0xA3014314);
- b = II(b, c, d, a, x[k+13], S44, 0x4E0811A1);
- a = II(a, b, c, d, x[k+4], S41, 0xF7537E82);
- d = II(d, a, b, c, x[k+11], S42, 0xBD3AF235);
- c = II(c, d, a, b, x[k+2], S43, 0x2AD7D2BB);
- b = II(b, c, d, a, x[k+9], S44, 0xEB86D391);
- a = addUnsigned(a, AA);
- b = addUnsigned(b, BB);
- c = addUnsigned(c, CC);
- d = addUnsigned(d, DD);
- }
- var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
- return tempValue.toLowerCase();
- }
- });
- })(jQuery);/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();/** @license
- * SoundManager 2: Javascript Sound for the Web
- * --------------------------------------------
- * http://schillmania.com/projects/soundmanager2/
- *
- * Copyright (c) 2007, Scott Schiller. All rights reserved.
- * Code provided under the BSD License:
- * http://schillmania.com/projects/soundmanager2/license.txt
- *
- * V2.97a.20101010
- */
-
-/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: true, newcap: true, immed: true, regexp: false */
-/*global window, SM2_DEFER, sm2Debugger, alert, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
-
-(function(window) {
-
-var soundManager = null;
-
-function SoundManager(smURL, smID) {
-
- this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9.
- this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured)
- this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues
- this.useConsole = true; // use firebug/safari console.log()-type debug console if available
- this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug
- this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload()
- this.nullURL = 'about:blank'; // path to "null" (empty) MP3 file, used to unload sounds (Flash 8 only)
- this.allowPolling = true; // allow flash to poll for status update (required for whileplaying() events, peak, sound spectrum functions to work.)
- this.useFastPolling = false; // uses lower flash timer interval for higher callback frequency, best combined with useHighPerformance
- this.useMovieStar = true; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio formats (AAC, M4V, FLV, MOV etc.)
- this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000'
- this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag
- this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity)
- this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top)
- this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain'
- this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable.
- this.useHTML5Audio = false; // Beta feature: Use HTML 5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible.
- this.html5Test = /^probably$/i; // HTML5 Audio().canPlayType() test. /^(probably|maybe)$/i if you want to be more liberal/risky.
- this.ondebuglog = false; // callback made with each log message, regardless of debugMode
-
- this.audioFormats = {
- // determines HTML5 support, flash requirements
- // eg. if MP3 or MP4 required, Flash fallback is used if HTML5 can't play it
- // shotgun approach to MIME testing due to browser variance
- 'mp3': {
- 'type': ['audio/mpeg; codecs="mp3"','audio/mpeg','audio/mp3','audio/MPA','audio/mpa-robust'],
- 'required': true
- },
- 'mp4': {
- 'related': ['aac','m4a'], // additional formats under the MP4 container
- 'type': ['audio/mp4; codecs="mp4a.40.2"','audio/aac','audio/x-m4a','audio/MP4A-LATM','audio/mpeg4-generic'],
- 'required': true
- },
- 'ogg': {
- 'type': ['audio/ogg; codecs=vorbis'],
- 'required': false
- },
- 'wav': {
- 'type': ['audio/wav; codecs="1"','audio/wav','audio/wave','audio/x-wav'],
- 'required': false
- }
- };
-
- this.defaultOptions = {
- 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can)
- 'stream': true, // allows playing before entire file has loaded (recommended)
- 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true)
- 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0)
- 'onid3': null, // callback function for "ID3 data is added/available"
- 'onload': null, // callback function for "load finished"
- 'whileloading': null, // callback function for "download progress update" (X of Y bytes received)
- 'onplay': null, // callback for "play" start
- 'onpause': null, // callback for "pause"
- 'onresume': null, // callback for "resume" (pause toggle)
- 'whileplaying': null, // callback during play (position update)
- 'onstop': null, // callback for "user stop"
- 'onfailure': null, // callback function for when playing fails
- 'onfinish': null, // callback function for "sound finished playing"
- 'onbeforefinish': null, // callback for "before sound finished playing (at [time])"
- 'onbeforefinishtime': 5000, // offset (milliseconds) before end of sound to trigger beforefinish (eg. 1000 msec = 1 second)
- 'onbeforefinishcomplete': null,// function to call when said sound finishes playing
- 'onjustbeforefinish': null, // callback for [n] msec before end of current sound
- 'onjustbeforefinishtime': 200, // [n] - if not using, set to 0 (or null handler) and event will not fire.
- 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time
- 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled
- 'position': null, // offset (milliseconds) to seek to within loaded sound data.
- 'pan': 0, // "pan" settings, left-to-right, -100 to 100
- 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3
- 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)
- 'volume': 100 // self-explanatory. 0-100, the latter being the max.
- };
-
- this.flash9Options = { // flash 9-only options, merged into defaultOptions if flash 9 is being used
- 'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
- 'usePeakData': false, // enable left/right channel peak (level) data
- 'useWaveformData': false, // enable sound spectrum (raw waveform data) - WARNING: CPU-INTENSIVE: may set CPUs on fire.
- 'useEQData': false, // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.
- 'onbufferchange': null, // callback for "isBuffering" property change
- 'ondataerror': null, // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
- 'onstats': null // callback for when connection & play times have been measured
- };
-
- this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio options, merged into defaultOptions if flash 9+movieStar mode is enabled
- 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.)
- 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants
- 'onconnect': null, // rtmp: callback for connection to flash media server
- 'bufferTimes': null, // array of buffer sizes to use. Size increases as buffer fills up.
- 'duration': null // rtmp: song duration (msec)
- };
-
- this.version = null;
- this.versionNumber = 'V2.97a.20101010';
- this.movieURL = null;
- this.url = (smURL || null);
- this.altURL = null;
- this.swfLoaded = false;
- this.enabled = false;
- this.o = null;
- this.movieID = 'sm2-container';
- this.id = (smID || 'sm2movie');
- this.swfCSS = {
- 'swfBox': 'sm2-object-box',
- 'swfDefault': 'movieContainer',
- 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error)
- 'swfTimedout': 'swf_timedout',
- 'swfUnblocked': 'swf_unblocked', // or loaded OK
- 'sm2Debug': 'sm2_debug',
- 'highPerf': 'high_performance',
- 'flashDebug': 'flash_debug'
- };
- this.oMC = null;
- this.sounds = {};
- this.soundIDs = [];
- this.muted = false;
- this.debugID = 'soundmanager-debug';
- this.debugURLParam = /([#?&])debug=1/i;
- this.specialWmodeCase = false;
- this.didFlashBlock = false;
-
- this.filePattern = null;
- this.filePatterns = {
- 'flash8': /\.mp3(\?.*)?$/i,
- 'flash9': /\.mp3(\?.*)?$/i
- };
-
- this.baseMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3
- this.netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3, mp4, aac etc.
- this.netStreamTypes = ['aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2']; // Flash v9.0r115+ "moviestar" formats
- this.netStreamPattern = new RegExp('\\.(' + this.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
- this.mimePattern = this.baseMimeTypes;
-
- this.features = {
- 'buffering': false,
- 'peakData': false,
- 'waveformData': false,
- 'eqData': false,
- 'movieStar': false
- };
-
- this.sandbox = {
- // <d>
- 'type': null,
- 'types': {
- 'remote': 'remote (domain-based) rules',
- 'localWithFile': 'local with file access (no internet access)',
- 'localWithNetwork': 'local with network (internet access only, no local access)',
- 'localTrusted': 'local, trusted (local+internet access)'
- },
- 'description': null,
- 'noRemote': null,
- 'noLocal': null
- // </d>
- };
-
- this.hasHTML5 = null; // switch for handling logic
- this.html5 = { // stores canPlayType() results, etc. treat as read-only.
- // mp3: boolean
- // mp4: boolean
- 'usingFlash': null // set if/when flash fallback is needed
- };
- this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?)
-
- // --- private SM2 internals ---
-
- var SMSound,
- _s = this, _sm = 'soundManager', _id, _ua = navigator.userAgent, _wl = window.location.href.toString(), _fV = this.flashVersion, _doc = document, _win = window, _doNothing, _init, _onready = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnReady, _processOnReady, _initUserOnload, _go, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _beginInit, _strings, _initMovie, _dcLoaded, _didDCLoaded, _getDocument, _createMovie, _die, _mobileFlash, _setPolling, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5Only = false, _html5CanPlay, _html5Ext, _dcIE, _testHTML5, _addEvt, _removeEvt, _slice = Array.prototype.slice,
- _is_pre = _ua.match(/pre\//i),
- _iPadOrPhone = _ua.match(/(ipad|iphone)/i),
- _isMobile = (_ua.match(/mobile/i) || _is_pre || _iPadOrPhone),
- _isIE = (_ua.match(/MSIE/i)),
- _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)),
- _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'),
- _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null),
- _tryInitOnFocus = (typeof _doc.hasFocus === 'undefined' && _isSafari),
- _okToDisable = !_tryInitOnFocus;
-
- this._use_maybe = (_wl.match(/sm2\-useHTML5Maybe\=1/i)); // temporary feature: #sm2-useHTML5Maybe=1 forces loose canPlay() check
- this._overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null);
- this.useAltURL = !this._overHTTP; // use altURL if not "online"
-
- if (_iPadOrPhone || _is_pre) {
- // might as well force it on Apple + Palm, flash support unlikely
- _s.useHTML5Audio = true;
- _s.ignoreFlash = true;
- }
-
- if (_is_pre || this._use_maybe) {
- // less-strict canPlayType() checking option
- _s.html5Test = /^(probably|maybe)$/i;
- }
-
- // Temporary feature: allow force of HTML5 via URL: #sm2-usehtml5audio=0 or 1
- // <d>
- (function(){
- var a = '#sm2-usehtml5audio=', l = _wl, b = null;
- if (l.indexOf(a) !== -1) {
- b = (l.substr(l.indexOf(a)+a.length) === '1');
- if (typeof console !== 'undefined' && typeof console.log !== 'undefined') {
- console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter');
- }
- _s.useHTML5Audio = b;
- }
- }());
- // </d>
-
- // --- public API methods ---
-
- this.supported = function() {
- return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5));
- };
-
- this.getMovie = function(smID) {
- return _isIE?_win[smID]:(_isSafari?_id(smID) || _doc[smID]:_id(smID));
- };
-
- this.loadFromXML = function(sXmlUrl) {
- try {
- _s.o._loadFromXML(sXmlUrl);
- } catch(e) {
- _failSafely();
- }
- return true;
- };
-
- this.createSound = function(oOptions) {
- var _cs = 'soundManager.createSound(): ',
- thisOptions = null, oSound = null, _tO = null;
- if (!_didInit || !_s.supported()) {
- _complain(_cs + _str(!_didInit?'notReady':'notOK'));
- return false;
- }
- if (arguments.length === 2) {
- // function overloading in JS! :) ..assume simple createSound(id,url) use case
- oOptions = {
- 'id': arguments[0],
- 'url': arguments[1]
- };
- }
- thisOptions = _mixin(oOptions); // inherit from defaultOptions
- _tO = thisOptions; // alias
- // <d>
- if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) {
- _s._wD(_cs + _str('badID', _tO.id), 2);
- }
- _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1);
- // </d>
- if (_idCheck(_tO.id, true)) {
- _s._wD(_cs + _tO.id + ' exists', 1);
- return _s.sounds[_tO.id];
- }
-
- function make() {
- thisOptions = _loopFix(thisOptions);
- _s.sounds[_tO.id] = new SMSound(_tO);
- _s.soundIDs.push(_tO.id);
- return _s.sounds[_tO.id];
- }
-
- if (_html5OK(_tO)) {
- oSound = make();
- _s._wD('Loading sound '+_tO.id+' from HTML5');
- oSound._setup_html5(_tO);
- } else {
- if (_fV > 8 && _s.useMovieStar) {
- if (_tO.isMovieStar === null) {
- _tO.isMovieStar = ((_tO.serverURL || (_tO.type?_tO.type.match(_s.netStreamPattern):false)||_tO.url.match(_s.netStreamPattern))?true:false);
- }
- if (_tO.isMovieStar) {
- _s._wD(_cs + 'using MovieStar handling');
- }
- if (_tO.isMovieStar) {
- if (_tO.usePeakData) {
- _wDS('noPeak');
- _tO.usePeakData = false;
- }
- if (_tO.loops > 1) {
- _wDS('noNSLoop');
- }
- }
- }
- _tO = _policyFix(_tO, _cs);
- oSound = make();
- if (_fV === 8) {
- _s.o._createSound(_tO.id, _tO.onjustbeforefinishtime, _tO.loops||1, _tO.usePolicyFile);
- } else {
- _s.o._createSound(_tO.id, _tO.url, _tO.onjustbeforefinishtime, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.bufferTimes, _tO.onstats ? true : false, _tO.autoLoad, _tO.usePolicyFile);
- if (!_tO.serverURL) {
- // We are connected immediately
- oSound.connected = true;
- if (_tO.onconnect) {
- _tO.onconnect.apply(oSound);
- }
- }
- }
- }
- if (_tO.autoLoad || _tO.autoPlay) {
- if (oSound) {
- if (_s.isHTML5) {
- oSound.autobuffer = 'auto'; // early HTML5 implementation (non-standard)
- oSound.preload = 'auto'; // standard
- } else {
- oSound.load(_tO);
- }
- }
- }
- if (_tO.autoPlay) {
- oSound.play();
- }
- return oSound;
- };
-
- this.destroySound = function(sID, _bFromSound) {
- // explicitly destroy a sound before normal page unload, etc.
- if (!_idCheck(sID)) {
- return false;
- }
- var oS = _s.sounds[sID], i;
- oS._iO = {}; // Disable all callbacks while the sound is being destroyed
- oS.stop();
- oS.unload();
- for (i = 0; i < _s.soundIDs.length; i++) {
- if (_s.soundIDs[i] === sID) {
- _s.soundIDs.splice(i, 1);
- break;
- }
- }
- if (!_bFromSound) {
- // ignore if being called from SMSound instance
- oS.destruct(true);
- }
- oS = null;
- delete _s.sounds[sID];
- return true;
- };
-
- this.load = function(sID, oOptions) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].load(oOptions);
- };
-
- this.unload = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].unload();
- };
-
- this.play = function(sID, oOptions) {
- var fN = 'soundManager.play(): ';
- if (!_didInit || !_s.supported()) {
- _complain(fN + _str(!_didInit?'notReady':'notOK'));
- return false;
- }
- if (!_idCheck(sID)) {
- if (!(oOptions instanceof Object)) {
- oOptions = {
- url: oOptions
- }; // overloading use case: play('mySound','/path/to/some.mp3');
- }
- if (oOptions && oOptions.url) {
- // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'});
- _s._wD(fN + 'attempting to create "' + sID + '"', 1);
- oOptions.id = sID;
- return _s.createSound(oOptions).play();
- } else {
- return false;
- }
- }
- return _s.sounds[sID].play(oOptions);
- };
-
- this.start = this.play; // just for convenience
-
- this.setPosition = function(sID, nMsecOffset) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setPosition(nMsecOffset);
- };
-
- this.stop = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD('soundManager.stop(' + sID + ')', 1);
- return _s.sounds[sID].stop();
- };
-
- this.stopAll = function() {
- _s._wD('soundManager.stopAll()', 1);
- for (var oSound in _s.sounds) {
- if (_s.sounds[oSound] instanceof SMSound) {
- _s.sounds[oSound].stop(); // apply only to sound objects
- }
- }
- };
-
- this.pause = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].pause();
- };
-
- this.pauseAll = function() {
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].pause();
- }
- };
-
- this.resume = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].resume();
- };
-
- this.resumeAll = function() {
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].resume();
- }
- };
-
- this.togglePause = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].togglePause();
- };
-
- this.setPan = function(sID, nPan) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setPan(nPan);
- };
-
- this.setVolume = function(sID, nVol) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setVolume(nVol);
- };
-
- this.mute = function(sID) {
- var fN = 'soundManager.mute(): ',
- i = 0;
- if (typeof sID !== 'string') {
- sID = null;
- }
- if (!sID) {
- _s._wD(fN + 'Muting all sounds');
- for (i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].mute();
- }
- _s.muted = true;
- } else {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD(fN + 'Muting "' + sID + '"');
- return _s.sounds[sID].mute();
- }
- return true;
- };
-
- this.muteAll = function() {
- _s.mute();
- };
-
- this.unmute = function(sID) {
- var fN = 'soundManager.unmute(): ', i;
- if (typeof sID !== 'string') {
- sID = null;
- }
- if (!sID) {
- _s._wD(fN + 'Unmuting all sounds');
- for (i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].unmute();
- }
- _s.muted = false;
- } else {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD(fN + 'Unmuting "' + sID + '"');
- return _s.sounds[sID].unmute();
- }
- return true;
- };
-
- this.unmuteAll = function() {
- _s.unmute();
- };
-
- this.toggleMute = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].toggleMute();
- };
-
- this.getMemoryUse = function() {
- if (_fV === 8) {
- return 0;
- }
- if (_s.o) {
- return parseInt(_s.o._getMemoryUse(), 10);
- }
- };
-
- this.disable = function(bNoDisable) {
- // destroy all functions
- if (typeof bNoDisable === 'undefined') {
- bNoDisable = false;
- }
- if (_disabled) {
- return false;
- }
- _disabled = true;
- _wDS('shutdown', 1);
- for (var i = _s.soundIDs.length; i--;) {
- _disableObject(_s.sounds[_s.soundIDs[i]]);
- }
- _initComplete(bNoDisable); // fire "complete", despite fail
- _removeEvt(_win, 'load', _initUserOnload);
- return true;
- };
-
- this.canPlayMIME = function(sMIME) {
- var result;
- if (_s.hasHTML5) {
- result = _html5CanPlay({type:sMIME});
- }
- if (!_needsFlash || result) {
- // no flash, or OK
- return result;
- } else {
- return (sMIME?(sMIME.match(_s.mimePattern)?true:false):null);
- }
- };
-
- this.canPlayURL = function(sURL) {
- var result;
- if (_s.hasHTML5) {
- result = _html5CanPlay(sURL);
- }
- if (!_needsFlash || result) {
- // no flash, or OK
- return result;
- } else {
- return (sURL?(sURL.match(_s.filePattern)?true:false):null);
- }
- };
-
- this.canPlayLink = function(oLink) {
- if (typeof oLink.type !== 'undefined' && oLink.type) {
- if (_s.canPlayMIME(oLink.type)) {
- return true;
- }
- }
- return _s.canPlayURL(oLink.href);
- };
-
- this.getSoundById = function(sID, suppressDebug) {
- if (!sID) {
- throw new Error('SoundManager.getSoundById(): sID is null/undefined');
- }
- var result = _s.sounds[sID];
- if (!result && !suppressDebug) {
- _s._wD('"' + sID + '" is an invalid sound ID.', 2);
- }
- return result;
- };
-
- this.onready = function(oMethod, oScope) {
- if (oMethod && oMethod instanceof Function) {
- if (_didInit) {
- _wDS('queue');
- }
- if (!oScope) {
- oScope = _win;
- }
- _addOnReady(oMethod, oScope);
- _processOnReady();
- return true;
- } else {
- throw _str('needFunction');
- }
- };
-
- this.getMoviePercent = function() {
- return (_s.o && typeof _s.o.PercentLoaded !== 'undefined'?_s.o.PercentLoaded():null);
- };
-
- this._writeDebug = function(sText, sType, bTimestamp) {
- // If the debug log callback is set, always call it, regardless of debugMode
- if (_s.ondebuglog) {
- _s.ondebuglog(sText, sType, bTimestamp);
- }
- // pseudo-private console.log()-style output
- // <d>
- var sDID = 'soundmanager-debug', o, oItem, sMethod;
- if (!_s.debugMode) {
- return false;
- }
- if (typeof bTimestamp !== 'undefined' && bTimestamp) {
- sText = sText + ' | ' + new Date().getTime();
- }
- if (_hasConsole && _s.useConsole) {
- sMethod = _debugLevels[sType];
- if (typeof console[sMethod] !== 'undefined') {
- console[sMethod](sText);
- } else {
- console.log(sText);
- }
- if (_s.useConsoleOnly) {
- return true;
- }
- }
- try {
- o = _id(sDID);
- if (!o) {
- return false;
- }
- oItem = _doc.createElement('div');
- if (++_wdCount % 2 === 0) {
- oItem.className = 'sm2-alt';
- }
- if (typeof sType === 'undefined') {
- sType = 0;
- } else {
- sType = parseInt(sType, 10);
- }
- oItem.appendChild(_doc.createTextNode(sText));
- if (sType) {
- if (sType >= 2) {
- oItem.style.fontWeight = 'bold';
- }
- if (sType === 3) {
- oItem.style.color = '#ff3333';
- }
- }
- // o.appendChild(oItem); // top-to-bottom
- o.insertBefore(oItem, o.firstChild); // bottom-to-top
- } catch(e) {
- // oh well
- }
- o = null;
- // </d>
- return true;
- };
- this._wD = this._writeDebug; // alias
-
- this._debug = function() {
- // <d>
- _wDS('currentObj', 1);
- for (var i = 0, j = _s.soundIDs.length; i < j; i++) {
- _s.sounds[_s.soundIDs[i]]._debug();
- }
- // </d>
- };
-
- this.reboot = function() {
- // attempt to reset and init SM2
- _s._wD('soundManager.reboot()');
- if (_s.soundIDs.length) {
- _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...');
- }
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].destruct();
- }
- // trash ze flash
- try {
- if (_isIE) {
- _oRemovedHTML = _s.o.innerHTML;
- }
- _oRemoved = _s.o.parentNode.removeChild(_s.o);
- _s._wD('Flash movie removed.');
- } catch(e) {
- // uh-oh.
- _wDS('badRemove', 2);
- }
- // actually, force recreate of movie.
- _oRemovedHTML = _oRemoved = null;
- _s.enabled = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false;
- _s.soundIDs = _s.sounds = [];
- _s.o = null;
- for (i = _onready.length; i--;) {
- _onready[i].fired = false;
- }
- _s._wD(_sm + ': Rebooting...');
- _win.setTimeout(function() {
- _s.beginDelayedInit();
- }, 20);
- };
-
- this.destruct = function() {
- _s._wD('soundManager.destruct()');
- _s.disable(true);
- };
-
- this.beginDelayedInit = function() {
- // _s._wD('soundManager.beginDelayedInit()');
- _windowLoaded = true;
- _dcLoaded();
- setTimeout(_beginInit, 20);
- _delayWaitForEI();
- };
-
- // --- SMSound (sound object) instance ---
-
- SMSound = function(oOptions) {
- var _t = this, _resetProperties, _add_html5_events, _stop_html5_timer, _start_html5_timer, _get_html5_duration, _a;
- this.sID = oOptions.id;
- this.url = oOptions.url;
- this.options = _mixin(oOptions);
- this.instanceOptions = this.options; // per-play-instance-specific options
- this._iO = this.instanceOptions; // short alias
- // assign property defaults
- this.pan = this.options.pan;
- this.volume = this.options.volume;
- this._lastURL = null;
- this.isHTML5 = false;
-
- // --- public methods ---
-
- this.id3 = {};
-
- this._debug = function() {
- // <d>
- // pseudo-private console.log()-style output
- if (_s.debugMode) {
- var stuff = null, msg = [], sF, sfBracket, maxLength = 64;
- for (stuff in _t.options) {
- if (_t.options[stuff] !== null) {
- if (_t.options[stuff] instanceof Function) {
- // handle functions specially
- sF = _t.options[stuff].toString();
- sF = sF.replace(/\s\s+/g, ' '); // normalize spaces
- sfBracket = sF.indexOf('{');
- msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }');
- } else {
- msg.push(' ' + stuff + ': ' + _t.options[stuff]);
- }
- }
- }
- _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}');
- }
- // </d>
- };
-
- this._debug();
-
- this.load = function(oOptions) {
- var oS = null;
- if (typeof oOptions !== 'undefined') {
- _t._iO = _mixin(oOptions);
- _t.instanceOptions = _t._iO;
- } else {
- oOptions = _t.options;
- _t._iO = oOptions;
- _t.instanceOptions = _t._iO;
- if (_t._lastURL && _t._lastURL !== _t.url) {
- _wDS('manURL');
- _t._iO.url = _t.url;
- _t.url = null;
- }
- }
- _s._wD('soundManager.load(): ' + _t._iO.url, 1);
- if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) {
- _wDS('onURL', 1);
- return _t;
- }
- _t._lastURL = _t.url;
- _t.loaded = false;
- _t.readyState = 1;
- _t.playState = 0;
- if (_html5OK(_t._iO)) {
- _s._wD('HTML 5 load: '+_t._iO.url);
- oS = _t._setup_html5(_t._iO);
- oS.load();
- if (_t._iO.autoPlay) {
- _t.play();
- }
- } else {
- try {
- _t.isHTML5 = false;
- _t._iO = _policyFix(_loopFix(_t._iO));
- if (_fV === 8) {
- _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile);
- } else {
- _s.o._load(_t.sID, _t._iO.url, _t._iO.stream?true:false, _t._iO.autoPlay?true:false, _t._iO.loops||1, _t._iO.autoLoad?true:false, _t._iO.usePolicyFile);
- }
- } catch(e) {
- _wDS('smError', 2);
- _debugTS('onload', false);
- _die();
- }
- }
- return _t;
- };
-
- this.unload = function() {
- // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3
- // Flash 9/AS3: Close stream, preventing further load
- if (_t.readyState !== 0) {
- _s._wD('SMSound.unload(): "' + _t.sID + '"');
- if (!_t.isHTML5) {
- if (_fV === 8) {
- _s.o._unload(_t.sID, _s.nullURL);
- } else {
- _s.o._unload(_t.sID);
- }
- } else {
- _stop_html5_timer();
- if (_a) {
- // abort()-style method here, stop loading? (doesn't exist?)
- _a.pause();
- _a.src = _s.nullURL; // needed? does nulling object work? any better way to cancel/unload/abort?
- _a.load();
- _t._audio = null;
- _a = null;
- // delete _t._audio;
- }
- }
- // reset load/status flags
- _resetProperties();
- }
- return _t;
- };
-
- this.destruct = function(_bFromSM) {
- _s._wD('SMSound.destruct(): "' + _t.sID + '"');
- if (!_t.isHTML5) {
- // kill sound within Flash
- // Disable the onfailure handler
- _t._iO.onfailure = null;
- _s.o._destroySound(_t.sID);
- } else {
- _stop_html5_timer();
- if (_a) {
- _a.pause();
- _a.src = 'about:blank';
- _a.load();
- _t._audio = null;
- _a = null;
- // delete _t._audio;
- }
- }
- if (!_bFromSM) {
- _s.destroySound(_t.sID, true); // ensure deletion from controller
- }
- };
-
- this.play = function(oOptions, _updatePlayState) {
- var fN = 'SMSound.play(): ', allowMulti;
- _updatePlayState = (typeof _updatePlayState === 'undefined' ? true : _updatePlayState);
- if (!oOptions) {
- oOptions = {};
- }
- _t._iO = _mixin(oOptions, _t._iO);
- _t._iO = _mixin(_t._iO, _t.options);
- _t.instanceOptions = _t._iO;
- if (_t._iO.serverURL) {
- if (!_t.connected) {
- if (!_t.getAutoPlay()) {
- _s._wD(fN+' Netstream not connected yet - setting autoPlay');
- _t.setAutoPlay(true);
- }
- return _t;
- }
- }
- if (_html5OK(_t._iO)) {
- _t._setup_html5(_t._iO);
- _start_html5_timer();
- }
- // KJV paused sounds have playState 1. We want these sounds to play.
- if (_t.playState === 1 && !_t.paused) {
- allowMulti = _t._iO.multiShot;
- if (!allowMulti) {
- _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1);
- return _t;
- } else {
- _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1);
- if (_t.isHTML5) {
- // TODO: BUG?
- _t.setPosition(_t._iO.position);
- }
- }
- }
- if (!_t.loaded) {
- if (_t.readyState === 0) {
- _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1);
- // try to get this sound playing ASAP
- if (!_t.isHTML5) {
- if (!_t._iO.serverURL) {
- _t._iO.autoPlay = true;
- _t.load(_t._iO);
- }
- } else {
- _t.load(_t._iO);
- _t.readyState = 1;
- }
- } else if (_t.readyState === 2) {
- _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2);
- return _t;
- } else {
- _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1);
- }
- } else {
- _s._wD(fN + '"' + _t.sID + '"');
- }
- // Streams will pause when their buffer is full if they are not auto-playing.
- // In this case paused is true, but the song hasn't started playing yet. If
- // we just call resume() the onplay() callback will never be called.
-
- // Also, if we just call resume() in this case and the sound has been muted
- // (volume is 0), it will never have its volume set so sound will be heard
- // when it shouldn't.
- if (_t.paused && _t.position && _t.position > 0) { // https://gist.github.com/37b17df75cc4d7a90bf6
- _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1);
- _t.resume();
- } else {
- _s._wD(fN+'"'+ _t.sID+'" is starting to play');
- _t.playState = 1;
- _t.paused = false;
- if (!_t.instanceCount || _t._iO.multiShotEvents || (_fV > 8 && !_t.isHTML5 && !_t.getAutoPlay())) {
- _t.instanceCount++;
- }
- _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);
- _t._iO = _policyFix(_loopFix(_t._iO));
- if (_t._iO.onplay && _updatePlayState) {
- _t._iO.onplay.apply(_t);
- }
- _t.setVolume(_t._iO.volume, true);
- _t.setPan(_t._iO.pan, true);
- if (!_t.isHTML5) {
- _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t.position:_t.position / 1000));
- } else {
- _start_html5_timer();
- _t._setup_html5().play();
- }
- }
- return _t;
- };
-
- this.start = this.play; // just for convenience
-
- this.stop = function(bAll) {
- if (_t.playState === 1) {
- _t._onbufferchange(0);
- _t.resetOnPosition(0);
- if (!_t.isHTML5) {
- _t.playState = 0;
- }
- _t.paused = false;
- if (_t._iO.onstop) {
- _t._iO.onstop.apply(_t);
- }
- if (!_t.isHTML5) {
- _s.o._stop(_t.sID, bAll);
- // hack for netStream: just unload
- if (_t._iO.serverURL) {
- _t.unload();
- }
- } else {
- if (_a) {
- _t.setPosition(0); // act like Flash, though
- _a.pause(); // html5 has no stop()
- _t.playState = 0;
- _t._onTimer(); // and update UI
- _stop_html5_timer();
- _t.unload();
- }
- }
- _t.instanceCount = 0;
- _t._iO = {};
- }
- return _t;
- };
-
- this.setAutoPlay = function(autoPlay) {
- _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off'));
- _t._iO.autoPlay = autoPlay;
- _s.o._setAutoPlay(_t.sID, autoPlay);
- if (autoPlay) {
- // KJV Only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP)
- if (!_t.instanceCount && _t.readyState === 1) {
- _t.instanceCount++;
- _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount);
- }
- }
- };
-
- this.getAutoPlay = function() {
- return _t._iO.autoPlay;
- };
-
- this.setPosition = function(nMsecOffset, bNoDebug) {
- if (nMsecOffset === undefined) {
- nMsecOffset = 0;
- }
- // KJV Use the duration from the instance options, if we don't have a track duration yet.
- // Auto-loading streams with a starting position in their options will start playing
- // as soon as they connect. In the start() call we set the position on the stream,
- // but because the stream hasn't played _t.duration won't have been set (that is
- // done in whileloading()). So if we don't have a duration yet, use the duration
- // from the instance options, if available.
- var position, offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); // position >= 0 and <= current available (loaded) duration
- _t.position = offset;
- _t.resetOnPosition(_t.position);
- if (!_t.isHTML5) {
- position = _fV === 9 ? _t.position : _t.position / 1000;
- // KJV We want our sounds to play on seek. A progressive download that
- // is loaded has paused = false so resume() does nothing and the sound
- // doesn't play. Handle that case here.
- if (_t.playState === 0) {
- _t.play({ position: position });
- } else {
- _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); // if paused or not playing, will not resume (by playing)
- // if (_t.paused) {
- // _t.resume();
- // }
- }
- } else if (_a) {
- _s._wD('setPosition(): setting position to '+(_t.position / 1000));
- if (_t.playState) {
- // DOM/JS errors/exceptions to watch out for:
- // if seek is beyond (loaded?) position, "DOM exception 11"
- // "INDEX_SIZE_ERR": DOM exception 1
- try {
- _a.currentTime = _t.position / 1000;
- } catch(e) {
- _s._wD('setPosition('+_t.position+'): WARN: Caught exception: '+e.message, 2);
- }
- } else {
- _s._wD('HTML 5 warning: cannot set position while playState == 0 (not playing)',2);
- }
- if (_t.paused) { // if paused, refresh UI right away
- _t._onTimer(true); // force update
- if (_t._iO.useMovieStar) {
- _t.resume();
- }
- }
- }
- return _t;
- };
-
- this.pause = function(bCallFlash) {
- if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) {
- return _t;
- }
- _s._wD('SMSound.pause()');
- _t.paused = true;
- if (!_t.isHTML5) {
- if (bCallFlash || bCallFlash === undefined) {
- _s.o._pause(_t.sID);
- }
- } else {
- _t._setup_html5().pause();
- _stop_html5_timer();
- }
- if (_t._iO.onpause) {
- _t._iO.onpause.apply(_t);
- }
- return _t;
- };
-
- this.resume = function() {
- // When auto-loaded streams pause on buffer full they have a playState of 0.
- // We need to make sure that the playState is set to 1 when these streams "resume".
- if (!_t.paused) {
- return _t;
- }
- _s._wD('SMSound.resume()');
- _t.paused = false;
- _t.playState = 1; // TODO: verify that this is needed.
- if (!_t.isHTML5) {
- _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume)
- } else {
- _t._setup_html5().play();
- _start_html5_timer();
- }
- if (_t._iO.onresume) {
- _t._iO.onresume.apply(_t);
- }
- return _t;
- };
-
- this.togglePause = function() {
- _s._wD('SMSound.togglePause()');
- if (_t.playState === 0) {
- _t.play({
- position: (_fV === 9 && !_t.isHTML5 ? _t.position:_t.position / 1000)
- });
- return _t;
- }
- if (_t.paused) {
- _t.resume();
- } else {
- _t.pause();
- }
- return _t;
- };
-
- this.setPan = function(nPan, bInstanceOnly) {
- if (typeof nPan === 'undefined') {
- nPan = 0;
- }
- if (typeof bInstanceOnly === 'undefined') {
- bInstanceOnly = false;
- }
- if (!_t.isHTML5) {
- _s.o._setPan(_t.sID, nPan);
- } // else { no HTML5 pan? }
- _t._iO.pan = nPan;
- if (!bInstanceOnly) {
- _t.pan = nPan;
- }
- return _t;
- };
-
- this.setVolume = function(nVol, bInstanceOnly) {
- if (typeof nVol === 'undefined') {
- nVol = 100;
- }
- if (typeof bInstanceOnly === 'undefined') {
- bInstanceOnly = false;
- }
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol);
- } else if (_a) {
- _a.volume = nVol/100;
- }
- _t._iO.volume = nVol;
- if (!bInstanceOnly) {
- _t.volume = nVol;
- }
- return _t;
- };
-
- this.mute = function() {
- _t.muted = true;
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, 0);
- } else if (_a) {
- _a.muted = true;
- }
- return _t;
- };
-
- this.unmute = function() {
- _t.muted = false;
- var hasIO = typeof _t._iO.volume !== 'undefined';
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume);
- } else if (_a) {
- _a.muted = false;
- }
- return _t;
- };
-
- this.toggleMute = function() {
- return (_t.muted?_t.unmute():_t.mute());
- };
-
- this.onposition = function(nPosition, oMethod, oScope) {
- // TODO: allow for ranges, too? eg. (nPosition instanceof Array)
- _t._onPositionItems.push({
- position: nPosition,
- method: oMethod,
- scope: (typeof oScope !== 'undefined'?oScope:_t),
- fired: false
- });
- return _t;
- };
-
- this.processOnPosition = function() {
- var i, item, j = _t._onPositionItems.length;
- if (!j || !_t.playState || _t._onPositionFired >= j) {
- return false;
- }
- for (i=j; i--;) {
- item = _t._onPositionItems[i];
- if (!item.fired && _t.position >= item.position) {
- item.method.apply(item.scope,[item.position]);
- item.fired = true;
- _s._onPositionFired++;
- }
- }
- return true;
- };
-
- this.resetOnPosition = function(nPosition) {
- // reset "fired" for items interested in this position
- var i, item, j = _t._onPositionItems.length;
- if (!j) {
- return false;
- }
- for (i=j; i--;) {
- item = _t._onPositionItems[i];
- if (item.fired && nPosition <= item.position) {
- item.fired = false;
- _s._onPositionFired--;
- }
- }
- return true;
- };
-
- // pseudo-private soundManager reference
-
- this._onTimer = function(bForce) {
- // HTML 5-only _whileplaying() etc.
- var time, x = {};
- if (_t._hasTimer || bForce) {
- if (_a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { // TODO: May not need to track readyState (1 = loading)
- _t.duration = _get_html5_duration();
- _t.durationEstimate = _t.duration;
- time = _a.currentTime?_a.currentTime*1000:0;
- _t._whileplaying(time,x,x,x,x);
- return true;
- } else {
- _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK'));
- return false;
- }
- }
- };
-
- // --- private internals ---
-
- _get_html5_duration = function() {
- var d = (_a?_a.duration*1000:undefined);
- return (d && !isNaN(d)?d:null);
- };
-
- _start_html5_timer = function() {
- if (_t.isHTML5) {
- _startTimer(_t);
- }
- };
-
- _stop_html5_timer = function() {
- if (_t.isHTML5) {
- _stopTimer(_t);
- }
- };
-
- _resetProperties = function(bLoaded) {
- _t._onPositionItems = [];
- _t._onPositionFired = 0;
- _t._hasTimer = null;
- _t._added_events = null;
- _t._audio = null;
- _a = null;
- _t.bytesLoaded = null;
- _t.bytesTotal = null;
- _t.position = null;
- _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null);
- _t.durationEstimate = null;
- _t.failures = 0;
- _t.loaded = false;
- _t.playState = 0;
- _t.paused = false;
- _t.readyState = 0; // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success
- _t.muted = false;
- _t.didBeforeFinish = false;
- _t.didJustBeforeFinish = false;
- _t.isBuffering = false;
- _t.instanceOptions = {};
- _t.instanceCount = 0;
- _t.peakData = {
- left: 0,
- right: 0
- };
- _t.waveformData = {
- left: [],
- right: []
- };
- _t.eqData = []; // legacy: 1D array
- _t.eqData.left = [];
- _t.eqData.right = [];
- };
-
- _resetProperties();
-
- // pseudo-private methods used by soundManager
-
- this._setup_html5 = function(oOptions) {
- var _iO = _mixin(_t._iO, oOptions);
- if (_a) {
- if (_t.url !== _iO.url) {
- _s._wD('setting new URL on existing object: '+_iO.url);
- _a.src = _iO.url;
- }
- } else {
- _s._wD('creating HTML 5 audio element with URL: '+_iO.url);
- _t._audio = new Audio(_iO.url);
- _a = _t._audio;
- _t.isHTML5 = true;
- _add_html5_events();
- }
- _a.loop = (_iO.loops>1?'loop':'');
- return _t._audio;
- };
-
- // related private methods
-
- _add_html5_events = function() {
- if (_t._added_events) {
- return false;
- }
- _t._added_events = true;
-
- function _add(oEvt, oFn, bCapture) {
- return (_a ? _a.addEventListener(oEvt, oFn, bCapture||false) : null);
- }
-
- _add('load', function(e) {
- _s._wD('HTML5::load: '+_t.sID);
- if (_a) {
- _t._onbufferchange(0);
- _t._whileloading(_t.bytesTotal, _t.bytesTotal, _get_html5_duration());
- _t._onload(true);
- }
- }, false);
-
- _add('canplay', function(e) {
- _s._wD('HTML5::canplay: '+_t.sID);
- // enough has loaded to play
- _t._onbufferchange(0);
- },false);
-
- _add('waiting', function(e) {
- _s._wD('HTML5::waiting: '+_t.sID);
- // playback faster than download rate, etc.
- _t._onbufferchange(1);
- },false);
-
- _add('progress', function(e) { // not supported everywhere yet..
- _s._wD('HTML5::progress: '+_t.sID+': loaded/total: '+(e.loaded||0)+'/'+(e.total||1));
- if (!_t.loaded && _a) {
- _t._onbufferchange(0); // if progress, likely not buffering
- _t._whileloading(e.loaded||0, e.total||1, _get_html5_duration());
- }
- }, false);
-
- _add('error', function(e) {
- if (_a) {
- _s._wD('HTML5::error: '+_a.error.code);
- // call load with error state?
- _t._onload(false);
- }
- }, false);
-
- _add('loadstart', function(e) {
- _s._wD('HTML5::loadstart: '+_t.sID);
- // assume buffering at first
- _t._onbufferchange(1);
- }, false);
-
- _add('play', function(e) {
- _s._wD('HTML5::play: '+_t.sID);
- // once play starts, no buffering
- _t._onbufferchange(0);
- }, false);
-
- // TODO: verify if this is actually implemented anywhere yet.
- _add('playing', function(e) {
- _s._wD('HTML5::playing: '+_t.sID);
- // once play starts, no buffering
- _t._onbufferchange(0);
- }, false);
-
- _add('timeupdate', function(e) {
- _t._onTimer();
- }, false);
-
- // avoid stupid premature event-firing bug in Safari(?)
- setTimeout(function(){
- if (_t && _a) {
- _add('ended',function(e) {
- _s._wD('HTML5::ended: '+_t.sID);
- _t._onfinish();
- }, false);
- }
- }, 250);
- return true;
- };
-
- // --- "private" methods called by Flash ---
-
- this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
- _t.bytesLoaded = nBytesLoaded;
- _t.bytesTotal = nBytesTotal;
- _t.duration = Math.floor(nDuration);
- _t.bufferLength = nBufferLength;
- if (!_t._iO.isMovieStar) {
- if (_t._iO.duration) {
- // use options, if specified and larger
- _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration;
- } else {
- _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);
- }
- if (_t.durationEstimate === undefined) {
- _t.durationEstimate = _t.duration;
- }
- _t.bufferLength = nBufferLength;
- if (_t.readyState !== 3 && _t._iO.whileloading) {
- _t._iO.whileloading.apply(_t);
- }
- } else {
- _t.durationEstimate = _t.duration;
- if (_t.readyState !== 3 && _t._iO.whileloading) {
- _t._iO.whileloading.apply(_t);
- }
- }
- };
-
- this._onid3 = function(oID3PropNames, oID3Data) {
- // oID3PropNames: string array (names)
- // ID3Data: string array (data)
- _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.');
- var oData = [], i, j;
- for (i = 0, j = oID3PropNames.length; i < j; i++) {
- oData[oID3PropNames[i]] = oID3Data[i];
- }
- _t.id3 = _mixin(_t.id3, oData);
- if (_t._iO.onid3) {
- _t._iO.onid3.apply(_t);
- }
- };
-
- this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
- if (isNaN(nPosition) || nPosition === null) {
- return false; // Flash may return NaN at times
- }
- if (_t.playState === 0 && nPosition > 0) {
- // invalid position edge case for end/stop
- nPosition = 0;
- }
- _t.position = nPosition;
- _t.processOnPosition();
- if (_fV > 8 && !_t.isHTML5) {
- if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) {
- _t.peakData = {
- left: oPeakData.leftPeak,
- right: oPeakData.rightPeak
- };
- }
- if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) {
- _t.waveformData = {
- left: oWaveformDataLeft.split(','),
- right: oWaveformDataRight.split(',')
- };
- }
- if (_t._iO.useEQData) {
- if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) {
- var eqLeft = oEQData.leftEQ.split(',');
- _t.eqData = eqLeft;
- _t.eqData.left = eqLeft;
- if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) {
- _t.eqData.right = oEQData.rightEQ.split(',');
- }
- }
- }
- }
- if (_t.playState === 1) {
- // special case/hack: ensure buffering is false if loading from cache (and not yet started)
- if (!_t.isHTML5 && _s.flashVersion === 8 && !_t.position && _t.isBuffering) {
- _t._onbufferchange(0);
- }
- if (_t._iO.whileplaying) {
- _t._iO.whileplaying.apply(_t); // flash may call after actual finish
- }
- if ((_t.loaded || (!_t.loaded && _t._iO.isMovieStar)) && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration - _t.position <= _t._iO.onbeforefinishtime) {
- _t._onbeforefinish();
- }
- }
- return true;
- };
-
- this._onconnect = function(bSuccess) {
- var fN = 'SMSound._onconnect(): ';
- bSuccess = (bSuccess === 1);
- _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2));
- _t.connected = bSuccess;
- if (bSuccess) {
- _t.failures = 0;
- if (_t._iO.onconnect) {
- _t._iO.onconnect.apply(_t,[bSuccess]);
- }
- // don't play if the sound is being destroyed
- if (_idCheck(_t.sID) && (_t.options.autoLoad || _t.getAutoPlay())) {
- _t.play(undefined, _t.getAutoPlay()); // only update the play state if auto playing
- }
- }
- };
-
- this._onload = function(nSuccess) {
- var fN = 'SMSound._onload(): ', loadOK = (nSuccess?true:false);
- _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2));
- // <d>
- if (!loadOK && !_t.isHTML5) {
- if (_s.sandbox.noRemote === true) {
- _s._wD(fN + _str('noNet'), 1);
- }
- if (_s.sandbox.noLocal === true) {
- _s._wD(fN + _str('noLocal'), 1);
- }
- }
- // </d>
- _t.loaded = loadOK;
- _t.readyState = loadOK?3:2;
- _t._onbufferchange(0);
- if (_t._iO.onload) {
- _t._iO.onload.apply(_t, [loadOK]);
- }
- return true;
- };
-
- // fire onfailure() only once at most
- // at this point we just recreate failed sounds rather than trying to reconnect.
- this._onfailure = function(msg, level, code) {
- _t.failures++;
- _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures);
- if (_t._iO.onfailure && _t.failures === 1) {
- _t._iO.onfailure(_t, msg, level, code);
- } else {
- _s._wD('SMSound._onfailure(): ignoring');
- }
- };
-
- this._onbeforefinish = function() {
- if (!_t.didBeforeFinish) {
- _t.didBeforeFinish = true;
- if (_t._iO.onbeforefinish) {
- _s._wD('SMSound._onbeforefinish(): "' + _t.sID + '"');
- _t._iO.onbeforefinish.apply(_t);
- }
- }
- };
-
- this._onjustbeforefinish = function(msOffset) {
- if (!_t.didJustBeforeFinish) {
- _t.didJustBeforeFinish = true;
- if (_t._iO.onjustbeforefinish) {
- _s._wD('SMSound._onjustbeforefinish(): "' + _t.sID + '"');
- _t._iO.onjustbeforefinish.apply(_t);
- }
- }
- };
-
- // KJV - connect & play time callback from Flash
- this._onstats = function(stats) {
- if (_t._iO.onstats) {
- _t._iO.onstats(_t, stats);
- }
- };
-
- this._onfinish = function() {
- // _s._wD('SMSound._onfinish(): "' + _t.sID + '" got instanceCount '+_t.instanceCount);
- _t._onbufferchange(0);
- _t.resetOnPosition(0);
- if (_t._iO.onbeforefinishcomplete) {
- _t._iO.onbeforefinishcomplete.apply(_t);
- }
- // reset some state items
- _t.didBeforeFinish = false;
- _t.didJustBeforeFinish = false;
- if (_t.instanceCount) {
- _t.instanceCount--;
- if (!_t.instanceCount) {
- // reset instance options
- _t.playState = 0;
- _t.paused = false;
- _t.instanceCount = 0;
- _t.instanceOptions = {};
- _stop_html5_timer();
- }
- if (!_t.instanceCount || _t._iO.multiShotEvents) {
- // fire onfinish for last, or every instance
- if (_t._iO.onfinish) {
- _s._wD('SMSound._onfinish(): "' + _t.sID + '"');
- _t._iO.onfinish.apply(_t);
- }
- }
- }
- };
-
- this._onbufferchange = function(nIsBuffering) {
- var fN = 'SMSound._onbufferchange()';
- if (_t.playState === 0) {
- // ignore if not playing
- return false;
- }
- if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) {
- return false;
- }
- _t.isBuffering = (nIsBuffering === 1);
- if (_t._iO.onbufferchange) {
- _s._wD(fN + ': ' + nIsBuffering);
- _t._iO.onbufferchange.apply(_t);
- }
- return true;
- };
-
- this._ondataerror = function(sError) {
- // flash 9 wave/eq data handler
- if (_t.playState > 0) { // hack: called at start, and end from flash at/after onfinish()
- _s._wD('SMSound._ondataerror(): ' + sError);
- if (_t._iO.ondataerror) {
- _t._iO.ondataerror.apply(_t);
- }
- }
- };
-
- }; // SMSound()
-
- // --- private SM2 internals ---
-
- _getDocument = function() {
- return (_doc.body?_doc.body:(_doc._docElement?_doc.documentElement:_doc.getElementsByTagName('div')[0]));
- };
-
- _id = function(sID) {
- return _doc.getElementById(sID);
- };
-
- _mixin = function(oMain, oAdd) {
- // non-destructive merge
- var o1 = {}, i, o2, o;
- for (i in oMain) { // clone c1
- if (oMain.hasOwnProperty(i)) {
- o1[i] = oMain[i];
- }
- }
- o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd);
- for (o in o2) {
- if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') {
- o1[o] = o2[o];
- }
- }
- return o1;
- };
-
- (function() {
- var old = (_win.attachEvent),
- evt = {
- add: (old?'attachEvent':'addEventListener'),
- remove: (old?'detachEvent':'removeEventListener')
- };
-
- function getArgs(oArgs) {
- var args = _slice.call(oArgs), len = args.length;
- if (old) {
- args[1] = 'on' + args[1]; // prefix
- if (len > 3) {
- args.pop(); // no capture
- }
- } else if (len === 3) {
- args.push(false);
- }
- return args;
- }
-
- function apply(args, sType) {
- var oFunc = args.shift()[evt[sType]];
- if (old) {
- oFunc(args[0], args[1]);
- } else {
- oFunc.apply(this, args);
- }
- }
-
- _addEvt = function() {
- apply(getArgs(arguments), 'add');
- };
-
- _removeEvt = function() {
- apply(getArgs(arguments), 'remove');
- };
- }());
-
- _html5OK = function(iO) {
- return ((iO.type?_html5CanPlay({type:iO.type}):false)||_html5CanPlay(iO.url));
- };
-
- _html5CanPlay = function(sURL) {
- // try to find MIME, test and return truthiness
- if (!_s.useHTML5Audio || !_s.hasHTML5) {
- return false;
- }
- var result, mime, fileExt, item, aF = _s.audioFormats;
- if (!_html5Ext) {
- _html5Ext = [];
- for (item in aF) {
- if (aF.hasOwnProperty(item)) {
- _html5Ext.push(item);
- if (aF[item].related) {
- _html5Ext = _html5Ext.concat(aF[item].related);
- }
- }
- }
- _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')','i');
- }
- mime = (typeof sURL.type !== 'undefined'?sURL.type:null);
- fileExt = (typeof sURL === 'string'?sURL.toLowerCase().match(_html5Ext):null); // TODO: Strip URL queries, etc.
- if (!fileExt || !fileExt.length) {
- if (!mime) {
- return false;
- }
- } else {
- fileExt = fileExt[0].substr(1); // "mp3", for example
- }
- if (fileExt && typeof _s.html5[fileExt] !== 'undefined') {
- // result known
- return _s.html5[fileExt];
- } else {
- if (!mime) {
- if (fileExt && _s.html5[fileExt]) {
- return _s.html5[fileExt];
- } else {
- // best-case guess, audio/whatever-dot-filename-format-you're-playing
- mime = 'audio/'+fileExt;
- }
- }
- result = _s.html5.canPlayType(mime);
- _s.html5[fileExt] = result;
- // _s._wD('canPlayType, found result: '+result);
- return result;
- }
- };
-
- _testHTML5 = function() {
- if (!_s.useHTML5Audio || typeof Audio === 'undefined') {
- return false;
- }
- var a = (typeof Audio !== 'undefined' ? new Audio():null), item, support = {}, aF, i;
- function _cp(m) {
- var canPlay, i, j, isOK = false;
- if (!a || typeof a.canPlayType !== 'function') {
- return false;
- }
- if (m instanceof Array) {
- // iterate through all mime types, return any successes
- for (i=0, j=m.length; i<j && !isOK; i++) {
- if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {
- isOK = true;
- _s.html5[m[i]] = true;
- }
- }
- return isOK;
- } else {
- canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
- return (canPlay && (canPlay.match(_s.html5Test)?true:false));
- }
- }
- // test all registered formats + codecs
- aF = _s.audioFormats;
- for (item in aF) {
- if (aF.hasOwnProperty(item)) {
- support[item] = _cp(aF[item].type);
- // assign result to related formats, too
- if (aF[item] && aF[item].related) {
- for (i=0; i<aF[item].related.length; i++) {
- _s.html5[aF[item].related[i]] = support[item];
- }
- }
- }
- }
- support.canPlayType = (a?_cp:null);
- _s.html5 = _mixin(_s.html5, support);
- return true;
- };
-
- _strings = {
- // <d>
- notReady: 'Not loaded yet - wait for soundManager.onload()/onready()',
- notOK: 'Audio support is not available.',
- appXHTML: _sm + '::createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.',
- spcWmode: _sm + '::createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue',
- swf404: _sm + ': Verify that %s is a valid path.',
- tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)',
- checkSWF: 'See SWF output for more debug info.',
- localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',
- waitFocus: _sm + ': Special case: Waiting for focus-related event..',
- waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...',
- waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...',
- needFunction: _sm + '.onready(): Function object expected',
- badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',
- noMS: 'MovieStar mode not enabled. Exiting.',
- currentObj: '--- ' + _sm + '._debug(): Current sound objects ---',
- waitEI: _sm + '::initMovie(): Waiting for ExternalInterface call from Flash..',
- waitOnload: _sm + ': Waiting for window.onload()',
- docLoaded: _sm + ': Document already loaded',
- onload: _sm + '::initComplete(): calling soundManager.onload()',
- onloadOK: _sm + '.onload() complete',
- init: '-- ' + _sm + '::init() --',
- didInit: _sm + '::init(): Already called?',
- flashJS: _sm + ': Attempting to call Flash from JS..',
- noPolling: _sm + ': Polling (whileloading()/whileplaying() support) is disabled.',
- secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',
- badRemove: 'Warning: Failed to remove flash movie.',
- noPeak: 'Warning: peakData features unsupported for movieStar formats',
- shutdown: _sm + '.disable(): Shutting down',
- queue: _sm + '.onready(): Queueing handler',
- smFail: _sm + ': Failed to initialise.',
- smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',
- fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..',
- fbLoaded: 'Flash loaded',
- fbHandler: 'soundManager::flashBlockHandler()',
- manURL: 'SMSound.load(): Using manually-assigned URL',
- onURL: _sm + '.load(): current URL already assigned.',
- badFV: 'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',
- as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)',
- noNSLoop: 'Note: Looping not implemented for MovieStar formats',
- needfl9: 'Note: Switching to flash 9, required for MP4 formats.',
- mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',
- mfOn: 'mobileFlash::enabling on-screen flash repositioning',
- policy: 'Enabling usePolicyFile for data access'
- // </d>
- };
-
- _id = function(sID) {
- return _doc.getElementById(sID);
- };
-
- _str = function() { // o [,items to replace]
- // <d>
- var args = _slice.call(arguments), // real array, please
- o = args.shift(), // first arg
- str = (_strings && _strings[o]?_strings[o]:''), i, j;
- if (str && args && args.length) {
- for (i = 0, j = args.length; i < j; i++) {
- str = str.replace('%s', args[i]);
- }
- }
- return str;
- // </d>
- };
-
- _loopFix = function(sOpt) {
- // flash 8 requires stream = false for looping to work
- if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) {
- _wDS('as2loop');
- sOpt.stream = false;
- }
- return sOpt;
- };
-
- _policyFix = function(sOpt, sPre) {
- if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
- _s._wD((sPre?sPre+':':'') + _str('policy'));
- sOpt.usePolicyFile = true;
- }
- return sOpt;
- };
-
- _complain = function(sMsg) {
- if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
- console.warn(sMsg);
- } else {
- _s._wD(sMsg);
- }
- };
-
- _doNothing = function() {
- return false;
- };
-
- _disableObject = function(o) {
- for (var oProp in o) {
- if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
- o[oProp] = _doNothing;
- }
- }
- oProp = null;
- };
-
- _failSafely = function(bNoDisable) {
- // general failure exception handler
- if (typeof bNoDisable === 'undefined') {
- bNoDisable = false;
- }
- if (_disabled || bNoDisable) {
- _wDS('smFail', 2);
- _s.disable(bNoDisable);
- }
- };
-
- _normalizeMovieURL = function(smURL) {
- var urlParams = null;
- if (smURL) {
- if (smURL.match(/\.swf(\?\.*)?$/i)) {
- urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);
- if (urlParams) {
- return smURL; // assume user knows what they're doing
- }
- } else if (smURL.lastIndexOf('/') !== smURL.length - 1) {
- smURL = smURL + '/';
- }
- }
- return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL;
- };
-
- _setVersionInfo = function() {
- if (_fV !== 8 && _fV !== 9) {
- _s._wD(_str('badFV', _fV, _defaultFlashVersion));
- _s.flashVersion = _defaultFlashVersion;
- }
- var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); // debug flash movie, if applicable
- if (_s.flashVersion < 9 && _s.useHTML5Audio && _s.audioFormats.mp4.required) {
- _s._wD(_str('needfl9'));
- _s.flashVersion = 9;
- }
- _fV = _s.flashVersion; // short-hand for internal use
- _s.version = _s.versionNumber + (_html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
- // set up default options
- if (_fV > 8) {
- _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options);
- _s.features.buffering = true;
- }
- if (_fV > 8 && _s.useMovieStar) {
- // flash 9+ support for movieStar formats as well as MP3
- _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions);
- _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _s.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
- _s.mimePattern = _s.netStreamMimeTypes;
- _s.features.movieStar = true;
- } else {
- _s.features.movieStar = false;
- }
- _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')];
- _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf',isDebug);
- _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8);
- };
-
- _setPolling = function(bPolling, bHighPerformance) {
- if (!_s.o || !_s.allowPolling) {
- return false;
- }
- _s.o._setPolling(bPolling, bHighPerformance);
- };
-
- (function() {
- var old = (_win.attachEvent),
- evt = {
- add: (old?'attachEvent':'addEventListener'),
- remove: (old?'detachEvent':'removeEventListener')
- };
-
- function getArgs(oArgs) {
- var args = _slice.call(oArgs), len = args.length;
- if (old) {
- args[1] = 'on' + args[1]; // prefix
- if (len > 3) {
- args.pop(); // no capture
- }
- } else if (len === 3) {
- args.push(false);
- }
- return args;
- }
-
- function apply(args, sType) {
- var oFunc = args.shift()[evt[sType]];
- if (old) {
- oFunc(args[0], args[1]);
- } else {
- oFunc.apply(this, args);
- }
- }
-
- _addEvt = function() {
- apply(getArgs(arguments), 'add');
- };
-
- _removeEvt = function() {
- apply(getArgs(arguments), 'remove');
- };
- }());
-
- function _initDebug() {
- if (_s.debugURLParam.test(_wl)) {
- _s.debugMode = true; // allow force of debug mode via URL
- }
- // <d>
- if (_id(_s.debugID)) {
- return false;
- }
- var oD, oDebug, oTarget, oToggle, tmp;
- if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) {
- oD = _doc.createElement('div');
- oD.id = _s.debugID + '-toggle';
- oToggle = {
- 'position': 'fixed',
- 'bottom': '0px',
- 'right': '0px',
- 'width': '1.2em',
- 'height': '1.2em',
- 'lineHeight': '1.2em',
- 'margin': '2px',
- 'textAlign': 'center',
- 'border': '1px solid #999',
- 'cursor': 'pointer',
- 'background': '#fff',
- 'color': '#333',
- 'zIndex': 10001
- };
- oD.appendChild(_doc.createTextNode('-'));
- oD.onclick = _toggleDebug;
- oD.title = 'Toggle SM2 debug console';
- if (_ua.match(/msie 6/i)) {
- oD.style.position = 'absolute';
- oD.style.cursor = 'hand';
- }
- for (tmp in oToggle) {
- if (oToggle.hasOwnProperty(tmp)) {
- oD.style[tmp] = oToggle[tmp];
- }
- }
- oDebug = _doc.createElement('div');
- oDebug.id = _s.debugID;
- oDebug.style.display = (_s.debugMode?'block':'none');
- if (_s.debugMode && !_id(oD.id)) {
- try {
- oTarget = _getDocument();
- oTarget.appendChild(oD);
- } catch(e2) {
- throw new Error(_str('appXHTML'));
- }
- oTarget.appendChild(oDebug);
- }
- }
- oTarget = null;
- // </d>
- }
-
- _mobileFlash = (function(){
-
- var oM = null;
-
- function resetPosition() {
- if (oM) {
- oM.left = oM.top = '-9999px';
- }
- }
-
- function reposition() {
- oM.left = _win.scrollX+'px';
- oM.top = _win.scrollY+'px';
- }
-
- function setReposition(bOn) {
- _s._wD('mobileFlash::flash on-screen hack: '+(bOn?'ON':'OFF'));
- var f = _win[(bOn?'add':'remove')+'EventListener'];
- f('resize', reposition, false);
- f('scroll', reposition, false);
- }
-
- function check(inDoc) {
- // mobile flash (Android for starters) check
- oM = _s.oMC.style;
- if (_ua.match(/android/i)) {
- if (inDoc) {
- if (_s.flashLoadTimeout) {
- _s._wDS('mfTimeout');
- _s.flashLoadTimeout = 0;
- }
- return false;
- }
- _s._wD('mfOn');
- oM.position = 'absolute';
- oM.left = oM.top = '0px';
- setReposition(true);
- _s.onready(function(){
- setReposition(false); // detach
- resetPosition(); // restore when OK/timed out
- });
- reposition();
- }
- return true;
- }
-
- return {
- 'check': check
- };
-
- }());
-
- _createMovie = function(smID, smURL) {
-
- var specialCase = null,
- remoteURL = (smURL?smURL:_s.url),
- localURL = (_s.altURL?_s.altURL:remoteURL),
- oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), s, x, sClass, side = '100%', isRTL = null, html = _doc.getElementsByTagName('html')[0];
- isRTL = (html && html.dir && html.dir.match(/rtl/i));
- smID = (typeof smID === 'undefined'?_s.id:smID);
-
- if (_didAppend && _appendSuccess) {
- return false; // ignore if already succeeded
- }
-
- function _initMsg() {
- _s._wD('-- SoundManager 2 ' + _s.version + (!_html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (_s.useMovieStar?', MovieStar mode':'') + (_s.useHighPerformance?', high performance mode, ':', ') + ((_s.useFastPolling?'fast':'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') + ' --', 1);
- }
-
- if (_html5Only) {
- _setVersionInfo();
- _initMsg();
- _s.oMC = _id(_s.movieID);
- _init();
- // prevent multiple init attempts
- _didAppend = true;
- _appendSuccess = true;
- return false;
- }
-
- _didAppend = true;
-
- // safety check for legacy (change to Flash 9 URL)
- _setVersionInfo();
- _s.url = _normalizeMovieURL(this._overHTTP?remoteURL:localURL);
- smURL = _s.url;
-
- _s.wmode = (!_s.wmode && _s.useHighPerformance && !_s.useMovieStar?'transparent':_s.wmode);
-
- if (_s.wmode !== null && !_isIE && !_s.useHighPerformance && navigator.platform.match(/win32/i)) {
- _s.specialWmodeCase = true;
- // extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here
- // does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout
- _wDS('spcWmode');
- _s.wmode = null;
- }
-
- oEmbed = {
- 'name': smID,
- 'id': smID,
- 'src': smURL,
- 'width': side,
- 'height': side,
- 'quality': 'high',
- 'allowScriptAccess': _s.allowScriptAccess,
- 'bgcolor': _s.bgColor,
- 'pluginspage': 'http://www.macromedia.com/go/getflashplayer',
- 'type': 'application/x-shockwave-flash',
- 'wmode': _s.wmode
- };
-
- if (_s.debugFlash) {
- oEmbed.FlashVars = 'debug=1';
- }
-
- if (!_s.wmode) {
- delete oEmbed.wmode; // don't write empty attribute
- }
-
- if (_isIE) {
- // IE is "special".
- oMovie = _doc.createElement('div');
- movieHTML = '<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" width="' + oEmbed.width + '" height="' + oEmbed.height + '"><param name="movie" value="' + smURL + '" /><param name="AllowScriptAccess" value="' + _s.allowScriptAccess + '" /><param name="quality" value="' + oEmbed.quality + '" />' + (_s.wmode?'<param name="wmode" value="' + _s.wmode + '" /> ':'') + '<param name="bgcolor" value="' + _s.bgColor + '" />' + (_s.debugFlash?'<param name="FlashVars" value="' + oEmbed.FlashVars + '" />':'') + '<!-- --></object>';
- } else {
- oMovie = _doc.createElement('embed');
- for (tmp in oEmbed) {
- if (oEmbed.hasOwnProperty(tmp)) {
- oMovie.setAttribute(tmp, oEmbed[tmp]);
- }
- }
- }
-
- _initDebug();
- extraClass = _getSWFCSS();
- oTarget = _getDocument();
-
- if (oTarget) {
- _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div');
- if (!_s.oMC.id) {
- _s.oMC.id = _s.movieID;
- _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass;
- // "hide" flash movie
- s = null;
- oEl = null;
- if (!_s.useFlashBlock) {
- if (_s.useHighPerformance) {
- s = {
- 'position': 'fixed',
- 'width': '8px',
- 'height': '8px',
- // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes.
- 'bottom': '0px',
- 'left': '0px',
- 'overflow': 'hidden'
- };
- } else {
- s = {
- 'position': 'absolute',
- 'width': '6px',
- 'height': '6px',
- 'top': '-9999px',
- 'left': '-9999px'
- };
- if (isRTL) {
- s.left = Math.abs(parseInt(s.left,10))+'px';
- }
- }
- }
- if (_ua.match(/webkit/i)) {
- _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5
- }
- if (!_s.debugFlash) {
- for (x in s) {
- if (s.hasOwnProperty(x)) {
- _s.oMC.style[x] = s[x];
- }
- }
- }
- try {
- if (!_isIE) {
- _s.oMC.appendChild(oMovie);
- }
- oTarget.appendChild(_s.oMC);
- if (_isIE) {
- oEl = _s.oMC.appendChild(_doc.createElement('div'));
- oEl.className = _s.swfCSS.swfBox;
- oEl.innerHTML = movieHTML;
- }
- _appendSuccess = true;
- } catch(e) {
- throw new Error(_str('appXHTML'));
- }
- _mobileFlash.check();
- } else {
- // it's already in the document.
- sClass = _s.oMC.className;
- _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
- _s.oMC.appendChild(oMovie);
- if (_isIE) {
- oEl = _s.oMC.appendChild(_doc.createElement('div'));
- oEl.className = _s.swfCSS.swfBox;
- oEl.innerHTML = movieHTML;
- }
- _appendSuccess = true;
- _mobileFlash.check(true);
- }
- }
-
- if (specialCase) {
- _s._wD(specialCase);
- }
-
- _initMsg();
- _s._wD('soundManager::createMovie(): Trying to load ' + smURL + (!this._overHTTP && _s.altURL?' (alternate URL)':''), 1);
-
- return true;
- };
-
- _idCheck = this.getSoundById;
-
- _initMovie = function() {
- if (_html5Only) {
- _createMovie();
- return false;
- }
- // attempt to get, or create, movie
- if (_s.o) {
- return false; // may already exist
- }
- _s.o = _s.getMovie(_s.id); // inline markup
- if (!_s.o) {
- if (!_oRemoved) {
- // try to create
- _createMovie(_s.id, _s.url);
- } else {
- // try to re-append removed movie after reboot()
- if (!_isIE) {
- _s.oMC.appendChild(_oRemoved);
- } else {
- _s.oMC.innerHTML = _oRemovedHTML;
- }
- _oRemoved = null;
- _didAppend = true;
- }
- _s.o = _s.getMovie(_s.id);
- }
- if (_s.o) {
- _s._wD('soundManager::initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')');
- _wDS('waitEI');
- }
- if (_s.oninitmovie instanceof Function) {
- setTimeout(_s.oninitmovie, 1);
- }
- return true;
- };
-
- _go = function(sURL) {
- // where it all begins.
- if (sURL) {
- _s.url = sURL;
- }
- _initMovie();
- };
-
- _delayWaitForEI = function() {
- setTimeout(_waitForEI, 500);
- };
-
- _waitForEI = function() {
- if (_waitingForEI) {
- return false;
- }
- _waitingForEI = true;
- _removeEvt(_win, 'load', _delayWaitForEI);
- if (_tryInitOnFocus && !_isFocused) {
- _wDS('waitFocus');
- return false;
- }
- var p;
- if (!_didInit) {
- p = _s.getMoviePercent();
- _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':''))));
- }
- setTimeout(function() {
- p = _s.getMoviePercent();
- if (!_didInit) {
- _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2);
- if (!this._overHTTP && p) {
- _wDS('localFail', 2);
- if (!_s.debugFlash) {
- _wDS('tryDebug', 2);
- }
- }
- if (p === 0) {
- // if 0 (not null), probably a 404.
- _s._wD(_str('swf404', _s.url));
- }
- _debugTS('flashtojs', false, ': Timed out' + this._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)');
- }
- // give up / time-out, depending
- if (!_didInit && _okToDisable) {
- if (p === null) {
- // SWF failed. Maybe blocked.
- if (_s.useFlashBlock || _s.flashLoadTimeout === 0) {
- if (_s.useFlashBlock) {
- _flashBlockHandler();
- }
- _wDS('waitForever');
- } else {
- // old SM2 behaviour, simply fail
- _failSafely(true);
- }
- } else {
- // flash loaded? Shouldn't be a blocking issue, then.
- if (_s.flashLoadTimeout === 0) {
- _wDS('waitForever');
- } else {
- _failSafely(true);
- }
- }
- }
- }, _s.flashLoadTimeout);
- };
-
- _go = function(sURL) {
- // where it all begins.
- if (sURL) {
- _s.url = sURL;
- }
- _initMovie();
- };
-
- // <d>
- _wDS = function(o, errorLevel) {
- if (!o) {
- return '';
- } else {
- return _s._wD(_str(o), errorLevel);
- }
- };
-
- if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) {
- _s._wD = function(sText) {alert(sText);};
- }
-
- _toggleDebug = function() {
- var o = _id(_s.debugID),
- oT = _id(_s.debugID + '-toggle');
- if (!o) {
- return false;
- }
- if (_debugOpen) {
- // minimize
- oT.innerHTML = '+';
- o.style.display = 'none';
- } else {
- oT.innerHTML = '-';
- o.style.display = 'block';
- }
- _debugOpen = !_debugOpen;
- };
-
- _debugTS = function(sEventType, bSuccess, sMessage) {
- // troubleshooter debug hooks
- if (typeof sm2Debugger !== 'undefined') {
- try {
- sm2Debugger.handleEvent(sEventType, bSuccess, sMessage);
- } catch(e) {
- // oh well
- }
- }
- return true;
- };
- // </d>
-
- _getSWFCSS = function() {
- var css = [];
- if (_s.debugMode) {
- css.push(_s.swfCSS.sm2Debug);
- }
- if (_s.debugFlash) {
- css.push(_s.swfCSS.flashDebug);
- }
- if (_s.useHighPerformance) {
- css.push(_s.swfCSS.highPerf);
- }
- return css.join(' ');
- };
-
- _flashBlockHandler = function() {
- // *possible* flash block situation.
- var name = _str('fbHandler'), p = _s.getMoviePercent();
- if (!_s.supported()) {
- if (_needsFlash) {
- // make the movie more visible, so user can fix
- _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + ' ' + (p === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
- _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':''));
- }
- _s.didFlashBlock = true;
- _processOnReady(true); // fire onready(), complain lightly
- if (_s.onerror instanceof Function) {
- _s.onerror.apply(_win);
- }
- } else {
- // SM2 loaded OK (or recovered)
- if (_s.didFlashBlock) {
- _s._wD(name+': Unblocked');
- }
- if (_s.oMC) {
- _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + (' '+_s.swfCSS.swfUnblocked);
- }
- }
- };
-
- _handleFocus = function() {
- function cleanup() {
- _removeEvt(_win, 'focus', _handleFocus);
- _removeEvt(_win, 'load', _handleFocus);
- }
- if (_isFocused || !_tryInitOnFocus) {
- cleanup();
- return true;
- }
- _okToDisable = true;
- _isFocused = true;
- _s._wD('soundManager::handleFocus()');
- if (_isSafari && _tryInitOnFocus) {
- // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event
- _removeEvt(_win, 'mousemove', _handleFocus);
- }
- // allow init to restart
- _waitingForEI = false;
- cleanup();
- return true;
- };
-
- _initComplete = function(bNoDisable) {
- if (_didInit) {
- return false;
- }
- if (_html5Only) {
- // all good.
- _s._wD('-- SoundManager 2: loaded --');
- _didInit = true;
- _processOnReady();
- _initUserOnload();
- return true;
- }
- var sClass = _s.oMC.className,
- wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent());
- if (!wasTimeout) {
- _didInit = true;
- }
- _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1);
- if (_disabled || bNoDisable) {
- if (_s.useFlashBlock) {
- _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
- }
- _processOnReady();
- _debugTS('onload', false);
- if (_s.onerror instanceof Function) {
- _s.onerror.apply(_win);
- }
- return false;
- } else {
- _debugTS('onload', true);
- }
- if (_s.waitForWindowLoad && !_windowLoaded) {
- _wDS('waitOnload');
- _addEvt(_win, 'load', _initUserOnload);
- return false;
- } else {
- if (_s.waitForWindowLoad && _windowLoaded) {
- _wDS('docLoaded');
- }
- _initUserOnload();
- }
- return true;
- };
-
- _addOnReady = function(oMethod, oScope) {
- _onready.push({
- 'method': oMethod,
- 'scope': (oScope || null),
- 'fired': false
- });
- };
-
- _processOnReady = function(ignoreInit) {
- if (!_didInit && !ignoreInit) {
- // not ready yet.
- return false;
- }
- var status = {
- success: (ignoreInit?_s.supported():!_disabled)
- },
- queue = [], i, j,
- canRetry = (!_s.useFlashBlock || (_s.useFlashBlock && !_s.supported()));
- for (i = 0, j = _onready.length; i < j; i++) {
- if (_onready[i].fired !== true) {
- queue.push(_onready[i]);
- }
- }
- if (queue.length) {
- _s._wD(_sm + ': Firing ' + queue.length + ' onready() item' + (queue.length > 1?'s':''));
- for (i = 0, j = queue.length; i < j; i++) {
- if (queue[i].scope) {
- queue[i].method.apply(queue[i].scope, [status]);
- } else {
- queue[i].method(status);
- }
- if (!canRetry) { // flashblock case doesn't count here
- queue[i].fired = true;
- }
- }
- }
- return true;
- };
-
- _initUserOnload = function() {
- _win.setTimeout(function() {
- if (_s.useFlashBlock) {
- _flashBlockHandler();
- }
- _processOnReady();
- _wDS('onload', 1);
- // call user-defined "onload", scoped to window
- if (_s.onload instanceof Function) {
- _s.onload.apply(_win);
- }
- _wDS('onloadOK', 1);
- if (_s.waitForWindowLoad) {
- _addEvt(_win, 'load', _initUserOnload);
- }
- },1);
- };
-
- _featureCheck = function() {
- var needsFlash, item,
- isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_(3|4)/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159
- isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works.
- if (isSpecial) {
- _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly.
- _html5Only = true; // ignore flash case, however
- if (_s.oMC) {
- _s.oMC.style.display = 'none';
- }
- return false;
- }
- if (_s.useHTML5Audio) {
- if (!_s.html5 || !_s.html5.canPlayType) {
- _s._wD('SoundManager: No HTML5 Audio() support detected.');
- _s.hasHTML5 = false;
- return true;
- } else {
- _s.hasHTML5 = true;
- }
- if (isBadSafari) {
- _s._wD('SoundManager::Note: Buggy HTML5 Audio in Safari on OS X 10.6.[3|4], see https://bugs.webkit.org/show_bug.cgi?id=32159 - disabling HTML5 audio',1);
- _s.useHTML5Audio = false;
- _s.hasHTML5 = false;
- return true;
- }
- } else {
- // flash required.
- return true;
- }
- for (item in _s.audioFormats) {
- if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) {
- // may need flash for this format?
- needsFlash = true;
- }
- }
- // sanity check..
- if (_s.ignoreFlash) {
- needsFlash = false;
- }
- _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash);
- return needsFlash;
- };
-
- _init = function() {
- var item, tests = [];
- _wDS('init');
-
- // called after onload()
- if (_didInit) {
- _wDS('didInit');
- return false;
- }
-
- function _cleanup() {
- _removeEvt(_win, 'load', _s.beginDelayedInit);
- }
-
- if (_s.hasHTML5) {
- for (item in _s.audioFormats) {
- if (_s.audioFormats.hasOwnProperty(item)) {
- tests.push(item+': '+_s.html5[item]);
- }
- }
- _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1);
- }
-
- if (_html5Only) {
- if (!_didInit) {
- // we don't need no steenking flash!
- _cleanup();
- _s.enabled = true;
- _initComplete();
- }
- return true;
- }
-
- // flash path
- _initMovie();
- try {
- _wDS('flashJS');
- _s.o._externalInterfaceTest(false); // attempt to talk to Flash
- if (!_s.allowPolling) {
- _wDS('noPolling', 1);
- } else {
- _setPolling(true, _s.useFastPolling?true:false);
- }
- if (!_s.debugMode) {
- _s.o._disableDebug();
- }
- _s.enabled = true;
- _debugTS('jstoflash', true);
- } catch(e) {
- _s._wD('js/flash exception: ' + e.toString());
- _debugTS('jstoflash', false);
- _failSafely(true); // don't disable, for reboot()
- _initComplete();
- return false;
- }
- _initComplete();
- // event cleanup
- _cleanup();
- return true;
- };
-
- _beginInit = function() {
- if (_initPending) {
- return false;
- }
- _createMovie();
- _initMovie();
- _initPending = true;
- return true;
- };
-
- _dcLoaded = function() {
- if (_didDCLoaded) {
- return false;
- }
- _didDCLoaded = true;
- _initDebug();
- _testHTML5();
- _s.html5.usingFlash = _featureCheck();
- _needsFlash = _s.html5.usingFlash;
- _didDCLoaded = true;
- if (_doc.removeEventListener) {
- _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false);
- }
- _go();
- return true;
- };
-
- _startTimer = function(oSound) {
- if (!oSound._hasTimer) {
- oSound._hasTimer = true;
- }
- };
-
- _stopTimer = function(oSound) {
- if (oSound._hasTimer) {
- oSound._hasTimer = false;
- }
- };
-
- _die = function() {
- if (_s.onerror instanceof Function) {
- _s.onerror();
- }
- _s.disable();
- };
-
- // pseudo-private methods called by Flash
-
- this._setSandboxType = function(sandboxType) {
- // <d>
- var sb = _s.sandbox;
- sb.type = sandboxType;
- sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')];
- _s._wD('Flash security sandbox type: ' + sb.type);
- if (sb.type === 'localWithFile') {
- sb.noRemote = true;
- sb.noLocal = false;
- _wDS('secNote', 2);
- } else if (sb.type === 'localWithNetwork') {
- sb.noRemote = false;
- sb.noLocal = true;
- } else if (sb.type === 'localTrusted') {
- sb.noRemote = false;
- sb.noLocal = false;
- }
- // </d>
- };
-
- this._externalInterfaceOK = function(flashDate) {
- // flash callback confirming flash loaded, EI working etc.
- // flashDate = approx. timing/delay info for JS/flash bridge
- if (_s.swfLoaded) {
- return false;
- }
- var eiTime = new Date().getTime();
- _s._wD('soundManager::externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':''));
- _debugTS('swf', true);
- _debugTS('flashtojs', true);
- _s.swfLoaded = true;
- _tryInitOnFocus = false;
- if (_isIE) {
- // IE needs a timeout OR delay until window.onload - may need TODO: investigating
- setTimeout(_init, 100);
- } else {
- _init();
- }
- };
-
- _dcIE = function() {
- if (_doc.readyState === 'complete') {
- _dcLoaded();
- _doc.detachEvent('onreadystatechange', _dcIE);
- }
- return true;
- };
-
- // focus and window load, init
- if (!_s.hasHTML5 || _needsFlash) {
- // only applies to Flash mode
- _addEvt(_win, 'focus', _handleFocus);
- _addEvt(_win, 'load', _handleFocus);
- _addEvt(_win, 'load', _delayWaitForEI);
- if (_isSafari && _tryInitOnFocus) {
- _addEvt(_win, 'mousemove', _handleFocus); // massive Safari focus hack
- }
- }
-
- if (_doc.addEventListener) {
- _doc.addEventListener('DOMContentLoaded', _dcLoaded, false);
- } else if (_doc.attachEvent) {
- _doc.attachEvent('onreadystatechange', _dcIE);
- } else {
- // no add/attachevent support - safe to assume no JS -> Flash either
- _debugTS('onload', false);
- _die();
- }
-
- if (_doc.readyState === 'complete') {
- setTimeout(_dcLoaded,100);
- }
-
-} // SoundManager()
-
-// var SM2_DEFER = true;
-// details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
-
-if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) {
- soundManager = new SoundManager();
-}
-
-// public interfaces
-window.SoundManager = SoundManager; // constructor
-window.soundManager = soundManager; // public instance: API, Flash callbacks etc.
-
-}(window));
-var d =
- {
- DEBUG: false,
- act: function (s)
- {
- // $('#msg').append('<strong>'+s+'</strong><br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- joy: function (s)
- {
- // $('#msg').append('<b>'+s+'</b><br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- warn: function (s)
- {
- // $('#msg').append(s+'<br/>')
- // d.scrollToBottom("#msg")
- // if (d.DEBUG)
- // console.log(s)
- return false
- },
- error: function (s)
- {
- // $('#msg').append('<em>ERROR: '+s+'</em><br/>')
- // d.scrollToBottom("#msg")
- // console.log(s)
- return false
- },
- noop: function () {},
- scrollToTop: function (elem)
- {
- $(elem).scrollTop( 0 )
- },
- scrollToBottom: function (elem)
- {
- try
- {
- $(elem).scrollTop( $(elem)[0].scrollHeight )
- }
- catch (err)
- {
- }
- },
- pageUp: function (div)
- {
- var st = $(div).scrollTop()
- var h = $(window).height()
- d.warn("PAGEUP: "+st+" "+h)
- $(div).scrollTop( st - (2/3) * h )
- var st = $(div).scrollTop()
- d.warn("ST NOW: "+st+" "+h)
- },
- pageDown: function (div)
- {
- var st = $(div).scrollTop()
- var h = $(window).height()
- $(div).scrollTop( st + (2/3) * h )
- },
- choice: function (list)
- {
- return list[Math.floor (Math.random () * list.length)]
- },
- trim: function (s)
- {
- if (s)
- return s.replace(/^\s+|\s+$/g,"")
- else
- return ""
- },
- sanitizeWithNewlines: function (s)
- {
- if (s)
- return d.trim( s ).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\0/g,"")
- return ""
- },
- sanitize: function (s)
- {
- if (s)
- return d.trim( s ).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\n/g,"").replace(/\r/g,"").replace(/\0/g,"")
- return ""
- },
- linkify: function (s)
- {
- var words = s.split(" ")
- var checked = []
- for (i in words)
- {
- var word = words[i]
- if (words[i].indexOf("http") === 0)
- {
- var poffset = word.indexOf('//')
- var linktext = word.substr(poffset+2, word.indexOf('/', poffset+2))
- checked.push('<a href="'+word+'" target="_blank">'+linktext+'</a>')
- }
- else
- checked.push(word)
- }
- return checked.join(" ")
- },
- enableStylesheet: function (style)
- {
- $("link[@rel*=style][title]").each(function (i)
- {
- if (this.getAttribute('title') == style)
- this.disabled = false
- })
- },
- disableStylesheet: function (style)
- {
- $("link[@rel*=style][title]").each(function (i)
- {
- if (this.getAttribute('title') == style)
- this.disabled = true
- })
- },
- buildLookup: function (list)
- {
- var lookup = {}
- for (var i = 0; i < list.length; i++)
- lookup[list[i]] = true
- return lookup
- }
- }
-
-var API =
- {
- HEADER: "#@scanjam 0.3b",
- BASE_URL: "http://"+serverHost+":"+serverPort,
- URL:
- {
- auth:
- {
- login: "/api/auth/login",
- logout: "/api/auth/logout",
- checkin: "/api/auth/checkin",
- sneakin: "/api/auth/sneakin",
- },
- room:
- {
- join: "/api/room/join",
- list: "/api/room/list",
- view: "/api/room/view",
- poll: "/api/room/poll",
- watch: "/api/room/watch",
- say: "/api/room/say",
- settings: "/api/room/settings",
- stats: "/stats",
- },
- video:
- {
- date: "/api/video/date",
- like: "/api/video/like",
- unlike: "/api/video/unlike",
- remove: "/api/video/remove",
- search: "/api/video/search",
- },
- user:
- {
- settings: "/api/user/settings",
- videos: "/api/user/videos",
- likes: "/api/user/likes",
- },
- },
- error: function (s)
- {
- d.error("API: "+s)
- return false
- },
- parse: function (api, raw)
- {
- if (! raw)
- return API.error("no result")
- var lines = raw.split("\n")
- if (lines.shift() !== API.HEADER)
- return API.error("bad header")
- if (! lines.length)
- return API.error("no content")
- return lines
- },
- init: function ()
- {
- d.warn("INIT API")
- for (type in API.URL)
- {
- for (name in API.URL[type])
- {
- API.URL[type][name] = API.BASE_URL + API.URL[type][name]
- }
- }
- // $.ajaxSetup({ timeout: 1000 })
- }
- }
-var Local =
- {
- support: false,
- hash: null,
- get: null,
- set: null,
- _html5_get: function (key)
- {
- var val = localStorage["scanjam."+key]
- if (val === "true") return true
- if (val === "false") return false
- if (val === "undefined") return undefined
- return val
- },
- _html5_set: function (key, val)
- {
- if (val === undefined)
- localStorage["scanjam."+key] = ""
- else
- localStorage["scanjam."+key] = val
- },
- _hash_get: function (key)
- {
- if (key in Local.hash)
- return Local.hash[key]
- },
- _hash_set: function (key, val)
- {
- Local.hash[key] = val
- },
- _supports_html5_storage: function ()
- {
- try
- { return 'localStorage' in window && window['localStorage'] !== null; }
- catch (e)
- { return false }
- },
- like: function (videoid)
- { Local.set("like."+videoid, true) },
- unlike: function (videoid)
- { Local.set("like."+videoid, false) },
- isLiked: function (videoid)
- { return Local.get("like."+videoid) },
- init: function ()
- {
- Local.support = Local._supports_html5_storage()
- if (Local.support)
- {
- d.warn("SUPPORTS LOCAL STORAGE")
- Local.get = Local._html5_get
- Local.set = Local._html5_set
- }
- else
- {
- d.error("NO LOCAL STORAGE")
- Local.hash = {}
- Local.get = Local._hash_get
- Local.set = Local._hash_set
- }
- }
- }
-API.init()
-Local.init()
-
-var Auth =
- {
- userid: false,
- username: false,
- session: false,
- loaded: false,
- access: 0,
- login: function ()
- {
- d.warn("LOG IN")
- var username = d.trim( $("#login-username").val() )
- var password = d.trim( $("#login-password").val() )
- var pwhash = $.md5("scanjam"+password)
- if (! username || ! password) return
- Main.enter = false
- d.warn("LOGGING IN")
- $.post(API.URL.auth.login, {'username':username, 'password': pwhash}, Auth.loginCallback)
- $("#chat").hide()
- },
- loginCallback: function (raw)
- {
- var lines = API.parse("/auth/login", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- u = lines[1].split("\t")
-
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.session = u[2]
- Auth.access = u[3]
-
- document.cookie = "session="+Auth.session+";path=/;domain=.scannerjammer.com;max-age=1086400"
- Auth.success()
- },
- checkin: function ()
- {
- d.warn("CHECK IN")
- $.post(API.URL.auth.checkin, {'session':Auth.session}, Auth.checkinCallback)
- },
- checkinCallback: function (raw)
- {
- var lines = API.parse("/auth/checkin", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- u = lines[1].split("\t")
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.success()
- },
- sneakin: function (userid,username)
- {
- d.warn("SNEAK IN")
- $.post(API.URL.auth.sneakin, {'userid':userid,'username':username}).success(Auth.sneakinCallback)
- },
- sneakinCallback: function (raw)
- {
- var lines = API.parse("/auth/sneakin", raw)
- if (! lines.length) return
- if (lines[0] !== "OK")
- {
- alert(lines[0].split("\t")[1])
- return Auth.error()
- }
- d.joy("snuck in!")
- u = lines[1].split("\t")
-
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.session = u[2]
- Auth.access = u[3]
-
- d.warn(lines[1])
- if (! Auth.session)
- return
- document.cookie = "session="+Auth.session+";path=/;domain=.scannerjammer.com;max-age=1086400"
- Auth.success()
- },
- logout: function ()
- {
- d.warn("LOG OUT")
- clearTimeout(Room.timer)
- Room.unload()
- Auth.userid = false
- Auth.username = false
- Local.set('userid', false)
- Local.set('username', false)
- document.cookie = "session=false;path=/;domain=.scannerjammer.com;max-age=0"
- Auth.session = ""
- Auth.load()
- },
- error: function ()
- {
- Auth.load()
- },
- success: function ()
- {
- d.joy("logged in as "+Auth.username)
- Auth.unload()
- Room.load()
- },
- unload: function ()
- {
- d.warn("AUTH UNLOAD")
- $("#login").hide()
- $("#loading").show()
- Keyboard.enter = false
- Auth.loaded = false
- },
- load: function ()
- {
- d.warn("AUTH LOAD")
- $("#loading").hide()
- $("#login").show()
- $("#login-username").focus()
- $("#login-username").keydown(Keyboard.textareaMap)
- $("#login-password").keydown(Keyboard.textareaMap)
- $("#login-password").val("")
- $("#login-go").click(Auth.login)
- Keyboard.enter = Auth.login
- $("#bg").show()
- Auth.loaded = true
- },
- init: function ()
- {
- d.warn("INIT AUTH")
- if (document.cookie)
- {
- d.warn("got a cookie")
- d.warn(document.cookie)
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("session") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Auth.session = cookie[1]
- break
- }
- }
- }
- d.warn("got sessionid "+Auth.session)
- if (Auth.session)
- return true
- }
- var userid = Local.get('userid')
- var username = Local.get('username')
- if (userid && username)
- {
- d.warn("attempting to sneak in "+username)
- Auth.sneakin(userid,username)
- return true
- }
- return false
- }
- }
-
-var Like =
- {
- timeout: false,
- likeVideoDelay: 1000,
- likeMessageDelay: 10000,
- favewords:
- [
- 'dazzled', 'dangled', 'amazed', 'shocked', 'wowed',
- 'spangled', 'glittered', 'blinged', 'jazzed', 'smoked',
- 'rocked', 'jammed', 'stoked', 'blazed', 'pringled', 'engulfed',
- ],
- colors:
- [
- "#ffa1b8","#ffb9a1","#ffe8a1","#ffa1e7","#a1a4ff","#cda1ff","#fca1ff","#a1d3ff","#e8a1ff","#a1f6ff","#a1ffaa","#c7ffa1"
- ],
- enqueue: function (username)
- {
- d.joy("liked by "+username)
- $("#likereport").append(
- $("<a>").attr("href","/profile/"+username).html(username+" was "+d.choice(Like.favewords)+"!").attr("style","color:"+d.choice(Like.colors)))
- if (Viewport.focused)
- Like.fire()
- else
- Like.pending = true
- },
- fire: function ()
- {
- d.joy("LIKE ANIMATION GO")
- Like.pending = false
- $("#likereport").stop(false,false).show()
- d.scrollToBottom("#likereport")
- $("#plant").stop(true, true).show()
- $("#flower").stop(true, true).show()
- if (Like.timeout)
- clearTimeout(Like.timeout)
- Like.timeout = setTimeout(Like.queueFade, 1000)
- },
- queueFade: function timeout()
- {
- d.joy("LIKE ANIMATION FADE")
- Like.timeout = false
- $("#plant").fadeOut(Like.likeVideoDelay)
- $("#flower").fadeOut(Like.likeVideoDelay)
- $("#likereport").fadeOut(Like.likeMessageDelay, function(){$("#likereport").html("")})
- },
- likeVideo: function (video)
- {
- if (! Auth.session)
- return d.error("like: not logged in")
- if (video.username === Auth.username)
- return d.error("like: that's you")
- var data = { video: video.id, session: Auth.session, }
- if (Local.isLiked(video.id))
- {
- d.joy("unliking "+video.key)
- if (Player.currentKey === video.key)
- $("#like").removeClass("liked")
- $("#like_"+video.id).removeClass("liked").html("&nbsp;&nbsp;like")
- video.liked = false
- Local.unlike(video.id)
- if (video.score)
- {
- video.score -= 1
- if (video.score < 0)
- {
- video.score = 0
- $("#score_"+video.id).html('&nbsp;')
- }
- else
- {
- $("#score_"+video.id).html(video.score)
- }
- }
- $.post(API.URL.video.unlike, data)
- }
- else
- {
- d.joy("liking "+video.key)
- if (Player.currentKey === video.key)
- $("#like").addClass("liked")
- $("#like_"+video.id).addClass("liked").html("liked")
- $("#flower").show().fadeOut(Like.likeVideoDelay)
- video.liked = true
- Local.like(video.id)
- if (video.score)
- {
- video.score += 1
- $("#score_"+video.id).html(video.score)
- }
- $.post(API.URL.video.like, data)
- }
- },
- init: function ()
- {
- }
- }
-
-YOUTUBE_SEARCH_URL = "https://gdata.youtube.com/feeds/api/videos"
-YOUTUBE_URL_PREFIX = "http://youtube.com/watch?v="
-function courtesy_s (quantity, noun)
- {
- if (quantity > 1)
- return quantity + " " + noun + "s"
- return quantity + " " + noun
- }
-var Search =
- {
- start: 0,
- limit: 20,
- sj: function ()
- {
- Search.start = 0
- Search.terms = $("#search-terms").val()
- Search.sjSearch (Search.terms, Search.start)
- },
- sjSearch: function (terms, start)
- {
- var params =
- {
- "q": terms,
- "start": Search.start,
- "limit": Search.limit,
- "session": Auth.session,
- }
- $.post(API.URL.video.search, params, Search.sjCallback)
- $("#search-instructions").hide()
- $("#search-results").html("").hide()
- $("#search-loading").show()
- $("#search-results-container").show()
- },
- sjCallback: function (raw)
- {
- var lines = API.parse ("/video/search", raw)
- var items = []
- for (var i = 0; i < lines.length; i++)
- {
- // 0 id 1 score 2 user 3 usercount 4 title 5 url 6 thumbnail
- var line = lines[i].split("\t")
- if (line.length < 7)
- continue
- var video =
- {
- url: line[5],
- thumbnail: line[6],
- title: line[4],
- user: line[2],
- quantify: "",
- }
- if (parseInt(line[3]) > 1)
- video['user'] += " + " + courtesy_s (parseInt(line[3])-1, "other")
- if (parseInt(line[1]) > 0)
- video['quantify'] = courtesy_s (parseInt(line[1]), "like")
- var tag = Search.resultTag (video)
- items.push(tag)
- }
- if (items.length === Search.limit)
- {
- Search.start += Search.limit
- $("#search-next-page").show()
- }
- else
- {
- $("#search-next-page").hide()
- }
- $("#search-loading").hide()
- $("#search-results").html(items.join("")).show()
- $("#search-instructions").show()
- $("#curtain").bind("click", Search.close).css({"background-color": "transparent", "z-index": 99}).show()
- },
- youtube: function ()
- {
- var terms = $("#search-terms").val()
- var params =
- {
- "q": terms,
- "v": 2,
- "alt": "jsonc",
- }
- $.get(YOUTUBE_SEARCH_URL, params, Search.youtubeCallback, "jsonp")
- $("#search-results-container").show()
- $("#search-results").html("").hide()
- $("#search-loading").show()
- },
- durationToString: function (duration)
- {
- return Math.floor(duration / 60) + ":" + (duration % 60)
- },
- viewCountToString: function (viewCount)
- {
- if (! viewCount)
- return '0'
- var vc = viewCount.toString ()
- var commas = /(\d+)(\d{3})/;
- while (commas.test(vc))
- {
- vc = vc.replace(commas, '$1' + ',' + '$2');
- }
- return vc
- },
- resultTag: function (video)
- {
- var tag = "<li data-url='"+video['url']+"'>"
- tag += "<div class='thumb' style='background-image: url(" + video['thumbnail'] + ")'></div>"
- tag += "<h4>" + video['title'] + "</h4>"
- tag += "<span class='metadata'>"
- tag += video['user']
- tag += "<br/>"
- tag += video['quantify']
- tag += "</span>"
- tag += "<a href='"+video['url']+"' target='_blank' class='preview'>Preview</a>"
- tag += "</li>"
- return tag
- },
- youtubeCallback: function (data)
- {
- var items = []
- for (var i = 0; i < data['data']['items'].length; i++)
- {
- var item = data['data']['items'][i]
- var video =
- {
- url: YOUTUBE_URL_PREFIX+item['id'],
- thumbnail: item['thumbnail']['sqDefault'],
- title: item['title'],
- user: item['uploader'],
- quantify: Search.viewCountToString(item['viewCount']) + "views",
- }
- var tag = Search.resultTag (video)
- items.push(tag)
- }
- $("#search-loading").hide()
- $("#search-results").html(items.join("")).show()
- },
- keydown: function (e)
- {
- if (e.keyCode === 13)
- {
- Search.sj ()
- }
- if (e.keyCode === 27)
- {
- Search.close ()
- Keyboard.focusTextarea ()
- }
- },
- nextPage: function ()
- {
- Search.sjSearch (Search.terms, Search.start)
- },
- loadResult: function ()
- {
- var url = $(this).parent().data("url")
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: url})
- Search.close ()
- },
- close: function ()
- {
- $("#curtain").unbind("click", Search.close).hide()
- $("#search-results-container").hide()
- $("#search-terms").val("")
- },
- blurSearchTextarea: function ()
- {
- $(window).unbind("keydown")
- $("#chat-message").unbind("keydown").bind("keydown", Keyboard.textareaMap)
- $("#chat-message").unbind("focus").focus().bind("focus", Keyboard.focusTextarea)
- if ($("#chat-message").val().length === 0)
- Keyboard.enteredText = false
- },
- focusSearchTextarea: function ()
- {
- $(window).unbind("keydown")
- $("#chat-message").unbind("keydown")
- },
- init: function ()
- {
- $("#search-results li div").live("click", Search.loadResult)
- $("#search-results li h4").live("click", Search.loadResult)
- $("#search-results li span").live("click", Search.loadResult)
- $("#search-terms").bind("keydown", Search.keydown)
- $("#search-terms").bind("focus", Search.focusSearchTextarea)
- $("#search-terms").bind("blur", Search.blurSearchTextarea)
- // $("#search-terms").val("glock n my hand")
- // Search.sj ()
- }
- }
-Search.init ()
-
-var VIMEOregexp = /^(\bhttps?:\/\/)(www.)?vimeo.com\/([0-9]+).*$/i
-var PLAY_BUTTONS =
- {
- prev: "<div class='arrow-prev'></div> <div class='arrow-prev'></div>",
- next: "<div class='arrow-next'></div> <div class='arrow-next'></div>",
- pause: "<div class='arrow-pause'></div> <div class='arrow-pause'></div>",
- play: "<div class='arrow-play'></div>",
- }
-var Player =
- {
- videos: {},
- queue: [],
- projectors: {},
- projector: null,
- newVideos: false,
- currentIdx: 0,
- video: false,
- errors: 0,
- width: '100%',
- height: '100%',
- playlistOffset: 30,
- queueOffset: 60,
- paused: false,
- muted: false,
- enqueue: function (video)
- {
- if (! (video.type in Player.projectors))
- return d.error("unknown video type "+video.type)
- var key = video.type+"_"+video.name
- if (key in Player.videos)
- {
- Player.videos[key].idx = Player.queue.length
- Player.videos[key].seen = false
- if (video.offset)
- Player.videos[key].offset = video.offset
- d.warn("bumped "+key)
- }
- else
- {
- video.key = key
- video.idx = Player.queue.length
- Player.videos[key] = video
- Player.newVideos = true
- d.warn("enqueued "+key)
- }
- $("#"+video.key).html(video.title)
- Player.queue.push(key)
- return true
- },
- clearQueue: function ()
- {
- Player.queue = []
- Player.currentIdx = 0
- Playlist.count = 0
- },
- register: function (projector)
- {
- d.warn("registered "+projector.type)
- Player.projectors[projector.type] = projector
- },
- unregister: function (projectortype)
- {
- d.warn("unregistered "+projectortype)
- delete Player.projectors[projectortype]
- },
- start: function ()
- {
- d.warn("PLAYER START")
- Player.currentIdx = Player.queue.length - 1
- if (! Player.queue.length)
- return d.error("empty queue")
- Player.playLatest()
- },
- finish: function ()
- {
- d.warn("PLAYER FINISH")
- d.warn("____________")
- Player.playLatest()
- },
- error: function (s)
- {
- if (s)
- d.error(Player.errors+" "+s)
- else
- d.error("PLAYER ERROR "+Player.errors)
- $("li#queue_"+Player.video.idx+" span.title").html("<i>This video cannot be embedded</i>")
- Player.video.error = true
- },
- playLatest: function ()
- {
- d.warn("PLAY LATEST")
- var idx = Player.currentIdx
- var len = Player.queue.length
- if (Player.newVideos)
- {
- for (i = idx; i < len; i++)
- {
- var video = Player.videos[Player.queue[i]]
- d.warn("check "+Player.queue[i])
- if (video.seen)
- continue
- Player.currentIdx = i
- d.joy("new video! "+video.key+" at "+i)
- Player.queueJumpToCurrentVideo(Player.currentIdx)
- Player.playVideo(video)
- return
- }
- for (i = idx - 1; i >= 0; i--)
- {
- var video = Player.videos[Player.queue[i]]
- d.warn("check "+Player.queue[i])
- if (video.seen)
- continue
- Player.currentIdx = i
- d.joy("new video! "+video.key+" at "+i)
- Player.queueJumpToCurrentVideo(Player.currentIdx)
- Player.playVideo(video)
- return
- }
- Player.newVideos = false
- d.warn("no new videos")
- }
- Player.playNext()
- },
- playNext: function ()
- {
- d.warn("____________")
- d.warn("PLAY NEXT")
- var idx = Player.currentIdx
- do
- {
- idx -= 1
- if (Player.queue[idx] === Player.video.key)
- idx -= 1
- if (idx < 0)
- idx = Player.queue.length - 1
- }
- while (Player.videos[ Player.queue[idx] ].error === true)
- Player.queueJumpToCurrentVideo(idx)
- Player.playIdx(idx)
- },
- playPrev: function ()
- {
- d.warn("____________")
- d.warn("PLAY PREV")
- var idx = Player.currentIdx
- do
- {
- idx = (idx + 1) % Player.queue.length
- if (Player.queue[idx] === Player.video.key)
- continue
- }
- while (Player.videos[ Player.queue[idx] ].error === true)
- Player.queueJumpToCurrentVideo(idx)
- Player.playIdx(idx)
- },
- playKey: function (key)
- {
- Player.playVideo( Player.videos[key] )
- },
- playIdx: function (idx)
- {
- d.warn("play idx: "+idx)
- Player.currentIdx = idx
- Player.playVideo( Player.videos[Player.queue[idx]] )
- },
- throttle: function ()
- {
- d.error("THROTTLED")
- Player.stop()
- Player.errors = 0
- },
- stop: function ()
- {
- Player.projector.stop()
- },
- playVideo: function (video)
- {
- if (! video)
- {
- d.error("GOT EMPTY VIDEO")
- d.warn(Player.currentIdx)
- d.warn(Player.queue[ Player.currentIdx ])
- d.warn(Player.videos[ Player.queue[ Player.currentIdx ] ])
- return
- }
- if (video.error === true)
- {
- Player.errors += 1
- d.error(video.key)
- if (Player.errors > Player.queue.length)
- return Player.throttle()
- return Player.finish()
- }
- d.warn("PLAY VIDEO: "+video.key)
- if (video.type !== Player.projector.type)
- {
- d.warn("SWITCHING PROJECTORS")
- d.warn([Player.projector.type, video.type].join(" &rarr; "))
- Player.projector.unload()
- Player.projector = Player.projectors[video.type]
- Player.projector.load()
- if (Player.muted)
- Player.projector.setVolume(0)
- }
- video.seen = true
- if (! Player.fullscreenMode)
- {
- $("#video-title").hide().html(video.title).fadeIn(100, function () {
- setTimeout("$('#video-title').fadeOut(2000)", 4000)
- })
- }
-
- Player.errors = 0
- Player.video = video
- Player.projector.play(video)
- Player.linkUpdate(video)
- Player.currentIdx = video.idx
- $("#queue li.playing").removeClass("playing")
- $("#chat a.ytlink.playing").removeClass("playing")
- $("#queue li").removeClass("playing")
- $("li#queue_"+video.idx).addClass("playing")
- $("#"+video.key).addClass("playing")
- $("#"+video.key).html(video.title)
- $("#like").removeClass("liked").html("LIKE")
- $("#pause").html(PLAY_BUTTONS.pause)
- if (Local.isLiked(video.id))
- {
- $("#like").addClass("liked").html("LIKED")
- }
- },
- queueJumpToCurrentVideo: function (idx)
- {
- $("#playlist").scrollTop( $("li#queue_"+idx)[0].offsetTop - Player.playlistOffset )
- $("#queue").scrollTop( $("li#queue_"+idx)[0].offsetTop - Player.queueOffset )
- },
- toggle: function ()
- {
- Player.projector.toggle()
- },
- pause: function ()
- {
- Player.projector.pause()
- $("#pause").html(PLAY_BUTTONS.play)
- },
- mute: function ()
- {
- if (Player.projector)
- {
- if (Player.muted)
- Player.projector.setVolume(100)
- else
- Player.projector.setVolume(0)
- }
- Player.muted = ! Player.muted
- },
- muteClick: function ()
- {
- if (Player.muted)
- $("#mute").removeClass("muted")
- else
- $("#mute").addClass("muted")
- Player.mute()
- },
- prevClick: function ()
- {
- d.act("+ clicked prev")
- Player.playPrev()
- },
- pauseClick: function ()
- {
- d.act("+ clicked pause")
- Player.errors = 0
- if (Player.projector.toggle())
- {
- $("#pause").html(PLAY_BUTTONS.play)
- d.warn("set to play")
- }
- else
- {
- $("#pause").html(PLAY_BUTTONS.pause)
- d.warn("set to pause")
- }
- },
- nextClick: function ()
- {
- d.act("+ clicked next")
- Player.playNext()
- },
- scanClick: function ()
- {
- d.act("+ clicked scan")
- Scanner.scan()
- },
- likeClick: function ()
- {
- d.act("+ clicked player like")
- Like.likeVideo(Player.video)
- },
- linkClick: function ()
- {
- d.act("+ clicked permalink")
- Player.pause()
- },
- linkUpdate: function (video)
- {
- d.warn("UPDATING LINK")
- $("#video-link").attr("href", video.src)
- var vidurl = "http://scannerjammer.com/"
- if (Room.name !== "main")
- vidurl += Room.name+"/"
- vidurl += "#v="+video.id
- $("#sharebutton").attr("st_url", vidurl).attr("st_title", video.title)
-/*
- stWidget.addEntry({
- service: "sharethis",
- element: document.getElementById("sharebutton"),
- url: vidurl,
- title: video.title,
- summary: "ScannerJammer: Youtube video chat",
- })
-*/
- },
-
- fullscreenClick: function ()
- {
- d.act("+ clicked fullscreen")
- },
- setVolume: function (vol)
- {
- if (Player.projector && Player.projector.type !== 'null')
- {
- // alert(Player.projector.type)
- Player.projector.setVolume(vol)
- }
- },
- init: function ()
- {
- d.warn("PLAYER INIT")
- $("#prev").html(PLAY_BUTTONS.prev)
- $("#pause").html(PLAY_BUTTONS.play)
- $("#next").html(PLAY_BUTTONS.next)
- $("#prev").bind("click", Player.prevClick)
- $("#pause").bind("click", Player.pauseClick)
- $("#next").bind("click", Player.nextClick)
- $("#scan").bind("click", Player.scanClick)
- $("#like").bind("click", Player.likeClick)
- $("#video-link").bind("click", Player.linkClick)
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- Player.projector = {type:"null",load:d.noop,unload:Youtube.unload,}
- for (i in Player.projectors)
- Player.projectors[i].init()
- if (Player.queue.length > 0)
- Player.currentIdx = Player.queue.length
- Playlist.init()
- }
- }
-
-var Playlist =
- {
- count: 0,
- showScores: false,
- enqueue: function (videos)
- {
- if (! (videos instanceof Array))
- videos = [videos]
- // d.warn("PLAYLIST ENQUEUE "+videos.length)
- var rows = []
- var clickables = []
- for (i in videos)
- {
- var video = videos[i]
- $("#"+video.key).html(video.title)
- if (Player.enqueue(video))
- {
- rows.push(Playlist.display(video))
- Playlist.count += 1
- }
- }
- $("#queue").prepend(rows.reverse().join(""))
- },
- enqueueOldVideoFormat: function (videos)
- {
- // d.warn("ENQUEUING "+videos.length+" OLD FORMAT")
- for (i in videos)
- {
- // 0 id 1 date 2 userid 3 user 4 url 5 title
- var row = videos[i]
- var video =
- {
- id: row[0],
- date: row[1],
- userid: row[2],
- username: row[3],
- src: row[4],
- title: row[5] || '___',
- seen: false,
- error: false,
- }
- if (row.length > 6)
- {
- video.score = parseInt(row[6]) || 0
- // block video if it's a duplicate
- }
- var url = row[4]
- if (url.indexOf("youtube.com") !== -1)
- {
- var ytid = Youtube.getYtid(url)
- video.type = "youtube"
- video.name = ytid
- }
- else if (url.indexOf("vimeo.com") !== -1)
- {
- var vimeoid = url.replace(VIMEOregexp, "$3")
- video.type = "vimeo"
- video.name = vimeoid
- }
- else if (url.indexOf("soundcloud.com") !== -1)
- {
- video.type = "soundcloud"
- video.name = $.md5(video.src)
- }
- else if (url.indexOf("mp3") !== -1)
- {
- video.type = "audio"
- video.name = $.md5(video.src)
- }
- else
- {
- d.error("bad video id in "+url)
- continue
- }
- video.key = video.type + "_" + video.name
- Playlist.enqueue(video)
- // d.joy("GOT VIDEO: "+key)
- }
- },
- clickTitle: function (e)
- {
- var id = $(this).parent().attr("id")
- var idx = id.substr(id.indexOf("_")+1)
- d.act("+ clicked playlist "+idx)
- Player.playIdx(parseInt(idx))
- },
- clickLike: function (e)
- {
- var id = $(this).parent().attr("id")
- var idx = id.substr(id.indexOf("_")+1)
- var videokey = Player.queue[idx]
- var video = Player.videos[videokey]
- d.act("+ clicked playlist like "+video.key)
- Like.likeVideo(video)
- },
- clickChatlink: function (e)
- {
- e.preventDefault()
- var key = $(this).attr("id")
- var video = Player.videos[key]
- d.act("+ clicked link "+video.key)
- Player.playVideo(video)
- },
- display: function (video)
- {
- var likeClass = ''
- var likeWord = "&nbsp;&nbsp;like"
- if (video.username === Auth.username)
- {
- likeClass = "you"
- }
- else if (Local.isLiked(video.id))
- {
- likeClass = 'liked'
- likeWord = 'liked'
- }
- var s = "<li id='queue_"+Playlist.count+"'>"
- if (Playlist.showScores)
- {
- score = video.score
- if (score < 1)
- score = '&nbsp;'
- s += "<span class='score' id='score_"+video.id+"'>"+score+"</span>"
- }
- s += "<span id='like_"+video.id+"' class='like "+likeClass+"'>"+likeWord+"</span>"
- s += "<a class='user' href='/profile/"+video.username+"'>"+video.username+"</a>"
- s += "<span class='title'>"+video.title+"</span>"
- s += "</li>"
- return s
- },
- init: function ()
- {
- d.warn("PLAYLIST INIT")
- $("#queue li span.title").live("click", Playlist.clickTitle)
- $("#queue li span.like").live("click", Playlist.clickLike)
- $("#chat a.ytlink").live("click", Playlist.clickChatlink)
- }
- }
-
-var Scanner =
- {
- scanMode: false,
- scanTimeout: false,
- scanBlinkTimeout: false,
- scanBlinkState: false,
- scanBlinkRate: 200,
- scanRate: 9000,
- scanBlink: function ()
- {
- if (Scanner.scanBlinkState)
- {
- $("#scan").addClass("blinkOff")
- $("#scan").removeClass("blinkOn")
- Scanner.scanBlinkState = false
- }
- else
- {
- $("#scan").addClass("blinkOn")
- $("#scan").removeClass("blinkOff")
- Scanner.scanBlinkState = true
- }
- Scanner.scanBlinkTimeout = setTimeout(Scanner.scanBlink, Scanner.scanBlinkRate)
- },
- scanGo: function ()
- {
- Player.playNext()
- Scanner.scanTimeout = setTimeout(Scanner.scanGo, Scanner.scanRate)
- },
- scan: function ()
- {
- if (Scanner.scanMode)
- {
- d.warn("SCANNER ON")
- Scanner.scanMode = false
- clearTimeout(Scanner.scanTimeout)
- clearTimeout(Scanner.scanBlinkTimeout)
- $("#scan").removeClass("blinkOn")
- $("#scan").removeClass("blinkOff")
- }
- else
- {
- d.warn("SCANNER OFF")
- Scanner.scanMode = true
- Scanner.scanBlink()
- Scanner.scanGo()
- }
- }
- }
-var Vimeo =
- {
- type: "vimeo",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 1,//from 100...some sort of error
- play: function (video)
- {
- d.warn("VIMEO PLAY "+video.key)
- if (video.error)
- return Vimeo.error()
- if (Vimeo.playing)
- Vimeo.stop()
- $("#screen").html("<div id='vimeo'></div>")
- Vimeo.video = video
- Vimeo.playing = true
- var params = { allowScriptAccess: "always", wmode: "opaque", }
- var atts = { id: "vimeo" }
- var flashvars = { api: 1 }
- swfobject.embedSWF("http://vimeo.com/moogaloop.swf?clip_id="+video.name+"&server=vimeo.com&color=00adef&api=1",
- "vimeo", "100%","100%", "8", null, flashvars, params, atts)
- // $("#vimeo").html('<iframe src="http://player.vimeo.com/video/'+video.name+'?api=1" width="100%" height="100%" frameborder="0"></iframe>')
- },
- toggle: function ()
- {
- if (Vimeo.player.api_paused())
- return Vimeo.resume()
- else
- return Vimeo.pause()
- },
- error: function (s)
- {
- Player.error("VIMEO "+s)
- Vimeo.finish()
- },
- setVolume: function (vol)
- {
- Vimeo.volume = vol
- Vimeo.player.api_setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Vimeo.playing = false
- Vimeo.player.api_pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Vimeo.playing = true
- Vimeo.player.api_play()
- return false
- },
- stop: function ()
- {
- d.warn("VIMEO STOP")
- Vimeo.playing = false
- },
- finish: function ()
- {
- d.warn("VIMEO FINISH")
- Vimeo.playing = false
- swfobject.removeSWF("vimeo")
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING VIMEO")
- Vimeo.loaded = true
- },
- unload: function ()
- {
- d.warn("VIMEO UNLOADED")
- swfobject.removeSWF("vimeo")
- Vimeo.loaded = false
- },
- init: function ()
- {
- d.warn("VIMEO INIT")
- }
- }
-function vimeo_player_loaded()
- {
- d.warn("VIMEO LOADED")
- Vimeo.player = document.getElementById('vimeo')
- Vimeo.player.api_play()
- // Vimeo.player.addEventListener("finish", "Vimeo.finish")
- Vimeo.player.api_addEventListener("finish", "Vimeo.finish")
- Vimeo.player.api_setVolume(Vimeo.volume)
- }
-Player.register(Vimeo)
-
-var Youtube =
- {
- type: "youtube",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- getYtid: function (url)
- {
- if (! url) return
- var ytid = url.substr(url.indexOf("v=")+2,11)
- if (ytid.indexOf("&") !== -1)
- ytid = ytid.substr(0, ytid.indexOf("&"))
- if (ytid.indexOf("#") !== -1)
- ytid = ytid.substr(0, ytid.indexOf("#"))
- return ytid
- },
- play: function (video)
- {
- d.warn("YOUTUBE PLAY "+video.key)
- if (video.error)
- return Youtube.error()
- if (Youtube.playing)
- Youtube.stop()
- Youtube.video = video
- Youtube.playing = true
- if (Youtube.ready)
- {
- d.warn("ORDERING VIDEO LOAD "+video.name)
- Youtube.player.loadVideoById(video.name)
- Youtube.pending = false
- }
- else
- {
- d.error("YOUTUBE PLAYER NOT READY")
- Youtube.pending = true
- }
- },
- toggle: function ()
- {
- if (Youtube.playing)
- return Youtube.pause()
- else
- return Youtube.resume()
- },
- error: function (s)
- {
- Player.error("YOUTUBE "+s)
- $("li#queue_"+Youtube.video.idx+" span.title").html("<i>This video cannot be embedded</i>")
- setTimeout(Youtube.finish, 1000)
- },
- onStateChange: function (state)
- {
- Youtube.state = state
- if (state === -1)
- {
- d.warn("YOUTUBE: UNSTARTED")
- Youtube.playing = false
- }
- else if (state === 0)
- {
- d.warn("YOUTUBE: ENDED")
- Youtube.playing = false
- return Youtube.finish()
- }
- else if (state === 1)
- {
- d.warn("YOUTUBE: PLAYING")
- Youtube.playing = true
- if (! Youtube.loaded)
- return Youtube.unload()
- }
- else if (state === 2)
- {
- d.warn("YOUTUBE: PAUSED")
- Youtube.playing = false
- }
- else if (state === 3)
- {
- d.warn("YOUTUBE: BUFFERING")
- }
- else if (state === 5)
- {
- d.warn("YOUTUBE: CUED")
- }
- else
- {
- d.error("YOUTUBE: UNKNOWN")
- }
- },
- onError: function (error)
- {
- var errorStr = 'UNKNOWN'
- if (error === 2)
- errorStr = "INVALID PARAMETER"
- if (error === 100)
- errorStr = "NOT FOUND"
- if (error === 101 || error === 150)
- errorStr = "EMBED FORBIDDEN"
- Youtube.error(errorStr)
- },
- setVolume: function (vol)
- {
- Youtube.player.setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Youtube.playing = false
- Youtube.player.pauseVideo()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Youtube.playing = true
- Youtube.player.playVideo()
- return false
- },
- stop: function ()
- {
- d.warn("YOUTUBE STOP")
- Youtube.player.stopVideo()
- Youtube.playing = false
- },
- finish: function ()
- {
- d.warn("YOUTUBE FINISH")
- Youtube.playing = false
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING YOUTUBE")
- $("#ytscreen").css("z-index", 19)
- Youtube.loaded = true
- },
- unload: function ()
- {
- d.warn("YOUTUBE UNLOADED")
- $("#ytscreen").css("z-index", -3)
- if (Youtube.player)
- Youtube.player.stopVideo()
- Youtube.playing = false
- Youtube.loaded = false
- Youtube.pending = false
- },
- init: function ()
- {
- d.warn("YOUTUBE INIT")
- var params = { allowScriptAccess: "always", wmode: "opaque" }
- var atts = { id: "ytscreen" }
- swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=ytscreen",
- "ytscreen", Player.width, Player.height, "8", null, null, params, atts)
- }
- }
-function onYouTubePlayerReady (playerId)
- {
- d.warn("YOUTUBE READY")
- Youtube.player = document.getElementById(playerId)
- Youtube.playerId = playerId
- Youtube.player.addEventListener("onStateChange", "Youtube.onStateChange")
- Youtube.player.addEventListener("onError", "Youtube.onError")
- Youtube.ready = true
- if (! Youtube.loaded)
- return Youtube.unload()
- if (Youtube.pending)
- Youtube.player.loadVideoById(Youtube.video.name)
- Youtube.pending = false
- }
-Player.register(Youtube)
-
-var Soundcloud =
- {
- type: "soundcloud",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 100,
- play: function (video)
- {
- d.warn("SOUNDCLOUD PLAY "+video.key)
- if (video.error)
- return Soundcloud.error()
- if (Soundcloud.playing)
- Soundcloud.stop()
- $("#screen").html("<div id='soundcloud'></div><div id='soundcloud-img'></div><div id='soundcloud-dl'></div>")
- Soundcloud.video = video
- Soundcloud.playing = false
-
- if (Soundcloud.player)
- {
- Soundcloud.player = null
- swfobject.removeSWF("soundcloud")
- }
-
- var flashvars = { enable_api: true, object_id: "soundcloud", url: video.src, theme_color: "#657b83", }
- var attributes = { id: "soundcloud", name: "soundcloud" }
- var params = { allowscriptaccess: "always", wmode: "opaque", }
-
- swfobject.embedSWF("http://player.soundcloud.com/player.swf", "soundcloud", "81", "81", "9.0.0",
- "expressInstall.swf", flashvars, params, attributes, Soundcloud.playerDidLoad);
- },
- playerDidLoad: function (e)
- {
- if (e.success === false)
- return Soundcloud.error("failed to load")
- d.warn("LOADED")
- Soundcloud.player = swfobject.getObjectById('soundcloud')
- $("#ytscreen").css("z-index", -2)
- // instead of raising events, the soundcloud swf calls it's js api directly
- window.soundcloud = { onPlayerReady: Soundcloud.ready, onMediaEnd: Soundcloud.finish }
- },
- ready: function ()
- {
- d.warn("READY")
- Soundcloud.playing = true
- Soundcloud.player = swfobject.getObjectById('soundcloud')
- if (Soundcloud.player)
- {
- Soundcloud.player.api_play()
- Soundcloud.player.api_setVolume(Soundcloud.volume)
- }
- Soundcloud.report()
- },
- report: function ()
- {
- if (! Soundcloud.player)
- return Soundcloud.error()
- var track = Soundcloud.player.api_getCurrentTrack()
- $("#video-title").html(track.title)
- if (track.downloadable && track.download_url !== "undefined" && track.download_url !== undefined)
- $("#soundcloud-dl").html('<a href="'+track.download_url+'" target="_parent">download</a>')
- else
- $("#soundcloud-dl").html("")
- var art = ''
- if (track.artwork)
- art = track.artwork.split("?")[0].replace('large','original')
- else if (track.user && track.user.avatarUrl)
- art = track.user.avatarUrl.split("?")[0].replace('large','crop')
- if (art.length)
- {
- $("#soundcloud-img").html("<img src='"+art+"' id='sc-art' />")
- $("#sc-art").bind("error", function(){$("#sc-art").hide()})
- }
- return
- d.warn("____________")
- for (i in track)
- d.warn("<b>"+i+":</b> "+track[i])
- d.warn("____________")
- var user = track.user
- for (i in user)
- d.warn("<b>"+i+":</b> "+user[i])
- d.warn("____________")
- },
- toggle: function ()
- {
- d.warn("TOGGLE PLAYBACK")
- if (Soundcloud.player)
- return Soundcloud.player.api_toggle()
- return false
- },
- error: function (s)
- {
- Player.error("SOUNDCLOUD "+s)
- Soundcloud.finish()
- },
- setVolume: function (vol)
- {
- Soundcloud.volume = vol
- if (Soundcloud.player)
- Soundcloud.player.api_setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Soundcloud.playing = false
- if (Soundcloud.player)
- Soundcloud.player.api_pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Soundcloud.playing = true
- if (Soundcloud.player)
- Soundcloud.player.api_play()
- return false
- },
- stop: function ()
- {
- d.warn("SOUNDCLOUD STOP")
- if (Soundcloud.player)
- Soundcloud.player.api_stop()
- Soundcloud.playing = false
- },
- finish: function ()
- {
- d.warn("SOUNDCLOUD FINISH")
- Soundcloud.playing = false
- swfobject.removeSWF("soundcloud")
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING SOUNDCLOUD")
- Soundcloud.loaded = true
- },
- unload: function ()
- {
- d.warn("SOUNDCLOUD UNLOADED")
- swfobject.removeSWF("soundcloud")
- Soundcloud.loaded = false
- Soundcloud.playing = false
- },
- init: function ()
- {
- d.warn("SOUNDCLOUD INIT")
- window.soundcloud = Soundcloud
- }
- }
-Player.register(Soundcloud)
-
-var Audio =
- {
- type: "audio",
- loaded: false,
- pending: false,
- playing: false,
- paused: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 100,
- play: function (video)
- {
- d.warn("AUDIO PLAY "+video.key)
- if (video.error)
- return Audio.error()
- if (Audio.playing)
- Audio.stop()
- $("#screen").html("<div id='audio'></div><div id='audio-img'></div><div id='audio-dl'></div>")
- $("#ytscreen").css("z-index", -2)
- Audio.video = video
- Audio.playing = false
-
- var partz = video.src.split(" ")
- var img = partz[0]
- var url = partz[1]
- var title = partz.slice(2).join(" ")
-
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Audio.player = soundManager.createSound
- ({
- id: "player-"+video.id,
- url: url,
- volume: Audio.volume,
- onfinish: Audio.finish,
- onerror: Audio.error,
- onload: Audio.onload,
- })
- if (! Audio.player)
- return Audio.error("no player")
- Audio.player.play()
-
- $("#video-title").html(title)
- $("#video-link").attr("href", url)
- $("#audio-dl").html('<a href="'+url+'" target="_parent">download</a>')
- $("#audio-img").html("<img src='"+img+"' id='audio-art' />")
- $("#audio-art").bind("error", function(){$("#audio-art").hide()})
- },
- onload: function (success)
- {
- if (! success)
- return Audio.error("failed to load")
- },
- toggle: function ()
- {
- d.warn("TOGGLE PLAYBACK")
- if (Audio.paused)
- return Audio.resume()
- else
- return Audio.pause()
- },
- error: function (s)
- {
- if (! s)
- s = "unspecified error"
- Player.error("AUDIO "+s)
- Audio.finish()
- },
- setVolume: function (vol)
- {
- Audio.volume = vol
- if (Audio.player)
- Audio.player.setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Audio.paused = true
- Audio.playing = false
- if (Audio.player)
- Audio.player.pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Audio.paused = false
- Audio.playing = true
- if (Audio.player)
- Audio.player.resume()
- return false
- },
- stop: function ()
- {
- d.warn("AUDIO STOP")
- if (Audio.player)
- Audio.player.stop()
- Audio.playing = false
- },
- finish: function ()
- {
- d.warn("AUDIO FINISH")
- Audio.playing = false
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING AUDIO")
- Audio.loaded = true
- },
- unload: function ()
- {
- d.warn("AUDIO UNLOADED")
- if (Audio.player)
- {
- Audio.player.stop()
- Audio.player.destruct()
- }
- Audio.loaded = false
- Audio.playing = false
- },
- init: function ()
- {
- d.warn("AUDIO INIT")
- }
- }
-Player.register(Audio)
-soundManager.url = '/swf/'
-soundManager.useFlashBlock = false
-soundManager.debugMode = false
-
-function Toggler (div, on, off)
- {
- var state = false
- function activate ()
- {
- $(div).addClass("on").html("ON")
- on ()
- }
- function deactivate ()
- {
- $(div).removeClass("on").html("off")
- off ()
- }
- function toggle ()
- {
- state = ! state
- if (state)
- activate ()
- else
- deactivate ()
- }
- function destroy ()
- {
- $(div).unbind("click")
- }
- $(div).bind("click", toggle)
- }
-
-var Tokbox =
- {
- height: 150,
- width: null,
- token_url: "/cgi-bin/tokbox_room.cgi",
- sessionid: null,
- token: null,
- togglers: [],
-
- session: null,
- publisher: null,
- subscribers: [],
-
- subscribeToStreams: function (streams)
- {
- for (var i = 0; i < streams.length; i++)
- {
- var stream = streams[i]
- if (stream.connection.connectionId != Tokbox.session.connection.connectionId)
- {
- var parentDiv = document.getElementById("tokbox-subscribers")
- var stubDiv = document.createElement("div")
- stubDiv.id = "opentok_subscriber_"+stream.connection.connectionId
- parentDiv.appendChild(stubDiv)
-
- var subscriberProps = {width: Tokbox.width, height: Tokbox.height, audioEnabled: true}
- var subscriber = Tokbox.session.subscribe(stream, stubDiv.id, subscriberProps)
- Tokbox.subscribers.push(subscriber)
- }
- }
- },
- sessionConnectedHandler: function (event)
- {
- Tokbox.height = $("#tokbox-embed").height()
- Tokbox.width = Math.floor( Tokbox.height / 1.618 )
- $("#tokbox-loading").hide()
-
- Tokbox.subscribeToStreams(event.streams)
-
- var parentDiv = document.getElementById("tokbox-publisher")
- var stubDiv = document.createElement("div")
- stubDiv.id = "opentok_publisher"
- parentDiv.appendChild(stubDiv)
-
- var publisherProps = {width: Tokbox.width, height: Tokbox.height, microphoneEnabled: false}
- Tokbox.publisher = Tokbox.session.publish(stubDiv.id, publisherProps)
- $("#tokbox-loading").hide()
- $("#tokbox-settings").fadeIn(1000)
- },
- streamCreatedHandler: function (event)
- {
- Tokbox.subscribeToStreams(event.streams)
- },
- tokenCallback: function (raw)
- {
- var lines = API.parse("/tokbox", raw)
- if (! lines)
- return d.error("API ERROR")
- for (i in lines)
- {
- pair = lines[i].split("\t")
- if (pair[0] === "ERROR")
- return d.error(pair[1])
- else if (pair[0] === "SESSION")
- Tokbox.sessionid = d.trim(pair[1])
- else if (pair[0] === "TOKEN")
- Tokbox.token = d.trim(pair[1])
- }
- if (Tokbox.sessionid && Tokbox.token)
- Tokbox.activate()
- },
- activate: function ()
- {
- Tokbox.session = TB.initSession(Tokbox.sessionid)
- Tokbox.session.addEventListener("sessionConnected", Tokbox.sessionConnectedHandler)
- Tokbox.session.addEventListener("streamCreated", Tokbox.streamCreatedHandler)
- Tokbox.session.connect(626221, Tokbox.token)
- },
- microphoneOn: function ()
- {
- Tokbox.publisher.publishAudio(true)
- d.warn(">>>> MICROPHONE ON")
- },
- microphoneOff: function ()
- {
- Tokbox.publisher.publishAudio(false)
- d.warn(">>>> MICROPHONE OFF")
- },
- mute: function ()
- {
- for (var i = 0; i < Tokbox.subscribers.length; i++)
- {
- try
- {
- Tokbox.subscribers[i].subscribeToAudio(false)
- d.warn("MUTED "+i)
- }
- catch (err)
- {
- d.warn("UNMUTE ERROR "+i+" "+ err.description)
- }
- }
- d.warn(">>>> MUTE ALL")
- },
- unmute: function ()
- {
- for (var i = 0; i < Tokbox.subscribers.length; i++)
- {
- try
- {
- Tokbox.subscribers[i].subscribeToAudio(true)
- d.warn("UNMUTED "+i)
- }
- catch (err)
- {
- d.warn("UNMUTE ERROR "+i+" "+ err.description)
- }
- }
- d.warn(">>>> UNMUTE ALL")
- },
- load: function ()
- {
- $("#tokbox-embed").show()
- $("#tokbox-settings").hide()
- $("#tokbox-loading").show()
- $(window).trigger("resize")
- $.get(Tokbox.token_url, {room:Room.name}).success(Tokbox.tokenCallback)
- Tokbox.togglers.push( new Toggler ("#tokbox-microphone", Tokbox.microphoneOn, Tokbox.microphoneOff) )
- Tokbox.togglers.push( new Toggler ("#tokbox-mute-all", Tokbox.mute, Tokbox.unmute) )
- },
- unload: function ()
- {
- $("#tokbox-embed").hide()
- $(window).trigger("resize")
- if (Tokbox.session)
- {
- if (Tokbox.publisher)
- Tokbox.session.unpublish(Tokbox.publisher)
- Tokbox.session.disconnect()
- }
- Tokbox.publisher = null
- Tokbox.session = null
- $("#tokbox-publisher").html("")
- $("#tokbox-subscriber").html("")
- for (t in Tokbox.togglers)
- Tokbox.togglers[i].destroy ()
- Tokbox.togglers = []
- },
- init: function ()
- {
- }
- }
-var VIMEOregexp = /^(\bhttps?:\/\/)(www.)?vimeo.com\/([0-9]+).*$/i
-var Chat =
- {
- timer: null,
- oldChat: {},
- oldVideo: {},
- lastPoll: 0,
- delay: 1000,
- delayShort: 1000,
- delayLong: 5000,
- messages: {},
- callback: false,
- parse: function (row)
- {
- var s = '<a href="/profile/' + row[2] + '" class="u">' + row[2] + "</a> <span>"
- s += Chat.parseWords(row[3])
- s += "</span><br />"
- return s
- },
- parseWords: function (raw)
- {
- if (! raw)
- return ""
- var words = raw.split(" ")
- var s = ""
- for (i in words)
- {
- var word = words[i]
- if (word.indexOf("http") !== -1)
- {
- if (word.indexOf("youtube.com/watch?") !== -1)
- {
- var ytid = "youtube_"+Youtube.getYtid(word)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtube.com/v/") !== -1)
- {
- var index = word.indexOf("/v/")
- var ytid = "youtube_"+word.substr(index+3,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("youtu.be") !== -1)
- {
- var ytid = "youtube_"+word.substr(16,11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- // http://www.youtube.com/user/ahchachachacha#p/f/28/1GSBekxLR1E
- else if (word.indexOf("youtube.com/user") !== -1)
- {
- var ytid = "youtube_"+word.substr(-11)
- var txt
- if (ytid in Player.videos)
- txt = Player.videos[ytid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+ytid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("vimeo.com") !== -1)
- {
- var vimeoid = word.replace(VIMEOregexp, "vimeo_$3")
- if (vimeoid in Player.videos)
- txt = Player.videos[vimeoid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+vimeoid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf("soundcloud.com") !== -1)
- {
- var scid = "soundcloud_" + $.md5(word)
- if (scid in Player.videos)
- txt = Player.videos[scid].title
- else
- txt = word
- s += '<a href="'+word+'" class="ytlink" id="'+scid+'" target="_parent">'+txt+'</a> '
- }
- else if (word.indexOf(".jpeg") !== -1 ||
- word.indexOf(".JPG") !== -1 ||
- word.indexOf(".GIF") !== -1 ||
- word.indexOf(".PNG") !== -1 ||
- word.indexOf(".JPEG") !== -1 ||
- word.indexOf(".jpg") !== -1 ||
- word.indexOf(".gif") !== -1 ||
- word.indexOf(".png") !== -1)
- {
- s += '<a href="'+word+'" target="_blank" class="pic"><img src="'+word+'" /></a>'
- }
- else if (word.indexOf("scannerjammer.com/profile") !== -1)
- {
- var username = word.substr( word.indexOf("profile")+8 ).replace("/","")
- s += '<a href="'+word+'">@'+username+'</a>'
- }
- // else if (word.indexOf("@") === 0 && word.length > 2)
- // {
- // }
- else
- {
- var poffset = word.indexOf('//')
- var linktext = word.substr(poffset+2, word.indexOf('/', poffset+2) - 2).replace("www.","").replace(/\/+$/,"")
- s += '<a href="'+word+'" target="_blank">'+linktext+'</a> '
- }
- }
- else if (word.indexOf(".com") !== -1 ||
- word.indexOf(".net") !== -1 ||
- word.indexOf(".org") !== -1 ||
- word.indexOf(".us") !== -1 ||
- word.indexOf(".nu") !== -1 ||
- word.indexOf(".uk") !== -1 ||
- word.indexOf(".fr") !== -1 ||
- word.indexOf(".de") !== -1 ||
- word.indexOf(".fm") !== -1)
- {
- var txt = word.replace("www.","")
- s += '<a href="http://'+word+'" target="_blank">'+txt+'</a> '
- }
- else
- s += word + " "
- }
- return s
- },
- store: function (lines)
- {
- var newVideos = []
- var newChat = []
- var postponeScroll = false
- for (i in lines)
- {
- if (! lines[i])
- continue
- row = lines[i].split("\t")
- if (row[0] === 'VIDEO')
- {
- row.shift()
- if (row[0] in Chat.oldVideo)
- continue
- Chat.oldVideo[row[0]] = row
- Playlist.enqueueOldVideoFormat([row])
- }
- else if (row[0] === 'ROOM')
- {
- Room.updateSetting(row[1],row[2])
- }
- else if (row[0] === 'LIKE')
- {
- username = row[1]
- Like.enqueue(username)
- }
- else if (row[0] === 'CAM')
- {
- VideoChat.updateCount(row[1])
- }
- else
- {
- // 0 id 1 date 2 user 3 msg
- if (row[0] in Chat.oldChat)
- continue
- Chat.oldChat[row[0]] = row
- var c = Chat.parse(row)
- if (c.indexOf("<img") !== -1)
- {
- postponeScroll = true
- d.joy(">> POSTPONING")
- }
- if (row[2] === Auth.username && $.md5(row[3]) in Chat.messages)
- continue
- newChat.push(c)
- }
- }
- if (newChat.length)
- {
- $("#chat").append(newChat.join(""))
- if (postponeScroll)
- setTimeout('d.scrollToBottom("#chat")', 2000)
- else
- d.scrollToBottom("#chat")
- }
- },
- say: function ()
- {
- d.act("+ sent message")
- var msg = d.sanitize( $("#chat-message").val() )
- $("#chat-message").val("")
- if (! msg) return
- if (msg === "debug=1") { $("#msg").show(); d.scrollToBottom("#msg"); return }
- if (msg === "debug=0") { $("#msg").hide(); return }
- if (msg === "poll=0") { d.error("+ DISABLED POLLING"); clearTimeout(Chat.timer); return}
- var hash = $.md5(msg)
- Chat.messages[hash] = true
- var newrow = [0, 0, Auth.username, msg]
- var newdiv = Chat.parse(newrow)
- $("#chat").append(newdiv)
- // if (Chat.callback)
- // Chat.callback(1)
- if (newdiv.indexOf("<img") !== -1)
- setTimeout('d.scrollToBottom("#chat")', 2000)
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: msg}, Room.sayCallback)
- d.scrollToBottom("#chat")
- },
- send: function (msg)
- {
- $.post(API.URL.room.say, {room: Room.name, session: Auth.session, msg: msg}, Room.sayCallback)
- // var hash = $.md5(msg)
- // Chat.messages[hash] = true
- // var newrow = [0, 0, Auth.username, msg]
- // var newdiv = Chat.parse(newrow)
- // $("#chat").append(newdiv)
- // if (newdiv.indexOf("<img") !== -1)
- // setTimeout('d.scrollToBottom("#chat")', 2000)
- // d.scrollToBottom("#chat")
- },
- sayCallback: function (raw)
- {
- var lines = API.parse("/room/say", raw)
- if (! lines) return
- var newid = lines.split("\t")[0]
- Chat.oldChat[newid] = true
- // Room.store(lines)
- d.joy("MESSAGE SENT")
- },
- poll: function ()
- {
- // d.warn("Polling")
- $.post(API.URL.room.poll,
- {
- room: Room.name,
- session: Auth.session,
- last: Chat.lastPoll,
- cam: VideoChat.isOpen,
- }).success(Chat.pollCallback).error(Chat.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- d.error("Poll failed, waiting "+Math.floor(Chat.delayLong)+"s...")
- Chat.timer = setTimeout(Chat.poll, Chat.delayLong)
- },
- pollCallback: function (raw)
- {
- // d.warn("Poll successful")
- Chat.timer = setTimeout(Chat.poll, Chat.delay)
- var lines = API.parse("/room/poll", raw)
- if (! lines)
- return d.error("Poll failed")
- Chat.lastPoll = parseInt(lines.shift()) - 1
- Lastlog.update(lines.shift())
- Chat.store(lines)
- }
- }
-
-var Lastlog =
- {
- old: "",
- update: function (lastlog)
- {
- if (Lastlog.old === lastlog)
- return
- Lastlog.old = lastlog
- var names = lastlog.split("\t")
- var s = ""
- for (i in names.sort())
- {
- s += "<li class='ll'><a href='/profile/"+names[i]+"'>"+names[i]+"</a></li>"
- }
- $("#lastlog").html(s)
- $("#lastlogbg").css("height", $("#lastlogbox").height())
- }
- }
-var Menu = {}
-var Room =
- {
- loaded: false,
- ops: {},
- settings: {},
- settingsButtonBound: false,
- updateSettingMethods:
- {
- bg: function (url)
- {
- if (url === Room.settings.bg)
- return
- d.warn("clearing bg")
- $("#bg").fadeOut(500, function ()
- {
- if (url)
- {
- d.warn("updating bg to "+url)
- $("#bg img").attr('src', url).bind("load", function(){$("#bg").fadeIn(2000);d.warn("bg updated")})
- }
- })
- },
- title: function (s)
- {
- if (s.length === 0)
- s = "&nbsp;"
- $("#heading").html( s.replace(">","&gt;").replace("<","&lt;") )
- },
- topic: function (s)
- {
- if (s.length === 0)
- s = "&nbsp;"
- $("#topic").html( d.linkify(s.replace(">","&gt;").replace("<","&lt;")) )
- },
- phase: function (s)
- {
- if (s === 'light')
- {
- // turn on lookit stylesheet
- }
- else
- {
- // turn off lookit stylesheet
- }
- },
- bgcolor: function (s)
- {
- if (s)
- $('body').css("background-color", s)
- }
- },
- updateSetting: function (k, v)
- {
- d.warn( "update setting: "+k )
- $("room-"+k).val(v)
- if (k in Room.updateSettingMethods)
- var f = Room.updateSettingMethods[k](v)
- Room.settings[k] = v
- },
- settingsOpen: function ()
- {
- d.warn("ROOM SETTINGS LOAD")
- $("#room-id").html(Room.id)
- $("#room-name").html(Room.name)
- $("#room-path").html(Room.path)
- $("#room-title").val(Room.settings['title'])
- $("#room-topic").val(Room.settings['topic'])
- $("#room-phase").val(Room.settings['phase'])
- $("#room-bg").val(Room.settings['bg'])
- $("#room-bgcolor").val(Room.settings['bgcolor'])
- $("#room-plant").val(Room.settings['plant'])
- $("#room-flower").val(Room.settings['flower'])
- $("#room-updater").html(Room.settings['updater'])
- if (! Room.settingsButtonBound)
- {
- Room.settingsButtonBound = true
- $("#room-settings-save").bind("click", Room.settingsSaveClick)
- }
- $("#room-settings-unload").bind("click", Room.settingsClose)
- if (Auth.access > 0)
- $("#room-mod-tag").html("<a href='/"+Room.name+"/admin'>Moderate room</a>")
- else
- $("#room-mod-tag").html("")
- d.warn("LOADED")
- },
- settingsClose: function ()
- {
- d.warn("ROOM SETTINGS UNLOAD")
- Room.settingsButtonBound = false
- $("#room-settings-save").unbind("click")
- },
- settingsKeys: ["title","topic","bg"],
- last_bg: "",
- settingsSaveClick: function ()
- {
- $("#room-settings-save").unbind("click")
- var set = []
- if (Room.ops !== false)
- {
- if (Auth.access < 1 && !(Auth.username in Room.ops))
- {
- Menu.settings.close()
- return
- }
- }
- Room.last_bg = Room.settingsKeys['bg']
- for (i in Room.settingsKeys)
- {
- var k = Room.settingsKeys[i]
- var v = d.sanitize( $("#room-"+k).val() )
- Room.updateSetting(k, v)
- set.push(k+"\t"+v)
- }
- set.push("updater\t"+Auth.username)
- var s = set.join("\n")
- $.post(API.URL.room.settings, {room: Room.name, session: Auth.session, settings: s}, Room.settingsCallback)
- Menu.settings.close()
- },
- settingsCallback: function (raw)
- {
- var lines = API.parse("/room/say", raw)
- if (! lines)
- return
- if (lines[0].indexOf("OK") !== -1)
- {
- d.warn("settings updated: "+lines.shift())
- $("#room-updater").hide().html("you!").fadeIn(500)
- }
- else if (lines[0].indexOf("BG_SIZE") !== -1)
- {
- var partz = lines[0].split("\t")
- setTimeout('Room.updateSettingMethods.bg(Room.last_bg)', 2000)
- alert("Background too large!\n\nYour image: "+ partz[2]+" bytes\nMax size: " + partz[3] + " bytes")
- }
- else if (lines[0].indexOf("BG_DATA") !== -1)
- {
- setTimeout('Room.updateSettingMethods.bg(Room.last_bg)', 2000)
- alert("Unable to retrieve background image")
- }
- $("#room-settings-save").bind("click", Room.settingsSaveClick)
- },
- connect: 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("JOINING ROOM "+Room.name)
- $.ajax({
- type: 'POST',
- url: API.URL.room.join,
- data: {'room':Room.name,'session':Auth.session,'enqueue':videoKey},
- timeout: 2000,
- }).success(Room.joinCallback).error(Room.joinErrorCallback)
- },
- joinErrorCallback: function (jqXHR, textStatus, errorThrown)
- {
- d.warn("JOIN ERROR")
- if (Room.loaded)
- return
- if (textStatus === "timeout")
- Room.connect()
- else
- Auth.load()
- },
- joinCallback: function (raw)
- {
- var lines = API.parse("/room/join", raw)
- if (!lines){
- d.error("UNABLE TO LOAD ROOM");
- setTimeout(Room.load, 500);
- return;
- }
- var u = lines.shift().split("\t")
-
- if (u[0] === '0')
- return Auth.load()
- d.warn("JOINED ROOM")
- Auth.unload()
- Auth.userid = u[0]
- Auth.username = u[1]
- Auth.access = u[2]
- d.joy("logged in as "+Auth.username)
-
- Lastlog.update(lines.shift())
- Chat.store(lines)
-
- d.warn("__________")
- d.warn("__________")
- d.warn("__________")
- Room.load()
- d.warn("__________")
- d.warn("__________")
- d.warn("__________")
- },
- load: function ()
- {
- d.warn("LOAD ROOM")
- $("#loading").fadeOut(500, function()
- {
- Background.load()
- Player.init()
- VideoChat.init()
- Chat.poll()
- })
- $("#loading").fadeOut(1500, Room.loadFinish)
- },
- loadFinish: function ()
- {
- setTimeout("d.scrollToBottom('#chat')", 500)
- $("#logo").show()
- $("#logobg,#logobar").show()
- $("#likebutton").css("display", "inline-block")
-
- $("#player").show()
- $("#playlist").show()
- $("#playlistbg").show()
-
- $("#form").show()
- $("#formbg").show()
- $("#chat").fadeIn(200)
- d.scrollToBottom("#chat")
- $("#chatbg").show()
- $("#lastlogbox").show()
- $("#lastlogbg").show()
-
- Keyboard.enter = Chat.say
- $("#chat-message").bind("focus", Keyboard.focusTextarea)
- $("#chat-message").bind("blur", Keyboard.blurTextarea)
- $("#chat-message").focus()
- Keyboard.focusTextarea()
- $("#chat-send").bind("click", Chat.say)
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- $("#sitez").show()
- $("#logout").click(Auth.logout)
- if (Room.name === "feederbleeder")
- {
- $("#heading").css({ "color": "#ff3333" })
- // Viewport.fullscreenOn()
- }
- //else
- Viewport.standardResize()
- // $(".ytlink").live("click", Player.ytLinkClick, false)
-
- if (Auth.access > 0)
- {
- // var div = $("<div>").addClass("modhello").html("Congratulations new moderator! Click on the cube icon in the upper right corner and you will see the MODERATE ROOM link.").click(function(){$(this).fadeOut(1000)})
- // $("#chat").append(div)
- }
- // var div = $("<div>").addClass("modhello").html("Hey! You can now use the LEFT AND RIGHT ARROW KEYS to browse the playlist, and the L key to like a video!").click(function(){$(this).fadeOut(1000)})
- // $("#chat").append(div)
- setTimeout(Player.start, 2000)
- Room.loaded = true
- document.cookie = "room="+Room.name+";path=/;domain=.scannerjammer.com;max-age=86400"
- if (Room.loadCallback)
- Room.loadCallback()
- },
- loadCallback: false,
- unload: function ()
- {
- $("#logo,#logobg,#player,#playlist,#playlistbg,#form,#formbg,#chat,#chatbg,#lastlogbox,#lastlogbg,#sitez").hide()
- Menu.close()
- },
- init: function ()
- {
- d.warn("INIT ROOM")
- if (roomName !== undefined)
- Room.name = roomName
- else
- Room.name = "main"
- d.warn("room: "+Room.name)
- // $("#chat").show()
- }
- }
-
-var Rooms =
- {
- loaded: false,
- queue: [
- [0, "rooms", "/", "http://scannerjammer.com/bgz/gridzy9.jpg", "<span style='color: #fff;'>&rarr; SEE ALL <span style='text-decoration: underline;'>OPEN ROOMS</span></span>"],
- [1, "main", "/main", "http://scannerjammer.com/bgz/1302474305250-dumpfm-GucciSoFlosy-pattern4.gif", "MAIN ROOM"],
- [12, "FEEDERBLEEDER", "/feederbleeder", "http://scannerjammer.com/img/Tropic_Of_Cancer__The_Sorrow_Of_Two_Blooms_1308602037.jpg", "FEEDERBLEEDER"],
- [2, "avatar", "/avatar", "http://scannerjammer.com/img/avatar2.png", "avatar"],
- [3, "glitter", "/glitter", "http://scannerjammer.com/bgz/argus.gif", "glitter"],
- [10, 'jono', '/jonomilo', 'http://scannerjammer.com/bgz/whitesquare.gif', 'j&ograve;n&ograve; m&igrave; l&ograve;'],
- //[11, 'SJD', 'http://lolz.biz/sjd', 'http://scannerjammer.com/img/idgiguy2.png', 'SJD'],
- [4, "waterfall", "/waterfall", "http://i.imgur.com/QEZRF.gif", "waterfall"],
- ],
- list: function ()
- {
- if (Rooms.loaded)
- return
- Rooms.listDisplay(Rooms.queue)
- // $.post(API.URL.room.list, {session:Auth.session}).success(Rooms.listCallback).error(Rooms.listError)
- },
- listCallback: function (raw)
- {
- // parse API
- Rooms.listDisplay(lines)
- },
- listError: function ()
- {
- Rooms.listDisplay(Rooms.queue)
- },
- listDisplay: function (rooms)
- {
- $("#rooms-loading").hide()
- var divz = []
- for (i in rooms)
- {
- var r = rooms[i]
- var s = "<a href='"+r[2]+"'><li style='background-image: url("+r[3]+")'>"+r[4]
- if (r[1] === Room.name)
- s += " &lt; YOU ARE HERE"
- s += "</li></a>"
- divz.push(s)
- }
- $("#rooms-list").html(divz.join(''))
- Rooms.loaded = true
- }
- }
-var About =
- {
- loaded: false,
- init: function ()
- {
- $("#your-profile").attr('href', 'http://scannerjammer.com/profile/'+Auth.username)
- About.loaded = true
- }
- }
-function menu (key, loadCallback)
- {
- d.warn("MENU INIT "+key)
- this.appear = function ()
- {
- if (! Menu.isOpen)
- {
- $("#"+key+"-container").show()
- Menu.current = key
- loadCallback()
- $("#chat-message").blur()
- Keyboard.blurTextarea()
- }
- }
- this.disappear = function ()
- {
- if (! Menu.isOpen)
- $("#"+key+"-container").hide()
- }
- this.close = function ()
- {
- $("#"+key+"-container").hide()
- $(".opened").removeClass("opened")
- Menu.isOpen = false
- }
- this.click = function ()
- {
- for (i in Menu.keys)
- {
- $("#"+Menu.keys[i]+"-container").hide()
- }
- $("#"+key+"-container").show()
- if (Menu.current !== key)
- loadCallback()
- Menu.current = key
- $(".opened").removeClass("opened")
- $("#"+key+"-hook").addClass("opened")
- Menu.isOpen = true
- }
- $("#"+key+"-hook").hover(this.appear, this.disappear).click(this.click)
- $("#"+key+"-close").click(this.close)
- $("#"+key+"-container").hover(this.click, this.close)
- }
-var VideoChat =
- {
- isOpen: false,
- badgePositioned: false,
- suppressBadge: 0,
- updateCount: function (count)
- {
- /*
- if (VideoChat.suppressBadge > 0)
- {
- VideoChat.suppressBadge -= 1
- return
- }
- */
- if (parseInt(count) > 0)
- {
- if (! VideoChat.badgePositioned)
- {
- VideoChat.badgePositioned = true
- $("#videochat-badge").css({
- right: 5,
- top: 5,
- }).show()
- }
- $("#videochat-badge").html(count).show()
- }
- else
- {
- $("#videochat-badge").hide()
- }
- },
- open: function ()
- {
- // $("#tokbox-embed").html('<iframe id="tokbox-embedded" src="http://scannerjammer.com/tokbox/" style="border:none"></iframe>')
- // $("#tokbox-embed").show()
- // $(window).trigger('resize')
- VideoChat.isOpen = true
- // Webcam.load()
- Tokbox.load()
- },
- close: function ()
- {
- // $("#tokbox-embed").hide().html("")
- // $("#tokbox-close").hide()
- // $(window).trigger('resize')
- VideoChat.isOpen = false
- VideoChat.suppressBadge = 20
- // Webcam.unload()
- Tokbox.unload()
- },
- toggle: function ()
- {
- if (VideoChat.isOpen)
- VideoChat.close()
- else
- VideoChat.open()
- },
- init: function ()
- {
- // Webcam.init()
- $("#tokbox").show()
- $("#videochat-toggle").click(VideoChat.toggle)
- }
- }
-var Menu =
- {
- isOpen: false,
- current: false,
- keys: ["settings","about","rooms"],
- close: function ()
- {
- if (Menu.current)
- Menu[Menu.current].close()
- },
- settings: new menu("settings", Room.settingsOpen),
- rooms: new menu("rooms", Rooms.list),
- about: new menu("about", About.init),
- }
-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 ()
diff --git a/www/static/js/soundcloud.js b/www/static/js/soundcloud.js
deleted file mode 100755
index 1ff6c45..0000000
--- a/www/static/js/soundcloud.js
+++ /dev/null
@@ -1,157 +0,0 @@
-var Soundcloud =
- {
- type: "soundcloud",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 100,
- play: function (video)
- {
- d.warn("SOUNDCLOUD PLAY "+video.key)
- if (video.error)
- return Soundcloud.error()
- if (Soundcloud.playing)
- Soundcloud.stop()
- $("#screen").html("<div id='soundcloud'></div><div id='soundcloud-img'></div><div id='soundcloud-dl'></div>")
- Soundcloud.video = video
- Soundcloud.playing = false
-
- if (Soundcloud.player)
- {
- Soundcloud.player = null
- swfobject.removeSWF("soundcloud")
- }
-
- var flashvars = { enable_api: true, object_id: "soundcloud", url: video.src, theme_color: "#657b83", }
- var attributes = { id: "soundcloud", name: "soundcloud" }
- var params = { allowscriptaccess: "always", wmode: "opaque", }
-
- swfobject.embedSWF("http://player.soundcloud.com/player.swf", "soundcloud", "81", "81", "9.0.0",
- "expressInstall.swf", flashvars, params, attributes, Soundcloud.playerDidLoad);
- },
- playerDidLoad: function (e)
- {
- if (e.success === false)
- return Soundcloud.error("failed to load")
- d.warn("LOADED")
- Soundcloud.player = swfobject.getObjectById('soundcloud')
- $("#ytscreen").css("z-index", -2)
- // instead of raising events, the soundcloud swf calls it's js api directly
- window.soundcloud = { onPlayerReady: Soundcloud.ready, onMediaEnd: Soundcloud.finish }
- },
- ready: function ()
- {
- d.warn("READY")
- Soundcloud.playing = true
- Soundcloud.player = swfobject.getObjectById('soundcloud')
- if (Soundcloud.player)
- {
- Soundcloud.player.api_play()
- Soundcloud.player.api_setVolume(Soundcloud.volume)
- }
- Soundcloud.report()
- },
- report: function ()
- {
- if (! Soundcloud.player)
- return Soundcloud.error()
- var track = Soundcloud.player.api_getCurrentTrack()
- $("#video-title").html(track.title)
- if (track.downloadable && track.download_url !== "undefined" && track.download_url !== undefined)
- $("#soundcloud-dl").html('<a href="'+track.download_url+'" target="_parent">download</a>')
- else
- $("#soundcloud-dl").html("")
- var art = ''
- if (track.artwork)
- art = track.artwork.split("?")[0].replace('large','original')
- else if (track.user && track.user.avatarUrl)
- art = track.user.avatarUrl.split("?")[0].replace('large','crop')
- if (art.length)
- {
- $("#soundcloud-img").html("<img src='"+art+"' id='sc-art' />")
- $("#sc-art").bind("error", function(){$("#sc-art").hide()})
- }
- return
- d.warn("____________")
- for (i in track)
- d.warn("<b>"+i+":</b> "+track[i])
- d.warn("____________")
- var user = track.user
- for (i in user)
- d.warn("<b>"+i+":</b> "+user[i])
- d.warn("____________")
- },
- toggle: function ()
- {
- d.warn("TOGGLE PLAYBACK")
- if (Soundcloud.player)
- return Soundcloud.player.api_toggle()
- return false
- },
- error: function (s)
- {
- Player.error("SOUNDCLOUD "+s)
- Soundcloud.finish()
- },
- setVolume: function (vol)
- {
- Soundcloud.volume = vol
- if (Soundcloud.player)
- Soundcloud.player.api_setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Soundcloud.playing = false
- if (Soundcloud.player)
- Soundcloud.player.api_pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Soundcloud.playing = true
- if (Soundcloud.player)
- Soundcloud.player.api_play()
- return false
- },
- stop: function ()
- {
- d.warn("SOUNDCLOUD STOP")
- if (Soundcloud.player)
- Soundcloud.player.api_stop()
- Soundcloud.playing = false
- },
- finish: function ()
- {
- d.warn("SOUNDCLOUD FINISH")
- Soundcloud.playing = false
- swfobject.removeSWF("soundcloud")
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING SOUNDCLOUD")
- Soundcloud.loaded = true
- },
- unload: function ()
- {
- d.warn("SOUNDCLOUD UNLOADED")
- swfobject.removeSWF("soundcloud")
- Soundcloud.loaded = false
- Soundcloud.playing = false
- },
- init: function ()
- {
- d.warn("SOUNDCLOUD INIT")
- window.soundcloud = Soundcloud
- }
- }
-Player.register(Soundcloud)
-
diff --git a/www/static/js/soundmanager2.js b/www/static/js/soundmanager2.js
deleted file mode 100755
index 46528c9..0000000
--- a/www/static/js/soundmanager2.js
+++ /dev/null
@@ -1,2838 +0,0 @@
-/** @license
- * SoundManager 2: Javascript Sound for the Web
- * --------------------------------------------
- * http://schillmania.com/projects/soundmanager2/
- *
- * Copyright (c) 2007, Scott Schiller. All rights reserved.
- * Code provided under the BSD License:
- * http://schillmania.com/projects/soundmanager2/license.txt
- *
- * V2.97a.20101010
- */
-
-/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, regexp: true, newcap: true, immed: true, regexp: false */
-/*global window, SM2_DEFER, sm2Debugger, alert, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
-
-(function(window) {
-
-var soundManager = null;
-
-function SoundManager(smURL, smID) {
-
- this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9.
- this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured)
- this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues
- this.useConsole = true; // use firebug/safari console.log()-type debug console if available
- this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug
- this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload()
- this.nullURL = 'about:blank'; // path to "null" (empty) MP3 file, used to unload sounds (Flash 8 only)
- this.allowPolling = true; // allow flash to poll for status update (required for whileplaying() events, peak, sound spectrum functions to work.)
- this.useFastPolling = false; // uses lower flash timer interval for higher callback frequency, best combined with useHighPerformance
- this.useMovieStar = true; // enable support for Flash 9.0r115+ (codename "MovieStar") MPEG4 audio formats (AAC, M4V, FLV, MOV etc.)
- this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000'
- this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag
- this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity)
- this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top)
- this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain'
- this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable.
- this.useHTML5Audio = false; // Beta feature: Use HTML 5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible.
- this.html5Test = /^probably$/i; // HTML5 Audio().canPlayType() test. /^(probably|maybe)$/i if you want to be more liberal/risky.
- this.ondebuglog = false; // callback made with each log message, regardless of debugMode
-
- this.audioFormats = {
- // determines HTML5 support, flash requirements
- // eg. if MP3 or MP4 required, Flash fallback is used if HTML5 can't play it
- // shotgun approach to MIME testing due to browser variance
- 'mp3': {
- 'type': ['audio/mpeg; codecs="mp3"','audio/mpeg','audio/mp3','audio/MPA','audio/mpa-robust'],
- 'required': true
- },
- 'mp4': {
- 'related': ['aac','m4a'], // additional formats under the MP4 container
- 'type': ['audio/mp4; codecs="mp4a.40.2"','audio/aac','audio/x-m4a','audio/MP4A-LATM','audio/mpeg4-generic'],
- 'required': true
- },
- 'ogg': {
- 'type': ['audio/ogg; codecs=vorbis'],
- 'required': false
- },
- 'wav': {
- 'type': ['audio/wav; codecs="1"','audio/wav','audio/wave','audio/x-wav'],
- 'required': false
- }
- };
-
- this.defaultOptions = {
- 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can)
- 'stream': true, // allows playing before entire file has loaded (recommended)
- 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true)
- 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0)
- 'onid3': null, // callback function for "ID3 data is added/available"
- 'onload': null, // callback function for "load finished"
- 'whileloading': null, // callback function for "download progress update" (X of Y bytes received)
- 'onplay': null, // callback for "play" start
- 'onpause': null, // callback for "pause"
- 'onresume': null, // callback for "resume" (pause toggle)
- 'whileplaying': null, // callback during play (position update)
- 'onstop': null, // callback for "user stop"
- 'onfailure': null, // callback function for when playing fails
- 'onfinish': null, // callback function for "sound finished playing"
- 'onbeforefinish': null, // callback for "before sound finished playing (at [time])"
- 'onbeforefinishtime': 5000, // offset (milliseconds) before end of sound to trigger beforefinish (eg. 1000 msec = 1 second)
- 'onbeforefinishcomplete': null,// function to call when said sound finishes playing
- 'onjustbeforefinish': null, // callback for [n] msec before end of current sound
- 'onjustbeforefinishtime': 200, // [n] - if not using, set to 0 (or null handler) and event will not fire.
- 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time
- 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled
- 'position': null, // offset (milliseconds) to seek to within loaded sound data.
- 'pan': 0, // "pan" settings, left-to-right, -100 to 100
- 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3
- 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)
- 'volume': 100 // self-explanatory. 0-100, the latter being the max.
- };
-
- this.flash9Options = { // flash 9-only options, merged into defaultOptions if flash 9 is being used
- 'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
- 'usePeakData': false, // enable left/right channel peak (level) data
- 'useWaveformData': false, // enable sound spectrum (raw waveform data) - WARNING: CPU-INTENSIVE: may set CPUs on fire.
- 'useEQData': false, // enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.
- 'onbufferchange': null, // callback for "isBuffering" property change
- 'ondataerror': null, // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
- 'onstats': null // callback for when connection & play times have been measured
- };
-
- this.movieStarOptions = { // flash 9.0r115+ MPEG4 audio options, merged into defaultOptions if flash 9+movieStar mode is enabled
- 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.)
- 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants
- 'onconnect': null, // rtmp: callback for connection to flash media server
- 'bufferTimes': null, // array of buffer sizes to use. Size increases as buffer fills up.
- 'duration': null // rtmp: song duration (msec)
- };
-
- this.version = null;
- this.versionNumber = 'V2.97a.20101010';
- this.movieURL = null;
- this.url = (smURL || null);
- this.altURL = null;
- this.swfLoaded = false;
- this.enabled = false;
- this.o = null;
- this.movieID = 'sm2-container';
- this.id = (smID || 'sm2movie');
- this.swfCSS = {
- 'swfBox': 'sm2-object-box',
- 'swfDefault': 'movieContainer',
- 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error)
- 'swfTimedout': 'swf_timedout',
- 'swfUnblocked': 'swf_unblocked', // or loaded OK
- 'sm2Debug': 'sm2_debug',
- 'highPerf': 'high_performance',
- 'flashDebug': 'flash_debug'
- };
- this.oMC = null;
- this.sounds = {};
- this.soundIDs = [];
- this.muted = false;
- this.debugID = 'soundmanager-debug';
- this.debugURLParam = /([#?&])debug=1/i;
- this.specialWmodeCase = false;
- this.didFlashBlock = false;
-
- this.filePattern = null;
- this.filePatterns = {
- 'flash8': /\.mp3(\?.*)?$/i,
- 'flash9': /\.mp3(\?.*)?$/i
- };
-
- this.baseMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3
- this.netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // mp3, mp4, aac etc.
- this.netStreamTypes = ['aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2']; // Flash v9.0r115+ "moviestar" formats
- this.netStreamPattern = new RegExp('\\.(' + this.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
- this.mimePattern = this.baseMimeTypes;
-
- this.features = {
- 'buffering': false,
- 'peakData': false,
- 'waveformData': false,
- 'eqData': false,
- 'movieStar': false
- };
-
- this.sandbox = {
- // <d>
- 'type': null,
- 'types': {
- 'remote': 'remote (domain-based) rules',
- 'localWithFile': 'local with file access (no internet access)',
- 'localWithNetwork': 'local with network (internet access only, no local access)',
- 'localTrusted': 'local, trusted (local+internet access)'
- },
- 'description': null,
- 'noRemote': null,
- 'noLocal': null
- // </d>
- };
-
- this.hasHTML5 = null; // switch for handling logic
- this.html5 = { // stores canPlayType() results, etc. treat as read-only.
- // mp3: boolean
- // mp4: boolean
- 'usingFlash': null // set if/when flash fallback is needed
- };
- this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?)
-
- // --- private SM2 internals ---
-
- var SMSound,
- _s = this, _sm = 'soundManager', _id, _ua = navigator.userAgent, _wl = window.location.href.toString(), _fV = this.flashVersion, _doc = document, _win = window, _doNothing, _init, _onready = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnReady, _processOnReady, _initUserOnload, _go, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _beginInit, _strings, _initMovie, _dcLoaded, _didDCLoaded, _getDocument, _createMovie, _die, _mobileFlash, _setPolling, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5Only = false, _html5CanPlay, _html5Ext, _dcIE, _testHTML5, _addEvt, _removeEvt, _slice = Array.prototype.slice,
- _is_pre = _ua.match(/pre\//i),
- _iPadOrPhone = _ua.match(/(ipad|iphone)/i),
- _isMobile = (_ua.match(/mobile/i) || _is_pre || _iPadOrPhone),
- _isIE = (_ua.match(/MSIE/i)),
- _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)),
- _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'),
- _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null),
- _tryInitOnFocus = (typeof _doc.hasFocus === 'undefined' && _isSafari),
- _okToDisable = !_tryInitOnFocus;
-
- this._use_maybe = (_wl.match(/sm2\-useHTML5Maybe\=1/i)); // temporary feature: #sm2-useHTML5Maybe=1 forces loose canPlay() check
- this._overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null);
- this.useAltURL = !this._overHTTP; // use altURL if not "online"
-
- if (_iPadOrPhone || _is_pre) {
- // might as well force it on Apple + Palm, flash support unlikely
- _s.useHTML5Audio = true;
- _s.ignoreFlash = true;
- }
-
- if (_is_pre || this._use_maybe) {
- // less-strict canPlayType() checking option
- _s.html5Test = /^(probably|maybe)$/i;
- }
-
- // Temporary feature: allow force of HTML5 via URL: #sm2-usehtml5audio=0 or 1
- // <d>
- (function(){
- var a = '#sm2-usehtml5audio=', l = _wl, b = null;
- if (l.indexOf(a) !== -1) {
- b = (l.substr(l.indexOf(a)+a.length) === '1');
- if (typeof console !== 'undefined' && typeof console.log !== 'undefined') {
- console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter');
- }
- _s.useHTML5Audio = b;
- }
- }());
- // </d>
-
- // --- public API methods ---
-
- this.supported = function() {
- return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5));
- };
-
- this.getMovie = function(smID) {
- return _isIE?_win[smID]:(_isSafari?_id(smID) || _doc[smID]:_id(smID));
- };
-
- this.loadFromXML = function(sXmlUrl) {
- try {
- _s.o._loadFromXML(sXmlUrl);
- } catch(e) {
- _failSafely();
- }
- return true;
- };
-
- this.createSound = function(oOptions) {
- var _cs = 'soundManager.createSound(): ',
- thisOptions = null, oSound = null, _tO = null;
- if (!_didInit || !_s.supported()) {
- _complain(_cs + _str(!_didInit?'notReady':'notOK'));
- return false;
- }
- if (arguments.length === 2) {
- // function overloading in JS! :) ..assume simple createSound(id,url) use case
- oOptions = {
- 'id': arguments[0],
- 'url': arguments[1]
- };
- }
- thisOptions = _mixin(oOptions); // inherit from defaultOptions
- _tO = thisOptions; // alias
- // <d>
- if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) {
- _s._wD(_cs + _str('badID', _tO.id), 2);
- }
- _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1);
- // </d>
- if (_idCheck(_tO.id, true)) {
- _s._wD(_cs + _tO.id + ' exists', 1);
- return _s.sounds[_tO.id];
- }
-
- function make() {
- thisOptions = _loopFix(thisOptions);
- _s.sounds[_tO.id] = new SMSound(_tO);
- _s.soundIDs.push(_tO.id);
- return _s.sounds[_tO.id];
- }
-
- if (_html5OK(_tO)) {
- oSound = make();
- _s._wD('Loading sound '+_tO.id+' from HTML5');
- oSound._setup_html5(_tO);
- } else {
- if (_fV > 8 && _s.useMovieStar) {
- if (_tO.isMovieStar === null) {
- _tO.isMovieStar = ((_tO.serverURL || (_tO.type?_tO.type.match(_s.netStreamPattern):false)||_tO.url.match(_s.netStreamPattern))?true:false);
- }
- if (_tO.isMovieStar) {
- _s._wD(_cs + 'using MovieStar handling');
- }
- if (_tO.isMovieStar) {
- if (_tO.usePeakData) {
- _wDS('noPeak');
- _tO.usePeakData = false;
- }
- if (_tO.loops > 1) {
- _wDS('noNSLoop');
- }
- }
- }
- _tO = _policyFix(_tO, _cs);
- oSound = make();
- if (_fV === 8) {
- _s.o._createSound(_tO.id, _tO.onjustbeforefinishtime, _tO.loops||1, _tO.usePolicyFile);
- } else {
- _s.o._createSound(_tO.id, _tO.url, _tO.onjustbeforefinishtime, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.bufferTimes, _tO.onstats ? true : false, _tO.autoLoad, _tO.usePolicyFile);
- if (!_tO.serverURL) {
- // We are connected immediately
- oSound.connected = true;
- if (_tO.onconnect) {
- _tO.onconnect.apply(oSound);
- }
- }
- }
- }
- if (_tO.autoLoad || _tO.autoPlay) {
- if (oSound) {
- if (_s.isHTML5) {
- oSound.autobuffer = 'auto'; // early HTML5 implementation (non-standard)
- oSound.preload = 'auto'; // standard
- } else {
- oSound.load(_tO);
- }
- }
- }
- if (_tO.autoPlay) {
- oSound.play();
- }
- return oSound;
- };
-
- this.destroySound = function(sID, _bFromSound) {
- // explicitly destroy a sound before normal page unload, etc.
- if (!_idCheck(sID)) {
- return false;
- }
- var oS = _s.sounds[sID], i;
- oS._iO = {}; // Disable all callbacks while the sound is being destroyed
- oS.stop();
- oS.unload();
- for (i = 0; i < _s.soundIDs.length; i++) {
- if (_s.soundIDs[i] === sID) {
- _s.soundIDs.splice(i, 1);
- break;
- }
- }
- if (!_bFromSound) {
- // ignore if being called from SMSound instance
- oS.destruct(true);
- }
- oS = null;
- delete _s.sounds[sID];
- return true;
- };
-
- this.load = function(sID, oOptions) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].load(oOptions);
- };
-
- this.unload = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].unload();
- };
-
- this.play = function(sID, oOptions) {
- var fN = 'soundManager.play(): ';
- if (!_didInit || !_s.supported()) {
- _complain(fN + _str(!_didInit?'notReady':'notOK'));
- return false;
- }
- if (!_idCheck(sID)) {
- if (!(oOptions instanceof Object)) {
- oOptions = {
- url: oOptions
- }; // overloading use case: play('mySound','/path/to/some.mp3');
- }
- if (oOptions && oOptions.url) {
- // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'});
- _s._wD(fN + 'attempting to create "' + sID + '"', 1);
- oOptions.id = sID;
- return _s.createSound(oOptions).play();
- } else {
- return false;
- }
- }
- return _s.sounds[sID].play(oOptions);
- };
-
- this.start = this.play; // just for convenience
-
- this.setPosition = function(sID, nMsecOffset) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setPosition(nMsecOffset);
- };
-
- this.stop = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD('soundManager.stop(' + sID + ')', 1);
- return _s.sounds[sID].stop();
- };
-
- this.stopAll = function() {
- _s._wD('soundManager.stopAll()', 1);
- for (var oSound in _s.sounds) {
- if (_s.sounds[oSound] instanceof SMSound) {
- _s.sounds[oSound].stop(); // apply only to sound objects
- }
- }
- };
-
- this.pause = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].pause();
- };
-
- this.pauseAll = function() {
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].pause();
- }
- };
-
- this.resume = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].resume();
- };
-
- this.resumeAll = function() {
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].resume();
- }
- };
-
- this.togglePause = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].togglePause();
- };
-
- this.setPan = function(sID, nPan) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setPan(nPan);
- };
-
- this.setVolume = function(sID, nVol) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].setVolume(nVol);
- };
-
- this.mute = function(sID) {
- var fN = 'soundManager.mute(): ',
- i = 0;
- if (typeof sID !== 'string') {
- sID = null;
- }
- if (!sID) {
- _s._wD(fN + 'Muting all sounds');
- for (i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].mute();
- }
- _s.muted = true;
- } else {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD(fN + 'Muting "' + sID + '"');
- return _s.sounds[sID].mute();
- }
- return true;
- };
-
- this.muteAll = function() {
- _s.mute();
- };
-
- this.unmute = function(sID) {
- var fN = 'soundManager.unmute(): ', i;
- if (typeof sID !== 'string') {
- sID = null;
- }
- if (!sID) {
- _s._wD(fN + 'Unmuting all sounds');
- for (i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].unmute();
- }
- _s.muted = false;
- } else {
- if (!_idCheck(sID)) {
- return false;
- }
- _s._wD(fN + 'Unmuting "' + sID + '"');
- return _s.sounds[sID].unmute();
- }
- return true;
- };
-
- this.unmuteAll = function() {
- _s.unmute();
- };
-
- this.toggleMute = function(sID) {
- if (!_idCheck(sID)) {
- return false;
- }
- return _s.sounds[sID].toggleMute();
- };
-
- this.getMemoryUse = function() {
- if (_fV === 8) {
- return 0;
- }
- if (_s.o) {
- return parseInt(_s.o._getMemoryUse(), 10);
- }
- };
-
- this.disable = function(bNoDisable) {
- // destroy all functions
- if (typeof bNoDisable === 'undefined') {
- bNoDisable = false;
- }
- if (_disabled) {
- return false;
- }
- _disabled = true;
- _wDS('shutdown', 1);
- for (var i = _s.soundIDs.length; i--;) {
- _disableObject(_s.sounds[_s.soundIDs[i]]);
- }
- _initComplete(bNoDisable); // fire "complete", despite fail
- _removeEvt(_win, 'load', _initUserOnload);
- return true;
- };
-
- this.canPlayMIME = function(sMIME) {
- var result;
- if (_s.hasHTML5) {
- result = _html5CanPlay({type:sMIME});
- }
- if (!_needsFlash || result) {
- // no flash, or OK
- return result;
- } else {
- return (sMIME?(sMIME.match(_s.mimePattern)?true:false):null);
- }
- };
-
- this.canPlayURL = function(sURL) {
- var result;
- if (_s.hasHTML5) {
- result = _html5CanPlay(sURL);
- }
- if (!_needsFlash || result) {
- // no flash, or OK
- return result;
- } else {
- return (sURL?(sURL.match(_s.filePattern)?true:false):null);
- }
- };
-
- this.canPlayLink = function(oLink) {
- if (typeof oLink.type !== 'undefined' && oLink.type) {
- if (_s.canPlayMIME(oLink.type)) {
- return true;
- }
- }
- return _s.canPlayURL(oLink.href);
- };
-
- this.getSoundById = function(sID, suppressDebug) {
- if (!sID) {
- throw new Error('SoundManager.getSoundById(): sID is null/undefined');
- }
- var result = _s.sounds[sID];
- if (!result && !suppressDebug) {
- _s._wD('"' + sID + '" is an invalid sound ID.', 2);
- }
- return result;
- };
-
- this.onready = function(oMethod, oScope) {
- if (oMethod && oMethod instanceof Function) {
- if (_didInit) {
- _wDS('queue');
- }
- if (!oScope) {
- oScope = _win;
- }
- _addOnReady(oMethod, oScope);
- _processOnReady();
- return true;
- } else {
- throw _str('needFunction');
- }
- };
-
- this.getMoviePercent = function() {
- return (_s.o && typeof _s.o.PercentLoaded !== 'undefined'?_s.o.PercentLoaded():null);
- };
-
- this._writeDebug = function(sText, sType, bTimestamp) {
- // If the debug log callback is set, always call it, regardless of debugMode
- if (_s.ondebuglog) {
- _s.ondebuglog(sText, sType, bTimestamp);
- }
- // pseudo-private console.log()-style output
- // <d>
- var sDID = 'soundmanager-debug', o, oItem, sMethod;
- if (!_s.debugMode) {
- return false;
- }
- if (typeof bTimestamp !== 'undefined' && bTimestamp) {
- sText = sText + ' | ' + new Date().getTime();
- }
- if (_hasConsole && _s.useConsole) {
- sMethod = _debugLevels[sType];
- if (typeof console[sMethod] !== 'undefined') {
- console[sMethod](sText);
- } else {
- console.log(sText);
- }
- if (_s.useConsoleOnly) {
- return true;
- }
- }
- try {
- o = _id(sDID);
- if (!o) {
- return false;
- }
- oItem = _doc.createElement('div');
- if (++_wdCount % 2 === 0) {
- oItem.className = 'sm2-alt';
- }
- if (typeof sType === 'undefined') {
- sType = 0;
- } else {
- sType = parseInt(sType, 10);
- }
- oItem.appendChild(_doc.createTextNode(sText));
- if (sType) {
- if (sType >= 2) {
- oItem.style.fontWeight = 'bold';
- }
- if (sType === 3) {
- oItem.style.color = '#ff3333';
- }
- }
- // o.appendChild(oItem); // top-to-bottom
- o.insertBefore(oItem, o.firstChild); // bottom-to-top
- } catch(e) {
- // oh well
- }
- o = null;
- // </d>
- return true;
- };
- this._wD = this._writeDebug; // alias
-
- this._debug = function() {
- // <d>
- _wDS('currentObj', 1);
- for (var i = 0, j = _s.soundIDs.length; i < j; i++) {
- _s.sounds[_s.soundIDs[i]]._debug();
- }
- // </d>
- };
-
- this.reboot = function() {
- // attempt to reset and init SM2
- _s._wD('soundManager.reboot()');
- if (_s.soundIDs.length) {
- _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...');
- }
- for (var i = _s.soundIDs.length; i--;) {
- _s.sounds[_s.soundIDs[i]].destruct();
- }
- // trash ze flash
- try {
- if (_isIE) {
- _oRemovedHTML = _s.o.innerHTML;
- }
- _oRemoved = _s.o.parentNode.removeChild(_s.o);
- _s._wD('Flash movie removed.');
- } catch(e) {
- // uh-oh.
- _wDS('badRemove', 2);
- }
- // actually, force recreate of movie.
- _oRemovedHTML = _oRemoved = null;
- _s.enabled = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false;
- _s.soundIDs = _s.sounds = [];
- _s.o = null;
- for (i = _onready.length; i--;) {
- _onready[i].fired = false;
- }
- _s._wD(_sm + ': Rebooting...');
- _win.setTimeout(function() {
- _s.beginDelayedInit();
- }, 20);
- };
-
- this.destruct = function() {
- _s._wD('soundManager.destruct()');
- _s.disable(true);
- };
-
- this.beginDelayedInit = function() {
- // _s._wD('soundManager.beginDelayedInit()');
- _windowLoaded = true;
- _dcLoaded();
- setTimeout(_beginInit, 20);
- _delayWaitForEI();
- };
-
- // --- SMSound (sound object) instance ---
-
- SMSound = function(oOptions) {
- var _t = this, _resetProperties, _add_html5_events, _stop_html5_timer, _start_html5_timer, _get_html5_duration, _a;
- this.sID = oOptions.id;
- this.url = oOptions.url;
- this.options = _mixin(oOptions);
- this.instanceOptions = this.options; // per-play-instance-specific options
- this._iO = this.instanceOptions; // short alias
- // assign property defaults
- this.pan = this.options.pan;
- this.volume = this.options.volume;
- this._lastURL = null;
- this.isHTML5 = false;
-
- // --- public methods ---
-
- this.id3 = {};
-
- this._debug = function() {
- // <d>
- // pseudo-private console.log()-style output
- if (_s.debugMode) {
- var stuff = null, msg = [], sF, sfBracket, maxLength = 64;
- for (stuff in _t.options) {
- if (_t.options[stuff] !== null) {
- if (_t.options[stuff] instanceof Function) {
- // handle functions specially
- sF = _t.options[stuff].toString();
- sF = sF.replace(/\s\s+/g, ' '); // normalize spaces
- sfBracket = sF.indexOf('{');
- msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }');
- } else {
- msg.push(' ' + stuff + ': ' + _t.options[stuff]);
- }
- }
- }
- _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}');
- }
- // </d>
- };
-
- this._debug();
-
- this.load = function(oOptions) {
- var oS = null;
- if (typeof oOptions !== 'undefined') {
- _t._iO = _mixin(oOptions);
- _t.instanceOptions = _t._iO;
- } else {
- oOptions = _t.options;
- _t._iO = oOptions;
- _t.instanceOptions = _t._iO;
- if (_t._lastURL && _t._lastURL !== _t.url) {
- _wDS('manURL');
- _t._iO.url = _t.url;
- _t.url = null;
- }
- }
- _s._wD('soundManager.load(): ' + _t._iO.url, 1);
- if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) {
- _wDS('onURL', 1);
- return _t;
- }
- _t._lastURL = _t.url;
- _t.loaded = false;
- _t.readyState = 1;
- _t.playState = 0;
- if (_html5OK(_t._iO)) {
- _s._wD('HTML 5 load: '+_t._iO.url);
- oS = _t._setup_html5(_t._iO);
- oS.load();
- if (_t._iO.autoPlay) {
- _t.play();
- }
- } else {
- try {
- _t.isHTML5 = false;
- _t._iO = _policyFix(_loopFix(_t._iO));
- if (_fV === 8) {
- _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile);
- } else {
- _s.o._load(_t.sID, _t._iO.url, _t._iO.stream?true:false, _t._iO.autoPlay?true:false, _t._iO.loops||1, _t._iO.autoLoad?true:false, _t._iO.usePolicyFile);
- }
- } catch(e) {
- _wDS('smError', 2);
- _debugTS('onload', false);
- _die();
- }
- }
- return _t;
- };
-
- this.unload = function() {
- // Flash 8/AS2 can't "close" a stream - fake it by loading an empty MP3
- // Flash 9/AS3: Close stream, preventing further load
- if (_t.readyState !== 0) {
- _s._wD('SMSound.unload(): "' + _t.sID + '"');
- if (!_t.isHTML5) {
- if (_fV === 8) {
- _s.o._unload(_t.sID, _s.nullURL);
- } else {
- _s.o._unload(_t.sID);
- }
- } else {
- _stop_html5_timer();
- if (_a) {
- // abort()-style method here, stop loading? (doesn't exist?)
- _a.pause();
- _a.src = _s.nullURL; // needed? does nulling object work? any better way to cancel/unload/abort?
- _a.load();
- _t._audio = null;
- _a = null;
- // delete _t._audio;
- }
- }
- // reset load/status flags
- _resetProperties();
- }
- return _t;
- };
-
- this.destruct = function(_bFromSM) {
- _s._wD('SMSound.destruct(): "' + _t.sID + '"');
- if (!_t.isHTML5) {
- // kill sound within Flash
- // Disable the onfailure handler
- _t._iO.onfailure = null;
- _s.o._destroySound(_t.sID);
- } else {
- _stop_html5_timer();
- if (_a) {
- _a.pause();
- _a.src = 'about:blank';
- _a.load();
- _t._audio = null;
- _a = null;
- // delete _t._audio;
- }
- }
- if (!_bFromSM) {
- _s.destroySound(_t.sID, true); // ensure deletion from controller
- }
- };
-
- this.play = function(oOptions, _updatePlayState) {
- var fN = 'SMSound.play(): ', allowMulti;
- _updatePlayState = (typeof _updatePlayState === 'undefined' ? true : _updatePlayState);
- if (!oOptions) {
- oOptions = {};
- }
- _t._iO = _mixin(oOptions, _t._iO);
- _t._iO = _mixin(_t._iO, _t.options);
- _t.instanceOptions = _t._iO;
- if (_t._iO.serverURL) {
- if (!_t.connected) {
- if (!_t.getAutoPlay()) {
- _s._wD(fN+' Netstream not connected yet - setting autoPlay');
- _t.setAutoPlay(true);
- }
- return _t;
- }
- }
- if (_html5OK(_t._iO)) {
- _t._setup_html5(_t._iO);
- _start_html5_timer();
- }
- // KJV paused sounds have playState 1. We want these sounds to play.
- if (_t.playState === 1 && !_t.paused) {
- allowMulti = _t._iO.multiShot;
- if (!allowMulti) {
- _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1);
- return _t;
- } else {
- _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1);
- if (_t.isHTML5) {
- // TODO: BUG?
- _t.setPosition(_t._iO.position);
- }
- }
- }
- if (!_t.loaded) {
- if (_t.readyState === 0) {
- _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1);
- // try to get this sound playing ASAP
- if (!_t.isHTML5) {
- if (!_t._iO.serverURL) {
- _t._iO.autoPlay = true;
- _t.load(_t._iO);
- }
- } else {
- _t.load(_t._iO);
- _t.readyState = 1;
- }
- } else if (_t.readyState === 2) {
- _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2);
- return _t;
- } else {
- _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1);
- }
- } else {
- _s._wD(fN + '"' + _t.sID + '"');
- }
- // Streams will pause when their buffer is full if they are not auto-playing.
- // In this case paused is true, but the song hasn't started playing yet. If
- // we just call resume() the onplay() callback will never be called.
-
- // Also, if we just call resume() in this case and the sound has been muted
- // (volume is 0), it will never have its volume set so sound will be heard
- // when it shouldn't.
- if (_t.paused && _t.position && _t.position > 0) { // https://gist.github.com/37b17df75cc4d7a90bf6
- _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1);
- _t.resume();
- } else {
- _s._wD(fN+'"'+ _t.sID+'" is starting to play');
- _t.playState = 1;
- _t.paused = false;
- if (!_t.instanceCount || _t._iO.multiShotEvents || (_fV > 8 && !_t.isHTML5 && !_t.getAutoPlay())) {
- _t.instanceCount++;
- }
- _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);
- _t._iO = _policyFix(_loopFix(_t._iO));
- if (_t._iO.onplay && _updatePlayState) {
- _t._iO.onplay.apply(_t);
- }
- _t.setVolume(_t._iO.volume, true);
- _t.setPan(_t._iO.pan, true);
- if (!_t.isHTML5) {
- _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t.position:_t.position / 1000));
- } else {
- _start_html5_timer();
- _t._setup_html5().play();
- }
- }
- return _t;
- };
-
- this.start = this.play; // just for convenience
-
- this.stop = function(bAll) {
- if (_t.playState === 1) {
- _t._onbufferchange(0);
- _t.resetOnPosition(0);
- if (!_t.isHTML5) {
- _t.playState = 0;
- }
- _t.paused = false;
- if (_t._iO.onstop) {
- _t._iO.onstop.apply(_t);
- }
- if (!_t.isHTML5) {
- _s.o._stop(_t.sID, bAll);
- // hack for netStream: just unload
- if (_t._iO.serverURL) {
- _t.unload();
- }
- } else {
- if (_a) {
- _t.setPosition(0); // act like Flash, though
- _a.pause(); // html5 has no stop()
- _t.playState = 0;
- _t._onTimer(); // and update UI
- _stop_html5_timer();
- _t.unload();
- }
- }
- _t.instanceCount = 0;
- _t._iO = {};
- }
- return _t;
- };
-
- this.setAutoPlay = function(autoPlay) {
- _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off'));
- _t._iO.autoPlay = autoPlay;
- _s.o._setAutoPlay(_t.sID, autoPlay);
- if (autoPlay) {
- // KJV Only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP)
- if (!_t.instanceCount && _t.readyState === 1) {
- _t.instanceCount++;
- _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount);
- }
- }
- };
-
- this.getAutoPlay = function() {
- return _t._iO.autoPlay;
- };
-
- this.setPosition = function(nMsecOffset, bNoDebug) {
- if (nMsecOffset === undefined) {
- nMsecOffset = 0;
- }
- // KJV Use the duration from the instance options, if we don't have a track duration yet.
- // Auto-loading streams with a starting position in their options will start playing
- // as soon as they connect. In the start() call we set the position on the stream,
- // but because the stream hasn't played _t.duration won't have been set (that is
- // done in whileloading()). So if we don't have a duration yet, use the duration
- // from the instance options, if available.
- var position, offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0))); // position >= 0 and <= current available (loaded) duration
- _t.position = offset;
- _t.resetOnPosition(_t.position);
- if (!_t.isHTML5) {
- position = _fV === 9 ? _t.position : _t.position / 1000;
- // KJV We want our sounds to play on seek. A progressive download that
- // is loaded has paused = false so resume() does nothing and the sound
- // doesn't play. Handle that case here.
- if (_t.playState === 0) {
- _t.play({ position: position });
- } else {
- _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState)); // if paused or not playing, will not resume (by playing)
- // if (_t.paused) {
- // _t.resume();
- // }
- }
- } else if (_a) {
- _s._wD('setPosition(): setting position to '+(_t.position / 1000));
- if (_t.playState) {
- // DOM/JS errors/exceptions to watch out for:
- // if seek is beyond (loaded?) position, "DOM exception 11"
- // "INDEX_SIZE_ERR": DOM exception 1
- try {
- _a.currentTime = _t.position / 1000;
- } catch(e) {
- _s._wD('setPosition('+_t.position+'): WARN: Caught exception: '+e.message, 2);
- }
- } else {
- _s._wD('HTML 5 warning: cannot set position while playState == 0 (not playing)',2);
- }
- if (_t.paused) { // if paused, refresh UI right away
- _t._onTimer(true); // force update
- if (_t._iO.useMovieStar) {
- _t.resume();
- }
- }
- }
- return _t;
- };
-
- this.pause = function(bCallFlash) {
- if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) {
- return _t;
- }
- _s._wD('SMSound.pause()');
- _t.paused = true;
- if (!_t.isHTML5) {
- if (bCallFlash || bCallFlash === undefined) {
- _s.o._pause(_t.sID);
- }
- } else {
- _t._setup_html5().pause();
- _stop_html5_timer();
- }
- if (_t._iO.onpause) {
- _t._iO.onpause.apply(_t);
- }
- return _t;
- };
-
- this.resume = function() {
- // When auto-loaded streams pause on buffer full they have a playState of 0.
- // We need to make sure that the playState is set to 1 when these streams "resume".
- if (!_t.paused) {
- return _t;
- }
- _s._wD('SMSound.resume()');
- _t.paused = false;
- _t.playState = 1; // TODO: verify that this is needed.
- if (!_t.isHTML5) {
- _s.o._pause(_t.sID); // flash method is toggle-based (pause/resume)
- } else {
- _t._setup_html5().play();
- _start_html5_timer();
- }
- if (_t._iO.onresume) {
- _t._iO.onresume.apply(_t);
- }
- return _t;
- };
-
- this.togglePause = function() {
- _s._wD('SMSound.togglePause()');
- if (_t.playState === 0) {
- _t.play({
- position: (_fV === 9 && !_t.isHTML5 ? _t.position:_t.position / 1000)
- });
- return _t;
- }
- if (_t.paused) {
- _t.resume();
- } else {
- _t.pause();
- }
- return _t;
- };
-
- this.setPan = function(nPan, bInstanceOnly) {
- if (typeof nPan === 'undefined') {
- nPan = 0;
- }
- if (typeof bInstanceOnly === 'undefined') {
- bInstanceOnly = false;
- }
- if (!_t.isHTML5) {
- _s.o._setPan(_t.sID, nPan);
- } // else { no HTML5 pan? }
- _t._iO.pan = nPan;
- if (!bInstanceOnly) {
- _t.pan = nPan;
- }
- return _t;
- };
-
- this.setVolume = function(nVol, bInstanceOnly) {
- if (typeof nVol === 'undefined') {
- nVol = 100;
- }
- if (typeof bInstanceOnly === 'undefined') {
- bInstanceOnly = false;
- }
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol);
- } else if (_a) {
- _a.volume = nVol/100;
- }
- _t._iO.volume = nVol;
- if (!bInstanceOnly) {
- _t.volume = nVol;
- }
- return _t;
- };
-
- this.mute = function() {
- _t.muted = true;
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, 0);
- } else if (_a) {
- _a.muted = true;
- }
- return _t;
- };
-
- this.unmute = function() {
- _t.muted = false;
- var hasIO = typeof _t._iO.volume !== 'undefined';
- if (!_t.isHTML5) {
- _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume);
- } else if (_a) {
- _a.muted = false;
- }
- return _t;
- };
-
- this.toggleMute = function() {
- return (_t.muted?_t.unmute():_t.mute());
- };
-
- this.onposition = function(nPosition, oMethod, oScope) {
- // TODO: allow for ranges, too? eg. (nPosition instanceof Array)
- _t._onPositionItems.push({
- position: nPosition,
- method: oMethod,
- scope: (typeof oScope !== 'undefined'?oScope:_t),
- fired: false
- });
- return _t;
- };
-
- this.processOnPosition = function() {
- var i, item, j = _t._onPositionItems.length;
- if (!j || !_t.playState || _t._onPositionFired >= j) {
- return false;
- }
- for (i=j; i--;) {
- item = _t._onPositionItems[i];
- if (!item.fired && _t.position >= item.position) {
- item.method.apply(item.scope,[item.position]);
- item.fired = true;
- _s._onPositionFired++;
- }
- }
- return true;
- };
-
- this.resetOnPosition = function(nPosition) {
- // reset "fired" for items interested in this position
- var i, item, j = _t._onPositionItems.length;
- if (!j) {
- return false;
- }
- for (i=j; i--;) {
- item = _t._onPositionItems[i];
- if (item.fired && nPosition <= item.position) {
- item.fired = false;
- _s._onPositionFired--;
- }
- }
- return true;
- };
-
- // pseudo-private soundManager reference
-
- this._onTimer = function(bForce) {
- // HTML 5-only _whileplaying() etc.
- var time, x = {};
- if (_t._hasTimer || bForce) {
- if (_a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) { // TODO: May not need to track readyState (1 = loading)
- _t.duration = _get_html5_duration();
- _t.durationEstimate = _t.duration;
- time = _a.currentTime?_a.currentTime*1000:0;
- _t._whileplaying(time,x,x,x,x);
- return true;
- } else {
- _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK'));
- return false;
- }
- }
- };
-
- // --- private internals ---
-
- _get_html5_duration = function() {
- var d = (_a?_a.duration*1000:undefined);
- return (d && !isNaN(d)?d:null);
- };
-
- _start_html5_timer = function() {
- if (_t.isHTML5) {
- _startTimer(_t);
- }
- };
-
- _stop_html5_timer = function() {
- if (_t.isHTML5) {
- _stopTimer(_t);
- }
- };
-
- _resetProperties = function(bLoaded) {
- _t._onPositionItems = [];
- _t._onPositionFired = 0;
- _t._hasTimer = null;
- _t._added_events = null;
- _t._audio = null;
- _a = null;
- _t.bytesLoaded = null;
- _t.bytesTotal = null;
- _t.position = null;
- _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null);
- _t.durationEstimate = null;
- _t.failures = 0;
- _t.loaded = false;
- _t.playState = 0;
- _t.paused = false;
- _t.readyState = 0; // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success
- _t.muted = false;
- _t.didBeforeFinish = false;
- _t.didJustBeforeFinish = false;
- _t.isBuffering = false;
- _t.instanceOptions = {};
- _t.instanceCount = 0;
- _t.peakData = {
- left: 0,
- right: 0
- };
- _t.waveformData = {
- left: [],
- right: []
- };
- _t.eqData = []; // legacy: 1D array
- _t.eqData.left = [];
- _t.eqData.right = [];
- };
-
- _resetProperties();
-
- // pseudo-private methods used by soundManager
-
- this._setup_html5 = function(oOptions) {
- var _iO = _mixin(_t._iO, oOptions);
- if (_a) {
- if (_t.url !== _iO.url) {
- _s._wD('setting new URL on existing object: '+_iO.url);
- _a.src = _iO.url;
- }
- } else {
- _s._wD('creating HTML 5 audio element with URL: '+_iO.url);
- _t._audio = new Audio(_iO.url);
- _a = _t._audio;
- _t.isHTML5 = true;
- _add_html5_events();
- }
- _a.loop = (_iO.loops>1?'loop':'');
- return _t._audio;
- };
-
- // related private methods
-
- _add_html5_events = function() {
- if (_t._added_events) {
- return false;
- }
- _t._added_events = true;
-
- function _add(oEvt, oFn, bCapture) {
- return (_a ? _a.addEventListener(oEvt, oFn, bCapture||false) : null);
- }
-
- _add('load', function(e) {
- _s._wD('HTML5::load: '+_t.sID);
- if (_a) {
- _t._onbufferchange(0);
- _t._whileloading(_t.bytesTotal, _t.bytesTotal, _get_html5_duration());
- _t._onload(true);
- }
- }, false);
-
- _add('canplay', function(e) {
- _s._wD('HTML5::canplay: '+_t.sID);
- // enough has loaded to play
- _t._onbufferchange(0);
- },false);
-
- _add('waiting', function(e) {
- _s._wD('HTML5::waiting: '+_t.sID);
- // playback faster than download rate, etc.
- _t._onbufferchange(1);
- },false);
-
- _add('progress', function(e) { // not supported everywhere yet..
- _s._wD('HTML5::progress: '+_t.sID+': loaded/total: '+(e.loaded||0)+'/'+(e.total||1));
- if (!_t.loaded && _a) {
- _t._onbufferchange(0); // if progress, likely not buffering
- _t._whileloading(e.loaded||0, e.total||1, _get_html5_duration());
- }
- }, false);
-
- _add('error', function(e) {
- if (_a) {
- _s._wD('HTML5::error: '+_a.error.code);
- // call load with error state?
- _t._onload(false);
- }
- }, false);
-
- _add('loadstart', function(e) {
- _s._wD('HTML5::loadstart: '+_t.sID);
- // assume buffering at first
- _t._onbufferchange(1);
- }, false);
-
- _add('play', function(e) {
- _s._wD('HTML5::play: '+_t.sID);
- // once play starts, no buffering
- _t._onbufferchange(0);
- }, false);
-
- // TODO: verify if this is actually implemented anywhere yet.
- _add('playing', function(e) {
- _s._wD('HTML5::playing: '+_t.sID);
- // once play starts, no buffering
- _t._onbufferchange(0);
- }, false);
-
- _add('timeupdate', function(e) {
- _t._onTimer();
- }, false);
-
- // avoid stupid premature event-firing bug in Safari(?)
- setTimeout(function(){
- if (_t && _a) {
- _add('ended',function(e) {
- _s._wD('HTML5::ended: '+_t.sID);
- _t._onfinish();
- }, false);
- }
- }, 250);
- return true;
- };
-
- // --- "private" methods called by Flash ---
-
- this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
- _t.bytesLoaded = nBytesLoaded;
- _t.bytesTotal = nBytesTotal;
- _t.duration = Math.floor(nDuration);
- _t.bufferLength = nBufferLength;
- if (!_t._iO.isMovieStar) {
- if (_t._iO.duration) {
- // use options, if specified and larger
- _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration;
- } else {
- _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);
- }
- if (_t.durationEstimate === undefined) {
- _t.durationEstimate = _t.duration;
- }
- _t.bufferLength = nBufferLength;
- if (_t.readyState !== 3 && _t._iO.whileloading) {
- _t._iO.whileloading.apply(_t);
- }
- } else {
- _t.durationEstimate = _t.duration;
- if (_t.readyState !== 3 && _t._iO.whileloading) {
- _t._iO.whileloading.apply(_t);
- }
- }
- };
-
- this._onid3 = function(oID3PropNames, oID3Data) {
- // oID3PropNames: string array (names)
- // ID3Data: string array (data)
- _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.');
- var oData = [], i, j;
- for (i = 0, j = oID3PropNames.length; i < j; i++) {
- oData[oID3PropNames[i]] = oID3Data[i];
- }
- _t.id3 = _mixin(_t.id3, oData);
- if (_t._iO.onid3) {
- _t._iO.onid3.apply(_t);
- }
- };
-
- this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
- if (isNaN(nPosition) || nPosition === null) {
- return false; // Flash may return NaN at times
- }
- if (_t.playState === 0 && nPosition > 0) {
- // invalid position edge case for end/stop
- nPosition = 0;
- }
- _t.position = nPosition;
- _t.processOnPosition();
- if (_fV > 8 && !_t.isHTML5) {
- if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) {
- _t.peakData = {
- left: oPeakData.leftPeak,
- right: oPeakData.rightPeak
- };
- }
- if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) {
- _t.waveformData = {
- left: oWaveformDataLeft.split(','),
- right: oWaveformDataRight.split(',')
- };
- }
- if (_t._iO.useEQData) {
- if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) {
- var eqLeft = oEQData.leftEQ.split(',');
- _t.eqData = eqLeft;
- _t.eqData.left = eqLeft;
- if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) {
- _t.eqData.right = oEQData.rightEQ.split(',');
- }
- }
- }
- }
- if (_t.playState === 1) {
- // special case/hack: ensure buffering is false if loading from cache (and not yet started)
- if (!_t.isHTML5 && _s.flashVersion === 8 && !_t.position && _t.isBuffering) {
- _t._onbufferchange(0);
- }
- if (_t._iO.whileplaying) {
- _t._iO.whileplaying.apply(_t); // flash may call after actual finish
- }
- if ((_t.loaded || (!_t.loaded && _t._iO.isMovieStar)) && _t._iO.onbeforefinish && _t._iO.onbeforefinishtime && !_t.didBeforeFinish && _t.duration - _t.position <= _t._iO.onbeforefinishtime) {
- _t._onbeforefinish();
- }
- }
- return true;
- };
-
- this._onconnect = function(bSuccess) {
- var fN = 'SMSound._onconnect(): ';
- bSuccess = (bSuccess === 1);
- _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2));
- _t.connected = bSuccess;
- if (bSuccess) {
- _t.failures = 0;
- if (_t._iO.onconnect) {
- _t._iO.onconnect.apply(_t,[bSuccess]);
- }
- // don't play if the sound is being destroyed
- if (_idCheck(_t.sID) && (_t.options.autoLoad || _t.getAutoPlay())) {
- _t.play(undefined, _t.getAutoPlay()); // only update the play state if auto playing
- }
- }
- };
-
- this._onload = function(nSuccess) {
- var fN = 'SMSound._onload(): ', loadOK = (nSuccess?true:false);
- _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2));
- // <d>
- if (!loadOK && !_t.isHTML5) {
- if (_s.sandbox.noRemote === true) {
- _s._wD(fN + _str('noNet'), 1);
- }
- if (_s.sandbox.noLocal === true) {
- _s._wD(fN + _str('noLocal'), 1);
- }
- }
- // </d>
- _t.loaded = loadOK;
- _t.readyState = loadOK?3:2;
- _t._onbufferchange(0);
- if (_t._iO.onload) {
- _t._iO.onload.apply(_t, [loadOK]);
- }
- return true;
- };
-
- // fire onfailure() only once at most
- // at this point we just recreate failed sounds rather than trying to reconnect.
- this._onfailure = function(msg, level, code) {
- _t.failures++;
- _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures);
- if (_t._iO.onfailure && _t.failures === 1) {
- _t._iO.onfailure(_t, msg, level, code);
- } else {
- _s._wD('SMSound._onfailure(): ignoring');
- }
- };
-
- this._onbeforefinish = function() {
- if (!_t.didBeforeFinish) {
- _t.didBeforeFinish = true;
- if (_t._iO.onbeforefinish) {
- _s._wD('SMSound._onbeforefinish(): "' + _t.sID + '"');
- _t._iO.onbeforefinish.apply(_t);
- }
- }
- };
-
- this._onjustbeforefinish = function(msOffset) {
- if (!_t.didJustBeforeFinish) {
- _t.didJustBeforeFinish = true;
- if (_t._iO.onjustbeforefinish) {
- _s._wD('SMSound._onjustbeforefinish(): "' + _t.sID + '"');
- _t._iO.onjustbeforefinish.apply(_t);
- }
- }
- };
-
- // KJV - connect & play time callback from Flash
- this._onstats = function(stats) {
- if (_t._iO.onstats) {
- _t._iO.onstats(_t, stats);
- }
- };
-
- this._onfinish = function() {
- // _s._wD('SMSound._onfinish(): "' + _t.sID + '" got instanceCount '+_t.instanceCount);
- _t._onbufferchange(0);
- _t.resetOnPosition(0);
- if (_t._iO.onbeforefinishcomplete) {
- _t._iO.onbeforefinishcomplete.apply(_t);
- }
- // reset some state items
- _t.didBeforeFinish = false;
- _t.didJustBeforeFinish = false;
- if (_t.instanceCount) {
- _t.instanceCount--;
- if (!_t.instanceCount) {
- // reset instance options
- _t.playState = 0;
- _t.paused = false;
- _t.instanceCount = 0;
- _t.instanceOptions = {};
- _stop_html5_timer();
- }
- if (!_t.instanceCount || _t._iO.multiShotEvents) {
- // fire onfinish for last, or every instance
- if (_t._iO.onfinish) {
- _s._wD('SMSound._onfinish(): "' + _t.sID + '"');
- _t._iO.onfinish.apply(_t);
- }
- }
- }
- };
-
- this._onbufferchange = function(nIsBuffering) {
- var fN = 'SMSound._onbufferchange()';
- if (_t.playState === 0) {
- // ignore if not playing
- return false;
- }
- if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) {
- return false;
- }
- _t.isBuffering = (nIsBuffering === 1);
- if (_t._iO.onbufferchange) {
- _s._wD(fN + ': ' + nIsBuffering);
- _t._iO.onbufferchange.apply(_t);
- }
- return true;
- };
-
- this._ondataerror = function(sError) {
- // flash 9 wave/eq data handler
- if (_t.playState > 0) { // hack: called at start, and end from flash at/after onfinish()
- _s._wD('SMSound._ondataerror(): ' + sError);
- if (_t._iO.ondataerror) {
- _t._iO.ondataerror.apply(_t);
- }
- }
- };
-
- }; // SMSound()
-
- // --- private SM2 internals ---
-
- _getDocument = function() {
- return (_doc.body?_doc.body:(_doc._docElement?_doc.documentElement:_doc.getElementsByTagName('div')[0]));
- };
-
- _id = function(sID) {
- return _doc.getElementById(sID);
- };
-
- _mixin = function(oMain, oAdd) {
- // non-destructive merge
- var o1 = {}, i, o2, o;
- for (i in oMain) { // clone c1
- if (oMain.hasOwnProperty(i)) {
- o1[i] = oMain[i];
- }
- }
- o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd);
- for (o in o2) {
- if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') {
- o1[o] = o2[o];
- }
- }
- return o1;
- };
-
- (function() {
- var old = (_win.attachEvent),
- evt = {
- add: (old?'attachEvent':'addEventListener'),
- remove: (old?'detachEvent':'removeEventListener')
- };
-
- function getArgs(oArgs) {
- var args = _slice.call(oArgs), len = args.length;
- if (old) {
- args[1] = 'on' + args[1]; // prefix
- if (len > 3) {
- args.pop(); // no capture
- }
- } else if (len === 3) {
- args.push(false);
- }
- return args;
- }
-
- function apply(args, sType) {
- var oFunc = args.shift()[evt[sType]];
- if (old) {
- oFunc(args[0], args[1]);
- } else {
- oFunc.apply(this, args);
- }
- }
-
- _addEvt = function() {
- apply(getArgs(arguments), 'add');
- };
-
- _removeEvt = function() {
- apply(getArgs(arguments), 'remove');
- };
- }());
-
- _html5OK = function(iO) {
- return ((iO.type?_html5CanPlay({type:iO.type}):false)||_html5CanPlay(iO.url));
- };
-
- _html5CanPlay = function(sURL) {
- // try to find MIME, test and return truthiness
- if (!_s.useHTML5Audio || !_s.hasHTML5) {
- return false;
- }
- var result, mime, fileExt, item, aF = _s.audioFormats;
- if (!_html5Ext) {
- _html5Ext = [];
- for (item in aF) {
- if (aF.hasOwnProperty(item)) {
- _html5Ext.push(item);
- if (aF[item].related) {
- _html5Ext = _html5Ext.concat(aF[item].related);
- }
- }
- }
- _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')','i');
- }
- mime = (typeof sURL.type !== 'undefined'?sURL.type:null);
- fileExt = (typeof sURL === 'string'?sURL.toLowerCase().match(_html5Ext):null); // TODO: Strip URL queries, etc.
- if (!fileExt || !fileExt.length) {
- if (!mime) {
- return false;
- }
- } else {
- fileExt = fileExt[0].substr(1); // "mp3", for example
- }
- if (fileExt && typeof _s.html5[fileExt] !== 'undefined') {
- // result known
- return _s.html5[fileExt];
- } else {
- if (!mime) {
- if (fileExt && _s.html5[fileExt]) {
- return _s.html5[fileExt];
- } else {
- // best-case guess, audio/whatever-dot-filename-format-you're-playing
- mime = 'audio/'+fileExt;
- }
- }
- result = _s.html5.canPlayType(mime);
- _s.html5[fileExt] = result;
- // _s._wD('canPlayType, found result: '+result);
- return result;
- }
- };
-
- _testHTML5 = function() {
- if (!_s.useHTML5Audio || typeof Audio === 'undefined') {
- return false;
- }
- var a = (typeof Audio !== 'undefined' ? new Audio():null), item, support = {}, aF, i;
- function _cp(m) {
- var canPlay, i, j, isOK = false;
- if (!a || typeof a.canPlayType !== 'function') {
- return false;
- }
- if (m instanceof Array) {
- // iterate through all mime types, return any successes
- for (i=0, j=m.length; i<j && !isOK; i++) {
- if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {
- isOK = true;
- _s.html5[m[i]] = true;
- }
- }
- return isOK;
- } else {
- canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
- return (canPlay && (canPlay.match(_s.html5Test)?true:false));
- }
- }
- // test all registered formats + codecs
- aF = _s.audioFormats;
- for (item in aF) {
- if (aF.hasOwnProperty(item)) {
- support[item] = _cp(aF[item].type);
- // assign result to related formats, too
- if (aF[item] && aF[item].related) {
- for (i=0; i<aF[item].related.length; i++) {
- _s.html5[aF[item].related[i]] = support[item];
- }
- }
- }
- }
- support.canPlayType = (a?_cp:null);
- _s.html5 = _mixin(_s.html5, support);
- return true;
- };
-
- _strings = {
- // <d>
- notReady: 'Not loaded yet - wait for soundManager.onload()/onready()',
- notOK: 'Audio support is not available.',
- appXHTML: _sm + '::createMovie(): appendChild/innerHTML set failed. May be app/xhtml+xml DOM-related.',
- spcWmode: _sm + '::createMovie(): Removing wmode, preventing win32 below-the-fold SWF loading issue',
- swf404: _sm + ': Verify that %s is a valid path.',
- tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)',
- checkSWF: 'See SWF output for more debug info.',
- localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',
- waitFocus: _sm + ': Special case: Waiting for focus-related event..',
- waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...',
- waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...',
- needFunction: _sm + '.onready(): Function object expected',
- badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',
- noMS: 'MovieStar mode not enabled. Exiting.',
- currentObj: '--- ' + _sm + '._debug(): Current sound objects ---',
- waitEI: _sm + '::initMovie(): Waiting for ExternalInterface call from Flash..',
- waitOnload: _sm + ': Waiting for window.onload()',
- docLoaded: _sm + ': Document already loaded',
- onload: _sm + '::initComplete(): calling soundManager.onload()',
- onloadOK: _sm + '.onload() complete',
- init: '-- ' + _sm + '::init() --',
- didInit: _sm + '::init(): Already called?',
- flashJS: _sm + ': Attempting to call Flash from JS..',
- noPolling: _sm + ': Polling (whileloading()/whileplaying() support) is disabled.',
- secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',
- badRemove: 'Warning: Failed to remove flash movie.',
- noPeak: 'Warning: peakData features unsupported for movieStar formats',
- shutdown: _sm + '.disable(): Shutting down',
- queue: _sm + '.onready(): Queueing handler',
- smFail: _sm + ': Failed to initialise.',
- smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',
- fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..',
- fbLoaded: 'Flash loaded',
- fbHandler: 'soundManager::flashBlockHandler()',
- manURL: 'SMSound.load(): Using manually-assigned URL',
- onURL: _sm + '.load(): current URL already assigned.',
- badFV: 'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',
- as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)',
- noNSLoop: 'Note: Looping not implemented for MovieStar formats',
- needfl9: 'Note: Switching to flash 9, required for MP4 formats.',
- mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',
- mfOn: 'mobileFlash::enabling on-screen flash repositioning',
- policy: 'Enabling usePolicyFile for data access'
- // </d>
- };
-
- _id = function(sID) {
- return _doc.getElementById(sID);
- };
-
- _str = function() { // o [,items to replace]
- // <d>
- var args = _slice.call(arguments), // real array, please
- o = args.shift(), // first arg
- str = (_strings && _strings[o]?_strings[o]:''), i, j;
- if (str && args && args.length) {
- for (i = 0, j = args.length; i < j; i++) {
- str = str.replace('%s', args[i]);
- }
- }
- return str;
- // </d>
- };
-
- _loopFix = function(sOpt) {
- // flash 8 requires stream = false for looping to work
- if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) {
- _wDS('as2loop');
- sOpt.stream = false;
- }
- return sOpt;
- };
-
- _policyFix = function(sOpt, sPre) {
- if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
- _s._wD((sPre?sPre+':':'') + _str('policy'));
- sOpt.usePolicyFile = true;
- }
- return sOpt;
- };
-
- _complain = function(sMsg) {
- if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
- console.warn(sMsg);
- } else {
- _s._wD(sMsg);
- }
- };
-
- _doNothing = function() {
- return false;
- };
-
- _disableObject = function(o) {
- for (var oProp in o) {
- if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
- o[oProp] = _doNothing;
- }
- }
- oProp = null;
- };
-
- _failSafely = function(bNoDisable) {
- // general failure exception handler
- if (typeof bNoDisable === 'undefined') {
- bNoDisable = false;
- }
- if (_disabled || bNoDisable) {
- _wDS('smFail', 2);
- _s.disable(bNoDisable);
- }
- };
-
- _normalizeMovieURL = function(smURL) {
- var urlParams = null;
- if (smURL) {
- if (smURL.match(/\.swf(\?\.*)?$/i)) {
- urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);
- if (urlParams) {
- return smURL; // assume user knows what they're doing
- }
- } else if (smURL.lastIndexOf('/') !== smURL.length - 1) {
- smURL = smURL + '/';
- }
- }
- return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL;
- };
-
- _setVersionInfo = function() {
- if (_fV !== 8 && _fV !== 9) {
- _s._wD(_str('badFV', _fV, _defaultFlashVersion));
- _s.flashVersion = _defaultFlashVersion;
- }
- var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf'); // debug flash movie, if applicable
- if (_s.flashVersion < 9 && _s.useHTML5Audio && _s.audioFormats.mp4.required) {
- _s._wD(_str('needfl9'));
- _s.flashVersion = 9;
- }
- _fV = _s.flashVersion; // short-hand for internal use
- _s.version = _s.versionNumber + (_html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
- // set up default options
- if (_fV > 8) {
- _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options);
- _s.features.buffering = true;
- }
- if (_fV > 8 && _s.useMovieStar) {
- // flash 9+ support for movieStar formats as well as MP3
- _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions);
- _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _s.netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
- _s.mimePattern = _s.netStreamMimeTypes;
- _s.features.movieStar = true;
- } else {
- _s.features.movieStar = false;
- }
- _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')];
- _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf',isDebug);
- _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8);
- };
-
- _setPolling = function(bPolling, bHighPerformance) {
- if (!_s.o || !_s.allowPolling) {
- return false;
- }
- _s.o._setPolling(bPolling, bHighPerformance);
- };
-
- (function() {
- var old = (_win.attachEvent),
- evt = {
- add: (old?'attachEvent':'addEventListener'),
- remove: (old?'detachEvent':'removeEventListener')
- };
-
- function getArgs(oArgs) {
- var args = _slice.call(oArgs), len = args.length;
- if (old) {
- args[1] = 'on' + args[1]; // prefix
- if (len > 3) {
- args.pop(); // no capture
- }
- } else if (len === 3) {
- args.push(false);
- }
- return args;
- }
-
- function apply(args, sType) {
- var oFunc = args.shift()[evt[sType]];
- if (old) {
- oFunc(args[0], args[1]);
- } else {
- oFunc.apply(this, args);
- }
- }
-
- _addEvt = function() {
- apply(getArgs(arguments), 'add');
- };
-
- _removeEvt = function() {
- apply(getArgs(arguments), 'remove');
- };
- }());
-
- function _initDebug() {
- if (_s.debugURLParam.test(_wl)) {
- _s.debugMode = true; // allow force of debug mode via URL
- }
- // <d>
- if (_id(_s.debugID)) {
- return false;
- }
- var oD, oDebug, oTarget, oToggle, tmp;
- if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) {
- oD = _doc.createElement('div');
- oD.id = _s.debugID + '-toggle';
- oToggle = {
- 'position': 'fixed',
- 'bottom': '0px',
- 'right': '0px',
- 'width': '1.2em',
- 'height': '1.2em',
- 'lineHeight': '1.2em',
- 'margin': '2px',
- 'textAlign': 'center',
- 'border': '1px solid #999',
- 'cursor': 'pointer',
- 'background': '#fff',
- 'color': '#333',
- 'zIndex': 10001
- };
- oD.appendChild(_doc.createTextNode('-'));
- oD.onclick = _toggleDebug;
- oD.title = 'Toggle SM2 debug console';
- if (_ua.match(/msie 6/i)) {
- oD.style.position = 'absolute';
- oD.style.cursor = 'hand';
- }
- for (tmp in oToggle) {
- if (oToggle.hasOwnProperty(tmp)) {
- oD.style[tmp] = oToggle[tmp];
- }
- }
- oDebug = _doc.createElement('div');
- oDebug.id = _s.debugID;
- oDebug.style.display = (_s.debugMode?'block':'none');
- if (_s.debugMode && !_id(oD.id)) {
- try {
- oTarget = _getDocument();
- oTarget.appendChild(oD);
- } catch(e2) {
- throw new Error(_str('appXHTML'));
- }
- oTarget.appendChild(oDebug);
- }
- }
- oTarget = null;
- // </d>
- }
-
- _mobileFlash = (function(){
-
- var oM = null;
-
- function resetPosition() {
- if (oM) {
- oM.left = oM.top = '-9999px';
- }
- }
-
- function reposition() {
- oM.left = _win.scrollX+'px';
- oM.top = _win.scrollY+'px';
- }
-
- function setReposition(bOn) {
- _s._wD('mobileFlash::flash on-screen hack: '+(bOn?'ON':'OFF'));
- var f = _win[(bOn?'add':'remove')+'EventListener'];
- f('resize', reposition, false);
- f('scroll', reposition, false);
- }
-
- function check(inDoc) {
- // mobile flash (Android for starters) check
- oM = _s.oMC.style;
- if (_ua.match(/android/i)) {
- if (inDoc) {
- if (_s.flashLoadTimeout) {
- _s._wDS('mfTimeout');
- _s.flashLoadTimeout = 0;
- }
- return false;
- }
- _s._wD('mfOn');
- oM.position = 'absolute';
- oM.left = oM.top = '0px';
- setReposition(true);
- _s.onready(function(){
- setReposition(false); // detach
- resetPosition(); // restore when OK/timed out
- });
- reposition();
- }
- return true;
- }
-
- return {
- 'check': check
- };
-
- }());
-
- _createMovie = function(smID, smURL) {
-
- var specialCase = null,
- remoteURL = (smURL?smURL:_s.url),
- localURL = (_s.altURL?_s.altURL:remoteURL),
- oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(), s, x, sClass, side = '100%', isRTL = null, html = _doc.getElementsByTagName('html')[0];
- isRTL = (html && html.dir && html.dir.match(/rtl/i));
- smID = (typeof smID === 'undefined'?_s.id:smID);
-
- if (_didAppend && _appendSuccess) {
- return false; // ignore if already succeeded
- }
-
- function _initMsg() {
- _s._wD('-- SoundManager 2 ' + _s.version + (!_html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (_s.useMovieStar?', MovieStar mode':'') + (_s.useHighPerformance?', high performance mode, ':', ') + ((_s.useFastPolling?'fast':'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') + ' --', 1);
- }
-
- if (_html5Only) {
- _setVersionInfo();
- _initMsg();
- _s.oMC = _id(_s.movieID);
- _init();
- // prevent multiple init attempts
- _didAppend = true;
- _appendSuccess = true;
- return false;
- }
-
- _didAppend = true;
-
- // safety check for legacy (change to Flash 9 URL)
- _setVersionInfo();
- _s.url = _normalizeMovieURL(this._overHTTP?remoteURL:localURL);
- smURL = _s.url;
-
- _s.wmode = (!_s.wmode && _s.useHighPerformance && !_s.useMovieStar?'transparent':_s.wmode);
-
- if (_s.wmode !== null && !_isIE && !_s.useHighPerformance && navigator.platform.match(/win32/i)) {
- _s.specialWmodeCase = true;
- // extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here
- // does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout
- _wDS('spcWmode');
- _s.wmode = null;
- }
-
- oEmbed = {
- 'name': smID,
- 'id': smID,
- 'src': smURL,
- 'width': side,
- 'height': side,
- 'quality': 'high',
- 'allowScriptAccess': _s.allowScriptAccess,
- 'bgcolor': _s.bgColor,
- 'pluginspage': 'http://www.macromedia.com/go/getflashplayer',
- 'type': 'application/x-shockwave-flash',
- 'wmode': _s.wmode
- };
-
- if (_s.debugFlash) {
- oEmbed.FlashVars = 'debug=1';
- }
-
- if (!_s.wmode) {
- delete oEmbed.wmode; // don't write empty attribute
- }
-
- if (_isIE) {
- // IE is "special".
- oMovie = _doc.createElement('div');
- movieHTML = '<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" width="' + oEmbed.width + '" height="' + oEmbed.height + '"><param name="movie" value="' + smURL + '" /><param name="AllowScriptAccess" value="' + _s.allowScriptAccess + '" /><param name="quality" value="' + oEmbed.quality + '" />' + (_s.wmode?'<param name="wmode" value="' + _s.wmode + '" /> ':'') + '<param name="bgcolor" value="' + _s.bgColor + '" />' + (_s.debugFlash?'<param name="FlashVars" value="' + oEmbed.FlashVars + '" />':'') + '<!-- --></object>';
- } else {
- oMovie = _doc.createElement('embed');
- for (tmp in oEmbed) {
- if (oEmbed.hasOwnProperty(tmp)) {
- oMovie.setAttribute(tmp, oEmbed[tmp]);
- }
- }
- }
-
- _initDebug();
- extraClass = _getSWFCSS();
- oTarget = _getDocument();
-
- if (oTarget) {
- _s.oMC = _id(_s.movieID)?_id(_s.movieID):_doc.createElement('div');
- if (!_s.oMC.id) {
- _s.oMC.id = _s.movieID;
- _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass;
- // "hide" flash movie
- s = null;
- oEl = null;
- if (!_s.useFlashBlock) {
- if (_s.useHighPerformance) {
- s = {
- 'position': 'fixed',
- 'width': '8px',
- 'height': '8px',
- // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes.
- 'bottom': '0px',
- 'left': '0px',
- 'overflow': 'hidden'
- };
- } else {
- s = {
- 'position': 'absolute',
- 'width': '6px',
- 'height': '6px',
- 'top': '-9999px',
- 'left': '-9999px'
- };
- if (isRTL) {
- s.left = Math.abs(parseInt(s.left,10))+'px';
- }
- }
- }
- if (_ua.match(/webkit/i)) {
- _s.oMC.style.zIndex = 10000; // soundcloud-reported render/crash fix, safari 5
- }
- if (!_s.debugFlash) {
- for (x in s) {
- if (s.hasOwnProperty(x)) {
- _s.oMC.style[x] = s[x];
- }
- }
- }
- try {
- if (!_isIE) {
- _s.oMC.appendChild(oMovie);
- }
- oTarget.appendChild(_s.oMC);
- if (_isIE) {
- oEl = _s.oMC.appendChild(_doc.createElement('div'));
- oEl.className = _s.swfCSS.swfBox;
- oEl.innerHTML = movieHTML;
- }
- _appendSuccess = true;
- } catch(e) {
- throw new Error(_str('appXHTML'));
- }
- _mobileFlash.check();
- } else {
- // it's already in the document.
- sClass = _s.oMC.className;
- _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
- _s.oMC.appendChild(oMovie);
- if (_isIE) {
- oEl = _s.oMC.appendChild(_doc.createElement('div'));
- oEl.className = _s.swfCSS.swfBox;
- oEl.innerHTML = movieHTML;
- }
- _appendSuccess = true;
- _mobileFlash.check(true);
- }
- }
-
- if (specialCase) {
- _s._wD(specialCase);
- }
-
- _initMsg();
- _s._wD('soundManager::createMovie(): Trying to load ' + smURL + (!this._overHTTP && _s.altURL?' (alternate URL)':''), 1);
-
- return true;
- };
-
- _idCheck = this.getSoundById;
-
- _initMovie = function() {
- if (_html5Only) {
- _createMovie();
- return false;
- }
- // attempt to get, or create, movie
- if (_s.o) {
- return false; // may already exist
- }
- _s.o = _s.getMovie(_s.id); // inline markup
- if (!_s.o) {
- if (!_oRemoved) {
- // try to create
- _createMovie(_s.id, _s.url);
- } else {
- // try to re-append removed movie after reboot()
- if (!_isIE) {
- _s.oMC.appendChild(_oRemoved);
- } else {
- _s.oMC.innerHTML = _oRemovedHTML;
- }
- _oRemoved = null;
- _didAppend = true;
- }
- _s.o = _s.getMovie(_s.id);
- }
- if (_s.o) {
- _s._wD('soundManager::initMovie(): Got '+_s.o.nodeName+' element ('+(_didAppend?'created via JS':'static HTML')+')');
- _wDS('waitEI');
- }
- if (_s.oninitmovie instanceof Function) {
- setTimeout(_s.oninitmovie, 1);
- }
- return true;
- };
-
- _go = function(sURL) {
- // where it all begins.
- if (sURL) {
- _s.url = sURL;
- }
- _initMovie();
- };
-
- _delayWaitForEI = function() {
- setTimeout(_waitForEI, 500);
- };
-
- _waitForEI = function() {
- if (_waitingForEI) {
- return false;
- }
- _waitingForEI = true;
- _removeEvt(_win, 'load', _delayWaitForEI);
- if (_tryInitOnFocus && !_isFocused) {
- _wDS('waitFocus');
- return false;
- }
- var p;
- if (!_didInit) {
- p = _s.getMoviePercent();
- _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':''))));
- }
- setTimeout(function() {
- p = _s.getMoviePercent();
- if (!_didInit) {
- _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2);
- if (!this._overHTTP && p) {
- _wDS('localFail', 2);
- if (!_s.debugFlash) {
- _wDS('tryDebug', 2);
- }
- }
- if (p === 0) {
- // if 0 (not null), probably a 404.
- _s._wD(_str('swf404', _s.url));
- }
- _debugTS('flashtojs', false, ': Timed out' + this._overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)');
- }
- // give up / time-out, depending
- if (!_didInit && _okToDisable) {
- if (p === null) {
- // SWF failed. Maybe blocked.
- if (_s.useFlashBlock || _s.flashLoadTimeout === 0) {
- if (_s.useFlashBlock) {
- _flashBlockHandler();
- }
- _wDS('waitForever');
- } else {
- // old SM2 behaviour, simply fail
- _failSafely(true);
- }
- } else {
- // flash loaded? Shouldn't be a blocking issue, then.
- if (_s.flashLoadTimeout === 0) {
- _wDS('waitForever');
- } else {
- _failSafely(true);
- }
- }
- }
- }, _s.flashLoadTimeout);
- };
-
- _go = function(sURL) {
- // where it all begins.
- if (sURL) {
- _s.url = sURL;
- }
- _initMovie();
- };
-
- // <d>
- _wDS = function(o, errorLevel) {
- if (!o) {
- return '';
- } else {
- return _s._wD(_str(o), errorLevel);
- }
- };
-
- if (_wl.indexOf('debug=alert') + 1 && _s.debugMode) {
- _s._wD = function(sText) {alert(sText);};
- }
-
- _toggleDebug = function() {
- var o = _id(_s.debugID),
- oT = _id(_s.debugID + '-toggle');
- if (!o) {
- return false;
- }
- if (_debugOpen) {
- // minimize
- oT.innerHTML = '+';
- o.style.display = 'none';
- } else {
- oT.innerHTML = '-';
- o.style.display = 'block';
- }
- _debugOpen = !_debugOpen;
- };
-
- _debugTS = function(sEventType, bSuccess, sMessage) {
- // troubleshooter debug hooks
- if (typeof sm2Debugger !== 'undefined') {
- try {
- sm2Debugger.handleEvent(sEventType, bSuccess, sMessage);
- } catch(e) {
- // oh well
- }
- }
- return true;
- };
- // </d>
-
- _getSWFCSS = function() {
- var css = [];
- if (_s.debugMode) {
- css.push(_s.swfCSS.sm2Debug);
- }
- if (_s.debugFlash) {
- css.push(_s.swfCSS.flashDebug);
- }
- if (_s.useHighPerformance) {
- css.push(_s.swfCSS.highPerf);
- }
- return css.join(' ');
- };
-
- _flashBlockHandler = function() {
- // *possible* flash block situation.
- var name = _str('fbHandler'), p = _s.getMoviePercent();
- if (!_s.supported()) {
- if (_needsFlash) {
- // make the movie more visible, so user can fix
- _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + ' ' + (p === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
- _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':''));
- }
- _s.didFlashBlock = true;
- _processOnReady(true); // fire onready(), complain lightly
- if (_s.onerror instanceof Function) {
- _s.onerror.apply(_win);
- }
- } else {
- // SM2 loaded OK (or recovered)
- if (_s.didFlashBlock) {
- _s._wD(name+': Unblocked');
- }
- if (_s.oMC) {
- _s.oMC.className = _getSWFCSS() + ' ' + _s.swfCSS.swfDefault + (' '+_s.swfCSS.swfUnblocked);
- }
- }
- };
-
- _handleFocus = function() {
- function cleanup() {
- _removeEvt(_win, 'focus', _handleFocus);
- _removeEvt(_win, 'load', _handleFocus);
- }
- if (_isFocused || !_tryInitOnFocus) {
- cleanup();
- return true;
- }
- _okToDisable = true;
- _isFocused = true;
- _s._wD('soundManager::handleFocus()');
- if (_isSafari && _tryInitOnFocus) {
- // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event
- _removeEvt(_win, 'mousemove', _handleFocus);
- }
- // allow init to restart
- _waitingForEI = false;
- cleanup();
- return true;
- };
-
- _initComplete = function(bNoDisable) {
- if (_didInit) {
- return false;
- }
- if (_html5Only) {
- // all good.
- _s._wD('-- SoundManager 2: loaded --');
- _didInit = true;
- _processOnReady();
- _initUserOnload();
- return true;
- }
- var sClass = _s.oMC.className,
- wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent());
- if (!wasTimeout) {
- _didInit = true;
- }
- _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1);
- if (_disabled || bNoDisable) {
- if (_s.useFlashBlock) {
- _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
- }
- _processOnReady();
- _debugTS('onload', false);
- if (_s.onerror instanceof Function) {
- _s.onerror.apply(_win);
- }
- return false;
- } else {
- _debugTS('onload', true);
- }
- if (_s.waitForWindowLoad && !_windowLoaded) {
- _wDS('waitOnload');
- _addEvt(_win, 'load', _initUserOnload);
- return false;
- } else {
- if (_s.waitForWindowLoad && _windowLoaded) {
- _wDS('docLoaded');
- }
- _initUserOnload();
- }
- return true;
- };
-
- _addOnReady = function(oMethod, oScope) {
- _onready.push({
- 'method': oMethod,
- 'scope': (oScope || null),
- 'fired': false
- });
- };
-
- _processOnReady = function(ignoreInit) {
- if (!_didInit && !ignoreInit) {
- // not ready yet.
- return false;
- }
- var status = {
- success: (ignoreInit?_s.supported():!_disabled)
- },
- queue = [], i, j,
- canRetry = (!_s.useFlashBlock || (_s.useFlashBlock && !_s.supported()));
- for (i = 0, j = _onready.length; i < j; i++) {
- if (_onready[i].fired !== true) {
- queue.push(_onready[i]);
- }
- }
- if (queue.length) {
- _s._wD(_sm + ': Firing ' + queue.length + ' onready() item' + (queue.length > 1?'s':''));
- for (i = 0, j = queue.length; i < j; i++) {
- if (queue[i].scope) {
- queue[i].method.apply(queue[i].scope, [status]);
- } else {
- queue[i].method(status);
- }
- if (!canRetry) { // flashblock case doesn't count here
- queue[i].fired = true;
- }
- }
- }
- return true;
- };
-
- _initUserOnload = function() {
- _win.setTimeout(function() {
- if (_s.useFlashBlock) {
- _flashBlockHandler();
- }
- _processOnReady();
- _wDS('onload', 1);
- // call user-defined "onload", scoped to window
- if (_s.onload instanceof Function) {
- _s.onload.apply(_win);
- }
- _wDS('onloadOK', 1);
- if (_s.waitForWindowLoad) {
- _addEvt(_win, 'load', _initUserOnload);
- }
- },1);
- };
-
- _featureCheck = function() {
- var needsFlash, item,
- isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_(3|4)/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Known Apple "radar" bug. https://bugs.webkit.org/show_bug.cgi?id=32159
- isSpecial = (_ua.match(/iphone os (1|2|3_0|3_1)/i)?true:false); // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works.
- if (isSpecial) {
- _s.hasHTML5 = false; // has Audio(), but is broken; let it load links directly.
- _html5Only = true; // ignore flash case, however
- if (_s.oMC) {
- _s.oMC.style.display = 'none';
- }
- return false;
- }
- if (_s.useHTML5Audio) {
- if (!_s.html5 || !_s.html5.canPlayType) {
- _s._wD('SoundManager: No HTML5 Audio() support detected.');
- _s.hasHTML5 = false;
- return true;
- } else {
- _s.hasHTML5 = true;
- }
- if (isBadSafari) {
- _s._wD('SoundManager::Note: Buggy HTML5 Audio in Safari on OS X 10.6.[3|4], see https://bugs.webkit.org/show_bug.cgi?id=32159 - disabling HTML5 audio',1);
- _s.useHTML5Audio = false;
- _s.hasHTML5 = false;
- return true;
- }
- } else {
- // flash required.
- return true;
- }
- for (item in _s.audioFormats) {
- if (_s.audioFormats.hasOwnProperty(item) && _s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) {
- // may need flash for this format?
- needsFlash = true;
- }
- }
- // sanity check..
- if (_s.ignoreFlash) {
- needsFlash = false;
- }
- _html5Only = (_s.useHTML5Audio && _s.hasHTML5 && !needsFlash);
- return needsFlash;
- };
-
- _init = function() {
- var item, tests = [];
- _wDS('init');
-
- // called after onload()
- if (_didInit) {
- _wDS('didInit');
- return false;
- }
-
- function _cleanup() {
- _removeEvt(_win, 'load', _s.beginDelayedInit);
- }
-
- if (_s.hasHTML5) {
- for (item in _s.audioFormats) {
- if (_s.audioFormats.hasOwnProperty(item)) {
- tests.push(item+': '+_s.html5[item]);
- }
- }
- _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1);
- }
-
- if (_html5Only) {
- if (!_didInit) {
- // we don't need no steenking flash!
- _cleanup();
- _s.enabled = true;
- _initComplete();
- }
- return true;
- }
-
- // flash path
- _initMovie();
- try {
- _wDS('flashJS');
- _s.o._externalInterfaceTest(false); // attempt to talk to Flash
- if (!_s.allowPolling) {
- _wDS('noPolling', 1);
- } else {
- _setPolling(true, _s.useFastPolling?true:false);
- }
- if (!_s.debugMode) {
- _s.o._disableDebug();
- }
- _s.enabled = true;
- _debugTS('jstoflash', true);
- } catch(e) {
- _s._wD('js/flash exception: ' + e.toString());
- _debugTS('jstoflash', false);
- _failSafely(true); // don't disable, for reboot()
- _initComplete();
- return false;
- }
- _initComplete();
- // event cleanup
- _cleanup();
- return true;
- };
-
- _beginInit = function() {
- if (_initPending) {
- return false;
- }
- _createMovie();
- _initMovie();
- _initPending = true;
- return true;
- };
-
- _dcLoaded = function() {
- if (_didDCLoaded) {
- return false;
- }
- _didDCLoaded = true;
- _initDebug();
- _testHTML5();
- _s.html5.usingFlash = _featureCheck();
- _needsFlash = _s.html5.usingFlash;
- _didDCLoaded = true;
- if (_doc.removeEventListener) {
- _doc.removeEventListener('DOMContentLoaded', _dcLoaded, false);
- }
- _go();
- return true;
- };
-
- _startTimer = function(oSound) {
- if (!oSound._hasTimer) {
- oSound._hasTimer = true;
- }
- };
-
- _stopTimer = function(oSound) {
- if (oSound._hasTimer) {
- oSound._hasTimer = false;
- }
- };
-
- _die = function() {
- if (_s.onerror instanceof Function) {
- _s.onerror();
- }
- _s.disable();
- };
-
- // pseudo-private methods called by Flash
-
- this._setSandboxType = function(sandboxType) {
- // <d>
- var sb = _s.sandbox;
- sb.type = sandboxType;
- sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')];
- _s._wD('Flash security sandbox type: ' + sb.type);
- if (sb.type === 'localWithFile') {
- sb.noRemote = true;
- sb.noLocal = false;
- _wDS('secNote', 2);
- } else if (sb.type === 'localWithNetwork') {
- sb.noRemote = false;
- sb.noLocal = true;
- } else if (sb.type === 'localTrusted') {
- sb.noRemote = false;
- sb.noLocal = false;
- }
- // </d>
- };
-
- this._externalInterfaceOK = function(flashDate) {
- // flash callback confirming flash loaded, EI working etc.
- // flashDate = approx. timing/delay info for JS/flash bridge
- if (_s.swfLoaded) {
- return false;
- }
- var eiTime = new Date().getTime();
- _s._wD('soundManager::externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':''));
- _debugTS('swf', true);
- _debugTS('flashtojs', true);
- _s.swfLoaded = true;
- _tryInitOnFocus = false;
- if (_isIE) {
- // IE needs a timeout OR delay until window.onload - may need TODO: investigating
- setTimeout(_init, 100);
- } else {
- _init();
- }
- };
-
- _dcIE = function() {
- if (_doc.readyState === 'complete') {
- _dcLoaded();
- _doc.detachEvent('onreadystatechange', _dcIE);
- }
- return true;
- };
-
- // focus and window load, init
- if (!_s.hasHTML5 || _needsFlash) {
- // only applies to Flash mode
- _addEvt(_win, 'focus', _handleFocus);
- _addEvt(_win, 'load', _handleFocus);
- _addEvt(_win, 'load', _delayWaitForEI);
- if (_isSafari && _tryInitOnFocus) {
- _addEvt(_win, 'mousemove', _handleFocus); // massive Safari focus hack
- }
- }
-
- if (_doc.addEventListener) {
- _doc.addEventListener('DOMContentLoaded', _dcLoaded, false);
- } else if (_doc.attachEvent) {
- _doc.attachEvent('onreadystatechange', _dcIE);
- } else {
- // no add/attachevent support - safe to assume no JS -> Flash either
- _debugTS('onload', false);
- _die();
- }
-
- if (_doc.readyState === 'complete') {
- setTimeout(_dcLoaded,100);
- }
-
-} // SoundManager()
-
-// var SM2_DEFER = true;
-// details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
-
-if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) {
- soundManager = new SoundManager();
-}
-
-// public interfaces
-window.SoundManager = SoundManager; // constructor
-window.soundManager = soundManager; // public instance: API, Flash callbacks etc.
-
-}(window));
diff --git a/www/static/js/swfobject.js b/www/static/js/swfobject.js
deleted file mode 100755
index 8eafe9d..0000000
--- a/www/static/js/swfobject.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}(); \ No newline at end of file
diff --git a/www/static/js/test-admin.js b/www/static/js/test-admin.js
deleted file mode 100755
index 5c34099..0000000
--- a/www/static/js/test-admin.js
+++ /dev/null
@@ -1,93 +0,0 @@
-function Enterable (id, callback)
- {
- function thisKeydown (e)
- {
- if (e.keyCode === 13)
- {
- var s = $(id).val()
- if (s)
- callback(s)
- }
- }
- $("#lookup-room").keydown(thisKeydown)
- }
-var Background =
- {
- off: function ()
- {
- $("#bg").hide()
- }
- }
-var Main = {load: function(){}}
-var AdminTest =
- {
- init: function ()
- {
- d.warn("INIT TEST")
- $(window).bind("resize", AdminTest.resize)
- AdminTest.resize()
- Auth.error = AdminTest.error
- Auth.success = AdminTest.success
- if ( ! Auth.init() )
- AdminTest.error()
- else
- Auth.checkin()
- },
- resize: function ()
- {
- var h = $(window).height()
- var statsheight = h-285-20-20-30
- $("#stats").css({height: statsheight})
- },
- error: function ()
- {
- $("body").hide()
- },
- success: function ()
- {
- $("#session").html(Auth.session)
- $("#bg-off").click(Background.off)
- $(".remove").live("click", Admin.removeVideoClick)
- AdminTest.lookupRoom(roomName)
- AdminTest.lookupRoomEnterable = new Enterable ("#lookup-room", AdminTest.lookupRoom)
- AdminTest.statsLoad()
- },
- lookupRoom: function (s)
- {
- d.warn("LOOKUP ROOM "+s)
- Room.name = s
- Admin.viewRoom()
- setTimeout(AdminTest.refresh, 500)
- },
- refresh: function ()
- {
- d.warn("ROOM REFRESH")
- Room.settingsOpen()
- $("#room-name").html(Room.name)
- $("#return-link").attr("href", "/"+Room.name)
- $("#room-lastlog").val(Lastlog.old)
- $("#pnp").attr("src", "http://scannerjammer.com/"+Room.name+"/read")
- },
- statsLoad: function ()
- {
- $.get(API.URL.room.stats).success(AdminTest.statsDump)
- },
- statsDump: function (html)
- {
- var greetings = ""
- greetings += "&gt;&gt;&gt; <a href='/register/reset'>Need to fix someone's password?</a>"
- greetings += "<br/><br/>"
- greetings += "<b>Congratulations, %%USERNAME%%!</b> You, on the basis of your score, have been selected to be a SCANNERJAMMER MODERATOR!<br/><br/>"
- greetings += "This means we are asking you to be a part of our team. As a moderator, your responsibility is to clear all of the crap videos from the playlist. If something seems like it doesn't belong, do not hesitate to remove it. We care about the content of our site. Soon we will also be adding a mute feature.<br/><br/>Another power you have been granted is to make your OWN SCANNERJAMMER ROOM. Only mods can do this! All you need to do is add the name of your new room to the end of the URL. For example, type <i><b>scannerjammer.com/whatupdoe</b></i> into the address bar and lo and behold, the SCANNERJAMMER \"whatupdoe\" room has been created!<br/><br/>This is a great way to have a more private SCANNERJAMMER experience, should you want to talk to friends. Feel free to create as many rooms as you want.<br><br/> Thank you, we love you! -Pepper and ryz"
- greetings = greetings.replace("%%USERNAME%%", Auth.username)
- if (html)
- greetings += "<br/><br/><b>STATS TODAY</b><br/>"+html
- $("#stats").html(greetings).fadeIn(1000)
- }
- }
-var Main =
- {
- }
-AdminTest.init()
-$("#msg").hide()
-
diff --git a/www/static/js/tokbox.js b/www/static/js/tokbox.js
deleted file mode 100755
index 69155ce..0000000
--- a/www/static/js/tokbox.js
+++ /dev/null
@@ -1,181 +0,0 @@
-
-function Toggler (div, on, off)
- {
- var state = false
- function activate ()
- {
- $(div).addClass("on").html("ON")
- on ()
- }
- function deactivate ()
- {
- $(div).removeClass("on").html("off")
- off ()
- }
- function toggle ()
- {
- state = ! state
- if (state)
- activate ()
- else
- deactivate ()
- }
- function destroy ()
- {
- $(div).unbind("click")
- }
- $(div).bind("click", toggle)
- }
-
-var Tokbox =
- {
- height: 150,
- width: null,
- token_url: "/cgi-bin/tokbox_room.cgi",
- sessionid: null,
- token: null,
- togglers: [],
-
- session: null,
- publisher: null,
- subscribers: [],
-
- subscribeToStreams: function (streams)
- {
- for (var i = 0; i < streams.length; i++)
- {
- var stream = streams[i]
- if (stream.connection.connectionId != Tokbox.session.connection.connectionId)
- {
- var parentDiv = document.getElementById("tokbox-subscribers")
- var stubDiv = document.createElement("div")
- stubDiv.id = "opentok_subscriber_"+stream.connection.connectionId
- parentDiv.appendChild(stubDiv)
-
- var subscriberProps = {width: Tokbox.width, height: Tokbox.height, audioEnabled: true}
- var subscriber = Tokbox.session.subscribe(stream, stubDiv.id, subscriberProps)
- Tokbox.subscribers.push(subscriber)
- }
- }
- },
- sessionConnectedHandler: function (event)
- {
- Tokbox.height = $("#tokbox-embed").height()
- Tokbox.width = Math.floor( Tokbox.height / 1.618 )
- $("#tokbox-loading").hide()
-
- Tokbox.subscribeToStreams(event.streams)
-
- var parentDiv = document.getElementById("tokbox-publisher")
- var stubDiv = document.createElement("div")
- stubDiv.id = "opentok_publisher"
- parentDiv.appendChild(stubDiv)
-
- var publisherProps = {width: Tokbox.width, height: Tokbox.height, microphoneEnabled: false}
- Tokbox.publisher = Tokbox.session.publish(stubDiv.id, publisherProps)
- $("#tokbox-loading").hide()
- $("#tokbox-settings").fadeIn(1000)
- },
- streamCreatedHandler: function (event)
- {
- Tokbox.subscribeToStreams(event.streams)
- },
- tokenCallback: function (raw)
- {
- var lines = API.parse("/tokbox", raw)
- if (! lines)
- return d.error("API ERROR")
- for (i in lines)
- {
- pair = lines[i].split("\t")
- if (pair[0] === "ERROR")
- return d.error(pair[1])
- else if (pair[0] === "SESSION")
- Tokbox.sessionid = d.trim(pair[1])
- else if (pair[0] === "TOKEN")
- Tokbox.token = d.trim(pair[1])
- }
- if (Tokbox.sessionid && Tokbox.token)
- Tokbox.activate()
- },
- activate: function ()
- {
- Tokbox.session = TB.initSession(Tokbox.sessionid)
- Tokbox.session.addEventListener("sessionConnected", Tokbox.sessionConnectedHandler)
- Tokbox.session.addEventListener("streamCreated", Tokbox.streamCreatedHandler)
- Tokbox.session.connect(626221, Tokbox.token)
- },
- microphoneOn: function ()
- {
- Tokbox.publisher.publishAudio(true)
- d.warn(">>>> MICROPHONE ON")
- },
- microphoneOff: function ()
- {
- Tokbox.publisher.publishAudio(false)
- d.warn(">>>> MICROPHONE OFF")
- },
- mute: function ()
- {
- for (var i = 0; i < Tokbox.subscribers.length; i++)
- {
- try
- {
- Tokbox.subscribers[i].subscribeToAudio(false)
- d.warn("MUTED "+i)
- }
- catch (err)
- {
- d.warn("UNMUTE ERROR "+i+" "+ err.description)
- }
- }
- d.warn(">>>> MUTE ALL")
- },
- unmute: function ()
- {
- for (var i = 0; i < Tokbox.subscribers.length; i++)
- {
- try
- {
- Tokbox.subscribers[i].subscribeToAudio(true)
- d.warn("UNMUTED "+i)
- }
- catch (err)
- {
- d.warn("UNMUTE ERROR "+i+" "+ err.description)
- }
- }
- d.warn(">>>> UNMUTE ALL")
- },
- load: function ()
- {
- $("#tokbox-embed").show()
- $("#tokbox-settings").hide()
- $("#tokbox-loading").show()
- $(window).trigger("resize")
- $.get(Tokbox.token_url, {room:Room.name}).success(Tokbox.tokenCallback)
- Tokbox.togglers.push( new Toggler ("#tokbox-microphone", Tokbox.microphoneOn, Tokbox.microphoneOff) )
- Tokbox.togglers.push( new Toggler ("#tokbox-mute-all", Tokbox.mute, Tokbox.unmute) )
- },
- unload: function ()
- {
- $("#tokbox-embed").hide()
- $(window).trigger("resize")
- if (Tokbox.session)
- {
- if (Tokbox.publisher)
- Tokbox.session.unpublish(Tokbox.publisher)
- Tokbox.session.disconnect()
- }
- Tokbox.publisher = null
- Tokbox.session = null
- $("#tokbox-publisher").html("")
- $("#tokbox-subscriber").html("")
- for (t in Tokbox.togglers)
- Tokbox.togglers[i].destroy ()
- Tokbox.togglers = []
- },
- init: function ()
- {
- }
- }
diff --git a/www/static/js/top.js b/www/static/js/top.js
deleted file mode 100755
index 9263bf8..0000000
--- a/www/static/js/top.js
+++ /dev/null
@@ -1,251 +0,0 @@
-var Keyboard =
- {
- altMode: false,
- fullscreenKeys: 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.toggle()
- if (kc === 76)
- Player.likeClick()
- return false
- },
- standardKeys: function (event)
- {
- kc = event.keyCode
- if (kc === 91)
- {
- Keyboard.altMode = true
- return true
- }
- if (kc === 27)
- {
- Viewport.fullscreenOn()
- return false
- }
- if (kc === 37 || kc === 177)
- {
- Player.playPrev()
- return false
- }
- else if (kc === 39 || kc === 176)
- {
- Player.playNext()
- return false
- }
- if (! Keyboard.altMode && kc === 76)
- {
- Player.likeClick()
- return false
- }
- if (kc === 32 || kc === 179)
- {
- Player.toggle()
- return false
- }
- Keyboard.altMode = false
- return true
- }
- }
-var Viewport =
- {
- fullscreenMode: false,
- fullscreenOn: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls").hide()
- $("#settings-container").hide()
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.fullscreenResize)
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.fullscreenKeys)
- Viewport.fullscreenResize()
- Viewport.fullscreenMode = true
- },
- fullscreenResize: function ()
- {
- $("#projector").css({ position: 'fixed', top: 0, left: 0, width: $(window).width(), height: $(window).height() })
- $("#screen,#ytscreen").css({ width: $(window).width(), height: $(window).height() })
- },
- fullscreenOff: function ()
- {
- $("#logo,#logobg,#sitez,#playlist,#playlistbg,#contact,#bg,#gif-container,#controls").show()
- $(window).unbind("resize")
- $(window).bind("resize", Viewport.standardResize)
- Viewport.standardResize()
- Viewport.fullscreenMode = false
- $(window).unbind("keydown")
- $(window).bind("keydown", Keyboard.standardKeys)
- $("#fullscreen").unbind("click")
- $("#fullscreen").bind("click", Viewport.fullscreenOn)
- },
- standardResize: function ()
- {
- var w = $(window).width()
- var h = $(window).height()
- var contact = w * 200 / 1425
- var ytw = (w-contact-40)*4/7
- var yth = ytw * 9/16
- var plw = (w-contact-40)*3/7
-
- $("#contact img").css("max-width", contact)
- var conheight = $("#controls").height()
- var contactheight = $("#contact").height()
- var qheight = Math.max(yth+conheight+40, h - 94 - 60 - 100)
-
- $("#playlist").css("top", 94).css("left", contact/2)
- $("#playlist,#playlistbg").css("width", plw-20+40)
- $("#playlist,#playlistbg").css("height", qheight)
- $("#queue").css("height", qheight)
- var queuetop = $("#queue").offset().top
- $("#playlistbg").css("top", queuetop).css("left", contact/2)
-
- $("#projector").css({ position: 'absolute', })
- $("#player").css("height", yth+conheight+20)
- // $("#player").css("top", queuetop+(qheight-yth-conheight-20)/2).css("left", plw+(contact/2)+40)
- $("#player").css("top", queuetop).css("left", plw+(contact/2)+40)
- $("#projector").css("left", 10)
- $("#player,#projector,#screen,#ytscreen").width(ytw-40)
- $("#projector,#screen,#ytscreen").height(yth)
-
- $("#controls").css({ position: 'absolute', top: yth+20, bottom: 'auto', right: 'auto', })
-
- $("#gif-container").css("top", qheight+30+134)
- }
- }
-
-var Profile =
- {
- mode: false,
- loadQueue: function (queue)
- {
- if (! queue || ! queue.length)
- return
- Player.clearQueue()
- $("#queue").html("")
- Playlist.enqueueOldVideoFormat(queue)
- },
- loadTodayQueue: function ()
- {
- if (Profile.mode === "today")
- return
- Profile.mode = "today"
- $(".mode").removeClass("mode")
- $("#todayQueue").addClass("mode")
- Profile.loadQueue(todayVideoQueue)
- },
- loadYesterdayQueue: function ()
- {
- if (Profile.mode === "yesterday")
- return
- Profile.mode = "yesterday"
- $(".mode").removeClass("mode")
- $("#yesterdayQueue").addClass("mode")
- Profile.loadQueue(yesterdayVideoQueue)
- },
- loadTopQueue: function ()
- {
- if (Profile.mode === "top")
- return
- Profile.mode = "top"
- $(".mode").removeClass("mode")
- $("#topQueue").addClass("mode")
- Profile.loadQueue(topVideoQueue)
- },
- init: function ()
- {
- if (todayVideoQueue && todayVideoQueue.length && todayVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="todayQueue">'+todayVideoQueueTitle+'</li>')
- $("#todayQueue").bind("click", Profile.loadTodayQueue)
- todayVideoQueue.reverse()
- }
- if (yesterdayVideoQueue && yesterdayVideoQueue.length && yesterdayVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="yesterdayQueue">'+yesterdayVideoQueueTitle+'</li>')
- $("#yesterdayQueue").bind("click", Profile.loadYesterdayQueue)
- }
- if (topVideoQueue && topVideoQueue.length && topVideoQueueTitle)
- {
- $("#queueLinks").append('<li id="topQueue">'+topVideoQueueTitle+'</li>')
- $("#topQueue").bind("click", Profile.loadTopQueue)
- topVideoQueue.reverse()
- }
- if (todayVideoQueue && todayVideoQueue.length)
- Profile.loadTodayQueue()
- else if (yesterdayVideoQueue && yesterdayVideoQueue.length)
- Profile.loadYesterdayQueue()
- }
- }
-
-var Room =
- {
- }
-var Poll =
- {
- room: "main",
- delay: 5000,
- init: function ()
- {
- if (document.cookie)
- {
- var cookies = document.cookie.split(";")
- for (i in cookies)
- {
- var cookie = cookies[i].split("=")
- if (cookie[0].indexOf("room") !== -1)
- {
- if (cookie[1] !== 'false' && cookie[1] !== 'undefined')
- {
- Poll.room = cookie[1]
- break
- }
- }
- }
- }
- Poll.poll()
- Viewport.standardResize()
- },
- poll: function ()
- {
- $.post(API.URL.room.poll,
- {
- room: Poll.room,
- session: Auth.session,
- last: 1,
- }).success(Poll.pollCallback).error(Poll.pollErrorCallback)
- },
- pollErrorCallback: function ()
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- },
- pollCallback: function (raw)
- {
- Poll.timer = setTimeout(Poll.poll, Poll.delay)
- }
- }
-
-var Main =
- {
- init: function ()
- {
- $(window).bind("resize", Viewport.standardResize)
- $(window).bind("keydown", Keyboard.standardKeys)
- Playlist.showScores = true
- Auth.success = Poll.init
- if (Auth.init())
- Auth.checkin()
- Profile.init()
- Player.init()
- $("#controls").fadeIn(2000)
- $("#contact").fadeIn(2000)
- setTimeout('Viewport.standardResize()', 1000)
- }
- }
-Main.init()
-
diff --git a/www/static/js/vimeo.js b/www/static/js/vimeo.js
deleted file mode 100755
index e20fdbd..0000000
--- a/www/static/js/vimeo.js
+++ /dev/null
@@ -1,100 +0,0 @@
-var Vimeo =
- {
- type: "vimeo",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- volume: 1,//from 100...some sort of error
- play: function (video)
- {
- d.warn("VIMEO PLAY "+video.key)
- if (video.error)
- return Vimeo.error()
- if (Vimeo.playing)
- Vimeo.stop()
- $("#screen").html("<div id='vimeo'></div>")
- Vimeo.video = video
- Vimeo.playing = true
- var params = { allowScriptAccess: "always", wmode: "opaque", }
- var atts = { id: "vimeo" }
- var flashvars = { api: 1 }
- swfobject.embedSWF("http://vimeo.com/moogaloop.swf?clip_id="+video.name+"&server=vimeo.com&color=00adef&api=1",
- "vimeo", "100%","100%", "8", null, flashvars, params, atts)
- // $("#vimeo").html('<iframe src="http://player.vimeo.com/video/'+video.name+'?api=1" width="100%" height="100%" frameborder="0"></iframe>')
- },
- toggle: function ()
- {
- if (Vimeo.player.api_paused())
- return Vimeo.resume()
- else
- return Vimeo.pause()
- },
- error: function (s)
- {
- Player.error("VIMEO "+s)
- Vimeo.finish()
- },
- setVolume: function (vol)
- {
- Vimeo.volume = vol
- Vimeo.player.api_setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Vimeo.playing = false
- Vimeo.player.api_pause()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Vimeo.playing = true
- Vimeo.player.api_play()
- return false
- },
- stop: function ()
- {
- d.warn("VIMEO STOP")
- Vimeo.playing = false
- },
- finish: function ()
- {
- d.warn("VIMEO FINISH")
- Vimeo.playing = false
- swfobject.removeSWF("vimeo")
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING VIMEO")
- Vimeo.loaded = true
- },
- unload: function ()
- {
- d.warn("VIMEO UNLOADED")
- swfobject.removeSWF("vimeo")
- Vimeo.loaded = false
- },
- init: function ()
- {
- d.warn("VIMEO INIT")
- }
- }
-function vimeo_player_loaded()
- {
- d.warn("VIMEO LOADED")
- Vimeo.player = document.getElementById('vimeo')
- Vimeo.player.api_play()
- // Vimeo.player.addEventListener("finish", "Vimeo.finish")
- Vimeo.player.api_addEventListener("finish", "Vimeo.finish")
- Vimeo.player.api_setVolume(Vimeo.volume)
- }
-Player.register(Vimeo)
-
diff --git a/www/static/js/youtube.js b/www/static/js/youtube.js
deleted file mode 100755
index 936a44a..0000000
--- a/www/static/js/youtube.js
+++ /dev/null
@@ -1,177 +0,0 @@
-var Youtube =
- {
- type: "youtube",
- loaded: false,
- pending: false,
- playing: false,
- player: null,
- playerId: null,
- timeout: null,
- video: null,
- width: "100%",
- height: "100%",
- getYtid: function (url)
- {
- if (! url) return
- var ytid = url.substr(url.indexOf("v=")+2,11)
- if (ytid.indexOf("&") !== -1)
- ytid = ytid.substr(0, ytid.indexOf("&"))
- if (ytid.indexOf("#") !== -1)
- ytid = ytid.substr(0, ytid.indexOf("#"))
- return ytid
- },
- play: function (video)
- {
- d.warn("YOUTUBE PLAY "+video.key)
- if (video.error)
- return Youtube.error()
- if (Youtube.playing)
- Youtube.stop()
- Youtube.video = video
- Youtube.playing = true
- if (Youtube.ready)
- {
- d.warn("ORDERING VIDEO LOAD "+video.name)
- Youtube.player.loadVideoById(video.name)
- Youtube.pending = false
- }
- else
- {
- d.error("YOUTUBE PLAYER NOT READY")
- Youtube.pending = true
- }
- },
- toggle: function ()
- {
- if (Youtube.playing)
- return Youtube.pause()
- else
- return Youtube.resume()
- },
- error: function (s)
- {
- Player.error("YOUTUBE "+s)
- $("li#queue_"+Youtube.video.idx+" span.title").html("<i>This video cannot be embedded</i>")
- setTimeout(Youtube.finish, 1000)
- },
- onStateChange: function (state)
- {
- Youtube.state = state
- if (state === -1)
- {
- d.warn("YOUTUBE: UNSTARTED")
- Youtube.playing = false
- }
- else if (state === 0)
- {
- d.warn("YOUTUBE: ENDED")
- Youtube.playing = false
- return Youtube.finish()
- }
- else if (state === 1)
- {
- d.warn("YOUTUBE: PLAYING")
- Youtube.playing = true
- if (! Youtube.loaded)
- return Youtube.unload()
- }
- else if (state === 2)
- {
- d.warn("YOUTUBE: PAUSED")
- Youtube.playing = false
- }
- else if (state === 3)
- {
- d.warn("YOUTUBE: BUFFERING")
- }
- else if (state === 5)
- {
- d.warn("YOUTUBE: CUED")
- }
- else
- {
- d.error("YOUTUBE: UNKNOWN")
- }
- },
- onError: function (error)
- {
- var errorStr = 'UNKNOWN'
- if (error === 2)
- errorStr = "INVALID PARAMETER"
- if (error === 100)
- errorStr = "NOT FOUND"
- if (error === 101 || error === 150)
- errorStr = "EMBED FORBIDDEN"
- Youtube.error(errorStr)
- },
- setVolume: function (vol)
- {
- Youtube.player.setVolume(vol)
- },
- pause: function ()
- {
- d.warn("PAUSED PLAYBACK")
- Youtube.playing = false
- Youtube.player.pauseVideo()
- return true
- },
- resume: function ()
- {
- d.warn("RESUME PLAYBACK")
- Youtube.playing = true
- Youtube.player.playVideo()
- return false
- },
- stop: function ()
- {
- d.warn("YOUTUBE STOP")
- Youtube.player.stopVideo()
- Youtube.playing = false
- },
- finish: function ()
- {
- d.warn("YOUTUBE FINISH")
- Youtube.playing = false
- Player.finish()
- },
- load: function ()
- {
- d.warn("LOADING YOUTUBE")
- $("#ytscreen").css("z-index", 19)
- Youtube.loaded = true
- },
- unload: function ()
- {
- d.warn("YOUTUBE UNLOADED")
- $("#ytscreen").css("z-index", -3)
- if (Youtube.player)
- Youtube.player.stopVideo()
- Youtube.playing = false
- Youtube.loaded = false
- Youtube.pending = false
- },
- init: function ()
- {
- d.warn("YOUTUBE INIT")
- var params = { allowScriptAccess: "always", wmode: "opaque" }
- var atts = { id: "ytscreen" }
- swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=ytscreen",
- "ytscreen", Player.width, Player.height, "8", null, null, params, atts)
- }
- }
-function onYouTubePlayerReady (playerId)
- {
- d.warn("YOUTUBE READY")
- Youtube.player = document.getElementById(playerId)
- Youtube.playerId = playerId
- Youtube.player.addEventListener("onStateChange", "Youtube.onStateChange")
- Youtube.player.addEventListener("onError", "Youtube.onError")
- Youtube.ready = true
- if (! Youtube.loaded)
- return Youtube.unload()
- if (Youtube.pending)
- Youtube.player.loadVideoById(Youtube.video.name)
- Youtube.pending = false
- }
-Player.register(Youtube)
-