From bdec59e3bd0707855d7ae8c7babeb7002b5a135c Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 28 Feb 2022 11:28:13 +0000 Subject: [PATCH] Update content of files --- .../api/bots/commands.html | 140 ---- .../constructor/inputGroupCallStream.html | 172 ----- data/corefork.telegram.org/js/main.js | 685 ------------------ 3 files changed, 997 deletions(-) delete mode 100644 data/corefork.telegram.org/api/bots/commands.html delete mode 100644 data/corefork.telegram.org/constructor/inputGroupCallStream.html delete mode 100644 data/corefork.telegram.org/js/main.js diff --git a/data/corefork.telegram.org/api/bots/commands.html b/data/corefork.telegram.org/api/bots/commands.html deleted file mode 100644 index d961c2d64d..0000000000 --- a/data/corefork.telegram.org/api/bots/commands.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Commands - - - - - - - - - - - - - -
- -
-
-
- -

Commands

- -
- -

Bots offer a set of commands that can be used by users in private, or in a chat.

-

For a simplified description using the HTTP bot API, see here ยป.

-

Getting commands

-
botCommand#c27ac8c7 command:string description:string = BotCommand;
-
-botInfo#1b74b335 user_id:long description:string commands:Vector<BotCommand> = BotInfo;
-
-channelFull#e13c3d20 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?Vector<string> = ChatFull;
-userFull#cf366521 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true id:long about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string = UserFull;
-
-user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
-

The botInfo constructors contained in the userFull, chatFull, channelFull contain a list of commands, and for groups, the ID and a description of each bot.

-

In graphical clients, when users begin a message with a /, a list of commands supported by all bots present in the current chat should be shown; the same should be done for one-to-one chats with the bot itself.

-

If the command list of a bot changes, the bot_info_version contained in the user constructor received in updates will change; this indicates that the client should refetch full bot information using users.getFullUser.

-

Setting commands

-
botCommand#c27ac8c7 command:string description:string = BotCommand;
-
----functions---
-
-bots.setBotCommands#517165a scope:BotCommandScope lang_code:string commands:Vector<BotCommand> = Bool;
-

The command list can be changed by the owner of the bot through @botfather, but bots can also change their own command list by invoking bots.setBotCommands.

- -
- -
-
- -
- - - - - - - - diff --git a/data/corefork.telegram.org/constructor/inputGroupCallStream.html b/data/corefork.telegram.org/constructor/inputGroupCallStream.html deleted file mode 100644 index 80ce048039..0000000000 --- a/data/corefork.telegram.org/constructor/inputGroupCallStream.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - inputGroupCallStream - - - - - - - - - - - - - -
- -
-
-
- -

inputGroupCallStream

- -

Chunk of a livestream

-

- -
-
inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation;

-

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
flags#Flags, see TL conditional fields
callInputGroupCallLivestream info
time_mslongTimestamp in milliseconds
scaleintSpecifies the duration of the video segment to fetch in milliseconds, by bitshifting 1000 to the right scale times: duration_ms := 1000 >> scale
video_channelflags.0?intSelected video channel
video_qualityflags.0?intSelected video quality (0 = lowest, 1 = medium, 2 = best)
-

Type

-

InputFileLocation

- -
- -
-
- -
- - - - - - diff --git a/data/corefork.telegram.org/js/main.js b/data/corefork.telegram.org/js/main.js deleted file mode 100644 index 5b19de1b7a..0000000000 --- a/data/corefork.telegram.org/js/main.js +++ /dev/null @@ -1,685 +0,0 @@ -var startTime = +(new Date()); -function dT() { - return '[' + ((+(new Date()) - startTime)/ 1000.0) + '] '; -} - -var jsonpCallbacks = []; -function twitterCustomShareInit () { - var btns = document.querySelectorAll - ? document.querySelectorAll('.tl_twitter_share_btn') - : [document.getElementById('tl_twitter_share_btn')]; - - if (!btns.length) { - return; - } - var head = document.getElementsByTagName('head')[0], i, script; - for (i = 0; i < btns.length; i++) { - (function (btn) { - var status = btn.getAttribute('data-text'), - url = btn.getAttribute('data-url') || location.toString() || 'https://telegram.org/', - via = btn.getAttribute('data-via'), - urlEncoded = encodeURIComponent(url), - popupUrl = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(status) + '&url=' + urlEncoded + '&via=' + encodeURIComponent(via); - - btn.setAttribute('href', popupUrl); - btn.href = popupUrl; - - btn.addEventListener('click', function (e) { - var popupW = 550, - popupH = 450, - params = [ - 'width=' + popupW, - 'height=' + popupH, - 'left=' + Math.round(screen.width / 2 - popupW / 2), - 'top=' + Math.round(screen.height / 2 - popupH / 2), - 'personalbar=0', - 'toolbar=0', - 'scrollbars=1', - 'resizable=1' - ].join(','), - popup = window.open(popupUrl, '_blank', params); - - if (popup) { - try { - popup.focus(); - } catch (e) {} - } - - return cancelEvent(e); - }, false); - })(btns[i]); - } -} - -function blogRecentNewsInit () { - if (document.querySelectorAll) { - var sideImages = document.querySelectorAll('.blog_side_image_wrap'); - var sideImage, parent, i; - var len = len = sideImages.length; - for (i = 0; i < len; i++) { - sideImage = sideImages[i]; - parent = sideImage.parentNode.parentNode; - if (parent) { - parent.insertBefore(sideImage, parent.firstChild); - } - } - } - - var moreBtn = document.getElementById('tlb_blog_head_more_link'); - if (!moreBtn) { - return false; - } - - var activeClassName = 'tlb_blog_head_recent_active'; - moreBtn.addEventListener('click', function (event) { - var parent = this.parentNode; - var className = parent.className; - if (className.indexOf(activeClassName) == -1) { - className += ' ' + activeClassName; - } else { - className = className.replace(' ' + activeClassName, ''); - } - parent.className = className; - - return cancelEvent(event); - }); -} - -function blogSideImageUpdate(argument) { - var isDesktop = document.documentElement.offsetWidth >= 1000 - document.querySelectorAll('.blog_side_image_wrap').forEach(function (imageWrap) { - if (isDesktop) { - var titleHeight = imageWrap.parentNode.previousElementSibling.clientHeight; - var beforeTitleEl = imageWrap.parentNode.previousElementSibling.previousElementSibling; - if (beforeTitleEl) { - titleHeight += beforeTitleEl.clientHeight; - } - imageWrap.firstElementChild.style.marginTop = (-titleHeight - 8) + 'px'; - } else { - imageWrap.firstElementChild.style.marginTop = ''; - } - }) -} - -function blogSideImageInit() { - window.addEventListener('resize', blogSideImageUpdate, false); - setTimeout(blogSideImageUpdate, 0); -} - -function cancelEvent (event) { - event = event || window.event; - if (event) event = event.originalEvent || event; - - if (event.stopPropagation) event.stopPropagation(); - if (event.preventDefault) event.preventDefault(); - - return false; -} - -function trackDlClick (element, event) { - var href = element.getAttribute('href'), - track = element.getAttribute('data-track') || false; - - if (!track || !window.ga) { - return; - } - - var trackData = track.toString().split('/'); - - ga('send', 'event', trackData[0], trackData[1], href); - - if ((element.getAttribute('target') || '').toLowerCase() != '_blank') { - setTimeout(function() { location.href = href; }, 200); - return false; - } -} - -var toTopWrapEl, - toTopEl, - pageContentWrapEl, - curVisible, - curShown = false; -function backToTopInit (labelHtml) { - pageContentWrapEl = document.getElementById('dev_page_content_wrap'); - if (!pageContentWrapEl) { - return false; - } - var t = document.createElement('div'); - - t.innerHTML = '
' + labelHtml + '
'; - toTopEl = t.firstChild; - t.innerHTML = ''; - toTopWrapEl = t.firstChild; - - toTopWrapEl.appendChild(toTopEl); - document.body.appendChild(toTopWrapEl); - - if (window.addEventListener) { - window.addEventListener('resize', backToTopResize, false); - window.addEventListener('scroll', backToTopScroll, false); - } - backToTopResize(); -} - -function backToTopGo () { - window.scroll(0, 0); - backToTopScroll(); -} - -function backToTopResize () { - var left = getXY(pageContentWrapEl)[0], - dwidth = Math.max(window.innerWidth, document.documentElement.clientWidth, 0), - dheight = Math.max(window.innerHeight, document.documentElement.clientHeight); - - curVisible = pageContentWrapEl && left > 130 && dwidth > 640; - toTopWrapEl.style.width = left + 'px'; - toTopEl.style.height = dheight + 'px'; - backToTopScroll(); -} - -function backToTopScroll () { - var st = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || document.documentElement.scrollTop; - if ((st > 400 && curVisible) != curShown) { - curShown = !curShown; - if (curShown) { - toTopWrapEl.classList.add('back_to_top_shown'); - } else { - toTopWrapEl.classList.remove('back_to_top_shown'); - } - } -} - -function removePreloadInit() { - if (window.addEventListener) { - window.addEventListener('load', function () { - document.body.classList.remove('preload'); - }, false); - } else { - setTimeout(function () { - document.body.classList.remove('preload'); - }, 1000) - } -} - -function getXY (obj) { - if (!obj) return [0, 0]; - - var left = 0, top = 0; - if (obj.offsetParent) { - do { - left += obj.offsetLeft; - top += obj.offsetTop; - } while (obj = obj.offsetParent); - } - return [left, top]; -} - - -var onDdBodyClick, - currentDd; -function dropdownClick (element, event) { - var parent = element.parentNode; - var isOpen = (parent.className || '').indexOf('open') > 0; - if (currentDd && currentDd != parent) { - dropdownHide(currentDd); - } - if (!isOpen) { - parent.className = (parent.className || '') + ' open'; - if (!onDdBodyClick) { - window.addEventListener('click', dropdownPageClick, false); - } - currentDd = parent; - } else { - dropdownHide(currentDd); - currentDd = false; - } - event.cancelBubble = true; - return false; -} - -function dropdownHide (parent) { - parent.className = parent.className.replace(' open', ''); -} - -function dropdownPageClick (event) { - if (currentDd) { - dropdownHide(currentDd); - currentDd = false; - } -} - -function escapeHTML (html) { - html = html || ''; - return html.replace(/&/g, '&') - .replace(/>/g, '>') - .replace(/'); - var lastLi = false; - var items = 0; - $('a.anchor').each(function (k, anchor) { - var parentTag = anchor.parentNode.tagName; - var matches = parentTag.match(/^h([34])$/i); - var anchorName = anchor.name; - if (!matches || !anchorName) { - return; - } - anchor.id = anchor.name; - var level = parseInt(matches[1]); - var li = $('
  • ' + escapeHTML(anchor.nextSibling.textContent) + '
  • '); - if (level == 3) { - li.appendTo(menu); - lastLi = li; - } else { - // console.log(lastLi); - if (!lastLi) { - return; - } - var subMenu = $('ul', lastLi)[0] || $('').appendTo(lastLi); - // console.log(subMenu); - li.appendTo(subMenu); - } - items++; - }); - // console.log(items, menu); - // console.timeEnd('page nav'); - if (items < 2) { - return false; - } - - return menu; -} - -function showTitleIfOverflows(element) { - if (element && - element.innerText && - element.scrollWidth && - element.offsetWidth && - element.offsetWidth < element.scrollWidth) { - element.setAttribute('title', element.innerText); - } - else if (element.removeAttribute) { - element.removeAttribute('title'); - } -} - -function initDevPageNav() { - window.hasDevPageNav = true; - var menu = getDevPageNav(); - if (!menu) { - return; - } - var sideNavCont = $('#dev_side_nav_cont'); - if (!sideNavCont.length) { - sideNavCont = $('#dev_page_content_wrap'); - } - var sideNavWrap = $('
    ').prependTo(sideNavCont); - var sideNav = $('
    ').appendTo(sideNavWrap); - menu.appendTo(sideNav); - $('body').css({position: 'relative'}).scrollspy({ target: '.dev_side_nav' }); - - $('body').on('activate.bs.scrollspy', function () { - $('.dev_side_nav > ul').affix('checkPosition'); - var active_el = $('.dev_side_nav li.active').get(-1); - if (active_el) { - if (active_el.scrollIntoViewIfNeeded) { - active_el.scrollIntoViewIfNeeded(); - } else if (active_el.scrollIntoView) { - active_el.scrollIntoView(false); - } - } - }); - $('body').trigger('activate.bs.scrollspy'); - - updateMenuAffix(menu); -} - -function updateDevPageNav() { - if (!window.hasDevPageNav) { - return; - } - var menu = getDevPageNav() || $(''); - $('.dev_side_nav > ul').replaceWith(menu); - $('body').scrollspy('refresh'); - updateMenuAffix(menu); -} - -function updateMenuAffix(menu) { - menu.affix({ - offset: { - top: function () { - return $('.dev_side_nav_wrap').offset().top; - }, - bottom: function () { - return (this.bottom = $('.footer_wrap').outerHeight(true) + 20) - } - } - }) -} - - -function initScrollVideos(desktop) { - var videos = document.querySelectorAll - ? document.querySelectorAll('video.tl_blog_vid_autoplay') - : []; - - window.pageVideos = Array.prototype.slice.apply(videos); - if (!pageVideos.length) { - return; - } - window.pageVideosPlaying = {}; - - var index = 1; - var tgStickersCnt = document.querySelectorAll('.js-tgsticker_image').length; - var preloadVideos = tgStickersCnt ? 0 : 2; - for (var i = 0; i < pageVideos.length; i++) { - var videoEl = pageVideos[i]; - videoEl.setAttribute('vindex', index++); - var preloadValue = i >= preloadVideos ? 'metadata' : 'auto'; - videoEl.setAttribute('preload', preloadValue); - videoEl.preload = preloadValue; - if (desktop) { - videoEl.removeAttribute('controls'); - videoEl.autoplay = false; - videoEl.removeAttribute('autoplay'); - } else { - videoEl.autoplay = true; - videoEl.playsinline = true; - videoEl.setAttribute('autoplay', 'autoplay'); - videoEl.setAttribute('playsinline', 'playsinline'); - } - } - if (!desktop) { - return; - } - - window.addEventListener('scroll', checkScrollVideos, false); - window.addEventListener('resize', checkScrollVideos, false); - setTimeout(checkScrollVideos, 1000); -} - -function checkScrollVideos() { - var w = window, - d = document, - e = d.documentElement, - g = d.getElementsByTagName('body')[0], - winWidth = w.innerWidth || e.clientWidth || g.clientWidth, - winHeight = w.innerHeight|| e.clientHeight|| g.clientHeight, - scrollTop = e.scrollTop || g.scrollTop || w.pageYOffset; - - for (var i = 0; i < pageVideos.length; i++) { - var videoEl = pageVideos[i]; - var curIndex = videoEl.getAttribute('vindex'); - var posY = getFullOffsetY(videoEl); - var height = videoEl.offsetHeight; - // console.log(scrollTop, winHeight, posY, height); - - - if (isVisibleEnough(posY, height, scrollTop, winHeight, 0.7, 0.9)) { - if (!pageVideosPlaying[curIndex]) { - pageVideosPlaying[curIndex] = true; - console.log('play', videoEl); - videoEl.play(); - } - } else { - if (pageVideosPlaying[curIndex]) { - delete pageVideosPlaying[curIndex]; - console.log('pause', videoEl); - videoEl.pause(); - } - } - } -} - -function isVisibleEnough(boxOffset, boxSize, viewOffset, viewSize, boxThreshold, viewThreshold) { - var boxEnd = boxOffset + boxSize; - var viewEnd = viewOffset + viewSize; - var viewBox = Math.min(viewEnd, boxEnd) - Math.max(boxOffset, viewOffset); - if (viewBox < 0) { - return false; - } - if (viewBox / boxSize > boxThreshold) { - return true; - } - if (viewThreshold && viewBox / viewSize > viewThreshold) { - return true; - } - return false -} - -function getFullOffsetY(el) { - var offsetTop = el.offsetTop || 0; - if (el.offsetParent) { - offsetTop += getFullOffsetY(el.offsetParent); - } - return offsetTop; -} - -function redraw(el) { - el.offsetTop + 1; -} - -function initRipple() { - if (!document.querySelectorAll) return; - var rippleTextFields = document.querySelectorAll('.textfield-item input.form-control'); - for (var i = 0; i < rippleTextFields.length; i++) { - (function(rippleTextField) { - function onTextRippleStart(e) { - if (document.activeElement === rippleTextField) return; - var rect = rippleTextField.getBoundingClientRect(); - if (e.type == 'touchstart') { - var clientX = e.targetTouches[0].clientX; - } else { - var clientX = e.clientX; - } - var ripple = rippleTextField.parentNode.querySelector('.textfield-item-underline'); - var rippleX = (clientX - rect.left) / rippleTextField.offsetWidth * 100; - ripple.style.transition = 'none'; - redraw(ripple); - ripple.style.left = rippleX + '%'; - ripple.style.right = (100 - rippleX) + '%'; - redraw(ripple); - ripple.style.left = ''; - ripple.style.right = ''; - ripple.style.transition = ''; - } - rippleTextField.removeEventListener('mousedown', onTextRippleStart); - rippleTextField.removeEventListener('touchstart', onTextRippleStart); - rippleTextField.addEventListener('mousedown', onTextRippleStart); - rippleTextField.addEventListener('touchstart', onTextRippleStart); - })(rippleTextFields[i]); - } - var rippleHandlers = document.querySelectorAll('.ripple-handler'); - for (var i = 0; i < rippleHandlers.length; i++) { - (function(rippleHandler) { - function onRippleStart(e) { - var rippleMask = rippleHandler.querySelector('.ripple-mask'); - if (!rippleMask) return; - var rect = rippleMask.getBoundingClientRect(); - if (e.type == 'touchstart') { - var clientX = e.targetTouches[0].clientX; - var clientY = e.targetTouches[0].clientY; - } else { - var clientX = e.clientX; - var clientY = e.clientY; - } - var rippleX = (clientX - rect.left) - rippleMask.offsetWidth / 2; - var rippleY = (clientY - rect.top) - rippleMask.offsetHeight / 2; - var ripple = rippleHandler.querySelector('.ripple'); - ripple.style.transition = 'none'; - redraw(ripple); - ripple.style.transform = 'translate3d(' + rippleX + 'px, ' + rippleY + 'px, 0) scale3d(0.2, 0.2, 1)'; - ripple.style.opacity = 1; - redraw(ripple); - ripple.style.transform = 'translate3d(' + rippleX + 'px, ' + rippleY + 'px, 0) scale3d(1, 1, 1)'; - ripple.style.transition = ''; - - function onRippleEnd(e) { - ripple.style.transitionDuration = '.2s'; - ripple.style.opacity = 0; - document.removeEventListener('mouseup', onRippleEnd); - document.removeEventListener('touchend', onRippleEnd); - document.removeEventListener('touchcancel', onRippleEnd); - } - document.addEventListener('mouseup', onRippleEnd); - document.addEventListener('touchend', onRippleEnd); - document.addEventListener('touchcancel', onRippleEnd); - } - rippleHandler.removeEventListener('mousedown', onRippleStart); - rippleHandler.removeEventListener('touchstart', onRippleStart); - rippleHandler.addEventListener('mousedown', onRippleStart); - rippleHandler.addEventListener('touchstart', onRippleStart); - })(rippleHandlers[i]); - } -} - -function mainInitRetinaVideos() { - var videoEls = document.querySelectorAll('video.video__init_retina'); - var isRetina = window.devicePixelRatio >= 1.5; - var videoEl, i, badChildren, j, badChild, sources, sourceEl; - for (i = 0; i < videoEls.length; i++) { - videoEl = videoEls[i]; - sources = (videoEl.getAttribute('data-sources')||'').split(','); - sourceEl = document.createElement('source'); - sourceEl.type = 'video/mp4'; - sourceEl.src = sources[isRetina ? 1 : 0]; - videoEl.appendChild(sourceEl); - videoEl.classList.remove('video__init_retina'); - videoEl.setAttribute('preload', 'auto'); - } -} - -function mainInitDemoAutoplay(videoLinkElsSelector) { - var videoLinkEls = document.querySelectorAll(videoLinkElsSelector); - var videoLinkEl, videoEl, i; - for (i = 0; i < videoLinkEls.length; i++) { - videoLinkEl = videoLinkEls[i]; - videoEl = videoLinkEl.querySelector('video'); - if (!videoEl) { - continue; - } - if (videoEl.readyState > 1) { - mainDemoVideoHover(videoLinkEl, 1); - } else { - videoEl.load(); - videoEl.addEventListener('loadeddata', (function(el) { - return function () { - setTimeout(function () { - mainDemoVideoHover(el, 1); - }, 0) - } - })(videoLinkEl), false); - } - } -} - -function mainDemoVideoHover(videoLinkEl, isHover) { - var outTimeout = videoLinkEl.outTimeout; - var curIsHover = videoLinkEl.isHover || 0; - if (outTimeout) { - clearTimeout(outTimeout); - } - if (curIsHover == isHover) { - return false; - } - if (!isHover) { - outTimeout = setTimeout(function () { - mainDemoVideoDoHover(videoLinkEl, isHover) - }, 100); - videoLinkEl.outTimeout = outTimeout; - return false; - } - mainDemoVideoDoHover(videoLinkEl, isHover); -} - -function mainDemoVideoDoHover(videoLinkEl, isHover) { - delete videoLinkEl.outTimeout; - - var videoEl = videoLinkEl.querySelector('video'); - if (isHover) { - if (videoEl.readyState > 1) { - videoLinkEl.classList.add('video_play'); - videoEl.play(); - videoLinkEl.isHover = 1; - } - } else { - videoLinkEl.isHover = 0; - } - if (!videoEl.inited) { - videoEl.inited = true; - // videoEl.onended = - videoEl.addEventListener('ended', function onVideoEnded(e) { - if (videoLinkEl.isHover) { - videoEl.currentTime = 0; - videoEl.play(); - } else { - videoEl.pause(); - videoEl.currentTime = 0; - videoLinkEl.classList.remove('video_play') - } - }, false); - } -} - -function mainInitTgStickers(options) { - options = options || {}; - if (!RLottie.isSupported) { - if (options.unsupportedURL) { - if (!getCookie('stel_notgs')) { - setCookie('stel_notgs', 1, 7); - } - location = options.unsupportedURL; - } - return false; - } - document.querySelectorAll('.js-tgsticker_image').forEach(function (imgEl) { - RLottie.init(imgEl, options); - }); -} - -function setCookie(name, value, days) { - var expires = ''; - if (days) { - var date = new Date(); - date.setTime(date.getTime() + (days * 86400000)); - expires = "; expires=" + date.toUTCString(); - } - document.cookie = name + "=" + (value || "") + expires + "; path=/"; -} - -function getCookie(name) { - var nameEQ = name + '='; - var ca = document.cookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) == ' ') { - c = c.substr(1, c.length); - } - if (c.indexOf(nameEQ) == 0) { - return c.substr(nameEQ.length, c.length); - } - } - return null; -} - -function mainScrollTo(element) { - if (typeof element === 'string') { - element = document.querySelector(element) - } - if (element) { - window.scroll(0, getFullOffsetY(element)); - } -}