Working autogif plugin

This commit is contained in:
Jiiks 2016-03-31 10:15:39 +03:00
parent 66e30fd54e
commit 76d0b7d9fc
1 changed files with 6 additions and 16 deletions

View File

@ -3,27 +3,17 @@
var agif = function () {}; var agif = function () {};
agif.prototype.convert = function () { agif.prototype.convert = function () {
$(".attachment-image").each(function() { $(".image canvas").each(function() {
var href = $(this).find("canvas").attr("href"); var href = $(this).attr("href");
if(href != undefined) { if(href != undefined) {
$(this).empty(); if(href.endsWith(".gif")) {
$(this).html('<img src="'+href+'"></img>'); $(this).replaceWith('<img src="'+href+'"></img>');
}
} }
}); });
$(".embed-thumbnail-image").each(function() {
var href = $(this).attr("href");
if(href != undefined) {
if(href.endsWith(".gif")) {
$(this).empty();
$(this).html('<img src="'+href+'"></img>');
}
}
});
}; };
agif.prototype.onMessage = function () { agif.prototype.onMessage = function () {
console.log("ONMESSAGE");
this.convert(); this.convert();
}; };
agif.prototype.onSwitch = function () { agif.prototype.onSwitch = function () {
@ -44,7 +34,7 @@ agif.prototype.getName = function () {
return "Autogif"; return "Autogif";
}; };
agif.prototype.getDescription = function () { agif.prototype.getDescription = function () {
return "Don't use currently broken."; return "Autoplay gifs without having to hover.";
}; };
agif.prototype.getVersion = function () { agif.prototype.getVersion = function () {
return "0.1.0"; return "0.1.0";