remove ad

This commit is contained in:
Wim Brand
2020-02-05 17:24:40 +01:00
parent dd1ccfea11
commit ecab08b5ae
2 changed files with 33 additions and 42 deletions

View File

@@ -54,8 +54,8 @@ function Viewer(type, viewToken, data) {
this.setFile(fileFromSkyNet(data)) this.setFile(fileFromSkyNet(data))
} }
this.renderSponsors() // this.renderSponsors()
window.addEventListener("resize", e => { this.renderSponsors(e) }) // window.addEventListener("resize", e => { this.renderSponsors(e) })
// Register keyboard shortcuts // Register keyboard shortcuts
document.addEventListener("keydown", e => { this.keyboardEvent(e) }) document.addEventListener("keydown", e => { this.keyboardEvent(e) })
@@ -129,40 +129,40 @@ Viewer.prototype.setFile = function(file) {
} }
} }
Viewer.prototype.renderSponsors = function() { // Viewer.prototype.renderSponsors = function() {
let scale = 1 // let scale = 1
let scaleWidth = 1 // let scaleWidth = 1
let scaleHeight = 1 // let scaleHeight = 1
let minWidth = 728 // let minWidth = 728
let minHeight = 800 // let minHeight = 800
if (window.innerWidth < minWidth) { // if (window.innerWidth < minWidth) {
scaleWidth = window.innerWidth/minWidth // scaleWidth = window.innerWidth/minWidth
} // }
if (window.innerHeight < minHeight) { // if (window.innerHeight < minHeight) {
scaleHeight = window.innerHeight/minHeight // scaleHeight = window.innerHeight/minHeight
} // }
scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight // scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight
// Because of the scale transformation the automatic margins don't work // // Because of the scale transformation the automatic margins don't work
// anymore. So we have to maunally calculate the margin. Where we take the // // anymore. So we have to maunally calculate the margin. Where we take the
// width of the viewport - the width of the ad to calculate the amount of // // width of the viewport - the width of the ad to calculate the amount of
// pixels around the ad. We multiply the ad size by the scale we calcualted // // pixels around the ad. We multiply the ad size by the scale we calcualted
// to account for the smaller size. // // to account for the smaller size.
let offset = (window.innerWidth - (minWidth*scale)) / 2 // let offset = (window.innerWidth - (minWidth*scale)) / 2
if (offset < 0) { // if (offset < 0) {
offset = 0 // offset = 0
} // }
document.querySelector(".sponsors > iframe").style.marginLeft = offset+"px" // document.querySelector(".sponsors > iframe").style.marginLeft = offset+"px"
if (scale == 1) { // if (scale == 1) {
document.querySelector(".sponsors > iframe").style.transform = "none" // document.querySelector(".sponsors > iframe").style.transform = "none"
document.querySelector(".sponsors").style.height = "90px" // document.querySelector(".sponsors").style.height = "90px"
} else { // } else {
document.querySelector(".sponsors > iframe").style.transform = "scale("+scale+")" // document.querySelector(".sponsors > iframe").style.transform = "scale("+scale+")"
document.querySelector(".sponsors").style.height = (scale*90)+"px" // document.querySelector(".sponsors").style.height = (scale*90)+"px"
} // }
} // }
Viewer.prototype.keyboardEvent = function(evt) { Viewer.prototype.keyboardEvent = function(evt) {
if (evt.ctrlKey || evt.altKey) { if (evt.ctrlKey || evt.altKey) {

View File

@@ -95,15 +95,6 @@
<div class="center" style="width: 100px; height: 100px;">{{template "spinner.svg" .}}</div> <div class="center" style="width: 100px; height: 100px;">{{template "spinner.svg" .}}</div>
</div> </div>
</div> </div>
<div id="sponsors" class="sponsors">
<!-- scrolling="no" is not allowed by the W3C, but overflow: hidden doesn't work in chrome, so I have no choice -->
<iframe
data-aa="73974"
src="//ad.a-ads.com/73974?size=728x90&background_color={{.Style.Layer1Color.RGB}}&text_color={{.Style.TextColor.RGB}}&title_color={{.Style.HighlightColor.RGB}}&title_hover_color={{.Style.HighlightColor.RGB}}&link_color={{.Style.HighlightColor.RGB}}&link_hover_color={{.Style.HighlightColor.RGB}}"
style="width:728px; height:90px; border:none; padding:0; overflow:hidden;"
scrolling="no">
</iframe>
</div>
<!-- Popup windows, hidden by default --> <!-- Popup windows, hidden by default -->
<div id="details_popup" class="popup details_popup"> <div id="details_popup" class="popup details_popup">