Greasy Fork镜像 is available in English.

Tumblr Image URL Redirect

Redirects Tumblr Image URLs to the raw version

< Commentaires sur Tumblr Image URL Redirect

Avis: Bon - le script fonctionne correctement

§
Posté le: 02/07/2017

Domain Redirect

a suggestion, you can shorten the first part of your script

if(window.location.href.indexOf("https://68.media.tumblr.com/") > -1) {
window.location = window.location.href.replace( "https://68.media.tumblr.com/", "http://media.tumblr.com/" );
}

if(window.location.href.indexOf("http://68.media.tumblr.com/") > -1) {
window.location = window.location.href.replace( "http://68.media.tumblr.com/", "http://media.tumblr.com/" );
}

like so

if(window.location.host.indexOf("media.tumblr.com") > 0) {
window.location = window.location.href.replace(/..\.media\.tumblr\.com/,"media.tumblr.com");
}

and it will work with http as well as https and other domains such as 56.media.tumblr.com

§
Posté le: 03/07/2017
a suggestion, you can shorten the first part of your script

if(window.location.href.indexOf("https://68.media.tumblr.com/") > -1) {
window.location = window.location.href.replace( "https://68.media.tumblr.com/", "http://media.tumblr.com/" );
}

if(window.location.href.indexOf("http://68.media.tumblr.com/") > -1) {
window.location = window.location.href.replace( "http://68.media.tumblr.com/", "http://media.tumblr.com/" );
}

like so

if(window.location.host.indexOf("media.tumblr.com") > 0) {
window.location = window.location.href.replace(/..\.media\.tumblr\.com/,"media.tumblr.com");
}

and it will work with http as well as https and other domains such as 56.media.tumblr.com

Hey thanks! I wanted to do something like that but I could never figure out how.

Poster une réponse

Connectez-vous pour poster une réponse.

长期地址
遇到问题?请前往 GitHub 提 Issues。