Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions activity1/activity1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

</head>
<body>
<div>
<input type="button" id="btn" value=""/>
<input type="text" id="num" name="number" placeholder="enter a number"/>
</div>

<b><p id="ncheck"></p></b>
<span>triales:</span>
<span id="tryno"></span>
<script src="activity1.js"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions activity1/activity1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let num = document.getElementById("num")
const guess=Math.floor((Math.random()*10)+1);
console.log(guess);
var x=0;
num.addEventListener('change',() => {
nval=num.value;
let pval=document.getElementById("ncheck");
let tryn=document.getElementById("tryno");
if(nval>guess){
pval.innerHTML="guess lower";
}
else if(nval<guess){
pval.innerHTML="guess higher";
}
else{
pval.innerHTML="match";
pval.setAttribute("style","color:green;font-size:50px;")
num.setAttribute("readonly","True");
}
tryn.innerHTML=(x+=1);
})
24 changes: 24 additions & 0 deletions activity2/activity2day1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="style.css"></link>
</head>
<body>
<input type="button" id="demo" value="data"/>
<br/>
<br/>
<input type="button" id="product" value="product"/>
<table id="pdtData" style="border:1px solid black;"></table>
<br>
<br>
<div class="disbtn">
<button>Previous</button>
<button>Next</button>
</div>
<script src="activity2day1.js"></script>
</body>
</html>
52 changes: 52 additions & 0 deletions activity2/activity2day1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const add="https://portal.tycoonstats.com/api/demo/1";
demo.addEventListener("click",
async ()=>{
const response = await fetch(add);
var data = await response.json();
console.log(data);
}
)
// resp=fetch(add);
// if(resp){
// console.log("working url");
// }
// console.log(resp)
const add2="https://fakestoreapi.com/products"
product.addEventListener("click",
async ()=>{

const response = await fetch(add2);
var pdt = await response.json();
console.log(pdt);
let tab =
`<tr style="background-color:grey">
<th rowspan=2>Id</th>
<th rowspan=2>Title</th>
<th rowspan=2>Price</th>
<th rowspan=2>Discription</th>
<th rowspan=2>Category</th>
<th rowspan=2>Image</th>
<th colspan=2>Rating</th>
</tr>
<tr style="background-color:grey">
<th>Rate</th>
<th>Count</th>
</tr>`;
for (let i=0;i<10;i++){
tab += `<tr>
<td>${pdt[i].id} </td>
<td>${pdt[i].title}</td>
<td>${pdt[i].price}</td>
<td>${pdt[i].description}</td>
<td>${pdt[i].category}</td>
<td><img style="width:200px;height:200px;" src="${pdt[i].image}"/></td>
<td>${pdt[i].rating.rate}</td>
<td>${pdt[i].rating.count}</td>
</tr>`;
}
document.getElementById("pdtData").innerHTML = tab;


}

)
Empty file added activity2/style.css
Empty file.
7 changes: 7 additions & 0 deletions day2/activity/activity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<script src="owl.js"></script>
<script src="activity.js"></script>
</body>
</html>
74 changes: 74 additions & 0 deletions day2/activity/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const{Component , mount , xml,useState,reactive,useEnv} = owl;

const guess=Math.floor((Math.random()*10)+1);
console.log(guess);

let num;

const finalData=()=>{
const apple=useEnv();
return useState(apple.store);
}
const finalguess=()=>{
const ap=useEnv();
return useState(ap.st);
}
class guesslist{
lab="..."
updateguess(){if(num>guess){
this.lab="lower";
console.log(this.lab);
}
else if(num<guess){
this.lab="higher";
console.log(this.lab);
}
else{

this.lab="match";
console.log(this.lab);
}};
getguess(){return this.lab};
}
class dataList{
count=0;
updateCount(){this.count++};
getCount(){return this.count};
}
class Second extends Component{
static template=xml`<b><t t-esc="this.labl.getguess()"/></b><br/><t t-esc="this.tries.getCount()"/>`
setup(){
this.labl=finalguess();
this.tries=finalData();
}

}
class Root extends Component{
static template=xml`<input type="text" placeholder="enter a number" id="num" t-on-change="getnum"/><br/><br/>

<Second />`
setup(){
this.vnum=finalguess();
this.cap=finalData();
}
getnum(event){

num=event.target.value;
this.cap.updateCount();
this.vnum.updateguess();


console.log("onchange");

}

static components={ Second };
}
const createData=()=>{
return reactive(new dataList());
}
const guessdata=()=>{
return reactive(new guesslist());
}
const env={store:createData(),st:guessdata()};
mount(Root,document.body,{dev:true,env});
Loading