can demonstrate button ddos in jsfiddle i guess

by J. Jones

HTML

<img name='resync' src="http://serverofstuff.appspot.com/static/images/resync.jpg"/>
<div id="remarks">hit the resync button</div><br/>
<button id='foo' onclick='clearConsole();'>clear console</button>
<div id="console">console log type thing</div>
<p>

JavaScript

function resync() {
   log("you hit the resync button again");
}
      function debounce(func, delay, immediate) {
        var timeout, result;
        return function () {
          var context = this, args = arguments;
          var later = function () {
            timeout = null;
            if (!immediate) result = func.apply(context, args);
          };
          var callNow = immediate && !timeout;
          clearTimeout(timeout);
          timeout = setTimeout(later, delay);
          if (callNow) result = func.apply(context, args);
          return result;
        };
      }


$(document).ready(function() {
$("img[name='resync']").on("click", function(ev) {
    console.log('clicked');
          ev.preventDefault();
          ev.stopPropagation();
          resync();
          return true;
      });
});
               

function clearConsole() {
    $('#console').html(" ");
}

function log(msg) {
    var oldmsg = $('#console').html();
    var newmsg = msg + "<br>" + oldmsg;
    $('#console').html(newmsg);
}

function dump(object) {
    var output = object + "<br>";
    var keys = [];
    for (var key in object) {
        if (key.length > 0) keys.push(key);
    }
    keys.sort();
    for (var i = 0; i < keys.length; i++) {
        var property = keys[i];
        try {
            var val = object[property];
            var vals = '' + val;
            if (val !== null && val !== undefined && vals.length > 0) output += "key:" + property + ': value:' + object[property] + ';<br>';
        } catch (err) { // deprecated members will cause this
            //output += property + ': ' + err.message;
        }
    }
    return output;
}