Skip to content

Commit 8f70fd9

Browse files
committed
Add bsa
1 parent eefafa0 commit 8f70fd9

9 files changed

Lines changed: 144 additions & 4 deletions

File tree

_includes/bsa.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script src="//m.servedby-buysellads.com/monetization.js" type="text/javascript"></script>
2+
<div id="bsa" class="bsa-cpc"><div id="bsaShadow" class="bsa-shadow"></div></div>
3+
<script>
4+
(function(){
5+
_bsa.init('default', 'CVAIP5QL', 'placement:htmlreferenceio', {
6+
target: '.bsa-cpc',
7+
align: 'horizontal',
8+
disable_css: 'true'
9+
});
10+
})();
11+
</script>

_layouts/collection.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ <h1 class="heading-title">
5555
</a>
5656
</p>
5757
</header>
58+
<div id="alo" class="alo">
59+
{% include bsa.html %}
60+
</div>
5861
<section class="elements">
5962
{{content}}
6063
</section>
@@ -63,6 +66,7 @@ <h1 class="heading-title">
6366
{% include google-fonts.html %}
6467
<script src="{{site.url}}/javascript/clipboard.min.js"></script>
6568
<script src="{{site.url}}/javascript/main.js"></script>
69+
<script src="{{site.url}}/javascript/collection.js"></script>
6670
{% include noscript.html %}
6771
</body>
6872
</html>

_layouts/single.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@
2929
<body>
3030
{% include menu.html %}
3131
<main class="single">
32-
<section class="elements">
32+
<div class="ola">
33+
{% include bsa.html %}
34+
</div>
35+
<section class="elements elements--single">
3336
{{content}}
3437
</section>
3538
</main>
3639
{% include modals/share.html %}
3740
{% include google-fonts.html %}
3841
<script src="{{site.url}}/javascript/clipboard.min.js"></script>
3942
<script src="{{site.url}}/javascript/main.js"></script>
43+
<script src="{{site.url}}/javascript/single.js"></script>
4044
{% include noscript.html %}
4145
</body>
4246
</html>

css/website.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/website.sass

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828

2929
@import "../sass/custom"
3030

31-
.modal
31+
.modal,
32+
.bsa-cpc
3233
z-index: 50
3334

3435
.menu

javascript/collection.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
document.addEventListener('DOMContentLoaded', function() {
2+
var $root = document.documentElement;
3+
var $alo = document.getElementById('alo');
4+
var $bsaShadow = document.getElementById('bsaShadow');
5+
6+
var toTravel = $root.scrollHeight - window.innerHeight;
7+
var fromTop = $alo.offsetTop;
8+
var menuThrottle = null;
9+
10+
if ($alo) {
11+
document.addEventListener('scroll', function(event) {
12+
var scrollTop = window.scrollY;
13+
setBsa(scrollTop);
14+
clearTimeout(menuThrottle);
15+
throttle = setTimeout(setBsaShadows(scrollTop), 100);
16+
});
17+
18+
function setBsaShadows(scrollTop) {
19+
var distance = toTravel - scrollTop;
20+
var topFactor = 1 - (distance / toTravel);
21+
$bsaShadow.style.opacity = topFactor;
22+
$bsaShadow.style.transform = 'scaleY(' + topFactor + ')';
23+
}
24+
25+
function setBsa(scrollTop) {
26+
if (scrollTop >= fromTop) {
27+
$alo.classList.add('is-fixed');
28+
} else {
29+
$alo.classList.remove('is-fixed');
30+
}
31+
}
32+
33+
setBsaShadows(0);
34+
}
35+
});

javascript/single.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
document.addEventListener('DOMContentLoaded', function() {
2+
var $root = document.documentElement;
3+
var toTravel = $root.scrollHeight - window.innerHeight;
4+
var $bsaShadow = document.getElementById('bsaShadow');
5+
var menuThrottle = null;
6+
7+
if ($bsaShadow) {
8+
document.addEventListener('scroll', function(event) {
9+
clearTimeout(menuThrottle);
10+
throttle = setTimeout(setBsaShadows(), 100);
11+
});
12+
13+
function setBsaShadows() {
14+
var scrollTop = window.scrollY;
15+
var distance = toTravel - scrollTop;
16+
var topFactor = 1 - (distance / toTravel);
17+
$bsaShadow.style.opacity = topFactor;
18+
$bsaShadow.style.transform = 'scaleY(' + topFactor + ')';
19+
}
20+
21+
setBsaShadows();
22+
}
23+
});

sass/elements.sass

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,66 @@
2727
background: none
2828
box-shadow: inset 0 0 0 1px $purple
2929
color: $purple
30+
31+
.bsa-shadow
32+
background: linear-gradient(rgba(#000, 0.1), rgba(#000, 0))
33+
display: block
34+
height: 1rem
35+
left: 0
36+
opacity: 0
37+
pointer-events: none
38+
position: absolute
39+
right: 0
40+
top: 42px
41+
transform-origin: center top
42+
43+
.bsa-cpc
44+
background-color: #fff
45+
font-size: 16px
46+
line-height: 1.4
47+
padding: 10px
48+
text-align: center
49+
& > div
50+
+center
51+
.default-ad
52+
background-color: $primary
53+
border-radius: 2px
54+
color: $primary-invert
55+
font-size: 12px
56+
order: 2
57+
margin-left: 10px
58+
padding: 0 4px
59+
text-transform: uppercase
60+
a._default_
61+
+center
62+
flex-wrap: wrap
63+
min-height: 20px
64+
order: 1
65+
&:hover
66+
text-decoration: underline
67+
.default-image
68+
+center
69+
height: 20px
70+
padding-right: 10px
71+
img
72+
height: 20px
73+
.default-title
74+
padding-right: 5px
75+
76+
+mobile
77+
.bsa-cpc
78+
border-top: 1px solid $border
79+
80+
+desktop
81+
.elements--single
82+
padding-top: 42px
83+
.bsa-cpc
84+
min-height: 42px
85+
.ola .bsa-cpc,
86+
.alo.is-fixed .bsa-cpc
87+
left: $menu-width
88+
position: fixed
89+
right: 0
90+
top: 0
91+
.alo
92+
min-height: 42px

sass/mixins.sass

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
align-items: center
33
display: flex
44
justify-content: center
5-
text-align: center
65

76
=clearfix
87
&:after

0 commit comments

Comments
 (0)