Skip to content

Instantly share code, notes, and snippets.

@omkarnathsingh
Created December 9, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omkarnathsingh/c9f36b74123d406e4719ec008ac3b208 to your computer and use it in GitHub Desktop.
Save omkarnathsingh/c9f36b74123d406e4719ec008ac3b208 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/ciwaxi
<!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'>
&mdash;
<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>
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