Skip to content

Instantly share code, notes, and snippets.

View hkb's full-sized avatar

Hans-Kristian Bjerregaard hkb

View GitHub Profile
@hkb
hkb / tsd.html
Last active December 20, 2015 17:28 — forked from fadur/tsd.html
Closed tag
<script type="text/javascript" charset="utf-8">
TheSocialDigits.config({
key: "1234567890",
templateFormatters: {my_link: function(absolute_url) {
return "href='"+absolute_url+"'"
}
},
});
</script>
@hkb
hkb / jQuery.log_click.js
Created March 22, 2012 11:53 — forked from fadur/jQuery.log_click.js
a plugin that binds a click event
(function() {
items = {
_call: function(id, href) {
API_KEY = ''; // <-- api key here
url = 'http://api.thesocialdigits.com/v1/__log_click?callback=?';
payload = {'key': API_KEY, 'product': id, 'metadata': {'api': 'search', 'args': {}}};
var t = setTimeout('window.location.href = "' + href + '";', 500);
$.getJSON(url, {'payload': JSON.stringify(payload)}, function(data) {
if (data.status === 'error') {
@hkb
hkb / log_click.js
Created March 21, 2012 17:30 — forked from fadur/log_click.js
atach event to list
function bind_click_logging() {
$('.product_items > a').click(function() {
// fetch link destination
var href = $(this).attr('href');
// extract product id
var _href = href.split('/');
var id = parseInt(_href[_href.length-2]);
// set timeout