mirror of https://github.com/vuejs/vitepress
parent
b127aeeaf1
commit
3151e4d7b0
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div class="bsa-cpc-wrapper">
|
||||
<div class="bsa-cpc"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
/* global _bsa */
|
||||
const ID = 'bsa-cpc-script'
|
||||
|
||||
export default {
|
||||
name: 'BuySellAds',
|
||||
props: {
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
placement: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
function load() {
|
||||
if (typeof _bsa !== 'undefined' && _bsa) {
|
||||
_bsa.init('default', props.code, `placement:${props.placement}`, {
|
||||
target: '.bsa-cpc',
|
||||
align: 'horizontal',
|
||||
disable_css: 'true',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (!document.getElementById(ID)) {
|
||||
const s = document.createElement('script')
|
||||
s.id = ID
|
||||
s.src = `//m.servedby-buysellads.com/monetization.js`
|
||||
document.head.appendChild(s)
|
||||
s.onload = () => {
|
||||
load()
|
||||
}
|
||||
} else {
|
||||
load()
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.bsa-cpc-wrapper {
|
||||
font-size: 0.95rem;
|
||||
/* from Page.vue */
|
||||
max-width: 50rem;
|
||||
margin: 0px auto;
|
||||
padding: 1rem 2rem 0;
|
||||
margin-bottom: -1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 419px) {
|
||||
.bsa-cpc-wrapper {
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.bsa-cpc {
|
||||
font-size: 0.9em;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.bsa-cpc .default-text {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.bsa-cpc a._default_ {
|
||||
text-align: left;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
padding: 10px 15px 12px;
|
||||
margin-bottom: 20px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.bsa-cpc a._default_ .default-image img {
|
||||
height: 20px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
.bsa-cpc a._default_ .default-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bsa-cpc a._default_ .default-description:after {
|
||||
font-size: 0.85em;
|
||||
content: 'Sponsored';
|
||||
color: #1c90f3;
|
||||
border: 1px solid #1c90f3;
|
||||
border-radius: 3px;
|
||||
padding: 0 4px 1px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.bsa-cpc .default-ad {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bsa-cpc a._default_ .default-image,
|
||||
.bsa-cpc a._default_ .default-title,
|
||||
.bsa-cpc a._default_ .default-description {
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
margin-right: 6px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<div class="carbon-ads" ref="el"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
export default {
|
||||
name: 'CarbonAds',
|
||||
props: {
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
placement: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
const el = ref()
|
||||
|
||||
onMounted(() => {
|
||||
const s = document.createElement('script')
|
||||
s.id = '_carbonads_js'
|
||||
s.src = `//cdn.carbonads.com/carbon.js?serve=${props.code}&placement=${props.placement}`
|
||||
el.value.appendChild(s)
|
||||
})
|
||||
|
||||
return { el }
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.carbon-ads {
|
||||
min-height: 102px;
|
||||
padding: 1.5rem 1.5rem 0;
|
||||
font-size: 0.75rem;
|
||||
|
||||
width: 125px;
|
||||
position: fixed;
|
||||
z-index: 19;
|
||||
bottom: 0;
|
||||
right: 22px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 425px) {
|
||||
.carbon-ads {
|
||||
width: auto;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1300px) {
|
||||
.carbon-ads {
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
top: 12px;
|
||||
right: 20px;
|
||||
float: right;
|
||||
padding: 0 0 20px 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.carbon-ads a {
|
||||
color: #444;
|
||||
font-weight: normal;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.carbon-ads .carbon-img {
|
||||
float: left;
|
||||
margin-right: 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.carbon-ads .carbon-img img {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.carbon-ads .carbon-poweredby {
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
@media (max-width: 719px) {
|
||||
.carbon-ads .carbon-img img {
|
||||
width: 100px;
|
||||
height: 77px;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue