Skip to content

Instantly share code, notes, and snippets.

@jsmestad
Created January 4, 2009 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsmestad/43219 to your computer and use it in GitHub Desktop.
Save jsmestad/43219 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$("div.votes a").click(function() {
$.post( this.href, {"vote[vote]": (this.className == "vote_up") ? 1 : -1} );
$(this).parent().children("a").hide();
$(this).parent().html("<img src=\"/images/accept.png\" />Voted");
var count = intParse($(this).parent().parent().children("div.count").text());
$(this).parent().parent().children("div.count").text((count+1));
return false;
});
})
<div>
<h3>jdoe</h3>
<ul>
<li>2009-01-03</li>
<li>Refactors: 2</li>
</ul>
</div>
<div>
<div>
<div class='count'>0</div>
<div class='votes'>
<a class="vote_up" href="/snippets/1/refactors/2/votes"><img src="/images/add.png?010416490230" /></a>
<a class="vote_down" href="/snippets/1/refactors/2/votes"><img src="/images/delete.png?010416490219" /></a>
</div>
</div>
<table class="CodeRay"><tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><tt>&#x000A;</tt></pre></td>
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="r">def</span> <span class="fu">hello</span><span class="er">\</span>n<span class="er">\</span>tprint <span class="s"><span class="dl">&quot;</span><span class="k">hello</span><span class="dl">&quot;</span></span><span class="er">\</span>nend</pre></td>
</tr></table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment