Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
39696ed6
Commit
39696ed6
authored
Jun 14, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix adbutler spa
parent
f3f732e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
AdbutlerBanner.tsx
ui/shared/ad/AdbutlerBanner.tsx
+11
-2
adbutlerScript.ts
ui/shared/ad/adbutlerScript.ts
+22
-6
No files found.
ui/shared/ad/AdbutlerBanner.tsx
View file @
39696ed6
/* eslint-disable max-len */
/* eslint-disable max-len */
import
{
Flex
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/navigation
'
;
import
Script
from
'
next/script
'
;
import
Script
from
'
next/script
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
connectAdbutler
,
placeAd
}
from
'
ui/shared/ad/adbutlerScript
'
;
import
isBrowser
from
'
lib/isBrowser
'
;
import
{
connectAdbutler
,
placeAd
,
placeAdSPA
}
from
'
ui/shared/ad/adbutlerScript
'
;
const
AdbutlerBanner
=
({
className
}:
{
className
?:
string
})
=>
{
const
AdbutlerBanner
=
({
className
}:
{
className
?:
string
})
=>
{
const
router
=
useRouter
();
React
.
useEffect
(()
=>
{
if
(
isBrowser
())
{
eval
(
placeAdSPA
);
}
},
[
router
]);
return
(
return
(
<
Flex
className=
{
className
}
id=
"adBanner"
h=
{
{
base
:
'
100px
'
,
lg
:
'
90px
'
}
}
>
<
Flex
className=
{
className
}
id=
"adBanner"
h=
{
{
base
:
'
100px
'
,
lg
:
'
90px
'
}
}
>
<
div
id=
"ad-banner"
></
div
>
<
Script
id=
"ad-butler-1"
>
{
connectAdbutler
}
</
Script
>
<
Script
id=
"ad-butler-1"
>
{
connectAdbutler
}
</
Script
>
<
Script
id=
"ad-butler-2"
>
{
placeAd
}
</
Script
>
<
Script
id=
"ad-butler-2"
>
{
placeAd
}
</
Script
>
<
div
id=
"ad-banner"
></
div
>
</
Flex
>
</
Flex
>
);
);
};
};
...
...
ui/shared/ad/adbutlerScript.ts
View file @
39696ed6
/* eslint-disable max-len */
/* eslint-disable max-len */
import
appConfig
from
'
configs/app/config
'
;
import
appConfig
from
'
configs/app/config
'
;
const
ADBUTLER_ACCOUNT
=
182226
;
export
const
connectAdbutler
=
`if (!window.AdButler){(function(){var s = document.createElement("script"); s.async = true; s.type = "text/javascript";s.src = 'https://servedbyadbutler.com/app.js';var n = document.getElementsByTagName("script")[0]; n.parentNode.insertBefore(s, n);}());}`
;
export
const
connectAdbutler
=
`if (!window.AdButler){(function(){var s = document.createElement("script"); s.async = true; s.type = "text/javascript";s.src = 'https://servedbyadbutler.com/app.js';var n = document.getElementsByTagName("script")[0]; n.parentNode.insertBefore(s, n);}());}`
;
export
const
placeAd
=
`
export
const
placeAd
=
`
var AdButler = AdButler || {}; AdButler.ads = AdButler.ads || [];
var AdButler = AdButler || {}; AdButler.ads = AdButler.ads || [];
var abkw = window.abkw || '';
var abkw = window.abkw || '';
const isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;
const isMobile = window.matchMedia("only screen and (max-width: 1000px)").matches;
if (isMobile) {
var plc
${
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
||
0
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
+
'
"></
'
+
'
div>
'
;
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
AdButler
.
register
(
$
{
ADBUTLER_ACCOUNT
},
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
}
else
{
var
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
||
0
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
+
'
"></
'
+
'
div>
'
;
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
AdButler
.
register
(
$
{
ADBUTLER_ACCOUNT
},
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
}
`;
export const placeAdSPA = `
if
(
!
window
.
AdButler
.
ads
)
{
window
.
AdButler
.
ads
=
[];}
var
abkw
=
window
.
abkw
||
''
;
const
isMobile
=
window
.
matchMedia
(
"
only screen and (max-width: 1000px)
"
).
matches
;
if
(
isMobile
)
{
if
(
isMobile
)
{
var
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
||
0
;
var
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
||
0
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
+=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
+
'
"></
'
+
'
div>
'
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
+
'
"></
'
+
'
div>
'
;
document
.
getElementById
(
"
ad-banner
"
).
className
=
"
ad-container mb-3
"
;
window
.
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
AdButler
.
register
(
$
{
ADBUTLER_ACCOUNT
},
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
AdButler
.
register
(
182226
,
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigMobile?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigMobile
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
}
else
{
}
else
{
var
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
||
0
;
var
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
=
window
.
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
||
0
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
+
=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
+
'
"></
'
+
'
div>
'
;
document
.
getElementById
(
'
ad-banner
'
).
innerHTML
=
'
<
'
+
'
div id="placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
+
'
"></
'
+
'
div>
'
;
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
AdButler
.
register
(
182226
,
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
window
.
AdButler
.
ads
.
push
({
handler
:
function
(
opt
){
window
.
AdButler
.
register
(
$
{
ADBUTLER_ACCOUNT
}
,
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
},
[
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
width
},
$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
height
}],
'
placement_${ appConfig.ad.adButlerConfigDesktop?.id }_
'
+
opt
.
place
,
opt
);
},
opt
:
{
place
:
plc$
{
appConfig
.
ad
.
adButlerConfigDesktop
?.
id
}
++
,
keywords
:
abkw
,
domain
:
'
servedbyadbutler.com
'
,
click
:
'
CLICK_MACRO_PLACEHOLDER
'
}});
}
}
`;
`;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment