Created
December 9, 2017 17:22
-
-
Save omkarnathsingh/c9f36b74123d406e4719ec008ac3b208 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/ciwaxi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<label for=chat-group>Group: </label><input type=text id=chat-group placeholder='group name' value='TheTelegramIndia'> | |
<br><br> | |
<label for=chat-from>chat number</label> | |
<input type=text id=chat-from placeholder='from'> | |
— | |
<input type=text id=chat-to placeholder='to..'><br/> | |
<button id=go>go!</button> | |
<div class=chat-wrapper></div> | |
<script id="jsbin-javascript"> | |
var chatWrapper = document.getElementsByClassName('chat-wrapper')[0] | |
, goButton = document.getElementById('go') | |
, groupInput = document.getElementById('chat-group') | |
, fromInput = document.getElementById('chat-from') | |
, toInput = document.getElementById('chat-to'); | |
goButton.addEventListener('click', e => { | |
var chatFrom = parseInt(fromInput.value) | |
, chatTo = parseInt(toInput.value) | |
, chatGroup = groupInput.value; | |
chatWrapper.innerHTML=''; | |
for(var chatIndex = chatFrom; chatIndex <= chatTo; chatIndex++) { | |
var embededChat = document.createElement('script'); | |
embededChat.src = 'https://telegram.org/js/telegram-widget.js'; | |
embededChat.setAttribute('async', ''); | |
embededChat.dataset.telegramPost = `${chatGroup}/${chatIndex}`; | |
embededChat.dataset.width = '100%'; | |
chatWrapper.appendChild(embededChat); | |
} | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var chatWrapper = document.getElementsByClassName('chat-wrapper')[0] | |
, goButton = document.getElementById('go') | |
, groupInput = document.getElementById('chat-group') | |
, fromInput = document.getElementById('chat-from') | |
, toInput = document.getElementById('chat-to'); | |
goButton.addEventListener('click', e => { | |
var chatFrom = parseInt(fromInput.value) | |
, chatTo = parseInt(toInput.value) | |
, chatGroup = groupInput.value; | |
chatWrapper.innerHTML=''; | |
for(var chatIndex = chatFrom; chatIndex <= chatTo; chatIndex++) { | |
var embededChat = document.createElement('script'); | |
embededChat.src = 'https://telegram.org/js/telegram-widget.js'; | |
embededChat.setAttribute('async', ''); | |
embededChat.dataset.telegramPost = `${chatGroup}/${chatIndex}`; | |
embededChat.dataset.width = '100%'; | |
chatWrapper.appendChild(embededChat); | |
} | |
}); | |
</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chatWrapper = document.getElementsByClassName('chat-wrapper')[0] | |
, goButton = document.getElementById('go') | |
, groupInput = document.getElementById('chat-group') | |
, fromInput = document.getElementById('chat-from') | |
, toInput = document.getElementById('chat-to'); | |
goButton.addEventListener('click', e => { | |
var chatFrom = parseInt(fromInput.value) | |
, chatTo = parseInt(toInput.value) | |
, chatGroup = groupInput.value; | |
chatWrapper.innerHTML=''; | |
for(var chatIndex = chatFrom; chatIndex <= chatTo; chatIndex++) { | |
var embededChat = document.createElement('script'); | |
embededChat.src = 'https://telegram.org/js/telegram-widget.js'; | |
embededChat.setAttribute('async', ''); | |
embededChat.dataset.telegramPost = `${chatGroup}/${chatIndex}`; | |
embededChat.dataset.width = '100%'; | |
chatWrapper.appendChild(embededChat); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment