Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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="{{ }}">Like</li>
<span data-role="vote-counter" data-source="{{ }}">...</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.