Skip to content

Commit 6655d77

Browse files
author
neocogent
committed
add btc ticker for reddit, update readme
1 parent 9680182 commit 6655d77

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ scripts:
1212
greasemonkey:
1313
collapsetips - script to collapse ChangeTips on /r/bitcoin
1414
bitcoinwisdom - script to add USD on Chinese exchanges
15+
reddit-btc-ticker - script to add BTC price ticker on /r/bitcoin
1516

1617
from other repos/gists:
1718
subgit - nice script for easily managing sub-projects (like these)

greasemonkey/reddit-btc-ticker.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ==UserScript==
2+
// @name Reddit BTC Ticker
3+
// @namespace topherkhaew
4+
// @include https://www.reddit.com/r/Bitcoin/*
5+
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
6+
// @version 1
7+
// @grant GM_xmlhttpRequest
8+
// ==/UserScript==
9+
10+
function add_btc_price(price) {
11+
var btc_css = {
12+
"position": "absolute",
13+
"top": "60px",
14+
"right": "60px",
15+
"font-size": "14pt"
16+
};
17+
var btc = jQuery("<div>"+parseFloat(price).toFixed(2)+"</div>").appendTo("#header");
18+
btc.css(btc_css);
19+
}
20+
21+
GM_xmlhttpRequest ({
22+
method: "GET",
23+
url: "https://blockchain.info/ticker",
24+
onload: function (response) {
25+
data = $.parseJSON(response.responseText);
26+
add_btc_price(data['USD']['last']);
27+
}
28+
});
29+

0 commit comments

Comments
 (0)