keep-out-polyfill
Advanced tools
Comparing version 1.2.16 to 1.2.17
@@ -0,0 +0,0 @@ import buble from 'rollup-plugin-buble'; |
import 'key-board-hook'; | ||
(function(){ | ||
(function () { | ||
var KeepOut = function KeepOut() { | ||
@@ -10,3 +10,3 @@ this.winHeight = window.innerHeight; | ||
this.dispatchResize = false; | ||
this.keyHeight = 0; | ||
@@ -18,3 +18,3 @@ this.clientY = 0; | ||
}; | ||
KeepOut.prototype.init = function init () { | ||
@@ -41,19 +41,19 @@ this.initOrientation(); | ||
KeepOut.prototype.touchFn = function touchFn (){ | ||
KeepOut.prototype.touchFn = function touchFn () { | ||
var transform = window.getComputedStyle(document.body, null).getPropertyValue('transform'); | ||
var transformMatrix = transform.slice(7, transform.length - 1).split(', '); | ||
var translateY = transformMatrix[transformMatrix.length -1]; | ||
if(translateY && translateY < 0){ | ||
window.addEventListener('touchmove',this.touchmoveFn); | ||
window.addEventListener('touchend',this.touchendFn); | ||
var translateY = transformMatrix[transformMatrix.length - 1]; | ||
if (translateY && translateY < 0) { | ||
window.addEventListener('touchmove', this.touchmoveFn); | ||
window.addEventListener('touchend', this.touchendFn); | ||
} | ||
}; | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn (){ | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn () { | ||
}; | ||
KeepOut.prototype.touchendFn = function touchendFn (){ | ||
window.removeEventListener('touchmove',this.mouseMove); | ||
window.removeEventListener('touchend',this.mouseUp); | ||
KeepOut.prototype.touchendFn = function touchendFn () { | ||
window.removeEventListener('touchmove', this.mouseMove); | ||
window.removeEventListener('touchend', this.mouseUp); | ||
}; | ||
KeepOut.prototype.isResize = function isResize () { | ||
@@ -67,16 +67,16 @@ // 配合keyboard事件使用 | ||
}; | ||
KeepOut.prototype.getKeiHeight = function getKeiHeight () { | ||
if(this.isKeepOut){ | ||
if (this.isKeepOut) { | ||
this.keyHeight = screen.availHeight - window.innerHeight - 50; | ||
} | ||
else{ | ||
else { | ||
this.keyHeight = window.innerHeight / 2; | ||
} | ||
}; | ||
KeepOut.prototype.onceComput = function onceComput () { | ||
if(this.dispatchResize) { return; } | ||
if (this.dispatchResize) { return; } | ||
this.dispatchResize = true; | ||
if(this.isKeepOut === null){ | ||
if (this.isKeepOut === null) { | ||
this.isKeepOut = this.isResize(); | ||
@@ -86,6 +86,6 @@ this.getKeiHeight(); | ||
}; | ||
KeepOut.prototype.focusFn = function focusFn () { | ||
if(this.clientY > this.keyHeight) { | ||
if(this.isKeepOut === false || this.isbodyHide){ | ||
if (this.clientY > this.keyHeight) { | ||
if (this.isKeepOut === false || this.isbodyHide) { | ||
var polyfill = this.clientY - this.keyHeight; | ||
@@ -97,7 +97,7 @@ document.body.style.transition = '0.2s'; | ||
}; | ||
KeepOut.prototype.blurFn = function blurFn () { | ||
document.body.style.transform = "translateY(0px)"; | ||
}; | ||
KeepOut.prototype.initFocus = function initFocus () { | ||
@@ -110,6 +110,6 @@ var this$1 = this; | ||
var _this = this$1; | ||
this$1.status = true; | ||
if(this$1.fnQuery.length){ | ||
this$1.fnQuery.forEach(function (fn){ | ||
if (this$1.fnQuery.length) { | ||
this$1.fnQuery.forEach(function (fn) { | ||
fn.call(_this); | ||
@@ -123,7 +123,7 @@ }); | ||
this$1.onceComput(); | ||
if(this$1.status){ | ||
if (this$1.status) { | ||
this$1.focusFn(); | ||
this$1.status = false; | ||
} | ||
else{ | ||
else { | ||
this$1.fnQuery.push(this$1.focusFn); | ||
@@ -133,3 +133,3 @@ } | ||
}; | ||
KeepOut.prototype.initBlur = function initBlur () { | ||
@@ -143,3 +143,28 @@ var this$1 = this; | ||
}; | ||
new KeepOut(); | ||
var browser = { | ||
versions: function () { | ||
var u = navigator.userAgent; | ||
return { | ||
trident: u.indexOf('Trident') > -1, //IE内核 | ||
presto: u.indexOf('Presto') > -1, //opera内核 | ||
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 | ||
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核 | ||
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 | ||
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 | ||
android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 | ||
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 | ||
iPad: u.indexOf('iPad') > -1, //是否iPad | ||
webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 | ||
weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) | ||
qq: u.match(/\sQQ/i) == " qq" //是否QQ | ||
}; | ||
}(), | ||
language: (navigator.browserLanguage || navigator.language).toLowerCase() | ||
}; | ||
if((browser.versions.mobile||browser.versions.android) && !browser.versions.ios){ | ||
new KeepOut(); | ||
} | ||
})(); |
(function () { | ||
'use strict'; | ||
(function(){ | ||
(function () { | ||
var KeepOut = function KeepOut() { | ||
@@ -11,3 +11,3 @@ this.winHeight = window.innerHeight; | ||
this.dispatchResize = false; | ||
this.keyHeight = 0; | ||
@@ -19,3 +19,3 @@ this.clientY = 0; | ||
}; | ||
KeepOut.prototype.init = function init () { | ||
@@ -42,19 +42,19 @@ this.initOrientation(); | ||
KeepOut.prototype.touchFn = function touchFn (){ | ||
KeepOut.prototype.touchFn = function touchFn () { | ||
var transform = window.getComputedStyle(document.body, null).getPropertyValue('transform'); | ||
var transformMatrix = transform.slice(7, transform.length - 1).split(', '); | ||
var translateY = transformMatrix[transformMatrix.length -1]; | ||
if(translateY && translateY < 0){ | ||
window.addEventListener('touchmove',this.touchmoveFn); | ||
window.addEventListener('touchend',this.touchendFn); | ||
var translateY = transformMatrix[transformMatrix.length - 1]; | ||
if (translateY && translateY < 0) { | ||
window.addEventListener('touchmove', this.touchmoveFn); | ||
window.addEventListener('touchend', this.touchendFn); | ||
} | ||
}; | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn (){ | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn () { | ||
}; | ||
KeepOut.prototype.touchendFn = function touchendFn (){ | ||
window.removeEventListener('touchmove',this.mouseMove); | ||
window.removeEventListener('touchend',this.mouseUp); | ||
KeepOut.prototype.touchendFn = function touchendFn () { | ||
window.removeEventListener('touchmove', this.mouseMove); | ||
window.removeEventListener('touchend', this.mouseUp); | ||
}; | ||
KeepOut.prototype.isResize = function isResize () { | ||
@@ -68,16 +68,16 @@ // 配合keyboard事件使用 | ||
}; | ||
KeepOut.prototype.getKeiHeight = function getKeiHeight () { | ||
if(this.isKeepOut){ | ||
if (this.isKeepOut) { | ||
this.keyHeight = screen.availHeight - window.innerHeight - 50; | ||
} | ||
else{ | ||
else { | ||
this.keyHeight = window.innerHeight / 2; | ||
} | ||
}; | ||
KeepOut.prototype.onceComput = function onceComput () { | ||
if(this.dispatchResize) { return; } | ||
if (this.dispatchResize) { return; } | ||
this.dispatchResize = true; | ||
if(this.isKeepOut === null){ | ||
if (this.isKeepOut === null) { | ||
this.isKeepOut = this.isResize(); | ||
@@ -87,6 +87,6 @@ this.getKeiHeight(); | ||
}; | ||
KeepOut.prototype.focusFn = function focusFn () { | ||
if(this.clientY > this.keyHeight) { | ||
if(this.isKeepOut === false || this.isbodyHide){ | ||
if (this.clientY > this.keyHeight) { | ||
if (this.isKeepOut === false || this.isbodyHide) { | ||
var polyfill = this.clientY - this.keyHeight; | ||
@@ -98,7 +98,7 @@ document.body.style.transition = '0.2s'; | ||
}; | ||
KeepOut.prototype.blurFn = function blurFn () { | ||
document.body.style.transform = "translateY(0px)"; | ||
}; | ||
KeepOut.prototype.initFocus = function initFocus () { | ||
@@ -111,6 +111,6 @@ var this$1 = this; | ||
var _this = this$1; | ||
this$1.status = true; | ||
if(this$1.fnQuery.length){ | ||
this$1.fnQuery.forEach(function (fn){ | ||
if (this$1.fnQuery.length) { | ||
this$1.fnQuery.forEach(function (fn) { | ||
fn.call(_this); | ||
@@ -124,7 +124,7 @@ }); | ||
this$1.onceComput(); | ||
if(this$1.status){ | ||
if (this$1.status) { | ||
this$1.focusFn(); | ||
this$1.status = false; | ||
} | ||
else{ | ||
else { | ||
this$1.fnQuery.push(this$1.focusFn); | ||
@@ -134,3 +134,3 @@ } | ||
}; | ||
KeepOut.prototype.initBlur = function initBlur () { | ||
@@ -144,5 +144,30 @@ var this$1 = this; | ||
}; | ||
new KeepOut(); | ||
var browser = { | ||
versions: function () { | ||
var u = navigator.userAgent; | ||
return { | ||
trident: u.indexOf('Trident') > -1, //IE内核 | ||
presto: u.indexOf('Presto') > -1, //opera内核 | ||
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 | ||
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核 | ||
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 | ||
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 | ||
android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 | ||
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 | ||
iPad: u.indexOf('iPad') > -1, //是否iPad | ||
webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 | ||
weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) | ||
qq: u.match(/\sQQ/i) == " qq" //是否QQ | ||
}; | ||
}(), | ||
language: (navigator.browserLanguage || navigator.language).toLowerCase() | ||
}; | ||
if((browser.versions.mobile||browser.versions.android) && !browser.versions.ios){ | ||
new KeepOut(); | ||
} | ||
})(); | ||
}()); |
@@ -6,3 +6,3 @@ (function (factory) { | ||
(function(){ | ||
(function () { | ||
var KeepOut = function KeepOut() { | ||
@@ -14,3 +14,3 @@ this.winHeight = window.innerHeight; | ||
this.dispatchResize = false; | ||
this.keyHeight = 0; | ||
@@ -22,3 +22,3 @@ this.clientY = 0; | ||
}; | ||
KeepOut.prototype.init = function init () { | ||
@@ -45,19 +45,19 @@ this.initOrientation(); | ||
KeepOut.prototype.touchFn = function touchFn (){ | ||
KeepOut.prototype.touchFn = function touchFn () { | ||
var transform = window.getComputedStyle(document.body, null).getPropertyValue('transform'); | ||
var transformMatrix = transform.slice(7, transform.length - 1).split(', '); | ||
var translateY = transformMatrix[transformMatrix.length -1]; | ||
if(translateY && translateY < 0){ | ||
window.addEventListener('touchmove',this.touchmoveFn); | ||
window.addEventListener('touchend',this.touchendFn); | ||
var translateY = transformMatrix[transformMatrix.length - 1]; | ||
if (translateY && translateY < 0) { | ||
window.addEventListener('touchmove', this.touchmoveFn); | ||
window.addEventListener('touchend', this.touchendFn); | ||
} | ||
}; | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn (){ | ||
KeepOut.prototype.touchmoveFn = function touchmoveFn () { | ||
}; | ||
KeepOut.prototype.touchendFn = function touchendFn (){ | ||
window.removeEventListener('touchmove',this.mouseMove); | ||
window.removeEventListener('touchend',this.mouseUp); | ||
KeepOut.prototype.touchendFn = function touchendFn () { | ||
window.removeEventListener('touchmove', this.mouseMove); | ||
window.removeEventListener('touchend', this.mouseUp); | ||
}; | ||
KeepOut.prototype.isResize = function isResize () { | ||
@@ -71,16 +71,16 @@ // 配合keyboard事件使用 | ||
}; | ||
KeepOut.prototype.getKeiHeight = function getKeiHeight () { | ||
if(this.isKeepOut){ | ||
if (this.isKeepOut) { | ||
this.keyHeight = screen.availHeight - window.innerHeight - 50; | ||
} | ||
else{ | ||
else { | ||
this.keyHeight = window.innerHeight / 2; | ||
} | ||
}; | ||
KeepOut.prototype.onceComput = function onceComput () { | ||
if(this.dispatchResize) { return; } | ||
if (this.dispatchResize) { return; } | ||
this.dispatchResize = true; | ||
if(this.isKeepOut === null){ | ||
if (this.isKeepOut === null) { | ||
this.isKeepOut = this.isResize(); | ||
@@ -90,6 +90,6 @@ this.getKeiHeight(); | ||
}; | ||
KeepOut.prototype.focusFn = function focusFn () { | ||
if(this.clientY > this.keyHeight) { | ||
if(this.isKeepOut === false || this.isbodyHide){ | ||
if (this.clientY > this.keyHeight) { | ||
if (this.isKeepOut === false || this.isbodyHide) { | ||
var polyfill = this.clientY - this.keyHeight; | ||
@@ -101,7 +101,7 @@ document.body.style.transition = '0.2s'; | ||
}; | ||
KeepOut.prototype.blurFn = function blurFn () { | ||
document.body.style.transform = "translateY(0px)"; | ||
}; | ||
KeepOut.prototype.initFocus = function initFocus () { | ||
@@ -114,6 +114,6 @@ var this$1 = this; | ||
var _this = this$1; | ||
this$1.status = true; | ||
if(this$1.fnQuery.length){ | ||
this$1.fnQuery.forEach(function (fn){ | ||
if (this$1.fnQuery.length) { | ||
this$1.fnQuery.forEach(function (fn) { | ||
fn.call(_this); | ||
@@ -127,7 +127,7 @@ }); | ||
this$1.onceComput(); | ||
if(this$1.status){ | ||
if (this$1.status) { | ||
this$1.focusFn(); | ||
this$1.status = false; | ||
} | ||
else{ | ||
else { | ||
this$1.fnQuery.push(this$1.focusFn); | ||
@@ -137,3 +137,3 @@ } | ||
}; | ||
KeepOut.prototype.initBlur = function initBlur () { | ||
@@ -147,5 +147,30 @@ var this$1 = this; | ||
}; | ||
new KeepOut(); | ||
var browser = { | ||
versions: function () { | ||
var u = navigator.userAgent; | ||
return { | ||
trident: u.indexOf('Trident') > -1, //IE内核 | ||
presto: u.indexOf('Presto') > -1, //opera内核 | ||
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 | ||
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核 | ||
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 | ||
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 | ||
android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 | ||
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 | ||
iPad: u.indexOf('iPad') > -1, //是否iPad | ||
webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 | ||
weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) | ||
qq: u.match(/\sQQ/i) == " qq" //是否QQ | ||
}; | ||
}(), | ||
language: (navigator.browserLanguage || navigator.language).toLowerCase() | ||
}; | ||
if((browser.versions.mobile||browser.versions.android) && !browser.versions.ios){ | ||
new KeepOut(); | ||
} | ||
})(); | ||
})); |
{ | ||
"name": "keep-out-polyfill", | ||
"version": "1.2.16", | ||
"version": "1.2.17", | ||
"main": "dist/keep-out-polyfill.umd.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/keep-out-polyfill.esm.js", |
@@ -0,0 +0,0 @@ # keep-out-polyfill |
import 'key-board-hook' | ||
(function(){ | ||
(function () { | ||
class KeepOut { | ||
@@ -11,3 +12,3 @@ constructor() { | ||
this.dispatchResize = false | ||
this.keyHeight = 0 | ||
@@ -19,3 +20,3 @@ this.clientY = 0 | ||
} | ||
init() { | ||
@@ -40,19 +41,19 @@ this.initOrientation() | ||
touchFn(){ | ||
touchFn() { | ||
let transform = window.getComputedStyle(document.body, null).getPropertyValue('transform') | ||
let transformMatrix = transform.slice(7, transform.length - 1).split(', ') | ||
let translateY = transformMatrix[transformMatrix.length -1] | ||
if(translateY && translateY < 0){ | ||
window.addEventListener('touchmove',this.touchmoveFn) | ||
window.addEventListener('touchend',this.touchendFn) | ||
let translateY = transformMatrix[transformMatrix.length - 1] | ||
if (translateY && translateY < 0) { | ||
window.addEventListener('touchmove', this.touchmoveFn) | ||
window.addEventListener('touchend', this.touchendFn) | ||
} | ||
} | ||
touchmoveFn(){ | ||
touchmoveFn() { | ||
} | ||
touchendFn(){ | ||
window.removeEventListener('touchmove',this.mouseMove) | ||
window.removeEventListener('touchend',this.mouseUp) | ||
touchendFn() { | ||
window.removeEventListener('touchmove', this.mouseMove) | ||
window.removeEventListener('touchend', this.mouseUp) | ||
} | ||
isResize() { | ||
@@ -66,16 +67,16 @@ // 配合keyboard事件使用 | ||
} | ||
getKeiHeight () { | ||
if(this.isKeepOut){ | ||
getKeiHeight() { | ||
if (this.isKeepOut) { | ||
this.keyHeight = screen.availHeight - window.innerHeight - 50 | ||
} | ||
else{ | ||
else { | ||
this.keyHeight = window.innerHeight / 2 | ||
} | ||
} | ||
onceComput () { | ||
if(this.dispatchResize) return; | ||
onceComput() { | ||
if (this.dispatchResize) return; | ||
this.dispatchResize = true | ||
if(this.isKeepOut === null){ | ||
if (this.isKeepOut === null) { | ||
this.isKeepOut = this.isResize() | ||
@@ -85,6 +86,6 @@ this.getKeiHeight() | ||
} | ||
focusFn() { | ||
if(this.clientY > this.keyHeight) { | ||
if(this.isKeepOut === false || this.isbodyHide){ | ||
if (this.clientY > this.keyHeight) { | ||
if (this.isKeepOut === false || this.isbodyHide) { | ||
let polyfill = this.clientY - this.keyHeight | ||
@@ -96,7 +97,7 @@ document.body.style.transition = '0.2s' | ||
} | ||
blurFn() { | ||
document.body.style.transform = `translateY(0px)` | ||
} | ||
initFocus() { | ||
@@ -107,6 +108,6 @@ window.addEventListener('click', (e) => { | ||
let _this = this | ||
this.status = true | ||
if(this.fnQuery.length){ | ||
this.fnQuery.forEach(fn=>{ | ||
if (this.fnQuery.length) { | ||
this.fnQuery.forEach(fn => { | ||
fn.call(_this) | ||
@@ -120,7 +121,7 @@ }) | ||
this.onceComput() | ||
if(this.status){ | ||
if (this.status) { | ||
this.focusFn() | ||
this.status = false | ||
} | ||
else{ | ||
else { | ||
this.fnQuery.push(this.focusFn) | ||
@@ -130,3 +131,3 @@ } | ||
} | ||
initBlur() { | ||
@@ -139,4 +140,29 @@ window.addEventListener('keyboardBlur', () => { | ||
} | ||
new KeepOut() | ||
var browser = { | ||
versions: function () { | ||
var u = navigator.userAgent | ||
return { | ||
trident: u.indexOf('Trident') > -1, //IE内核 | ||
presto: u.indexOf('Presto') > -1, //opera内核 | ||
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 | ||
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核 | ||
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 | ||
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 | ||
android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 | ||
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 | ||
iPad: u.indexOf('iPad') > -1, //是否iPad | ||
webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 | ||
weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) | ||
qq: u.match(/\sQQ/i) == " qq" //是否QQ | ||
}; | ||
}(), | ||
language: (navigator.browserLanguage || navigator.language).toLowerCase() | ||
} | ||
if((browser.versions.mobile||browser.versions.android) && !browser.versions.ios){ | ||
new KeepOut() | ||
} | ||
})() | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
587
355580