add banner ad view counting

This commit is contained in:
Wim Brand
2020-02-21 13:14:21 +01:00
parent f17e58df29
commit e4eb24d8d1
6 changed files with 56 additions and 2 deletions

View File

@@ -56,8 +56,8 @@ function Viewer(type, viewToken, data) {
this.setFile(fileFromSkyNet(data))
}
// this.renderSponsors()
// window.addEventListener("resize", e => { this.renderSponsors(e) })
this.renderSponsorsSimple()
window.addEventListener("resize", e => { this.renderSponsorsSimple() })
// Register keyboard shortcuts
document.addEventListener("keydown", e => { this.keyboardEvent(e) })
@@ -138,6 +138,24 @@ Viewer.prototype.setFile = function(file) {
}
}
Viewer.prototype.renderSponsorsSimple = function() {
let scale = 1
let scaleWidth = 1
let scaleHeight = 1
let minWidth = 768
let minHeight = 1000
if (window.innerWidth < minWidth) {
scaleWidth = window.innerWidth/minWidth
}
if (window.innerHeight < minHeight) {
scaleHeight = window.innerHeight/minHeight
}
scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight
document.querySelector(".sponsors").style.height = (scale*128)+"px"
}
// Viewer.prototype.renderSponsors = function() {
// let scale = 1
// let scaleWidth = 1