Comparing version 1.1.2 to 1.2.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/Developmint/vue-if-bot/compare/v1.1.2...v1.2.0) (2018-07-22) | ||
### Features | ||
* remove nested div from dummy element ([34e8180](https://github.com/Developmint/vue-if-bot/commit/34e8180)) | ||
<a name="1.1.2"></a> | ||
@@ -7,0 +17,0 @@ ## [1.1.2](https://github.com/Developmint/vue-if-bot/compare/v1.1.1...v1.1.2) (2018-05-23) |
@@ -7,9 +7,21 @@ 'use strict'; | ||
var children = _ref.children, | ||
slots = _ref.slots, | ||
_ref$props = _ref.props, | ||
regex = _ref$props.regex, | ||
invert = _ref$props.invert; | ||
var dummyEl = h('div', {}, []); | ||
if (process.server) { | ||
return dummyEl; | ||
} | ||
var botRegex = regex || /bot|googlebot|crawler|spider|robot|crawling/i; | ||
var isBot = process.server ? true : navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var isBot = navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var shouldShow = invert ? isBot : !isBot; | ||
return h('div', {}, shouldShow ? children : [h('div')]); | ||
if (!shouldShow) { | ||
return dummyEl; | ||
} | ||
return h('div', {}, slots().default); | ||
} | ||
@@ -16,0 +28,0 @@ }; |
@@ -5,9 +5,21 @@ var index = { | ||
var children = _ref.children, | ||
slots = _ref.slots, | ||
_ref$props = _ref.props, | ||
regex = _ref$props.regex, | ||
invert = _ref$props.invert; | ||
var dummyEl = h('div', {}, []); | ||
if (process.server) { | ||
return dummyEl; | ||
} | ||
var botRegex = regex || /bot|googlebot|crawler|spider|robot|crawling/i; | ||
var isBot = process.server ? true : navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var isBot = navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var shouldShow = invert ? isBot : !isBot; | ||
return h('div', {}, shouldShow ? children : [h('div')]); | ||
if (!shouldShow) { | ||
return dummyEl; | ||
} | ||
return h('div', {}, slots().default); | ||
} | ||
@@ -14,0 +26,0 @@ }; |
@@ -11,9 +11,21 @@ (function (global, factory) { | ||
var children = _ref.children, | ||
slots = _ref.slots, | ||
_ref$props = _ref.props, | ||
regex = _ref$props.regex, | ||
invert = _ref$props.invert; | ||
var dummyEl = h('div', {}, []); | ||
if (process.server) { | ||
return dummyEl; | ||
} | ||
var botRegex = regex || /bot|googlebot|crawler|spider|robot|crawling/i; | ||
var isBot = process.server ? true : navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var isBot = navigator.userAgent && botRegex.test(navigator.userAgent); | ||
var shouldShow = invert ? isBot : !isBot; | ||
return h('div', {}, shouldShow ? children : [h('div')]); | ||
if (!shouldShow) { | ||
return dummyEl; | ||
} | ||
return h('div', {}, slots().default); | ||
} | ||
@@ -20,0 +32,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ifBot=t()}(this,function(){"use strict";return{functional:!0,render:function(e,t){var r=t.children,n=t.props,o=n.regex,i=n.invert,d=o||/bot|googlebot|crawler|spider|robot|crawling/i,f=!!process.server||navigator.userAgent&&d.test(navigator.userAgent);return e("div",{},(i?f:!f)?r:[e("div")])}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ifBot=t()}(this,function(){"use strict";return{functional:!0,render:function(e,t){t.children;var r=t.slots,n=t.props,o=n.regex,i=n.invert,f=e("div",{},[]);if(process.server)return f;var s=o||/bot|googlebot|crawler|spider|robot|crawling/i,u=navigator.userAgent&&s.test(navigator.userAgent);return(i?u:!u)?e("div",{},r().default):f}}}); | ||
//# sourceMappingURL=vue-if-bot.min.js.map |
{ | ||
"name": "vue-if-bot", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Hide stuff from bots (especially cookie consents)", | ||
@@ -5,0 +5,0 @@ "author": "Alexander Lichter <npm@lichter.io>", |
export default { | ||
functional: true, | ||
render (h, { children, props: { regex, invert } }) { | ||
render (h, { children, slots, props: { regex, invert } }) { | ||
const dummyEl = h('div', {}, []) | ||
if (process.server) { | ||
return dummyEl | ||
} | ||
const botRegex = regex || /bot|googlebot|crawler|spider|robot|crawling/i | ||
const isBot = process.server ? true : navigator.userAgent && botRegex.test(navigator.userAgent) | ||
const isBot = navigator.userAgent && botRegex.test(navigator.userAgent) | ||
const shouldShow = invert ? isBot : !isBot | ||
return h('div', {}, shouldShow ? children : [h('div')]) | ||
if (!shouldShow) { | ||
return dummyEl | ||
} | ||
return h('div', {}, slots().default) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12885
92