<commit_before>/** 
 * @version 1.0
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2010 <NAME>
 */
D3content = {
    createDiv: function(title, text)
    {
        text = D3content.base64_decode(text);
        var hr = document.createElement('hr'),
            infoDiv,
            infoText,
            infoHeading,
            infoClipboardCopy,
            backUrl,
            resizeHandle,
            heading,
            closeElem,
            centerBottomResize,
            startX,
            startY,
            startWidth,
            startHeight;

        if(!document.getElementById('D3-inject')) {
            infoDiv           = document.createElement('div');
            infoDiv.id        = 'D3-inject';
            infoDiv.className = 'content';

            backUrl = chrome.extension.getURL("images/grip.png"),

            resizeHandle                        = document.createElement('div');
            resizeHandle.id                     = 'D3-inject_handle';
            resizeHandle.className              = 'handle vertical';
            resizeHandle.style.backgroundColor  = '#333';
            resizeHandle.style.backgroundImage  = 'url(\'' + backUrl + '\')';
            resizeHandle.style.backgroundRepeat = ' no-repeat;';

            heading           = document.createElement('h1');
            heading.id        = 'D3-inject-heading';
            heading.innerText = 'd3coder Output:';

            closeElem           = document.createElement('a');
            closeElem.id        = 'D3-inject-close';
            closeElem.innerText = 'CLOSE [X]';

            document.body.appendChild(resizeHandle);
            document.body.appendChild(infoDiv);
            document.getElementById('D3-inject').appendChild(closeElem);
            document.getElementById('D3-inject').appendChild(heading);
            document.getElementById('D3-inject').appendChild(hr);

            document.getElementById('D3-inject-close').addEventListener('click', function(){
                document.getElementById('D3-inject').parentNode.removeChild();
                document.getElementById('D3-inject-close').parentNode.removeChild();
            });

            document.getElementById('D3-inject_handle').addEventListener('mousedown', initDrag, false);

            function initDrag(e) {
                function doDrag(e) {
                    var y = startHeight + (startY - e.clientY);
                    if (y < 100) {
                        return;
                    }

                    document.getElementById('D3-inject').style.height = 
                        y + 'px';
                    document.getElementById('D3-inject_handle').style.bottom =
                        y + 'px';
                }

                function stopDrag(e) {
                    document.documentElement.removeEventListener('mousemove', doDrag, false);
                    document.documentElement.removeEventListener('mouseup', stopDrag, false);
                }

                startY = e.clientY;
                startHeight = parseInt(
                                  document.defaultView.getComputedStyle(
                                      document.getElementById('D3-inject')
                                  ).height,
                              10);

                document.documentElement.addEventListener('mousemove', doDrag, false);
                document.documentElement.addEventListener('mouseup', stopDrag, false);
            }
        } else {
            infoDiv = document.getElementById('D3-inject');
        }

        infoHeading           = document.createElement('h3');
        infoHeading.className = 'D3-inject-heading';
        infoHeading.innerText = title;

        infoText           = document.createElement('pre');
        infoText.className = 'D3-inject-text';
        infoText.innerText = text;

        infoClipboardCopy              = document.createElement('a');
        infoClipboardCopy.href         = 'javascript:void';
        infoClipboardCopy.innerText    = ' ';
        infoClipboardCopy.style.width  = 20;
        infoClipboardCopy.style.height = 20;
        infoClipboardCopy.style.backgroundImage = 'url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5Ojf/2wBDAQoKCg0MDRoPDxo3JR8lNzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzf/wAARCAAUABQDASIAAhEBAxEB/8QAGAABAAMBAAAAAAAAAAAAAAAAAAQFBgf/xAAmEAABAwQCAQMFAAAAAAAAAAABAgMEAAUGERIhYRMiMQcjY5Gz/8QAFQEBAQAAAAAAAAAAAAAAAAAABAP/xAAcEQACAQUBAAAAAAAAAAAAAAAAAQIDERIx0SL/2gAMAwEAAhEDEQA/AOnZVerjbp1rg2lmOt+cp3an0qUEpQkKOgkgk6J/XmqGdkWR2aG5NdQy+y2pBeS/FcbI2dew70OyOjvXfZq1ydfHNsS8ql/zFQ/qOtQw24FSSPez8j8go8m8Zu+uIvFK8FbfTcUpSkEDPZNjMa9ORpD0yfHejKV6TkZ7gU8hpWjo/OhVCnBIkz7Uy83x9kkcmnZnJKu99jj4pSi1EsxNN+TeNN+kgJ5rX5WdmlKUoMf/2Q==)';<commit_msg>Updated dragging with disabled text selection<commit_after>/** 
 * @version 1.0
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2010 <NAME>
 */
D3content = {
    createDiv: function(title, text)
    {
        text = D3content.base64_decode(text);
        var hr = document.createElement('hr'),
            infoDiv,
            infoText,
            infoHeading,
            infoClipboardCopy,
            backUrl,
            resizeHandle,
            heading,
            closeElem,
            centerBottomResize,
            startX,
            startY,
            startWidth,
            startHeight;

        if(!document.getElementById('D3-inject')) {
            infoDiv           = document.createElement('div');
            infoDiv.id        = 'D3-inject';
            infoDiv.className = 'content';

            backUrl = chrome.extension.getURL("images/grip.png"),

            resizeHandle                        = document.createElement('div');
            resizeHandle.id                     = 'D3-inject_handle';
            resizeHandle.className              = 'handle vertical';
            resizeHandle.style.backgroundColor  = '#333';
            resizeHandle.style.backgroundImage  = 'url(\'' + backUrl + '\')';
            resizeHandle.style.backgroundRepeat = ' no-repeat;';

            heading           = document.createElement('h1');
            heading.id        = 'D3-inject-heading';
            heading.innerText = 'd3coder Output:';

            closeElem           = document.createElement('a');
            closeElem.id        = 'D3-inject-close';
            closeElem.innerText = 'CLOSE [X]';

            document.body.appendChild(resizeHandle);
            document.body.appendChild(infoDiv);
            document.getElementById('D3-inject').appendChild(closeElem);
            document.getElementById('D3-inject').appendChild(heading);
            document.getElementById('D3-inject').appendChild(hr);

            document.getElementById('D3-inject-close').addEventListener('click', function(){
                document.getElementById('D3-inject').parentNode.removeChild();
                document.getElementById('D3-inject-close').parentNode.removeChild();
            });

            document.getElementById('D3-inject_handle').addEventListener('mousedown', initDrag, false);

            function initDrag(e) {
                var oldSelectStart = document.body.onselectstart;
                document.body.onselectstart = function() {return false;};

                function doDrag(e) {
                    var y = startHeight + (startY - e.clientY);
                    if (y < 100) {
                        return;
                    }

                    document.getElementById('D3-inject').style.height = 
                        y + 'px';
                    document.getElementById('D3-inject_handle').style.bottom =
                        y + 'px';
                }

                function stopDrag(e) {
                    document.documentElement.removeEventListener('mousemove', doDrag, false);
                    document.documentElement.removeEventListener('mouseup', stopDrag, false);
                    document.body.onselectstart=oldSelectStart;
                }

                startY = e.clientY;
                startHeight = parseInt(
                                  document.defaultView.getComputedStyle(
                                      document.getElementById('D3-inject')
                                  ).height,
                              10);

                document.documentElement.addEventListener('mousemove', doDrag, false);
                document.documentElement.addEventListener('mouseup', stopDrag, false);
            }
        } else {
            infoDiv = document.getElementById('D3-inject');
        }

        infoHeading           = document.createElement('h3');
        infoHeading.className = 'D3-inject-heading';
        infoHeading.innerText = title;

        infoText           = document.createElement('pre');
        infoText.className = 'D3-inject-text';
        infoText.innerText = text;

        infoClipboardCopy              = document.createElement('a');
        infoClipboardCopy.href         = 'javascript:void';
        infoClipboardCopy.innerText    = ' ';
        infoClipboardCopy.style.width  = 20;
        infoClipboardCopy.style.height = 20;
        infoClipboardCopy.style.backgroundImage = 'url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5Ojf/2wBDAQoKCg0MDRoPDxo3JR8lNzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzf/wAARCAAUABQDASIAAhEBAxEB/8QAGAABAAMBAAAAAAAAAAAAAAAAAAQFBgf/xAAmEAABAwQCAQMFAAAAAAAAAAABAgMEAAUGERIhYRMiMQcjY5Gz/8QAFQEBAQAAAAAAAAAAAAAAAAAABAP/xAAcEQACAQUBAAAAAAAAAAAAAAAAAQIDERIx0SL/2gAMAwEAAhEDEQA/AOnZVerjbp1rg2lmOt+cp3an0qUEpQkKOgkgk6J/XmqGdkWR2aG5NdQy+y2pBeS/FcbI2dew70OyOjvXfZq1ydfHNsS8ql/zFQ/qOtQw24FSSPez8j8go8m8Zu+uIvFK8FbfTcUpSkEDPZNjMa9ORpD0yfHejKV6TkZ7gU8hpWjo/<KEY>)';
{'fraction_non_alphanumeric': 0.10095717884130982, 'fraction_numerical': 0.022670025188916875, 'mean_word_length': 1.9366863905325444, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5481252', 'n_tokens_mistral': 3098, 'n_tokens_neox': 2858, 'n_words': 308}