Skip to content

Commit

Permalink
Use JQUERYYYYYY!
Browse files Browse the repository at this point in the history
  • Loading branch information
sherzodv committed Aug 10, 2023
1 parent b0e4100 commit e07a47b
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
<html ng-app="custom-webapp-ui" lang="en" style="background-color: white">
<html>
<head>
<!-- Load the Telegram Library -->
<title>Begenot</title>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<!--Load the AngularJS Library-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script>
//initialize the AngularJS stuff...
angular.module("custom-webapp-ui", []).controller('CustomUIController', function CustomUIController($scope) {
//init our slider values that we will display
$scope.foods = [
{ name: "fruits", value: 5 },
{ name: "vegetables", value: 5 },
{ name: "meat", value: 5 },
{ name: "dairy", value: 5 }
];
//initialize the button
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
const mainButton = window.Telegram.WebApp.MainButton;
mainButton.text = "Save Preferences";
mainButton.enable();
mainButton.show();
// and make it send the "foods" object (as JSON string) back to the bot
mainButton.onClick(function(){
window.Telegram.WebApp.sendData(JSON.stringify($scope.foods));
})

mainButton.onClick(function() {
window.Telegram.WebApp.sendData("boo");
});
});
</script>
</head>
<body ng-controller="CustomUIController">
<div ng-repeat="food in foods">
<div style="width: 100px; display: inline-block">{{food.name}} : {{food.value}}</div>
<input style="display: inline-block" type="range" min="1" max="10" ng-model="food.value" value="{{food.value}}">
</div>
<body>
<p>Hello</p>
<p>World</p>
</body>
</html>

0 comments on commit e07a47b

Please sign in to comment.