diff --git a/data/telegram.org/js/telegram-web-app.js b/data/telegram.org/js/telegram-web-app.js index 408b192d30..712fb3d4c8 100644 --- a/data/telegram.org/js/telegram-web-app.js +++ b/data/telegram.org/js/telegram-web-app.js @@ -9,7 +9,7 @@ var initParams = urlParseHashParams(locationHash); - var isIframe = false; + var isIframe = false, iFrameStyle; try { isIframe = (window.parent != null && window != window.parent); if (isIframe) { @@ -23,8 +23,17 @@ if (!dataParsed || !dataParsed.eventType) { return; } - receiveEvent(dataParsed.eventType, dataParsed.eventData); + if (dataParsed.eventType == 'set_custom_style') { + iFrameStyle.innerHTML = dataParsed.eventData; + } else { + receiveEvent(dataParsed.eventType, dataParsed.eventData); + } }); + iFrameStyle = document.createElement('style'); + document.head.appendChild(iFrameStyle); + try { + window.parent.postMessage(JSON.stringify({eventType: 'iframe_ready'}), '*'); + } catch (e) {} } } catch (e) {} diff --git a/data/webappcontent.telegram.org/cafe.html b/data/webappcontent.telegram.org/cafe.html index b150487d3e..b2d82d2e62 100644 --- a/data/webappcontent.telegram.org/cafe.html +++ b/data/webappcontent.telegram.org/cafe.html @@ -9,7 +9,7 @@ - + +