This file contains 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
// Thanks to @MarvinMiles for Telegram Widget Login check function https://gist.github.com/MarvinMiles/f041205d872b0d8547d054eafeafe2a5 | |
// This function validates Web App input https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app | |
// Transforms Telegram.WebApp.initData string into object | |
function transformInitData(initData) { | |
return Object.fromEntries(new URLSearchParams(initData)); | |
} | |
// Accepts init data object and bot token | |
async function validate(data, botToken) { |
This file contains 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
<div id="swipezone"> | |
Swipe me | |
</div> | |
// credit: http://www.javascriptkit.com/javatutors/touchevents2.shtml | |
function swipedetect(el, callback){ | |
var touchsurface = el, | |
swipedir, | |
startX, |
This file contains 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
;(function () { | |
// Scroll Variables (tweakable) | |
var defaultOptions = { | |
// Scrolling Core | |
frameRate : 150, // [Hz] | |
animationTime : 400, // [ms] | |
stepSize : 100, // [px] |