Skip to content

Instantly share code, notes, and snippets.

@MSylvia
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save MSylvia/a815b3f08a40d86602e2 to your computer and use it in GitHub Desktop.

Select an option

Save MSylvia/a815b3f08a40d86602e2 to your computer and use it in GitHub Desktop.
quick little gog sales watcher
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>INSOMNIA SALE WATCHER</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
body {
font: 11px "Lucida Grande",Arial,Verdana,sans-serif;
background: #d4d4d4 ;
width: 100%;
margin: 0 auto;
}
.game {
background: #ddd ;
}
.game__img {
display: block;
margin-left: auto;
margin-right: auto;
}
.game__title {
text-align: center;
display: block;
color: #949494;
font-size: 20px;
font-weight: 400;
line-height: 1.2;
background: #eee ;
}
.game__box:after, .game-works-mac, .game-works-win {
background-image: url(http://static.gog.com/adhoc/2014_may_insomnia/img/sprite.png);
}
.game-works-win {
height: 13px;
width: 14px;
background-position: 0 0;
}
.game-works-mac {
height: 14px;
width: 12px;
background-position: -14px 0;
}
.game-works-mac, .game-works-win {
display: inline-block;
margin: 0 2px;
position: relative;
top: 2px;
vertical-align: baseline;
opacity: .8;
}
.game__left {
color: #ccc;
}
.game__price {
font-weight: 600;
color: #c7ec00;
}
.game__left, .game__price {
margin-top: 2px;
line-height: 1;
font-size: 22px;
text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.game__btn {
float: right;
padding: 0 23px;
height: 46px;
margin-bottom: 1px;
line-height: 46px;
text-align: center;
font-size: 18px;
font-weight: 600;
color: #03101a;
text-shadow: 0 1px rgba(255,255,255,0.2);
-moz-box-shadow: inset 0 1px 0 1px rgba(255,255,255,0.3),inset 0 0 1px rgba(255,255,255,0.1),0 0 0 1px rgba(0,0,0,0.35),0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: inset 0 1px 0 1px rgba(255,255,255,0.3),inset 0 0 1px rgba(255,255,255,0.1),0 0 0 1px rgba(0,0,0,0.35),0 1px 3px rgba(0,0,0,0.5);
box-shadow: inset 0 1px 0 1px rgba(255,255,255,0.3),inset 0 0 1px rgba(255,255,255,0.1),0 0 0 1px rgba(0,0,0,0.35),0 1px 3px rgba(0,0,0,0.5);
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…gd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
background: -moz-linear-gradient(top, #aacc00,#82ad00 96%);
background: -o-linear-gradient(top, #aacc00,#82ad00 96%);
background: -webkit-linear-gradient(top, #aacc00,#82ad00 96%);
background: linear-gradient(to bottom, #aacc00,#82ad00 96%);
cursor: pointer;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
margin-right: 20px;
}
.game__save {
margin-top: 2px;
font-size: 12px;
color: #b0b0b0;
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
.game__genre {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
color: #949494;
font-size: 12px;
}
.game__details {
display: block;
margin-top: 3px;
color: #949494;
font-size: 12px;
background: #444 ;
}
.game__progress
{
background: #444 ;
padding: 10px;
}
#data
{
padding-top: 20px;
width: 345px;
height: 410px;
display: block;
margin-left: auto;
margin-right: auto;
}
h1
{
text-align: center;
}
.nav_logo {
background: url("http://static.gog.com/www/default/-img/_nav.38808059.png") 0 -54px;
width: 98px;
height: 23px;
margin: 15px 10px 0 7px;
cursor: pointer;
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body id="home">
<div class="nav_logo"></div>
<div id="data">
</div>
<script>
String.prototype.replaceAll = function(search, replace) {
if (replace === undefined) {
return this.toString();
}
return this.split(search).join(replace);
}
function fun() {
$.ajax({
type: 'GET',
url: 'http://jsonp.jit.su/?url=http://www.gog.com/springinsomnia/ajax/getCurrentOffer',
dataType: 'json',
success: function (data) {
var processedData = data.html.replaceAll("\"/", "\"http://gog.com/");
console.log(data);
$('#data').html(processedData);// first set the value
console.log(data.amountLeft);
$('span.js-left-count').html(data.amountLeft);
}
});
}
fun();
var interval = setInterval(fun, 3000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment