Skip to content

Instantly share code, notes, and snippets.

@karmi
Forked from steida/gist:707352
Created November 19, 2010 22:52
Show Gist options
  • Save karmi/707357 to your computer and use it in GitHub Desktop.
Save karmi/707357 to your computer and use it in GitHub Desktop.
var Change = function (id, doc) {
console.log('new change:', id);
this.id = id;
this.glyph = $('<p title="' + this.url() + '"></p>')
.css({ bottom: this.position() })
.click($.proxy(this.onGlyphClick, this));
this.changes_in_current_period += 1;
$('#changes .interval:last')
.append(glyph)
.trigger('update_counter');
};
Change.prototype = {
onGlyphClick: function () {
document.location.href = this.url();
},
url: function () {
return 'http://' + db.client.host + ':' + db.client.port + '/' + db.name + '/' + this.id
},
position: function () {
return this.changes_in_current_period * 3 + 'px';
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment