Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keep-out-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-out-polyfill - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

2

package.json
{
"name": "keep-out-polyfill",
"version": "1.2.4",
"version": "1.2.5",
"main": "dist/keep-out-polyfill.umd.js",

@@ -5,0 +5,0 @@ "module": "dist/keep-out-polyfill.esm.js",

@@ -1,83 +0,88 @@

class KeepOut {
constructor() {
this.winHeight = window.innerHeight;
this.navHeight = screen.availHeight - this.winHeight
this.isKeepOut = null
this.isbodyHide = null
this.keyHeight = 0
this.clientY = 0
this.init()
}
init() {
this.initOrientation()
this.initFocus()
this.initBlur()
}
initOrientation() {
window.addEventListener("orientationchange", () => {
(function(){
class KeepOut {
constructor() {
this.winHeight = window.innerHeight;
this.navHeight = screen.availHeight - this.winHeight
this.getKeiHeight()
});
}
isResize() {
// 配合keyboard事件使用
let curHeight = window.innerHeight;
if (Math.abs(curHeight - this.winHeight) > this.navHeight) {
return true
this.isKeepOut = null
this.isbodyHide = null
this.dispatchResize = false
this.keyHeight = 0
this.clientY = 0
this.init()
}
return false
}
getKeiHeight () {
if(this.isKeepOut){
this.keyHeight = screen.availHeight - window.innerHeight - 50
init() {
this.initOrientation()
this.initFocus()
this.initBlur()
}
}
onceComput () {
if(this.isKeepOut === null){
this.isKeepOut = this.isResize()
this.getKeiHeight()
initOrientation() {
window.addEventListener("orientationchange", () => {
this.winHeight = window.innerHeight;
this.navHeight = screen.availHeight - this.winHeight
this.dispatchResize = false
});
}
this.onceComput = function(){}
}
focusFn() {
if(this.isKeepOut === false || this.isbodyHide){
isResize() {
// 配合keyboard事件使用
let curHeight = window.innerHeight;
if (Math.abs(curHeight - this.winHeight) > this.navHeight) {
return true
}
return false
}
getKeiHeight () {
if(this.isKeepOut){
this.keyHeight = screen.availHeight - window.innerHeight - 50
}
else{
this.keyHeight = window.innerHeight * 2 / 5
}
}
onceComput () {
if(this.dispatchResize) return;
this.dispatchResize = true
if(this.isKeepOut === null){
this.isKeepOut = this.isResize()
this.getKeiHeight()
}
}
focusFn() {
if(this.clientY > this.keyHeight) {
let polyfill = this.clientY - this.keyHeight
document.body.style.transition = '0.2s'
document.body.style.transform = `translateY(-${polyfill}px)`
if(this.isKeepOut === false || this.isbodyHide){
let polyfill = this.clientY - this.keyHeight
document.body.style.transition = '0.2s'
document.body.style.transform = `translateY(-${polyfill}px)`
}
}
}
}
blurFn() {
if(this.isKeepOut === false || this.isbodyHide){
blurFn() {
document.body.style.transform = `translateY(0px)`
}
initFocus() {
window.addEventListener('click', (e) => {
let event = e || window.event
this.clientY = event.clientY
})
window.addEventListener('keyboardFocus', () => {
this.isbodyHide = window.getComputedStyle(document.body, null).getPropertyValue("overflow") === 'hidden'
this.onceComput()
this.focusFn()
})
}
initBlur() {
window.addEventListener('keyboardBlur', () => {
this.blurFn()
})
}
}
initFocus() {
window.addEventListener('click', (e) => {
let event = e || window.event
this.clientY = event.clientY
})
window.addEventListener('keyboardFocus', () => {
this.isbodyHide = window.getComputedStyle(document.body, null).getPropertyValue("overflow") === 'hidden'
this.onceComput()
this.focusFn()
})
}
initBlur() {
window.addEventListener('keyboardBlur', () => {
this.blurFn()
})
}
}
new KeepOut()
new KeepOut()
})()
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc