-
Notifications
You must be signed in to change notification settings - Fork 0
/
trending.list.popularpost.widget.xml
212 lines (200 loc) · 9.53 KB
/
trending.list.popularpost.widget.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* Trending List */
.trending-list .post{flex-shrink:0;width:196px;}
.trending-list .post-content{width:100%;height:auto;padding-bottom:115%;position:relative;display:inline-block;overflow:hidden;}
.trending-list .film-poster{display:inline-block;background:rgba(255,255,255,.1);position:absolute;width:auto;left:40px;right:0;top:0;bottom:0;padding-bottom:0;height:auto;margin-bottom:0;}
.trending-list .film-poster img{position:absolute;width:100%;height:100%;object-fit:cover;left:0;top:0;right:0;bottom:0;-webkit-user-drag:none;user-select:none;pointer-events:none;}
.trending-list .number{position:absolute;left:0;top:0;bottom:0;overflow:hidden;width:40px;text-align:center;font-weight:600;cursor:default;}
.trending-list .number span{position:absolute;bottom:0;font-size:20px;line-height:1em;text-align:center;color:#ffdd95;z-index:9;left:0;right:0;}
.trending-list .number .film-title{width:100px;text-align:left;height:40px;transform:rotate(-90deg);position:absolute;bottom:90px;width:150px;line-height:40px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;left:-55px;font-size:15px;font-weight:500;}
.items.active{background:rgba(255,255,255,0.3);cursor:grabbing;cursor:-webkit-grabbing;transform:scale(1);}
.carousel .carousel__content{overflow-y:hidden;overflow-x:scroll;scrollbar-width:none;display:flex;-webkit-overflow-scrolling:touch;cursor:grab;padding-inline-end:60px;grid-gap:24px;grid-auto-flow:column;list-style:none;}
.carousel .carousel__content::-webkit-scrollbar{display:none;}
.carousel__header{display:flex;justify-content:space-between;}
.carousel .carousel__arrow:before{content:"";background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTUgOSI+Cgk8cGF0aCBmaWxsPSIjMzMzMzMzIiBkPSJNNy44NjcgOC41NzRsLTcuMjItNy4yMi43MDctLjcwOEw3Ljg2NyA3LjE2IDE0LjA1Ljk4bC43MDYuNzA3Ii8+Cjwvc3ZnPgo=");background-size:contain;display:block;width:18px;height:12px;cursor:pointer;}
.carousel .carousel__arrow.arrow-prev:before{transform:rotate(90deg);}
.carousel .carousel__arrow.arrow-next:before{transform:rotate(-90deg);}
.carousel .carousel__arrow.disabled::before{filter:brightness(2);}
.trending-list .item .number{background:linear-gradient(0deg,rgba(79,79,79,0) 0,#4f4f4f 100%);}
.trending-navi{position:absolute;top:0;right:0;bottom:0;width:40px;background-color:#ffffff;z-index:9;}
.trending-navi > button{position:absolute;height:48%;top:0;left:0;right:0;background:gray;border-radius:10px;text-align:center;cursor:pointer;outline:0;box-shadow:none;border:none;display:grid;place-content:center;width:40px;}
.swiper-container{counter-reset:msc;}
.trending-list .number span::before{counter-increment:msc;content:counter(msc);}
.trending-navi .arrow-next{bottom:0;top:auto;}
.swiper-container{margin:0 auto;position:relative;overflow:hidden;z-index:1;}
@media screen and (max-width:768px){.trending-list .item .number span{font-size:18px;line-height:30px;transform:none;text-align:center;color:#111;}.carousel .carousel__content{gap:15px;padding-inline-end:0;}.trending-list .post{width:140px;}.trending-list .post-content{padding-bottom:130%;}.trending-list .item .number{bottom:auto;top:0;right:auto;width:40px;left:0;height:30px;background:#fff;z-index:9;}.trending-list .item .film-poster{left:0;top:0;bottom:0;}.trending-navi{display:none;}}
@media screen and (max-width:568px){.carousel .carousel__content{gap:5px;}.trending-list .post{width:125px;}}
<b:widget id='PopularPosts2' locked='false' title='Trending' type='PopularPosts' version='2' visible='true'>
<b:widget-settings>
<b:widget-setting name='numItemsToShow'>10</b:widget-setting>
<b:widget-setting name='showThumbnails'>true</b:widget-setting>
<b:widget-setting name='showSnippets'>true</b:widget-setting>
<b:widget-setting name='timeRange'>LAST_YEAR</b:widget-setting>
</b:widget-settings>
<b:includable id='main' var='this'>
<b:class name='carousel'/>
<section class='trending-list carousel__wrapper has-arrows'>
<div class='carousel__header'>
<h2 class='carousel__headline'><data:title/></h2>
</div>
<div class='swiper-container'>
<b:include name='snippetedPosts'/>
<div class='carousel__controls trending-navi'>
<button class='carousel__arrow disabled arrow-prev'/>
<button class='carousel__arrow arrow-next'/>
</div>
</div>
</section>
<script>
/*<![CDATA[*/
window.addEventListener( 'load', () => {
const COMPONENT_SELECTOR = '.carousel__wrapper';
const CONTROLS_SELECTOR = '.carousel__controls';
const CONTENT_SELECTOR = '.carousel__content';
const components = document.querySelectorAll( COMPONENT_SELECTOR );
for ( let i = 0; i < components.length; i++ ) {
const component = components[ i ];
const content = component.querySelector( CONTENT_SELECTOR );
let x = 0;
let mx = 0;
const maxScrollWidth = content.scrollWidth - content.clientWidth / 2 - content.clientWidth / 2;
const nextButton = component.querySelector( '.arrow-next' );
const prevButton = component.querySelector( '.arrow-prev' );
if ( maxScrollWidth !== 0 ) {
component.classList.add( 'has-arrows' );
}
if ( nextButton ) {
nextButton.addEventListener( 'click', function ( event ) {
event.preventDefault();
x = content.clientWidth / 2 + content.scrollLeft + 0;
content.scroll( {
left: x,
behavior: 'smooth',
} );
} );
}
if ( prevButton ) {
prevButton.addEventListener( 'click', function ( event ) {
event.preventDefault();
x = content.clientWidth / 2 - content.scrollLeft + 0;
content.scroll( {
left: -x,
behavior: 'smooth',
} );
} );
}
/**
* Mouse move handler.
*
* @param {object} e event object.
*/
const mousemoveHandler = ( e ) => {
const mx2 = e.pageX - content.offsetLeft;
if ( mx ) {
content.scrollLeft = content.sx + mx - mx2;
}
};
/**
* Mouse down handler.
*
* @param {object} e event object.
*/
const mousedownHandler = ( e ) => {
content.sx = content.scrollLeft;
mx = e.pageX - content.offsetLeft;
content.classList.add( 'dragging' );
};
/**
* Scroll handler.
*/
const scrollHandler = () => {
toggleArrows();
};
/**
* Toggle arrow handler.
*/
const toggleArrows = () => {
if ( content.scrollLeft > maxScrollWidth - 10 ) {
nextButton.classList.add( 'disabled' );
} else if ( content.scrollLeft < 10 ) {
prevButton.classList.add( 'disabled' );
} else {
nextButton.classList.remove( 'disabled' );
prevButton.classList.remove( 'disabled' );
}
};
/**
* Mouse up handler.
*/
const mouseupHandler = () => {
mx = 0;
content.classList.remove( 'dragging' );
};
content.addEventListener( 'mousemove', mousemoveHandler );
content.addEventListener( 'mousedown', mousedownHandler );
if ( component.querySelector( CONTROLS_SELECTOR ) !== undefined ) {
content.addEventListener( 'scroll', scrollHandler );
}
content.addEventListener( 'mouseup', mouseupHandler );
content.addEventListener( 'mouseleave', mouseupHandler );
}
} );
/*]]>*/
</script>
</b:includable>
<b:includable id='blogThisShare'/>
<b:includable id='bylineByName' var='byline'/>
<b:includable id='bylineRegion' var='regionItems'/>
<b:includable id='commentsLink'/>
<b:includable id='commentsLinkIframe'/>
<b:includable id='emailPostIcon'/>
<b:includable id='facebookShare'/>
<b:includable id='footerBylines'/>
<b:includable id='googlePlusShare'/>
<b:includable id='headerByline'/>
<b:includable id='linkShare'/>
<b:includable id='otherSharingButton'/>
<b:includable id='platformShare'/>
<b:includable id='postAuthor'/>
<b:includable id='postCommentsLink'/>
<b:includable id='postJumpLink' var='post'/>
<b:includable id='postLabels'/>
<b:includable id='postLocation'/>
<b:includable id='postReactions'/>
<b:includable id='postShareButtons'/>
<b:includable id='postTimestamp'/>
<b:includable id='sharingButton'/>
<b:includable id='sharingButtonContent'/>
<b:includable id='sharingButtons'/>
<b:includable id='sharingButtonsMenu'/>
<b:includable id='sharingPlatformIcon'/>
<b:includable id='snippetedPostByline'/>
<b:includable id='snippetedPostContent'>
<div class='post-content carousel__item'>
<b:include cond='data:this.postDisplay.showTitle' name='snippetedPostTitle'/>
<b:include cond='data:this.postDisplay.showFeaturedImage and data:post.featuredImage' name='snippetedPostThumbnail'/>
</div>
</b:includable>
<b:includable id='snippetedPostThumbnail'>
<a class='film-poster' draggable='false' expr:href='data:post.url'>
<b:include data='{ image: data:post.featuredImage, imageSizes: [156, 225], imageRatio: "1:2", sourceSizes: "225px" }' name='responsiveImage'/>
</a>
</b:includable>
<b:includable id='snippetedPostTitle'>
<b:if cond='data:post.title != ""'>
<div class='number'>
<span/>
<h3 class='film-title dynamic-name'><data:post.title/></h3>
</div>
</b:if>
</b:includable>
<b:includable id='snippetedPosts'>
<div class='items carousel__content' role='feed'>
<!-- Don't render the post that we're currently already looking at. -->
<b:loop values='data:posts filter (p => p.id != data:view.postId)' var='post'>
<article class='post item' role='article'>
<b:include name='snippetedPostContent'/>
</article>
</b:loop>
</div>
</b:includable>
</b:widget>