Skip to content

Commit

Permalink
Add option to not use data:// URLs when replacing images
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Aug 22, 2019
1 parent 9fe6246 commit cc93ffe
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions userscript.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@ var $$IMU_EXPORT$$;
},
"rotate_right_btn": {
"en": "Rotate Right (R)"
},
"category_extra": {
"en": "Extra"
},
"subcategory_replaceimages": {
"en": "Replace Images"
}
};

Expand Down Expand Up @@ -631,7 +637,8 @@ var $$IMU_EXPORT$$;
allow_possibly_broken: false,
// thanks to LukasThyWalls on github for the idea
bigimage_blacklist: "",
bigimage_blacklist_engine: "glob"
bigimage_blacklist_engine: "glob",
replaceimgs_usedata: true
};
var orig_settings = deepcopy(settings);

Expand Down Expand Up @@ -1042,6 +1049,12 @@ var $$IMU_EXPORT$$;
name: "Regex"
}
}
},
replaceimgs_usedata: {
name: "Use data URLs",
description: "Uses data:// URLs instead of image links",
category: "extra",
subcategory: "replaceimages"
}
};

Expand All @@ -1058,7 +1071,9 @@ var $$IMU_EXPORT$$;
"ui": "subcategory_ui",
"rules": "category_rules",
"website": "category_website",
"extension": "category_extension"
"extension": "category_extension",
"extra": "category_extra",
"replaceimages": "subcategory_replaceimages"
};


Expand Down Expand Up @@ -41347,9 +41362,15 @@ if (domain_nosub === "lystit.com" && domain.match(/cdn[a-z]?\.lystit\.com/)) {
if (source.src && obj_indexOf(newobj, source.src) < 0)
newobj.push(fillobj(source.src)[0]);

var openb = get_single_setting("mouseover_open_behavior");
var usehead = false;

if (!multi && get_single_setting("mouseover_open_behavior") === "newtab") {
usehead = true;
} else if (multi && !get_single_setting("replaceimgs_usedata")) {
usehead = true;
}

if (openb === "newtab") {
if (usehead) {
processing.head = true;
}

Expand All @@ -41361,7 +41382,7 @@ if (domain_nosub === "lystit.com" && domain.match(/cdn[a-z]?\.lystit\.com/)) {
var data = {img: img, newurl: newurl, obj: obj, respdata: respdata};
var newurl1 = newurl;

if (openb === "newtab") {
if (usehead) {
data = {resp: img, obj: newurl};
newurl1 = data.resp.finalUrl;
}
Expand Down Expand Up @@ -41522,7 +41543,7 @@ if (domain_nosub === "lystit.com" && domain.match(/cdn[a-z]?\.lystit\.com/)) {
if (data.data.img) {
source.el.src = data.data.img.src;
} else if (data.data.obj) {
source.el.src = data.data.obj[0].url;
source.el.src = data.data.obj.url;
}
finish_img();
});
Expand Down

0 comments on commit cc93ffe

Please sign in to comment.