From 24f556d31b2a64d861c0e014886d3bb257770338 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Tue, 9 Feb 2016 19:08:20 +0200 Subject: [PATCH] Gif autoplayer --- Plugins/AutoPlayGifs.plugin.js | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Plugins/AutoPlayGifs.plugin.js diff --git a/Plugins/AutoPlayGifs.plugin.js b/Plugins/AutoPlayGifs.plugin.js new file mode 100644 index 0000000..6358e95 --- /dev/null +++ b/Plugins/AutoPlayGifs.plugin.js @@ -0,0 +1,53 @@ +//META{"name":"agif"}*// + +var agif = function () {}; + +agif.prototype.convert = function () { + $(".attachment-image").each(function() { + var href = $(this).find("canvas").attr("href"); + if(href != undefined) { + $(this).empty(); + $(this).html(''); + } + }); + + $(".embed-thumbnail-image").each(function() { + var href = $(this).attr("href"); + if(href != undefined) { + if(href.endsWith(".gif")) { + $(this).empty(); + $(this).html(''); + } + } + }); +}; + +agif.prototype.onMessage = function () { + this.convert(); +}; +agif.prototype.onSwitch = function () { + this.convert(); +}; +agif.prototype.start = function () { + this.convert(); +}; + +agif.prototype.load = function () {}; +agif.prototype.unload = function () {}; +agif.prototype.stop = function () {}; +agif.prototype.getSettingsPanel = function () { + return ""; +}; + +agif.prototype.getName = function () { + return "Autogif"; +}; +agif.prototype.getDescription = function () { + return "Autoplay gifs without having to hover."; +}; +agif.prototype.getVersion = function () { + return "0.1.0"; +}; +agif.prototype.getAuthor = function () { + return "Jiiks"; +}; \ No newline at end of file