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

@@ -29,8 +29,24 @@ Skyscraper.prototype.open = function () {
this.divAdSpace.innerHTML = `<iframe this.divAdSpace.innerHTML = `<iframe
data-aa="1811738" data-aa="1811738"
src="//ad.a-ads.com/1811738?size=160x600${adsColours}" src="//ad.a-ads.com/1811738?size=160x600${adsColours}"
style="width:160px; height:600px; border:0px; padding:0; overflow:hidden; background-color: transparent;" > style="width:160px; height:600px; border:0px; padding:0; overflow:hidden; background-color: transparent;">
</iframe>` </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 { } else {
return return
} }

View File

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

View File

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

View File

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

View File

@@ -87,25 +87,32 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
// propellerPopup = 2 // propellerPopup = 2
) )
vd.AdSkyscraperType = aAdsSkyscraper
// Intn returns a number up to n, but never n itself. So to get a random 0 // 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 // or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc // splits like 1/3 1/4, etc
switch i := rand.Intn(10); i { switch i := rand.Intn(20); i {
case 0: 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: case 1, 2, 3:
vd.AdBannerType = adsPlus vd.AdSkyscraperType = pixfutureSkyscraper
case 4, 5, 6:
vd.AdBannerType = pixFuture
case 7:
vd.AdBannerType = publisherrest1
case 8:
vd.AdBannerType = publisherrest2
case 9:
vd.AdBannerType = publisherrest3
default: default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i)) 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, "formatData": tm.formatData,
"formatSC": tm.formatSC, "formatSC": tm.formatSC,
"noescape": tm.noEscape, "noescape": tm.noEscape,
"noescapeJS": tm.noEscapeJS,
"slashes": tm.slashes,
}) })
// Parse dynamic templates // Parse dynamic templates
@@ -296,9 +298,9 @@ func (tm *TemplateManager) formatSC(amt float64) string {
} }
return fmtSize(amt/1e-24, "H") return fmtSize(amt/1e-24, "H")
} }
func (tm *TemplateManager) noEscape(t string) template.HTML { func (tm *TemplateManager) noEscape(t string) template.HTML { return template.HTML(t) }
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 { func detectInt(i interface{}) int {
switch v := i.(type) { 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 // Strict means the Cookie will only be sent when the user
// reaches a page by a link from the same domain. Lax means any // reaches a page by a link from the same domain. Lax means any
// page on the domain gets the cookie and None means embedded // page on the domain gets the cookie and None means embedded
// content also gets the cookie. We're not trying to track the // content also gets the cookie.
// user around the web so we use lax //
SameSite: http.SameSiteLaxMode, // 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, Secure: true,
} }
f.Extra.RedirectTo = "/user" f.Extra.RedirectTo = "/user"