2020-10-30 22:15:08 -07:00
< template >
2020-11-03 21:29:45 -07:00
< div >
< div
v - if = "!showAlt"
class = "ethical-ad"
data - ea - publisher = "modrinth-com"
: data - ea - type = "type"
data - ea - manual = "true"
/ >
< div v-else class = "alt" >
< p >
2020-11-04 21:11:41 +02:00
A privacy - focused ad used to fund this site would ' ve been here . Please
2020-11-03 21:29:45 -07:00
disable your content blocker to support Modrinth and it ' s authors .
< / p >
< / div >
< / div >
2020-10-30 22:15:08 -07:00
< / template >
< script >
export default {
name : 'EthicalAd' ,
props : {
type : {
type : String ,
default : 'text' ,
} ,
} ,
2020-11-03 21:29:45 -07:00
data ( ) {
return {
showAlt : false ,
}
} ,
2020-10-30 22:15:08 -07:00
mounted ( ) {
try {
// eslint-disable-next-line no-undef
2020-11-03 21:29:45 -07:00
if ( typeof ethicalads === 'undefined' ) {
this . $notify ( {
group : 'ads' ,
title : 'Please disable your Content Blocker' ,
text :
'Modrinth uses privacy-focused ads, from EthicalAds. Ads are the only way that our site is able to pay modders and support itself. Our ads are non-intrusive and minimal, and we only have one per page. We can assure you that none of your data is sold or used for tracking purposes.' ,
type : 'error' ,
} )
this . showAlt = true
} else {
const element = document . getElementsByClassName ( 'ethical-ad' ) [ 0 ]
element . className = 'ethical-ad'
element . innerHTML = ''
2020-10-31 09:59:57 -07:00
2020-11-03 21:29:45 -07:00
// eslint-disable-next-line no-undef
ethicalads . load ( )
element . className = 'ethical-ad loaded ' + this . $colorMode . preference
}
2020-10-30 22:15:08 -07:00
} catch ( err ) {
// eslint-disable-next-line no-console
console . error ( err )
}
} ,
}
< / script >
2020-11-03 21:29:45 -07:00
< style lang = "scss" scoped >
2020-11-02 22:04:40 -07:00
[ data - ea - type = 'text' ] {
min - height : 70 px ;
}
2020-10-30 22:15:08 -07:00
[ data - ea - type = 'image' ] {
margin : auto 10 px ;
2020-11-02 22:04:40 -07:00
min - height : 260 px ;
2020-10-30 22:15:08 -07:00
}
2020-11-03 21:29:45 -07:00
. alt {
font - size : 14 px ;
border - radius : var ( -- size - rounded - sm ) ;
2020-11-30 15:34:04 -07:00
background - color : var ( -- color - raised - bg ) ;
2020-11-03 21:29:45 -07:00
box - shadow : 0 2 px 3 px rgba ( 0 , 0 , 0 , 0.15 ) ;
padding : 0.7 em 1 em ;
margin : 1 em 1 em 2 em 1 em ;
}
2020-10-30 22:15:08 -07:00
< / style >