Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
import { EmoticonsDropdown, EmoticonsTab, EMOTICONSSTICKERGROUP } from ".."; |
|
import GifsMasonry from "../../gifsMasonry"; |
|
import Scrollable from "../../scrollable_new"; |
|
import { putPreloader } from "../../misc"; |
|
import apiManager from "../../../lib/mtproto/mtprotoworker"; |
|
import appDocsManager, {MyDocument} from "../../../lib/appManagers/appDocsManager"; |
|
|
|
export default class GifsTab implements EmoticonsTab { |
|
public content: HTMLElement; |
|
|
|
init() { |
|
this.content = document.getElementById('content-gifs'); |
|
const gifsContainer = this.content.firstElementChild as HTMLDivElement; |
|
gifsContainer.addEventListener('click', EmoticonsDropdown.onMediaClick); |
|
|
|
const masonry = new GifsMasonry(gifsContainer); |
|
const scroll = new Scrollable(this.content, 'y', 'GIFS', null); |
|
const preloader = putPreloader(this.content, true); |
|
|
|
apiManager.invokeApi('messages.getSavedGifs', {hash: 0}).then((res) => { |
|
//console.log('getSavedGifs res:', res); |
|
|
|
if(res._ == 'messages.savedGifs') { |
|
res.gifs.forEach((doc, idx) => { |
|
res.gifs[idx] = doc = appDocsManager.saveDoc(doc); |
|
//if(doc._ == 'documentEmpty') return; |
|
masonry.add(doc as MyDocument, EMOTICONSSTICKERGROUP, EmoticonsDropdown.lazyLoadQueue); |
|
}); |
|
} |
|
|
|
//let line: MTDocument[] = []; |
|
|
|
preloader.remove(); |
|
}); |
|
|
|
this.init = null; |
|
} |
|
|
|
onClose() { |
|
|
|
} |
|
} |