Skip to content

Instantly share code, notes, and snippets.

@muffinista
Created March 1, 2017 20:28
Show Gist options
  • Save muffinista/cc9b1bb9ab74abc578036814f64c0f7c to your computer and use it in GitHub Desktop.
Save muffinista/cc9b1bb9ab74abc578036814f64c0f7c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Screen Flipper</title>
<script>
// this little javascript snippet will parse any incoming URL
// parameters and place them in the window.urlParams object
window.urlParams = window.location.search.split(/[?&]/).slice(1).map(function(paramPair) {
return paramPair.split(/=(.+)?/).slice(0, 2);
}).reduce(function (obj, pairArray) {
obj[pairArray[0]] = pairArray[1];
return obj;
}, {});
</script>
<style>
* {
padding: 0;
margin: 0;
}
img {
transform: rotate(180deg);
}
</style>
</head>
<body>
<img id="screen" />
</body>
<script>
var img = document.getElementById("screen");
var url = unescape(decodeURIComponent(window.urlParams.screenshot));
img.src = url;
if ( typeof(window.urlParams.width) !== "undefined" ) {
img.width = window.urlParams.width;
img.height = window.urlParams.height;
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment