opendir_image.js updates.
- Put a try-catch around url normalize so a single bad url doesn't break the page. - Fix gfycat api url. - Add more reject urls.
This commit is contained in:
parent
5022257817
commit
29e1ba07f5
1 changed files with 22 additions and 2 deletions
|
@ -481,6 +481,14 @@ function get_all_urls()
|
||||||
console.log(url);
|
console.log(url);
|
||||||
if (url.indexOf("thumbs.redditmedia") != -1)
|
if (url.indexOf("thumbs.redditmedia") != -1)
|
||||||
{console.log("Rejecting reddit thumb"); continue;}
|
{console.log("Rejecting reddit thumb"); continue;}
|
||||||
|
if (url.indexOf("redditstatic.com/mailgray.png") != -1)
|
||||||
|
{console.log("Rejecting reddit icons"); continue;
|
||||||
|
if (url.indexOf("redditstatic.com/start_chat.png") != -1)
|
||||||
|
{console.log("Rejecting reddit icons"); continue;}
|
||||||
|
if (url.indexOf("preview.redd.it/award_images") != -1)
|
||||||
|
{console.log("Rejecting reddit awards"); continue;}
|
||||||
|
if (url.indexOf("redditstatic.com/gold/awards") != -1)
|
||||||
|
{console.log("Rejecting reddit awards"); continue;}
|
||||||
if (url.indexOf("pixel.reddit") != -1 || url.indexOf("reddit.com/static/pixel") != -1)
|
if (url.indexOf("pixel.reddit") != -1 || url.indexOf("reddit.com/static/pixel") != -1)
|
||||||
{console.log("Rejecting reddit pixel"); continue}
|
{console.log("Rejecting reddit pixel"); continue}
|
||||||
if (url.indexOf("/thumb/") != -1)
|
if (url.indexOf("/thumb/") != -1)
|
||||||
|
@ -550,7 +558,7 @@ function get_basename(url)
|
||||||
function get_gfycat_video(id)
|
function get_gfycat_video(id)
|
||||||
{
|
{
|
||||||
console.log("Resolving gfycat " + id);
|
console.log("Resolving gfycat " + id);
|
||||||
var url = "https://gfycat.com/cajax/get/" + id;
|
var url = "https://api.gfycat.com/v1/gfycats/" + id;
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
request.answer = null;
|
request.answer = null;
|
||||||
request.onreadystatechange = function()
|
request.onreadystatechange = function()
|
||||||
|
@ -696,7 +704,7 @@ function lazy_load_one(element, comeback)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalize_url(url)
|
function _normalize_url(url)
|
||||||
{
|
{
|
||||||
var protocol = window.location.protocol;
|
var protocol = window.location.protocol;
|
||||||
if (protocol == "file:")
|
if (protocol == "file:")
|
||||||
|
@ -789,6 +797,18 @@ function normalize_url(url)
|
||||||
return [url];
|
return [url];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalize_url(url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _normalize_url(url);
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resize_images(height)
|
function resize_images(height)
|
||||||
{
|
{
|
||||||
odi_divs = get_odi_divs();
|
odi_divs = get_odi_divs();
|
||||||
|
|
Loading…
Reference in a new issue