Skip to content

Instantly share code, notes, and snippets.

@vramana
Created May 11, 2014 07:15
Show Gist options
  • Save vramana/a781cb018cd337c775d1 to your computer and use it in GitHub Desktop.
Save vramana/a781cb018cd337c775d1 to your computer and use it in GitHub Desktop.
Prize
{
"manifest_version": 2,
"name": "The International Prize Pool Tracker",
"version": "1.0",
"permissions": [
"http://dota2.cyborgmatt.com/prizetracker/",
"tabs",
"contextMenus"
],
"browser_action": {
"default_popup": "popup.html"
},
"content_security_policy": "script-src 'self' http://dota2.cyborgmatt.com/; object-src 'self'"
}
<html>
<head>
<style type="text/css">@charset "UTF-8";[ng\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}</style>
<script src="jquery.min.js"></script>
<style type="text/css">
#prizePool {
margin-top:10px;
display:block;
width:264px;
height:226px;
position:relative;
background-image:url('ti4-compendium-button.png');
text-decoration: none;
}
#prizePoolNum {
font-family:arial,sans-serif;
font-weight:bold;
font-size:22px;
color:#c9c9c9;
position:absolute;
width:264px;
text-align:center;
top:53px;
height:19px;
letter-spacing:2px;
}
.hoverBG {
background-position: top;
background-repeat: no-repeat;
}
.hoverBG:hover {
background-position: bottom;
}
</style>
<script src="popup.js"></script>
</head>
<body style="">
<a class="hoverBG" id="prizePool" href="http://www.dota2.com/international/compendium/" target="_blank">
<div id="prizePoolNum">
<span id="prizeVal">Loading...</span>
<span id="prizeUSD" style="font-size: 14px;"> USD</span>
</div>
</a>
<spots-wrapper></spots-wrapper>
</body>
</html>
function populatePrizePool( dataJSON )
{
if ( dataJSON['dollars'] )
{
jQuery('#prizeVal').html( '$' + addCommas( dataJSON['dollars'] ) );
jQuery('#prizeUSD').show();
}
}
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
{
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
jQuery(document).ready(
function()
{
var baseURL = ( location.protocol == 'https:' ) ? 'https://dota2.cyborgmatt.com/' : 'http://dota2.cyborgmatt.com/';
URL = baseURL + 'prizetracker/data/ti4.json';
jQuery.ajax(
{
type:'GET',
cache:true,
url: URL,
dataType:'jsonp'
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment