tweak ad rates

This commit is contained in:
2020-11-08 16:10:11 +01:00
parent 51c195266e
commit d67d593cdb
2 changed files with 11 additions and 14 deletions

View File

@@ -167,7 +167,7 @@
{{ else if eq .Other.AdType 7}} {{ else if eq .Other.AdType 7}}
<iframe class="sponsors_banner" src="/ad/revenuehits" style="width:728px; height:90px; border:none; padding:0; overflow:hidden;" scrolling="no"></iframe> <iframe class="sponsors_banner" src="/ad/revenuehits" style="width:728px; height:90px; border:none; padding:0; overflow:hidden;" scrolling="no"></iframe>
{{ else if eq .Other.AdType 8}} {{ else if eq .Other.AdType 8}}
<a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="/brave"> <a class="sponsors_banner" style="display: inline-block; width: 728px; height: 90px;" href="https://brave.com/pix009">
<img src="/res/img/misc/brave-728x90.png" style="width: 100%; height: 100%" /> <img src="/res/img/misc/brave-728x90.png" style="width: 100%; height: 100%" />
</a> </a>
{{end}} {{end}}

View File

@@ -29,12 +29,7 @@ func browserCompat(ua string) bool {
return strings.Contains(ua, "MSIE") || strings.Contains(ua, "Trident/7.0") return strings.Contains(ua, "MSIE") || strings.Contains(ua, "Trident/7.0")
} }
func adType() (i int) { func adType() int {
// Intn returns a number up to n, but never n itself. So it 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
i = rand.Intn(5)
const ( const (
aAds = 0 aAds = 0
amarulaElectronics = 1 amarulaElectronics = 1
@@ -47,16 +42,18 @@ func adType() (i int) {
brave = 8 brave = 8
) )
switch i { // Intn returns a number up to n, but never n itself. So it get a random 0
case 0, 1: // 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(12); i {
case 0, 1, 2, 3, 4:
return amarulaSolutions return amarulaSolutions
case 5, 6, 7, 8:
case 2:
return adMaven return adMaven
case 9, 10:
case 3, 4:
return brave return brave
case 11:
return aAds
default: default:
panic(fmt.Errorf( panic(fmt.Errorf(
"random number generator returned unrecognised number: %d", i), "random number generator returned unrecognised number: %d", i),