Styled alert system for javascript
<p>i am using <a href="http://ssssnakes.com/smoke/" rel="nofollow">smoke.js</a> which allows to style the classic alert javascript windows.</p>

<p>All you have to do is place <code>.smoke</code> before the alert ie. <code>smoke.confirm()</code></p>

<p>The issue I am having is with the ok/cancel callback, it isnt working for me.</p>

<p>This is the example the website shows.</p>

<p>`You can implement these the same way you'd use the js alert()...just put "smoke." in front of it.</p>

<p>The confirm() replacement, however, needs to be used just a little differently:</p>

<pre><code>smoke.confirm('You are about to destroy everything. Are you sure?',function(e){
    if (e){
        smoke.alert('OK pressed');
    }else{
        smoke.alert('CANCEL pressed');
    }
});
</code></pre>

<p>and the code I have is;</p>

<pre><code>$(".upb_del_bookmark").click( function() {
        if(smoke.confirm(delete_message)) {
            var post_id = $(this).attr('rel');
            var data = {
                action: 'del_bookmark',
                del_post_id: post_id
            };
            $.post(upb_vars.ajaxurl, data, function(response) {
                $('.bookmark-'+post_id).fadeOut();
                $('.upb_bookmark_control_'+post_id).toggle();
            });
</code></pre>

<p>It shows the style button and everything but when i click on OK it doesnt perform the function above, nothing happens.</p>

<p><img src="http://i.stack.imgur.com/FPocg.png" alt="Confirm"></p>

<p>So i rewrote it to</p>

<pre><code>$(".upb_del_bookmark").click( function() {
        if(smoke.confirm(delete_message, function(e))) {
            if(e){
            var post_id = $(this).attr('rel');
            var data = {
                action: 'del_bookmark',
                del_post_id: post_id
            };
            $.post(upb_vars.ajaxurl, data, function(response) {
                $('.bookmark-'+post_id).fadeOut();
                $('.upb_bookmark_control_'+post_id).toggle();
            });
        }}
</code></pre>

<p>But now when i click it doesnt even show anything</p>

<p>I am not a programmer, Help!!!!!</p>

<p>If you want to try it go to latinunit.org login with david:123321 and then go to a post and try to add it to your favourites</p>

<p><strong>Update</strong></p>

<p>I tried the following, it shows the window but it doesnt perform the function;</p>

<pre><code>$(".upb_del_bookmark").click( function() {
        smoke.confirm(delete_message, function(e) {
            if(e){
            var post_id = $(this).attr('rel');
            var data = {
                action: 'del_bookmark',
                del_post_id: post_id
            };
            $.post(upb_vars.ajaxurl, data, function(response) {
                $('.bookmark-'+post_id).fadeOut();
                $('.upb_bookmark_control_'+post_id).toggle();
            });
        }})
        return false;
    });
</code></pre>

<p>Here is the js file of the smoke script <a href="http://latinunit.org/smoke.js" rel="nofollow">Link</a></p>

<p>When i click on cancel the following shows;</p>

<blockquote>
  <p>Uncaught TypeError: Property 'callback' of object # is not a
  function Line:198
  Uncaught TypeError: Property 'callback' of object # is not a
  function Line:208</p>
</blockquote>

<p>The following is what's on those linesof the smoke script;</p>

<pre><code>finishbuildConfirm: function (e, f, box)
    {
        smoke.listen(
            document.getElementById('confirm-cancel-' + f.newid),
            "click", 
            function () 
            {
                smoke.destroy(f.type, f.newid);
                f.callback(false);
            }
        );

        smoke.listen(
            document.getElementById('confirm-ok-' + f.newid),
            "click", 
            function () 
            {
                smoke.destroy(f.type, f.newid);
                f.callback(true);
            }
        );
</code></pre>
