<commit_before>function background() {
    var qrcode;

    chrome.contextMenus.create({
        "id": "QRtubeContextMenu",
        "title": "QRtube",
        "contexts": ["page", "selection", "link", "image"]
    });

    chrome.contextMenus.onClicked.addListener(function(info, tab) {
        if (tab) {

            var content;
            if (info.linkUrl) {
                content = info.linkUrl;
            } else if (info.selectionText) {
                content = info.selectionText;
            } else if (info.mediaType === "image") {
                content = tab.srcUrl;
            } else {
                content = tab.url;
            }

            /* Inject the code into the current tab */
            chrome.tabs.executeScript(tab.id, { code: 'QRcodeContent = "' + content + '";' });
            chrome.tabs.executeScript(tab.id, { file: "inject.js" });
        }
    });

    function updateQRcode(content) {
        if (qrcode == null) {
            qrcode = new QRCode($("#floater")[0], {
                text: content,
                width: 128,
                height: 128
            });

        } else {
            qrcode.clear();
            qrcode.makeCode(content);
        }
    };
};

background();
<commit_msg>fixed a bug for when generating code for image<commit_after>function background() {
    var qrcode;

    chrome.contextMenus.create({
        "id": "QRtubeContextMenu",
        "title": "QRtube",
        "contexts": ["page", "selection", "link", "image"]
    });

    chrome.contextMenus.onClicked.addListener(function(info, tab) {
        if (tab) {

            var content;
            if (info.linkUrl) {
                content = info.linkUrl;
            } else if (info.selectionText) {
                content = info.selectionText;
            } else if (info.mediaType === "image") {
                content = info.srcUrl;
            } else {
                content = tab.url;
            }

            /* Inject the code into the current tab */
            chrome.tabs.executeScript(tab.id, { code: 'QRcodeContent = "' + content + '";' });
            chrome.tabs.executeScript(tab.id, { file: "inject.js" });
        }
    });

    function updateQRcode(content) {
        if (qrcode == null) {
            qrcode = new QRCode($("#floater")[0], {
                text: content,
                width: 128,
                height: 128
            });

        } else {
            qrcode.clear();
            qrcode.makeCode(content);
        }
    };
};

background();

{'fraction_non_alphanumeric': 0.1382306477093207, 'fraction_numerical': 0.005529225908372828, 'mean_word_length': 1.5054401582591495, 'pattern_counts': {'":': 6, '<': 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': '4459542', 'n_tokens_mistral': 769, 'n_tokens_neox': 698, 'n_words': 148}