<commit_before>function viewPDFContent(url) {
    PDFJS.disableWorker = true;
    'use strict';

    pdfDoc = null;
    pageNum = 1;
    scale = 1;
    document.getElementById('pdf_content_display').style['display'] = 'block';
    canvas = document.getElementById('pdf-display-canvas');
    ctx = canvas.getContext('2d');

    //
    // Asynchronously download PDF as an ArrayBuffer
    //
    show_large_ajax_loader("ajax_loader");
    PDFJS.getDocument(url).then(function getPdfHelloWorld(_pdfDoc) {
        pdfDoc = _pdfDoc;
        renderPage(pageNum);
    });

}
<commit_msg>pdf inline only works on  html5 supporting browser<commit_after>function viewPDFContent(url) {
    if (isCanvasSupportBrowser){
        PDFJS.disableWorker = true;
        'use strict';

        pdfDoc = null;
        pageNum = 1;
        scale = 1;
        document.getElementById('pdf_content_display').style['display'] = 'block';
        canvas = document.getElementById('pdf-display-canvas');
        ctx = canvas.getContext('2d');

        //
        // Asynchronously download PDF as an ArrayBuffer
        //
        show_large_ajax_loader("ajax_loader");
        PDFJS.getDocument(url).then(function getPdfHelloWorld(_pdfDoc) {
            pdfDoc = _pdfDoc;
            renderPage(pageNum);
        });
    }else{
        alert('Your browser does not support html5 to view the pdf file inline, please upgrade the browser')
    }
}

function isCanvasSupportBrowser(){
    var test_canvas = document.createElement("canvas") //try and create sample canvas element
    var canvas_check=(test_canvas.getContext)? true : false //check if object supports getContext() method, a method of the canvas element
    return canvas_check;
}

{'fraction_non_alphanumeric': 0.10903790087463557, 'fraction_numerical': 0.004664723032069971, 'mean_word_length': 2.9630484988452657, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6059382', 'n_tokens_mistral': 478, 'n_tokens_neox': 472, 'n_words': 115}