mq4-hover-shim
Advanced tools
@@ -9,9 +9,8 @@ /*! | ||
| !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.mq4HoverShim=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
| "use strict"; | ||
| 'use strict'; | ||
| var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; }; | ||
| var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
| exports.__esModule = true; | ||
| /** | ||
@@ -27,3 +26,3 @@ * Does this UA's primary pointer support true hovering | ||
| exports.supportsTrueHover = supportsTrueHover; | ||
| /*eslint-env browser */ | ||
| /*eslint-env browser, es6 */ | ||
| /*eslint no-var:2*/ | ||
@@ -38,4 +37,6 @@ /* jshint browser: true, esnext: true */ | ||
| try { | ||
| var jQuery = _interopRequireWildcard(require("jquery")); | ||
| var _import = require('jquery'); | ||
| var jQuery = _interopRequireWildcard(_import); | ||
| return jQuery; | ||
@@ -45,3 +46,3 @@ } catch (importErr) { | ||
| if (!globaljQuery) { | ||
| throw new Error("mq4HoverShim needs jQuery (or similar)"); | ||
| throw new Error('mq4HoverShim needs jQuery (or similar)'); | ||
| } | ||
@@ -60,3 +61,3 @@ return globaljQuery; | ||
| function triggerEvent() { | ||
| $(document).trigger($.Event("mq4hsChange", { bubbles: false, trueHover: canTrulyHover })); | ||
| $(document).trigger($.Event('mq4hsChange', { bubbles: false, trueHover: canTrulyHover })); | ||
| } | ||
@@ -88,8 +89,8 @@ | ||
| // http://drafts.csswg.org/mediaqueries/#hover | ||
| var HOVER_NONE = "(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none)"; | ||
| var HOVER_ON_DEMAND = "(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)"; | ||
| var HOVER_HOVER = "(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)"; | ||
| if (window.matchMedia("" + HOVER_NONE + "," + HOVER_ON_DEMAND + "," + HOVER_HOVER).matches) { | ||
| var HOVER_NONE = '(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none)'; | ||
| var HOVER_ON_DEMAND = '(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)'; | ||
| var HOVER_HOVER = '(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)'; | ||
| if (window.matchMedia('' + HOVER_NONE + ',' + HOVER_ON_DEMAND + ',' + HOVER_HOVER).matches) { | ||
| // Browser understands the `hover` media feature | ||
| var hoverCallback = function (mql) { | ||
| var hoverCallback = function hoverCallback(mql) { | ||
| var doesMatch = mql.matches; | ||
@@ -128,3 +129,3 @@ if (doesMatch !== canTrulyHover) { | ||
| // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#-moz-touch-enabled | ||
| var touchEnabledQuery = window.matchMedia("(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)"); | ||
| var touchEnabledQuery = window.matchMedia('(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)'); | ||
| if (touchEnabledQuery.matches) { | ||
@@ -138,3 +139,3 @@ canTrulyHover = false; | ||
| // http://www.w3.org/TR/2013/REC-touch-events-20131010/ | ||
| if ("ontouchstart" in window) { | ||
| if ('ontouchstart' in window) { | ||
| canTrulyHover = false; | ||
@@ -148,7 +149,7 @@ triggerEvent(); | ||
| triggerEvent(); | ||
| })();function supportsTrueHover() { | ||
| })(); | ||
| function supportsTrueHover() { | ||
| return canTrulyHover; | ||
| } | ||
| exports.__esModule = true; | ||
| },{"jquery":undefined}]},{},[1])(1) | ||
| }); |
@@ -1,8 +0,7 @@ | ||
| "use strict"; | ||
| 'use strict'; | ||
| var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; }; | ||
| var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
| exports.__esModule = true; | ||
| /** | ||
@@ -18,3 +17,3 @@ * Does this UA's primary pointer support true hovering | ||
| exports.supportsTrueHover = supportsTrueHover; | ||
| /*eslint-env browser */ | ||
| /*eslint-env browser, es6 */ | ||
| /*eslint no-var:2*/ | ||
@@ -29,4 +28,6 @@ /* jshint browser: true, esnext: true */ | ||
| try { | ||
| var jQuery = _interopRequireWildcard(require("jquery")); | ||
| var _import = require('jquery'); | ||
| var jQuery = _interopRequireWildcard(_import); | ||
| return jQuery; | ||
@@ -36,3 +37,3 @@ } catch (importErr) { | ||
| if (!globaljQuery) { | ||
| throw new Error("mq4HoverShim needs jQuery (or similar)"); | ||
| throw new Error('mq4HoverShim needs jQuery (or similar)'); | ||
| } | ||
@@ -51,3 +52,3 @@ return globaljQuery; | ||
| function triggerEvent() { | ||
| $(document).trigger($.Event("mq4hsChange", { bubbles: false, trueHover: canTrulyHover })); | ||
| $(document).trigger($.Event('mq4hsChange', { bubbles: false, trueHover: canTrulyHover })); | ||
| } | ||
@@ -79,8 +80,8 @@ | ||
| // http://drafts.csswg.org/mediaqueries/#hover | ||
| var HOVER_NONE = "(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none)"; | ||
| var HOVER_ON_DEMAND = "(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)"; | ||
| var HOVER_HOVER = "(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)"; | ||
| if (window.matchMedia("" + HOVER_NONE + "," + HOVER_ON_DEMAND + "," + HOVER_HOVER).matches) { | ||
| var HOVER_NONE = '(hover: none),(-moz-hover: none),(-ms-hover: none),(-webkit-hover: none)'; | ||
| var HOVER_ON_DEMAND = '(hover: on-demand),(-moz-hover: on-demand),(-ms-hover: on-demand),(-webkit-hover: on-demand)'; | ||
| var HOVER_HOVER = '(hover: hover),(-moz-hover: hover),(-ms-hover: hover),(-webkit-hover: hover)'; | ||
| if (window.matchMedia('' + HOVER_NONE + ',' + HOVER_ON_DEMAND + ',' + HOVER_HOVER).matches) { | ||
| // Browser understands the `hover` media feature | ||
| var hoverCallback = function (mql) { | ||
| var hoverCallback = function hoverCallback(mql) { | ||
| var doesMatch = mql.matches; | ||
@@ -119,3 +120,3 @@ if (doesMatch !== canTrulyHover) { | ||
| // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#-moz-touch-enabled | ||
| var touchEnabledQuery = window.matchMedia("(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)"); | ||
| var touchEnabledQuery = window.matchMedia('(touch-enabled),(-moz-touch-enabled),(-ms-touch-enabled),(-webkit-touch-enabled)'); | ||
| if (touchEnabledQuery.matches) { | ||
@@ -129,3 +130,3 @@ canTrulyHover = false; | ||
| // http://www.w3.org/TR/2013/REC-touch-events-20131010/ | ||
| if ("ontouchstart" in window) { | ||
| if ('ontouchstart' in window) { | ||
| canTrulyHover = false; | ||
@@ -139,5 +140,5 @@ triggerEvent(); | ||
| triggerEvent(); | ||
| })();function supportsTrueHover() { | ||
| })(); | ||
| function supportsTrueHover() { | ||
| return canTrulyHover; | ||
| } | ||
| exports.__esModule = true; | ||
| } |
+5
-5
| { | ||
| "name": "mq4-hover-shim", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "description": "A shim for the Media Queries Level 4 `hover` @media feature", | ||
@@ -35,3 +35,3 @@ "scripts": { | ||
| "dependencies": { | ||
| "css-mediaquery": "^0.1.2", | ||
| "css-mq-parser": "^0.0.2", | ||
| "postcss": "^4.0.0" | ||
@@ -41,8 +41,8 @@ }, | ||
| "grunt": "^0.4.5", | ||
| "grunt-6to5": "^3.0.0", | ||
| "grunt-babel": "^5.0.0", | ||
| "grunt-browserify": "^3.2.1", | ||
| "grunt-contrib-jshint": "^0.11.0", | ||
| "grunt-contrib-nodeunit": "^0.4.1", | ||
| "grunt-eslint": "^5.0.0", | ||
| "grunt-jscs": "^1.0.0", | ||
| "grunt-eslint": "^10.0.0", | ||
| "grunt-jscs": "^1.5.0", | ||
| "jscs-jsdoc": "^0.4.0", | ||
@@ -49,0 +49,0 @@ "load-grunt-tasks": "^3.0.0", |
+3
-2
@@ -143,4 +143,5 @@ # mq4-hover-shim | ||
| ## Grunt | ||
| Use [grunt-postcss](https://github.com/nDmitry/grunt-postcss) to invoke the mq4-hover-shim CSS postprocessor via [Grunt](http://gruntjs.com/) task. | ||
| ## Grunt, Gulp | ||
| * **Grunt**: Use [grunt-postcss](https://github.com/nDmitry/grunt-postcss) to invoke the mq4-hover-shim CSS postprocessor via [Grunt](http://gruntjs.com/) task. | ||
| * **Gulp**: Use [gulp-postcss](https://github.com/w0rm/gulp-postcss) to invoke the mq4-hover-shim CSS postprocessor via [Gulp](http://gulpjs.com/) task. | ||
@@ -147,0 +148,0 @@ ## Contributing |
@@ -1,2 +0,2 @@ | ||
| /*eslint-env browser */ | ||
| /*eslint-env browser, es6 */ | ||
| /*eslint no-var:2*/ | ||
@@ -3,0 +3,0 @@ /* jshint browser: true, esnext: true */ |
@@ -12,3 +12,3 @@ /*eslint-env node */ | ||
| var postcss = require('postcss'); | ||
| var mediaQuery = require('css-mediaquery'); | ||
| var parseMediaQuery = require('css-mq-parser'); | ||
@@ -18,3 +18,3 @@ | ||
| function mediaTypeIfSimpleHoverHover(atRule) { | ||
| var mediaOrs = mediaQuery.parse(atRule.params); | ||
| var mediaOrs = parseMediaQuery(atRule.params); | ||
| if (mediaOrs.length !== 1) { | ||
@@ -21,0 +21,0 @@ return false; |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
33635
0.84%471
0.86%162
0.62%1
-66.67%+ Added
+ Added
- Removed
- Removed