Add working gifv support

This commit is contained in:
Les De Ridder 2016-01-18 16:37:16 +01:00
parent 0c2b28d11c
commit 757c92612c
2 changed files with 13 additions and 2 deletions

View File

@ -31,6 +31,7 @@ function copyToClipboard(url) {
chrome.pageAction.onClicked.addListener(function(tab) { chrome.pageAction.onClicked.addListener(function(tab) {
getCurrentTabUrl(function(url) { getCurrentTabUrl(function(url) {
url = getBetterUrl(url);
var filename = url.substr(url.lastIndexOf("/")); var filename = url.substr(url.lastIndexOf("/"));
chrome.storage.sync.get({url: '', tabbehaviour: '', copytoclipboard: false, replacebookmark: false}, function(config) { chrome.storage.sync.get({url: '', tabbehaviour: '', copytoclipboard: false, replacebookmark: false}, function(config) {
@ -69,13 +70,24 @@ chrome.pageAction.onClicked.addListener(function(tab) {
}); });
}); });
function getBetterUrl(url) {
var extensionIndex = url.lastIndexOf('.');
var extension = url.substr(extensionIndex + 1);
if(extension == "gifv") {
return url.replace("gifv", "mp4");
}
return url;
}
function isCoolUrl(url) { function isCoolUrl(url) {
url = url.toLowerCase(); url = url.toLowerCase();
var extensionIndex = url.lastIndexOf('.'); var extensionIndex = url.lastIndexOf('.');
var extension = url.substr(extensionIndex + 1); var extension = url.substr(extensionIndex + 1);
var validExtensions = ["jpg", "jpeg", "png", "gif", "webm"]; var validExtensions = ["jpg", "jpeg", "png", "gif", "webm", "gifv"];
var blackList = ["pomf", "mixtape.moe", "catgirlsare.sexy", "cocaine.ninja"]; var blackList = ["pomf", "mixtape.moe", "catgirlsare.sexy", "cocaine.ninja"];

View File

@ -45,7 +45,6 @@
* Add imageboard thread archival support * Add imageboard thread archival support
* Add booru support * Add booru support
* Add imgur album support * Add imgur album support
* Add gifv support
* Option to download a copy (checkbox) * Option to download a copy (checkbox)
* Error checks and messages * Error checks and messages
--> -->