feat: add buysellads

pull/90/head
Eduardo San Martin Morote 5 years ago
parent d865a202e1
commit 2478b53c07

@ -8,13 +8,13 @@
<SideBar> <SideBar>
<template #top> <template #top>
<slot name="sidebar-top"> <slot name="sidebar-top">
<!-- <CarbonAds <!-- use the title to force a new ad for every navigation -->
<CarbonAds
v-if="$site.themeConfig.carbonAds" v-if="$site.themeConfig.carbonAds"
:key="$page.title" :key="$page.title"
:serve="$site.themeConfig.carbonAds.serve" :serve="$site.themeConfig.carbonAds.serve"
:placement="$site.themeConfig.carbonAds.placement" :placement="$site.themeConfig.carbonAds.placement"
/> --> />
Hello
</slot> </slot>
</template> </template>
<template #bottom> <template #bottom>
@ -28,7 +28,22 @@
@click="toggleSidebar(false)" @click="toggleSidebar(false)"
/> />
<main> <main>
<Page /> <Page>
<template #top>
<slot name="page-top" />
</template>
<template #bottom>
<slot name="page-bottom">
<!-- use the title to force a new ad for every navigation -->
<BuySellAds
v-if="$site.themeConfig.carbonAds"
:key="$page.title"
:serve="$site.themeConfig.carbonAds.serve"
:placement="$site.themeConfig.carbonAds.placement"
/>
</slot>
</template>
</Page>
</main> </main>
</div> </div>
<Debug /> <Debug />
@ -41,6 +56,7 @@ import ToggleSideBarButton from './components/ToggleSideBarButton.vue'
import SideBar from './components/SideBar.vue' import SideBar from './components/SideBar.vue'
import Page from './components/Page.vue' import Page from './components/Page.vue'
import CarbonAds from './components/CarbonAds.vue' import CarbonAds from './components/CarbonAds.vue'
import BuySellAds from './components/BuySellAds.vue'
export default { export default {
components: { components: {
@ -48,7 +64,8 @@ export default {
ToggleSideBarButton, ToggleSideBarButton,
SideBar, SideBar,
Page, Page,
CarbonAds CarbonAds,
BuySellAds
}, },
setup() { setup() {

@ -0,0 +1,109 @@
<script>
import { h, onMounted } from 'vue'
/* global _bsa */
const ID = 'bsa-cpc-script'
export default {
name: 'BuySellAds',
props: {
serve: {
type: String,
required: true
},
placement: {
type: String,
required: true
}
},
setup(props) {
function load() {
if (typeof _bsa !== 'undefined' && _bsa) {
_bsa.init('default', props.serve, `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()
}
})
return () =>
h('div', { class: 'bsa-cpc-wrapper' }, [h('div', { class: 'bsa-cpc' })])
}
}
</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 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>

@ -1,8 +1,10 @@
<template> <template>
<div class="content"> <div class="content">
<slot name="top" />
<Content /> <Content />
<NextAndPrevLinks /> <NextAndPrevLinks />
<PageEdit /> <PageEdit />
<slot name="bottom" />
</div> </div>
</template> </template>
@ -18,6 +20,7 @@ export default {
.content { .content {
margin: 0 auto; margin: 0 auto;
padding: 0.025rem 2.5rem 2rem; padding: 0.025rem 2.5rem 2rem;
/* if this is moved to a variable, add it to BuySellAds.vue */
max-width: 50rem; max-width: 50rem;
} }

Loading…
Cancel
Save