Add Skype support

This commit is contained in:
Les De Ridder 2016-05-26 01:15:32 +02:00
parent 3e86ee7bd5
commit 4a06ac67f2
2 changed files with 19 additions and 5 deletions

View File

@ -92,15 +92,15 @@ function getBetterUrl(url, callback) {
url = url.replace("gifv", "mp4");
}
if(url.indexOf('pbs.twimg.com/media/') != -1 && url.indexOf(':orig') == -1) {
if(isTwitterUrl(url)) {
if(url.indexOf(':') != url.lastIndexOf(':')) { //Match if there are occurences of ':' other than the ':' in 'https://', such as in '.jpg:large'
url = url.substr(0, url.lastIndexOf(':'));
}
url = url + ':orig';
}
if(isInstagramUrl(url)) {
callback(url);
} else if(isInstagramUrl(url)) {
var request = new XMLHttpRequest();
request.open('GET', 'https://api.instagram.com/oembed/?callback=&url=' + url, true);
request.onload = function () {
@ -145,6 +145,11 @@ function getBetterUrl(url, callback) {
makerequest("jpg");
};
pageRequest.send();
} else if(isTwitterUrl(url)) {
url = url.substr(0, url.lastIndexOf('/'));
url = url + '/imgpsh_fullsize';
callback(url);
} else {
callback(url);
}
@ -185,6 +190,10 @@ function cleanExtension(url) {
return url;
}
function isTwitterUrl(url) {
return url.indexOf('pbs.twimg.com/media/') != -1;
}
function isInstagramUrl(url) {
return url.indexOf('instagram.com/p') != -1;
}
@ -193,6 +202,10 @@ function isPixivUrl(url) {
return url.indexOf('pixiv.net/member_illust.php') != -1;
}
function isSkypeUrl(url) {
return url.indexOf('api.asm.skype.com/v1/objects/') != -1;
}
function isCoolUrl(url, callback) {
url = url.toLowerCase();
@ -212,7 +225,7 @@ function isCoolUrl(url, callback) {
console.log('blacklist disabled!');
}
callback(validExtensions.indexOf(extension) != -1 || isInstagramUrl(url));
callback(validExtensions.indexOf(extension) != -1 || isInstagramUrl(url) || isSkypeUrl(url));
});
}

View File

@ -53,6 +53,7 @@
* Add gfycat support
* Option to download a copy (checkbox)
* Error checks and messages
* Context menu item
-->
<button id="save">Save</button>