<commit_before>function ModalBox() {
    this.view = $('<div class="modalbox"><div class="wrapper"><p></p><div class="buttons"></div></div></div>');
}

ModalBox.prototype.setMessage = function(message) {
    this.view.find('.wrapper p').text(message);
};

ModalBox.prototype.addButton = function(label, callback) {
    var self = this;
    var elem = $('<button></button>').text(label);
    elem.click(function() {
        callback(self);
    });
    this.view.find('.buttons').append(elem);
};

ModalBox.prototype.show = function() {
    $('body').append(this.view);
};

ModalBox.prototype.remove = function() {
    this.view.remove();
};

/* RELOAD DIALOG
 ****************************************************************************/

function ReloadDialog() {
    ModalBox.call(this);

    this.setMessage('Your account has been used somewhere else. Please reload the page.');

    this.addButton('Reload', function(self) {
        location.reload();
    });
}

ReloadDialog.prototype = new ModalBox();
ReloadDialog.prototype.constructor = ReloadDialog;

/* FLATTR DIALOG
 ****************************************************************************/

function WhatIsFlattrDialog() {
    ModalBox.call(this);

    this.setMessage('Flattr is an easy way to send micropayments. With your help we can create a sustainable way for music artists to get paid.');

    this.addButton('Connect your Flattr account', function(self) {
        location.href = '/flattrconnect';
    });

    this.addButton('Cancel', function(self) {
        self.remove();
    });
}

WhatIsFlattrDialog.prototype = new ModalBox();
WhatIsFlattrDialog.prototype.constructor = WhatIsFlattrDialog;
<commit_msg>Remove Flattr dialog if outside is clicked<commit_after>function ModalBox() {
    self = this;
    this.canBeClosed = false;
    this.view = $('<div class="modalbox"><div class="wrapper"><p></p><div class="buttons"></div></div></div>');
    this.view.click(function(e) {
        if ($(e.target).hasClass('modalbox') && self.canBeClosed) {
            self.remove();
        }
    });
}

ModalBox.prototype.setMessage = function(message) {
    this.view.find('.wrapper p').text(message);
};

ModalBox.prototype.addButton = function(label, callback) {
    var self = this;
    var elem = $('<button></button>').text(label);
    elem.click(function() {
        callback(self);
    });
    this.view.find('.buttons').append(elem);
};

ModalBox.prototype.show = function() {
    $('body').append(this.view);
};

ModalBox.prototype.remove = function() {
    this.view.remove();
};

/* RELOAD DIALOG
 ****************************************************************************/

function ReloadDialog() {
    ModalBox.call(this);

    this.setMessage('Your account has been used somewhere else. Please reload the page.');

    this.addButton('Reload', function(self) {
        location.reload();
    });
}

ReloadDialog.prototype = new ModalBox();
ReloadDialog.prototype.constructor = ReloadDialog;

/* FLATTR DIALOG
 ****************************************************************************/

function WhatIsFlattrDialog() {
    ModalBox.call(this);

    this.setMessage('Flattr is an easy way to send micropayments. With your help we can create a sustainable way for music artists to get paid.');

    this.canBeClosed = true;

    this.addButton('Connect your Flattr account', function(self) {
        location.href = '/flattrconnect';
    });

    this.addButton('Cancel', function(self) {
        self.remove();
    });
}

WhatIsFlattrDialog.prototype = new ModalBox();
WhatIsFlattrDialog.prototype.constructor = WhatIsFlattrDialog;

{'fraction_non_alphanumeric': 0.2297484102847664, 'fraction_numerical': 0.0, 'mean_word_length': 4.117397454031117, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '725200', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1010, 'n_words': 209}