"use strict"

function jsonBloodhound(url){
    var b = new Bloodhound({
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        datumTokenizer:  function(datum)
        {
            var out = [];
            for(var key in datum)
            {
                if(datum.hasOwnProperty(key)){
                    var curr = datum[key].split(" ");
                    for(var p = 0; p<curr.length; p++)
                    {
                        out.push(curr[p]);
                    }
                }
            }
            return out;
        },
        initialize: true,
        prefetch: {
            url: url,
            cache: false,
            transform: function(jsonObj)
            {
                return jsonObj;
            }, 
        }
    });
    return function(q, sync)
    {
        if(q === "")
        {
            return sync(b.index.all());
        }
        else
        {
            return b.search(q, sync);
        }
    };
}

function ConfirmationBox(text, buttons)
{
    // Buttons is an array of objects of the form {text: "button text", func: function() { console.log("Do stuff"); }}
    // Note that the functions are run with the actual ConfirmationBox as the context for using `this`, not the HTML or jQuery button. 
    this.buttons = buttons;
    this.text = text;
    this.$holder = $("<div class=\"confirmationBox\"></div>");
    this.$holder.html(text + "<br />");
    for(var i = 0; i < buttons.length; i++)
    {
        var $currButton = $("<div class=\"confirmationButton\"></div>");
        $currButton.html(buttons[i].text);
        $currButton.click(buttons[i].func.bind(this));
        this.$holder.append($currButton);
    }
    this.destroy = function() 
    {
        this.$holder.remove();
    };
}

@@ -1268,16 +1268,201 @@
 utton. %0A
+    this.destroy = function() %0A    %7B%0A        this.$holder.remove();%0A        $(%22body %3E *:not(.confirmationBox)%22).css(%22opacity%22, 1);%0A        $(%22:submit%22).prop(%22disabled%22, false);%0A    %7D;%0A%0A
     this
@@ -1481,16 +1481,16 @@
 uttons;%0A
-
     this
@@ -1602,24 +1602,125 @@
  %22%3Cbr /%3E%22);%0A
+    $(%22body %3E *:not(.confirmationBox)%22).css(%22opacity%22, .1);%0A    $(%22:submit%22).prop(%22disabled%22, true);%0A
     for(var 
@@ -1974,87 +1974,12 @@
 n);%0A
+
     %7D%0A
-    this.destroy = function() %0A    %7B%0A        this.$holder.remove();%0A    %7D;%0A
 %7D%0A

Make ConfirmationBox blur rest of page