Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Info
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiiks committed Mar 30, 2016
1 parent b767f9b commit c68a84e
Showing 1 changed file with 1 addition and 48 deletions.
49 changes: 1 addition & 48 deletions Plugins/videoSupport.js
Original file line number Diff line number Diff line change
@@ -1,48 +1 @@
//META{"name":"videoSupport"}*//

var videoSupport = function () {};

videoSupport.prototype.convert = function () {
$(".message a").each(function() {
var t = $(this);
var href = t.attr("href");
if(href == undefined) return true;
href = href.replace("http:", "https:");
if(!href.endsWith(".mp4") && !href.endsWith(".webm") && !href.endsWith(".ogg")) return true;
var type = "webm";
if(href.endsWith(".mp4")) type = "mp4";
if(href.endsWith(".ogg")) type = "ogg";

t.replaceWith( '<video width="480" height="320" src="'+href+'" type="video/'+type+'" controls></video>');
});
};

videoSupport.prototype.onMessage = function () {
setTimeout(this.convert(), 2000);
};
videoSupport.prototype.onSwitch = function () {
this.convert();
};
videoSupport.prototype.start = function () {
this.convert();
};

videoSupport.prototype.load = function () {};
videoSupport.prototype.unload = function () {};
videoSupport.prototype.stop = function () {};
videoSupport.prototype.getSettingsPanel = function () {
return "";
};

videoSupport.prototype.getName = function () {
return "Video Support";
};
videoSupport.prototype.getDescription = function () {
return "Add support for html5 video";
};
videoSupport.prototype.getVersion = function () {
return "0.1.0";
};
videoSupport.prototype.getAuthor = function () {
return "Jiiks";
};
Superseded by Media Support: https://github.com/Jiiks/BetterDiscordApp/blob/master/Plugins/mediaSupport.js

0 comments on commit c68a84e

Please sign in to comment.