<commit_before>/*eslint-env browser */
/* jshint browser: true, esnext: true */

/**
* Does this UA's primary pointer support true hovering
* OR does the UA at least not try to quirkily emulate hovering,
* such that :hover CSS styles are appropriate?
* Essentially tries to shim the `@media (hover: hover)` CSS media query feature.
* @type {boolean}
*/
export function supportsTrueHover() {
    if (!window.matchMedia) {
        // Opera Mini, IE<=9, or ancient; per http://caniuse.com/#feat=matchmedia
        var ua = navigator.userAgent;
        if (ua.indexOf("Opera Mini") > -1) {
            // Opera Mini doesn't support true hovering
            return false;
        }
        if (
            ua.indexOf('IEMobile') > -1 || ua.indexOf('Windows Phone') > -1 ||
            ua.indexOf('XBLWP7') > -1 || ua.indexOf('ZuneWP7') > -1 || // IE Mobile 9 in desktop view
            ua.indexOf('Windows CE') > -1 // out of an abundance of caution
        ) {
            // IE Mobile <=9
            return false;
        }
        // UA is ancient enough to probably be a desktop computer or at least not attempt emulation of hover.
        return true;
    }

    // CSSWG Media Queries Level 4 draft
    //     http://drafts.csswg.org/mediaqueries/#hover
    if (window.matchMedia(
            '(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none),' +
            '(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)'
    ).matches) {
        // true hovering explicitly not supported by primary pointer
        return false;
    }
    if (window.matchMedia('(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)').matches) {
        // true hovering explicitly supported by primary pointer
        return true;
    }
    // `hover` media feature not implemented by this browser; keep probing

    // Touch generally implies that hovering is merely emulated,
    // which doesn't count as true hovering support for our purposes
    // due to the quirkiness of the emulation (e.g. :hover being sticky).

    // W3C Pointer Events LC WD, 13 November 2014
    //     http://www.w3.org/TR/2014/WD-pointerevents-20141113/
    // Prefixed in IE10, per http://caniuse.com/#feat=pointer
    var supportsPointerEvents = window.PointerEvent || window.MSPointerEvent;
    if (supportsPointerEvents) {
        var pointerEventsIsTouch = (window.navigator.maxTouchPoints || window.navigator.msMaxTouchPoints) > 0;
        return !pointerEventsIsTouch;
    }

    // Mozilla's -moz-touch-enabled
    //     https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#-moz-touch-enabled
    if (window.matchMedia('(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)').matches) {
        return false;<commit_msg>use ES6 const keyword<commit_after>/*eslint-env browser */
/* jshint browser: true, esnext: true */

/**
* Does this UA's primary pointer support true hovering
* OR does the UA at least not try to quirkily emulate hovering,
* such that :hover CSS styles are appropriate?
* Essentially tries to shim the `@media (hover: hover)` CSS media query feature.
* @type {boolean}
*/
export function supportsTrueHover() {
    if (!window.matchMedia) {
        // Opera Mini, IE<=9, or ancient; per http://caniuse.com/#feat=matchmedia
        const ua = navigator.userAgent;
        if (ua.indexOf("Opera Mini") > -1) {
            // Opera Mini doesn't support true hovering
            return false;
        }
        if (
            ua.indexOf('IEMobile') > -1 || ua.indexOf('Windows Phone') > -1 ||
            ua.indexOf('XBLWP7') > -1 || ua.indexOf('ZuneWP7') > -1 || // IE Mobile 9 in desktop view
            ua.indexOf('Windows CE') > -1 // out of an abundance of caution
        ) {
            // IE Mobile <=9
            return false;
        }
        // UA is ancient enough to probably be a desktop computer or at least not attempt emulation of hover.
        return true;
    }

    // CSSWG Media Queries Level 4 draft
    //     http://drafts.csswg.org/mediaqueries/#hover
    if (window.matchMedia(
            '(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none),' +
            '(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)'
    ).matches) {
        // true hovering explicitly not supported by primary pointer
        return false;
    }
    if (window.matchMedia('(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)').matches) {
        // true hovering explicitly supported by primary pointer
        return true;
    }
    // `hover` media feature not implemented by this browser; keep probing

    // Touch generally implies that hovering is merely emulated,
    // which doesn't count as true hovering support for our purposes
    // due to the quirkiness of the emulation (e.g. :hover being sticky).

    // W3C Pointer Events LC WD, 13 November 2014
    //     http://www.w3.org/TR/2014/WD-pointerevents-20141113/
    // Prefixed in IE10, per http://caniuse.com/#feat=pointer
    const supportsPointerEvents = window.PointerEvent || window.MSPointerEvent;
    if (supportsPointerEvents) {
        const pointerEventsIsTouch = (window.navigator.maxTouchPoints || window.navigator.msMaxTouchPoints) > 0;
        return !pointerEventsIsTouch;
    }

    // Mozilla's -moz-touch-enabled
    //     https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#-moz-touch-enabled
    if (window.matchMedia('(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)').matches) {
        return false;
{'fraction_non_alphanumeric': 0.1314487632508834, 'fraction_numerical': 0.01254416961130742, 'mean_word_length': 2.555904522613065, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6120436', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1625, 'n_words': 488}