Skip to content

Instantly share code, notes, and snippets.

@autos
Last active August 29, 2015 14:23
Show Gist options
  • Save autos/e9e2aa33b96e0cb2e7b4 to your computer and use it in GitHub Desktop.
Save autos/e9e2aa33b96e0cb2e7b4 to your computer and use it in GitHub Desktop.
images.weserv.nl
<html>
<head>
<title>input</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
function myFunction() {
var input = document.getElementById('input').value;
var output="";
//if( input.search("https") > 0)
if( input.match(/https/gi).length > 0 )
output = input.replace("https://","");
else
output = input.replace("http://","");
//alert(output);
var res = "https://images.weserv.nl/?url="+output+"";
//alert(res);
var win = window.open(res, '_blank');
win.focus();
}
</script>
</head>
<body>
<center>
<br />
<br />
<br />
<h2>Paste</h2>
<br />
<br />
<br />
<br />
<br />
<input type="text" value=".jpg" class="form-control input-s" id="input" style = "width:300px;" />
<button class="btn btn-primary" onclick="myFunction()">Click</button>
</center>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment