Instantly share code, notes, and snippets.

What would you like to do?
actionQueue in practice
<!DOCTYPE html>
<title>Like Button</title>
<!-- just getting this stuff out of the way -->
<style type="text/css" media="screen">
body {width: 750px;margin: 0 auto;}
p { margin: 10px 0 5px 0;}
.like-button{padding:5px 10px 5px 5px;border-radius:3px;background-color:#eee;color:#000;text-decoration:none;}
.like-button .star{text-shadow:magenta 1px 1px,magenta 2px 2px,magenta 3px 3px;}
.un-liked .star,.liked:hover .star{color:#fff;}
.liked .star,.un-liked:hover .star{color:#000;}
<script type="text/javascript">
// build your global we can use to contain all our code
var A = {};
<!-- actionQueue -->
<script src="" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
interim: function(id){
var element = document.getElementById(id);
element.className = 'like-button liked';
cleanup: function(id){
var element = document.getElementById('like-button-text');
element.innerHTML = 'Done!';
<h1>A Simple Like Button</h1>
<a href='#' id='like-button' class='like-button un-liked' onclick='A.actionQueue.queue_click(;'>
<span class='star'>&#9733;</span>
<span id='like-button-text' class='text'>Like</span>
<p><a href='#' onclick='A.actionQueue.module_loaded("like-handler");'>Load the module</a>
<div class='qunit-output'>
<h1 id="qunit-header">QUnit example</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment