mirror of https://github.com/calzoneman/sync.git
Add imgur album embedding
This commit is contained in:
parent
ef6a415c1b
commit
8c6d2ccfb2
19
channel.js
19
channel.js
|
@ -952,12 +952,13 @@ function mediaUpdate(chan, id) {
|
|||
}
|
||||
|
||||
function isLive(type) {
|
||||
return type == "li"
|
||||
|| type == "tw"
|
||||
|| type == "jt"
|
||||
|| type == "rt"
|
||||
|| type == "jw"
|
||||
|| type == "us";
|
||||
return type == "li" // Livestream.com
|
||||
|| type == "tw" // Twitch.tv
|
||||
|| type == "jt" // Justin.tv
|
||||
|| type == "rt" // RTMP
|
||||
|| type == "jw" // JWPlayer
|
||||
|| type == "us" // Ustream.tv
|
||||
|| type == "im";// Imgur album
|
||||
}
|
||||
|
||||
Channel.prototype.queueAdd = function(media, idx) {
|
||||
|
@ -1050,6 +1051,12 @@ Channel.prototype.enqueue = function(data, user) {
|
|||
this.autoTemp(media, user);
|
||||
this.queueAdd(media, idx);
|
||||
break;
|
||||
case "im":
|
||||
var media = new Media(data.id, "Imgur Album", "--:--", "im");
|
||||
media.queueby = user ? user.name : "";
|
||||
this.autoTemp(media, user);
|
||||
this.queueAdd(media, idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -669,6 +669,8 @@ function parseVideoURL(url){
|
|||
return [parseVimeo(url), "vi"];
|
||||
else if(url.indexOf("dailymotion.com") != -1)
|
||||
return [parseDailymotion(url), "dm"];
|
||||
else if(url.indexOf("imgur.com") != -1)
|
||||
return [parseImgur(url), "im"];
|
||||
}
|
||||
|
||||
function parseYTURL(url) {
|
||||
|
@ -743,6 +745,14 @@ function parseDailymotion(url) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function parseImgur(url) {
|
||||
var m = url.match(/imgur\.com\/a\/([a-zA-Z0-9]+)/);
|
||||
if(m) {
|
||||
return m[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function closePoll() {
|
||||
if($("#pollcontainer .active").length != 0) {
|
||||
var poll = $("#pollcontainer .active");
|
||||
|
|
|
@ -51,6 +51,9 @@ var Media = function(data) {
|
|||
case "us":
|
||||
this.initUstream();
|
||||
break;
|
||||
case "im":
|
||||
this.initImgur();
|
||||
break;
|
||||
default:
|
||||
this.nullPlayer();
|
||||
break;
|
||||
|
@ -467,6 +470,31 @@ Media.prototype.initUstream = function() {
|
|||
this.seek = function() { }
|
||||
}
|
||||
|
||||
Media.prototype.initImgur = function() {
|
||||
var iframe = $("<iframe/>").insertBefore($("#ytapiplayer"));
|
||||
$("#ytapiplayer").remove();
|
||||
iframe.attr("id", "ytapiplayer");
|
||||
iframe.attr("width", VWIDTH);
|
||||
iframe.attr("height", VHEIGHT);
|
||||
iframe.attr("src", "http://imgur.com/a/"+this.id+"/embed");
|
||||
iframe.attr("frameborder", "0");
|
||||
iframe.attr("scrolling", "no");
|
||||
iframe.css("border", "none");
|
||||
|
||||
this.load = function(data) {
|
||||
this.id = data.id;
|
||||
this.initImgur()
|
||||
}
|
||||
|
||||
this.pause = function() { }
|
||||
|
||||
this.play = function() { }
|
||||
|
||||
this.getTime = function() { }
|
||||
|
||||
this.seek = function() { }
|
||||
}
|
||||
|
||||
Media.prototype.update = function(data) {
|
||||
if(data.id && data.id != this.id) {
|
||||
if(data.currentTime < 0) {
|
||||
|
|
Loading…
Reference in New Issue