<commit_before>/* Initialize the bookmarklet buttons */
define(['./nainwak', './settings'], function (nainwak, settings) {
    function getInjectionUrl(scriptUrl, channel) {
        var lines = [
            'javascript:(function () {',
            '    var w = window,',
            '        l = w.location,',
            '        u = l.origin + l.pathname,',
            '        d = document,',
            '        b = d.body,',
            '        n = "nany",',
            '        i = n + "Script",',
            '        s = d.getElementById(i);',
            '    if (u === "' + nainwak.gameUrl() + '") {',
            '        if (s) {',
            '            w[n].app.destroy();',
            '            w[n] = null;',
            '            b.removeChild(s);',
            '        } else {',
            '            s = d.createElement("script");',
            '            s.id = i;',
            '            s.type = "text/javascript";',
            '            s.src = "' + scriptUrl + '";',
            '            s.async = false;',
            '            s.setAttribute("data-channel", "' + channel + '");',
            '            b.appendChild(s);',
            '        }',
            '    } else {',
            '        alert("Ne fonctionne que sur Nainwak ! Vous devez être connecté à votre nain dans le jeu.");',
            '    }',
            '}())'
        ];
        return lines.join('\n').replace(/\s+/g, ' ');
    }

    function initialize(selector) {
        var buttons = document.querySelectorAll(selector || '.nanylet');
        Array.prototype.forEach.call(buttons, function (button) {
            var channel = button.getAttribute('data-channel'),
                href = getInjectionUrl(settings.scriptUrl, channel);
            button.setAttribute('href', href);
        });<commit_msg>Compressed the code a little bit<commit_after>/* Initialize the bookmarklet buttons */
define(['./nainwak', './settings'], function (nainwak, settings) {
    function getInjectionUrl(scriptUrl, channel) {
        var lines = [
            'javascript:(function () {',
            'var w = window,',
            '    l = w.location,',
            '    u = l.origin + l.pathname,',
            '    d = document,',
            '    b = d.body,',
            '    n = "nany",',
            '    i = n + "Script",',
            '    s = d.getElementById(i);',
            'if (u === "' + nainwak.gameUrl() + '") {',
            '    if (s) {',
            '        w[n].app.destroy();',
            '        w[n] = null;',
            '        b.removeChild(s);',
            '    } else {',
            '        s = d.createElement("script");',
            '        s.id = i;',
            '        s.type = "text/javascript";',
            '        s.src = "' + scriptUrl + '";',
            '        s.async = false;',
            '        s.setAttribute("data-channel", "' + channel + '");',
            '        b.appendChild(s);',
            '    }',
            '} else {',
            '    alert("Ne fonctionne que sur Nainwak ! Vous devez être connecté à votre nain dans le jeu.");',
            '}',
            '}())'
        ];
        return lines.join('\n').replace(/\s+/g, ' ');
    }

    function initialize(selector) {
        var buttons = document.querySelectorAll(selector || '.nanylet');
        Array.prototype.forEach.call(buttons, function (button) {
            var channel = button.getAttribute('data-channel'),
                href = getInjectionUrl(settings.scriptUrl, channel);
            button.setAttribute('href', href);
        });
{'fraction_non_alphanumeric': 0.16911560853895205, 'fraction_numerical': 0.0, 'mean_word_length': 1.2806573957016434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4117611', 'n_tokens_mistral': 1014, 'n_tokens_neox': 1010, 'n_words': 191}