morethanwords
3 years ago
11 changed files with 156 additions and 29 deletions
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
/* |
||||
* https://github.com/morethanwords/tweb
|
||||
* Copyright (C) 2019-2021 Eduard Kuzmenko |
||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/ |
||||
|
||||
import I18n, { i18n } from "../../lib/langPack"; |
||||
import Scrollable from "../scrollable"; |
||||
import PopupPeer from "./peer"; |
||||
|
||||
export default class PopupSponsored extends PopupPeer { |
||||
constructor() { |
||||
super('popup-sponsored', { |
||||
titleLangKey: 'Chat.Message.Sponsored.What', |
||||
descriptionLangKey: 'Chat.Message.Ad.Text', |
||||
descriptionLangArgs: [i18n('Chat.Message.Sponsored.Link')], |
||||
buttons: [{ |
||||
langKey: 'OK', |
||||
isCancel: true |
||||
}, { |
||||
langKey: 'Chat.Message.Ad.ReadMore', |
||||
callback: () => { |
||||
window.open(I18n.format('Chat.Message.Sponsored.Link', true)); |
||||
}, |
||||
isCancel: true |
||||
}] |
||||
}); |
||||
|
||||
const scrollable = new Scrollable(undefined); |
||||
scrollable.onAdditionalScroll = () => { |
||||
scrollable.container.classList.toggle('scrolled-top', !scrollable.scrollTop); |
||||
scrollable.container.classList.toggle('scrolled-bottom', scrollable.isScrolledDown); |
||||
}; |
||||
|
||||
this.description.replaceWith(scrollable.container); |
||||
|
||||
scrollable.container.append(this.description); |
||||
scrollable.container.classList.add('scrolled-top'); |
||||
|
||||
this.show(); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
/* |
||||
* https://github.com/morethanwords/tweb |
||||
* Copyright (C) 2019-2021 Eduard Kuzmenko |
||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
||||
*/ |
||||
|
||||
.popup-sponsored { |
||||
.scrollable-y { |
||||
position: relative; |
||||
max-height: 25rem; |
||||
margin: 0 -1.5rem; |
||||
width: calc(100% + 3rem); |
||||
padding: .5rem 1.5rem; |
||||
user-select: text; |
||||
border-top: 1px solid transparent; |
||||
border-bottom: 1px solid transparent; |
||||
|
||||
&:not(.scrolled-top) { |
||||
border-top: 1px solid var(--border-color); |
||||
} |
||||
|
||||
&:not(.scrolled-bottom) { |
||||
border-bottom: 1px solid var(--border-color); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue