First time here? Check out the FAQ!

Revision history  [back]

I would propose slowly rewrite post.js to be independent of the site's structure by using the HTML5 data- attribute. That way we can define the behaviour _in the template_ without touching javascript, ie. by

<li class="list-button" data-action="upvote" data-source="{{ post.id }}">Like</li>
...
<span data-role="vote-counter" data-source="{{ post.id }}">...</span>

The script will then dynamically link methods to the elements containing the respective data-action and outputs to the elements defined by data-role. Downside is that this takes a bit longer, but employing jQuery's full power should make up for that.