Fix pixfuture skyscraper

This commit is contained in:
2021-10-19 12:07:04 +02:00
parent fc8a9fe9d1
commit 21cd1ddd01
7 changed files with 55 additions and 23 deletions

View File

@@ -31,6 +31,22 @@ Skyscraper.prototype.open = function () {
src="//ad.a-ads.com/1811738?size=160x600${adsColours}"
style="width:160px; height:600px; border:0px; padding:0; overflow:hidden; background-color: transparent;">
</iframe>`
} else if (skyscraperType === "pixfuture") {
let div = document.createElement("div")
div.id = "27513x160x600x4605x_ADSLOT1"
div.setAttribute("clickTrack", "%%CLICK_URL_ESC%%")
this.divAdSpace.appendChild(div)
let script = document.createElement("script")
script.async = "async"
script.type = "text/javascript"
script.src = "https:\/\/served-by.pixfuture.com/www/delivery/headerbid.js"
script.setAttribute("slotId", "27513x160x600x4605x_ADSLOT1")
script.setAttribute("refreshTime", "5")
script.setAttribute("refreshInterval", "60")
document.head.appendChild(script)
} else {
return
}

View File

@@ -27,8 +27,8 @@ VideoViewer.prototype.render = function (parent) {
parent.appendChild(vidContainer)
// Possible fix for ios 15 video bug?
this.videoSource.src = this.file.get_href
this.videoSource.type = this.file.mime_type
videoSource.src = this.file.get_href
videoSource.type = this.file.mime_type
} else {
let container = document.createElement("div")
container.classList = "image-container"

View File

@@ -180,6 +180,11 @@
transition: right 0.5s;
background-color: var(--layer_2_color);
}
.file_viewer > .file_viewer_window > .skyscraper > .skyscraper_ad_space {
width: 100%;
height: 100%;
}
/* =====================
== FILE CONTAINERS ==

View File

@@ -150,7 +150,7 @@
<button id="btn_skyscraper_close" class="round">
<i class="icon">close</i> Close ad
</button>
<div id="skyscraper_ad_space"></div>
<div id="skyscraper_ad_space" class="skyscraper_ad_space"></div>
</div>
</div>

View File

@@ -87,25 +87,32 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
// propellerPopup = 2
)
vd.AdSkyscraperType = aAdsSkyscraper
// Intn returns a number up to n, but never n itself. So to get a random 0
// or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc
switch i := rand.Intn(10); i {
switch i := rand.Intn(20); i {
case 0:
vd.AdBannerType = brave
vd.AdBannerType = publisherrest1 // 5%, total 5%
case 1:
vd.AdBannerType = publisherrest2 // 5%, total 10%
case 2:
vd.AdBannerType = publisherrest3 // 5%, total 15%
case 3, 4, 5:
vd.AdBannerType = brave // 15%, total 30%
case 6, 7, 8, 9, 10, 11, 12:
vd.AdBannerType = adsPlus // 35%, total 65%
case 13, 14, 15, 16, 17, 18, 19:
vd.AdBannerType = pixFuture // 35%, total 100%
default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))
}
switch i := rand.Intn(4); i {
case 0:
vd.AdSkyscraperType = aAdsSkyscraper
case 1, 2, 3:
vd.AdBannerType = adsPlus
case 4, 5, 6:
vd.AdBannerType = pixFuture
case 7:
vd.AdBannerType = publisherrest1
case 8:
vd.AdBannerType = publisherrest2
case 9:
vd.AdBannerType = publisherrest3
vd.AdSkyscraperType = pixfutureSkyscraper
default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))
}

View File

@@ -141,6 +141,8 @@ func (tm *TemplateManager) ParseTemplates(silent bool) {
"formatData": tm.formatData,
"formatSC": tm.formatSC,
"noescape": tm.noEscape,
"noescapeJS": tm.noEscapeJS,
"slashes": tm.slashes,
})
// Parse dynamic templates
@@ -296,9 +298,9 @@ func (tm *TemplateManager) formatSC(amt float64) string {
}
return fmtSize(amt/1e-24, "H")
}
func (tm *TemplateManager) noEscape(t string) template.HTML {
return template.HTML(t)
}
func (tm *TemplateManager) noEscape(t string) template.HTML { return template.HTML(t) }
func (tm *TemplateManager) noEscapeJS(t string) template.JS { return template.JS(t) }
func (tm *TemplateManager) slashes() template.HTML { return template.HTML("//") }
func detectInt(i interface{}) int {
switch v := i.(type) {

View File

@@ -216,9 +216,11 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) {
// Strict means the Cookie will only be sent when the user
// reaches a page by a link from the same domain. Lax means any
// page on the domain gets the cookie and None means embedded
// content also gets the cookie. We're not trying to track the
// user around the web so we use lax
SameSite: http.SameSiteLaxMode,
// content also gets the cookie.
//
// Users who see pixeldrain links in iframes also expect their
// accounts to be logged in so we need to use None
SameSite: http.SameSiteNoneMode,
Secure: true,
}
f.Extra.RedirectTo = "/user"