mirror of
https://github.com/hacks-guide/Guide_Vita.git
synced 2024-11-23 17:49:42 +00:00
fixed ads
This commit is contained in:
parent
e899246fcb
commit
50de8f02a4
@ -1,6 +1,11 @@
|
|||||||
const config = require("./configs");
|
const config = require("./configs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
const adArr = [
|
||||||
|
{ slot: '/22046652915/vita-0', size: [[728, 90], [320, 50]], id: 'div-gpt-ad-1645091079164-0' },
|
||||||
|
{ slot: '/22046652915/vita-1', size: [[728, 90], [320, 50]], id: 'div-gpt-ad-1645091139070-0' }
|
||||||
|
]
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
locales: {
|
locales: {
|
||||||
'/': config.en_US.locales
|
'/': config.en_US.locales
|
||||||
@ -21,10 +26,7 @@ module.exports = {
|
|||||||
docsBranch: "master",
|
docsBranch: "master",
|
||||||
docsDir: "docs",
|
docsDir: "docs",
|
||||||
selectLanguageText: '<i class="fas fa-globe"/>',
|
selectLanguageText: '<i class="fas fa-globe"/>',
|
||||||
adArr: [
|
adArr: adArr,
|
||||||
{ slot: '/22046652915/vita-0', size: [[728, 90], [320, 50]], id: 'div-gpt-ad-1645091079164-0' },
|
|
||||||
{ slot: '/22046652915/vita-1', size: [[728, 90], [320, 50]], id: 'div-gpt-ad-1645091139070-0' }
|
|
||||||
],
|
|
||||||
locales: {
|
locales: {
|
||||||
'/': config.en_US.themeConfig
|
'/': config.en_US.themeConfig
|
||||||
},
|
},
|
||||||
@ -49,6 +51,7 @@ module.exports = {
|
|||||||
[ 'script', { src: 'https://cdn.thisiswaldo.com/static/js/5303.js' } ],
|
[ 'script', { src: 'https://cdn.thisiswaldo.com/static/js/5303.js' } ],
|
||||||
[ 'script', { src: 'https://www.googletagmanager.com/gtag/js?id=UA-152619365-1'} ],
|
[ 'script', { src: 'https://www.googletagmanager.com/gtag/js?id=UA-152619365-1'} ],
|
||||||
[ 'script', {}, 'function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-152619365-1");' ],
|
[ 'script', {}, 'function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-152619365-1");' ],
|
||||||
|
require('plugins/createAdScript/lib')(adArr)
|
||||||
],
|
],
|
||||||
|
|
||||||
theme: path.resolve(__dirname, './vuepress-theme'),
|
theme: path.resolve(__dirname, './vuepress-theme'),
|
||||||
|
23
docs/.vuepress/plugins/createAdScript/lib/index.js
Normal file
23
docs/.vuepress/plugins/createAdScript/lib/index.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
module.exports = (adArr) => {
|
||||||
|
var ret = 'window.googletag = window.googletag || {cmd: []}; var adScript__w = window.innerWidth;'
|
||||||
|
if (adArr) {
|
||||||
|
ret += 'var adScript__id, adScript__slot, adScript__size;'
|
||||||
|
}
|
||||||
|
adArr.map(function(ad) {
|
||||||
|
ret += `adScript__id = '${ad.id}';
|
||||||
|
adScript__slot = '${ad.slot}';
|
||||||
|
adScript__size = ${JSON.stringify(ad.size)};
|
||||||
|
adScript__size = adScript__size.filter(x => x[0] <= adScript__w);
|
||||||
|
adScript__size = adScript__size.sort().reverse();
|
||||||
|
adScript__size = [adScript__size[0]];
|
||||||
|
if (adScript__size) {
|
||||||
|
googletag.cmd.push(function() {
|
||||||
|
googletag.defineSlot(adScript__slot, adScript__size, adScript__id).addService(googletag.pubads());
|
||||||
|
googletag.pubads().enableSingleRequest();
|
||||||
|
googletag.ZenableServices();
|
||||||
|
});
|
||||||
|
}`
|
||||||
|
})
|
||||||
|
|
||||||
|
return ['script', {}, ret.replace(/\n/g, '')]
|
||||||
|
}
|
@ -4,42 +4,6 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
|
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
|
||||||
<script>
|
|
||||||
var w = window.innerWidth;
|
|
||||||
var id = '/22046652915/vita-0';
|
|
||||||
var tag = 'div-gpt-ad-1645091079164-0';
|
|
||||||
var adSize = [[320, 50], [728, 90]];
|
|
||||||
adSize = adSize.filter(x => x[0] <= w);
|
|
||||||
adSize = adSize.sort().reverse();
|
|
||||||
adSize = [adSize[0]];
|
|
||||||
|
|
||||||
if (adSize) {
|
|
||||||
window.googletag = window.googletag || {cmd: []};
|
|
||||||
googletag.cmd.push(function() {
|
|
||||||
googletag.defineSlot(id, adSize, tag).addService(googletag.pubads());
|
|
||||||
googletag.pubads().enableSingleRequest();
|
|
||||||
googletag.ZenableServices();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
var w = window.innerWidth;
|
|
||||||
var id = '/22046652915/vita-1';
|
|
||||||
var tag = 'div-gpt-ad-1645091139070-0';
|
|
||||||
var adSize = [[320, 50], [728, 90]];
|
|
||||||
adSize = adSize.filter(x => x[0] <= w);
|
|
||||||
adSize = adSize.sort().reverse();
|
|
||||||
adSize = [adSize[0]];
|
|
||||||
|
|
||||||
if (adSize) {
|
|
||||||
window.googletag = window.googletag || {cmd: []};
|
|
||||||
googletag.cmd.push(function() {
|
|
||||||
googletag.defineSlot(id, adSize, tag).addService(googletag.pubads());
|
|
||||||
googletag.pubads().enableSingleRequest();
|
|
||||||
googletag.enableServices();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--c-bg: #fff;
|
--c-bg: #fff;
|
||||||
|
@ -4,42 +4,6 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
|
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
|
||||||
<script>
|
|
||||||
var w = window.innerWidth;
|
|
||||||
var id = '/22046652915/vita-0';
|
|
||||||
var tag = 'div-gpt-ad-1645091079164-0';
|
|
||||||
var adSize = [[320, 50], [728, 90]];
|
|
||||||
adSize = adSize.filter(x => x[0] <= w);
|
|
||||||
adSize = adSize.sort().reverse();
|
|
||||||
adSize = [adSize[0]];
|
|
||||||
|
|
||||||
if (adSize) {
|
|
||||||
window.googletag = window.googletag || {cmd: []};
|
|
||||||
googletag.cmd.push(function() {
|
|
||||||
googletag.defineSlot(id, adSize, tag).addService(googletag.pubads());
|
|
||||||
googletag.pubads().enableSingleRequest();
|
|
||||||
googletag.ZenableServices();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
var w = window.innerWidth;
|
|
||||||
var id = '/22046652915/vita-1';
|
|
||||||
var tag = 'div-gpt-ad-1645091139070-0';
|
|
||||||
var adSize = [[320, 50], [728, 90]];
|
|
||||||
adSize = adSize.filter(x => x[0] <= w);
|
|
||||||
adSize = adSize.sort().reverse();
|
|
||||||
adSize = [adSize[0]];
|
|
||||||
|
|
||||||
if (adSize) {
|
|
||||||
window.googletag = window.googletag || {cmd: []};
|
|
||||||
googletag.cmd.push(function() {
|
|
||||||
googletag.defineSlot(id, adSize, tag).addService(googletag.pubads());
|
|
||||||
googletag.pubads().enableSingleRequest();
|
|
||||||
googletag.enableServices();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--c-bg: #fff;
|
--c-bg: #fff;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 9320c28706b68fab565306c626b437e589679cc4
|
Subproject commit 5a69a41403d7f8bd55dd98ab7843b715586386b3
|
Loading…
Reference in New Issue
Block a user