Add warning about pop-up ads

This commit is contained in:
2021-06-21 10:50:19 +02:00
parent ee3553ac6f
commit 5b9ff106df
3 changed files with 18 additions and 4 deletions

View File

@@ -125,6 +125,13 @@
transform-origin: 0 0;
}
/* Pop-up warning (row 5) */
.file_viewer > .popup_warn {
background-color: var(--layer_1_color);
border-top: 1px solid var(--layer_1_color_border);
text-align: center;
}
/* Toolbars */
.file_viewer > .file_viewer_window > .file_viewer_toolbar {
position: absolute;

View File

@@ -152,6 +152,13 @@
</div>
{{ end }}
</div>
{{ if and (and .Other.FileAdsEnabled .Other.UserAdsEnabled) (ne .Other.AdPopupType 0) }}
<div class="popup_warn">
You are viewing a large file ( > 250 MB ). Pop-up ads have been
enabled to cover bandwidth cost.
</div>
{{ end }}
</div>
<template id="tpl_details_popup">

View File

@@ -78,12 +78,12 @@ func (vd *viewerData) adType(files []pixelapi.ListFile) {
// 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(4); i {
case 0: // 25%
switch i := rand.Intn(8); i {
case 0: // 12.5%
vd.AdBannerType = clickAduBanner
case 1: // 25%
case 1, 2: // 25%
vd.AdBannerType = brave
case 2, 3: // 50%
case 3, 4, 5, 6, 7: // 62.5%
vd.AdBannerType = aAds
default:
panic(fmt.Errorf("random number generator returned unrecognised number: %d", i))