Add imgur album embedding
This commit is contained in:
parent
ef6a415c1b
commit
8c6d2ccfb2
3 changed files with 51 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue