started to implement task one

parent 4540c4e6
<!DOCTYPE html>
<html>
<head>
<title>Test Game</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="webgazer_calib.js" type="text/javascript"></script>
<style type="text/css">
body {
background-color: rgb(168, 209, 141);
}
.face {
height: 130px;
position: absolute;
}
</style>
</head>
<body style="margin: 0px; overflow: hidden;">
<img id="ch" class="slide" style="display: none;" src="finalTask/CHR.png">
<img id="s1" class="slide" style="display: none;" src="finalTask/F1.png">
<img id="s2" class="slide" style="display: none;" src="finalTask/F2.png">
<img id="s3" class="slide" style="display: none;" src="finalTask/gif1.gif">
<img id="s4" class="slide" style="display: none;" src="finalTask/F3.png">
<img id="s5" class="slide" style="display: none;" src="finalTask/gif2.gif">
<img id="s6" class="slide" style="display: none;" src="finalTask/F4R.png">
<img id="s7" class="slide" style="display: none;" src="finalTask/F5R.png">
<img id="s8" class="slide" style="display: none;" src="finalTask/F6R.png">
<img id="s9" class="slide" style="display: none;" src="finalTask/F7R.png">
<img id="s10" class="slide" style="display: none;" src="finalTask/F8R.png">
<img id="s11" class="slide" style="display: none;" src="finalTask/F9R.png">
<img id="s12" class="slide" style="display: none;" src="finalTask/F10R.png">
<img id="s13" class="slide" style="display: none;" src="finalTask/F11R.png">
<img id="s14" class="slide" style="display: none;" src="finalTask/F12R.png">
<img id="s15" class="slide" style="display: none;" src="finalTask/F13R.png">
<img id="s16" class="slide" style="display: none;" src="finalTask/F14R.png">
<img id="s17" class="slide" style="display: none;" src="finalTask/F15R.png">
<img id="s18" class="slide" style="display: none;" src="finalTask/F16R.png">
<img id="s19" class="slide" style="display: none;" src="finalTask/F17R.png">
<img id="result" class="slide" style="display: none;" src="finalTask/result.png">
<!-- <p id="objectName" style="position: absolute; top:500px; left: 500px;">Object name</p> -->
<script type="text/javascript">
boundaryArr = {
"s1": {
"F1I1": {
"name": "hat",
"type": "L",
"top": 216,
"bottom": 571,
"left": 450,
"right": 888,
},
},
"s2": {
"F2I1": {
"name": "head",
"type": "S",
"top": 137,
"bottom": 269,
"left": 626,
"right": 725,
},
"F2I2": {
"name": "hands",
"type": "S",
"top": 269,
"bottom": 380,
"left": 541,
"right": 846,
},
"F2I3": {
"name": "legs",
"type": "S",
"top": 380,
"bottom": 623,
"left": 526,
"right": 724,
},
},
"s3": {
"F3I1": {
"name": "head",
"type": "S",
"top": 132,
"bottom": 278,
"left": 597,
"right": 700,
},
"F3I2": {
"name": "hands",
"type": "S",
"top": 278,
"bottom": 393,
"left": 507,
"right": 832,
},
"F3I3": {
"name": "legs",
"type": "S",
"top": 393,
"bottom": 658,
"left": 480,
"right": 707,
},
},
"s4": {
"F4I1": {
"name": "car",
"type": "H",
"top": 237,
"bottom": 482,
"left": 271,
"right": 1055,
},
"F4I2": {
"name": "wheel1",
"type": "H",
"top": 336,
"bottom": 482,
"left": 353,
"right": 502,
},
"F4I3": {
"name": "wheel2",
"type": "H",
"top": 322,
"bottom": 465,
"left": 857,
"right": 1015,
},
},
"s5": {
"F5I1": {
"name": "car",
"type": "H",
"top": 277,
"bottom": 505,
"left": 313,
"right": 1058,
},
"F5I2": {
"name": "wheel1",
"type": "H",
"top": 364,
"bottom": 505,
"left": 394,
"right": 531,
},
"F5I3": {
"name": "wheel2",
"type": "H",
"top": 356,
"bottom": 493,
"left": 866,
"right": 1019,
},
},
"s6": {
"F6I1": {
"name": "baby",
"type": "S",
"top": 94,
"bottom": 496,
"left": 200,
"right": 460,
},
"F6I2": {
"name": "car",
"type": "H",
"top": 149,
"bottom": 320,
"left": 688,
"right": 1241,
},
"F6I3": {
"name": "hat",
"type": "I",
"top": 403,
"bottom": 678,
"left": 560,
"right": 904,
},
},
"s7": {
"F7I1": {
"name": "baby",
"type": "S",
"top": 28,
"bottom": 471,
"left": 940,
"right": 1228,
},
"F7I2": {
"name": "car",
"type": "H",
"top": 459,
"bottom": 643,
"left": 281,
"right": 883,
},
"F7I3": {
"name": "hat",
"type": "I",
"top": 109,
"bottom": 355,
"left": 217,
"right": 522,
},
},
"s8": {
"F8I1": {
"name": "girl",
"type": "S",
"top": 64,
"bottom": 536,
"left": 119,
"right": 286,
},
"F8I2": {
"name": "lady",
"type": "S",
"top": 371,
"bottom": 675,
"left": 338,
"right": 590,
},
"F8I3": {
"name": "doll",
"type": "S",
"top": 70,
"bottom": 478,
"left": 666,
"right": 925,
},
"F8I4": {
"name": "face",
"type": "S",
"top": 279,
"bottom": 591,
"left": 1002,
"right": 1282,
},
},
"s9": {
"F9I1": {
"name": "Sit",
"type": "S",
"top": 49,
"bottom": 322,
"left": 136,
"right": 501,
},
"F9I2": {
"name": "Half Body",
"type": "S",
"top": 421,
"bottom": 683,
"left": 251,
"right": 460,
},
"F9I3": {
"name": "Face",
"type": "S",
"top": 237,
"bottom": 532,
"left": 660,
"right": 877,
},
"F9I4": {
"name": "fullbody",
"type": "S",
"top": 102,
"bottom": 542,
"left": 1017,
"right": 1175,
},
},
"s10": {
"F10I1": {
"name": "boy",
"type": "S",
"top": 38,
"bottom": 294,
"left": 160,
"right": 368,
},
"F10I2": {
"name": "women",
"type": "S",
"top": 395,
"bottom": 665,
"left": 159,
"right": 389,
},
"F10I3": {
"name": "doll",
"type": "S",
"top": 196,
"bottom": 557,
"left": 558,
"right": 793,
},
"F10I4": {
"name": "men",
"type": "S",
"top": 57,
"bottom": 325,
"left": 976,
"right": 1288,
},
"F10I5": {
"name": "girl",
"type": "S",
"top": 455,
"bottom": 695,
"left": 958,
"right": 1196,
},
},
"s11": {
"F11I1": {
"name": "girl",
"type": "S",
"top": 60,
"bottom": 318,
"left": 611,
"right": 815,
},
"F11I2": {
"name": "upper boy",
"type": "S",
"top": 395,
"bottom": 665,
"left": 159,
"right": 389,
},
"F11I3": {
"name": "bread",
"type": "L",
"top": 115,
"bottom": 306,
"left": 917,
"right": 1218,
},
"F11I4": {
"name": "gloves",
"type": "L",
"top": 454,
"bottom": 716,
"left": 201,
"right": 418,
},
"F11I5": {
"name": "table",
"type": "L",
"top": 476,
"bottom": 702,
"left": 562,
"right": 825,
},
"F11I6": {
"name": "bottom boy",
"type": "S",
"top": 431,
"bottom": 653,
"left": 934,
"right": 1207,
},
},
"s12": {
"F12I1": {
"name": "baby face",
"type": "S",
"top": 88,
"bottom": 359,
"left": 157,
"right": 381,
},
"F12I2": {
"name": "threewheel",
"type": "H",
"top": 97,
"bottom": 295,
"left": 547,
"right": 752,
},
"F12I3": {
"name": "iorn",
"type": "H",
"top": 88,
"bottom": 302,
"left": 954,
"right": 1273,
},
"F12I4": {
"name": "lap",
"type": "L",
"top": 470,
"bottom": 686,
"left": 114,
"right": 436,
},
"F12I5": {
"name": "ball",
"type": "H",
"top": 423,
"bottom": 634,
"left": 576,
"right": 788,
},
"F12I6": {
"name": "block",
"type": "H",
"top": 459,
"bottom": 596,
"left": 947,
"right": 1191,
},
},
"s13": {
"F13I1": {
"name": "Throwser",
"type": "L",
"top": 75,
"bottom": 351,
"left": 168,
"right": 262,
},
"F13I2": {
"name": "book",
"type": "L",
"top": 111,
"bottom": 328,
"left": 502,
"right": 780,
},
"F13I3": {
"name": "bag",
"type": "L",
"top": 113,
"bottom": 263,
"left": 958,
"right": 1175,
},
"F13I4": {
"name": "apple",
"type": "L",
"top": 516,
"bottom": 703,
"left": 185,
"right": 345,
},
"F13I5": {
"name": "brush",
"type": "L",
"top": 454,
"bottom": 648,
"left": 481,
"right": 748,
},
"F13I6": {
"name": "baby",
"type": "S",
"top": 405,
"bottom": 735,
"left": 886,
"right": 1124,
},
},
"s14": {
"F14I1": {
"name": "bat",
"type": "H",
"top": 22,
"bottom": 319,
"left": 84,
"right": 399,
},
"F14I2": {
"name": "frock",
"type": "L",
"top": 44,
"bottom": 288,
"left": 535,
"right": 736,
},
"F14I3": {
"name": "train",
"type": "H",
"top": 171,
"bottom": 359,
"left": 933,
"right": 1291,
},
"F14I4": {
"name": "Tv",
"type": "H",
"top": 416,
"bottom": 620,
"left": 488,
"right": 803,
},
"F14I5": {
"name": "block",
"type": "H",
"top": 407,
"bottom": 652,
"left": 153,
"right": 270,
},
"F14I6": {
"name": "road signl",
"type": "H",
"top": 480,
"bottom": 716,
"left": 960,
"right": 1189,
},
},
"s15": {
"F15I1": {
"name": "batminton racket",
"type": "H",
"top": 88,
"bottom": 318,
"left": 98,
"right": 329,
},
"F15I2": {
"name": "bread",
"type": "L",
"top": 137,
"bottom": 263,
"left": 494,
"right": 741,
},
"F15I3": {
"name": "keyboard",
"type": "H",
"top": 98,
"bottom": 306,
"left": 904,
"right": 1258,
},
"F15I4": {
"name": "roadsignel",
"type": "H",
"top": 450,
"bottom": 644,
"left": 196,
"right": 263,
},
"F15I5": {
"name": "bycle",
"type": "H",
"top": 394,
"bottom": 641,
"left": 465,
"right": 840,
},
"F15I6": {
"name": "kettle",
"type": "H",
"top": 399,
"bottom": 688,
"left": 969,
"right": 1216,
},
},
"s16": {
"F16I1": {
"name": "bike",
"type": "H",
"top": 74,
"bottom": 380,
"left": 127,
"right": 434,
},
"F16I2": {
"name": "road signle",
"type": "H",
"top": 84,
"bottom": 282,
"left": 543,
"right": 746,
},
"F16I3": {
"name": "fridge",
"type": "H",
"top": 74,
"bottom": 416,
"left": 940,
"right": 1108,
},
"F16I4": {
"name": "pen",
"type": "L",
"top": 471,
"bottom": 679,
"left": 187,
"right": 407,
},
"F16I5": {
"name": "cap",
"type": "L",
"top": 407,
"bottom": 610,
"left": 529,
"right": 784,
},
"F16I6": {
"name": "gloves",
"type": "L",
"top": 478,
"bottom": 635,
"left": 966,
"right": 1209,
},
},
"s17": {
"F17I1": {
"name": "helicopter",
"type": "H",
"top": 120,
"bottom": 334,
"left": 63,
"right": 453,
},
"F17I2": {
"name": "tree",
"type": "L",
"top": 96,
"bottom": 302,
"left": 580,
"right": 806,
},
"F17I3": {
"name": "land phone",
"type": "H",
"top": 116,
"bottom": 352,
"left": 947,
"right": 1221,
},
"F17I4": {
"name": "chair",
"type": "L",
"top": 435,
"bottom": 669,
"left": 165,
"right": 358,
},
"F17I5": {
"name": "van",
"type": "H",
"top": 488,
"bottom": 643,
"left": 532,
"right": 866,
},
"F17I6": {
"name": "book",
"type": "L",
"top": 432,
"bottom": 670,
"left": 965,
"right": 1282,
},
},
"s18": {
"F18I1": {
"name": "Fan",
"type": "H",
"top": 79,
"bottom": 348,
"left": 198,
"right": 382,
},
"F18I2": {
"name": "caboard",
"type": "L",
"top": 53,
"bottom": 371,
"left": 581,
"right": 737,
},
"F18I3": {
"name": "tap",
"type": "L",
"top": 56,
"bottom": 325,
"left": 919,
"right": 1110,
},
"F18I4": {
"name": "bag",
"type": "L",
"top": 410,
"bottom": 680,
"left": 147,
"right": 351,
},
"F18I5": {
"name": "burger",
"type": "H",
"top": 467,
"bottom": 669,
"left": 526,
"right": 793,
},
"F18I6": {
"name": "shirt",
"type": "L",
"top": 409,
"bottom": 694,
"left": 932,
"right": 1184,
},
},
"s19": {
"F19I1": {
"name": "pencil",
"type": "L",
"top": 109,
"bottom": 305,
"left": 90,
"right": 420,
},
"F19I2": {
"name": "bag",
"type": "L",
"top": 92,
"bottom": 344,
"left": 579,
"right": 763,
},
"F19I3": {
"name": "tree",
"type": "L",
"top": 73,
"bottom": 314,
"left": 909,
"right": 1160,
},
"F19I4": {
"name": "bus",
"type": "H",
"top": 435,
"bottom": 631,
"left": 104,
"right": 465,
},
"F19I5": {
"name": "hat",
"type": "L",
"top": 479,
"bottom": 692,
"left": 531,
"right": 920,
},
"F19I6": {
"name": "skirt",
"type": "L",
"top": 375,
"bottom": 588,
"left": 1002,
"right": 1235,
},
},
};
// $(document).ready(function (){
// document.documentElement.requestFullscreen();
// })
// <!-- start webgazer -->
var arr = {};
var percentArr = {}
var slideID = null;
var slide = "ch";
webgazer.setGazeListener(function (data, elapsedTime) {
if (data == null) {
return;
}
var xprediction = data.x; //these x coordinates are relative to the viewport
var yprediction = data.y; //these y coordinates are relative to the viewport
// console.log(elapsedTime); //elapsed time is based on time since begin was called
// console.log(xprediction,yprediction);
if (slide != "ch" && slide != "result") {
gazeObject = getGazeObject(slide, xprediction, yprediction)
// console.log("gazeObject")
// console.log(gazeObject)
// console.log("/gazeObject")
if (arr[slide] == undefined) {
arr[slide] = [];
}
arr[slide].push({
"x": xprediction,
"y": yprediction,
"bb": gazeObject.name,
"type": gazeObject.type
})
$("#objectName").text(gazeObject.name, xprediction, yprediction)
}
}).begin();
// hide #webgazerVideoContainer
// $("#webgazerVideoContainer").hide();
// webgazer.setRegression("weightedRidge");
// webgazer.begin();
// var prediction = webgazer.getCurrentPrediction();
// if (prediction) {
// var x = prediction.x;
// var y = prediction.y;
// console.log(x,y);
// }
// printPred();
// printPred();
// printPred();
// printPred();
// const predloop = setInterval(printPred, 1000);
function printPred() {
var prediction = webgazer.getCurrentPrediction();
if (prediction) {
var x = prediction.x;
var y = prediction.y;
console.log(prediction);
}
}
function getGazeObject(slide, xcoordinate, ycoordinate) {
//cootima bounding box eke condition eka mulinma liyanna one
//condition for object1
// if () object1.left < xcoordinate < object1.right && object1.top < ycoordinate < object1.bottom ) then return object1
// console.log("object1")
// console.log(object1)
// console.log("/object1")
//final condition set
//slide1
if (slide == "s1") {
object1 = boundaryArr[slide]["F1I1"]
if (((object1.left < xcoordinate) && (xcoordinate < object1.right)) && ((object1.top < ycoordinate) && (ycoordinate < object1.bottom))) {
return {
"name": object1.name,
"type": object1.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide2
if (slide == "s2") {
object2 = boundaryArr[slide]["F2I1"]
if (((object2.left < xcoordinate) && (xcoordinate < object2.right)) && ((object2.top < ycoordinate) && (ycoordinate < object2.bottom))) {
return {
"name": object2.name,
"type": object2.type,
}
}
object3 = boundaryArr[slide]["F2I2"]
if (((object3.left < xcoordinate) && (xcoordinate < object3.right)) && ((object3.top < ycoordinate) && (ycoordinate < object3.bottom))) {
return {
"name": object3.name,
"type": object3.type,
}
}
object4 = boundaryArr[slide]["F2I3"]
if (((object4.left < xcoordinate) && (xcoordinate < object4.right)) && ((object4.top < ycoordinate) && (ycoordinate < object4.bottom))) {
return {
"name": object4.name,
"type": object4.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide3
if (slide == "s3") {
object5 = boundaryArr[slide]["F3I1"]
if (((object5.left < xcoordinate) && (xcoordinate < object5.right)) && ((object5.top < ycoordinate) && (ycoordinate < object5.bottom))) {
return {
"name": object5.name,
"type": object5.type,
}
}
object6 = boundaryArr[slide]["F3I2"]
if (((object6.left < xcoordinate) && (xcoordinate < object6.right)) && ((object6.top < ycoordinate) && (ycoordinate < object6.bottom))) {
return {
"name": object6.name,
"type": object6.type,
}
}
object7 = boundaryArr[slide]["F3I3"]
if (((object7.left < xcoordinate) && (xcoordinate < object7.right)) && ((object7.top < ycoordinate) && (ycoordinate < object7.bottom))) {
return {
"name": object7.name,
"type": object7.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide4
if (slide == "s4") {
object9 = boundaryArr[slide]["F4I2"]
if (((object9.left < xcoordinate) && (xcoordinate < object9.right)) && ((object9.top < ycoordinate) && (ycoordinate < object9.bottom))) {
return {
"name": object9.name,
"type": object9.type,
}
}
object10 = boundaryArr[slide]["F4I3"]
if (((object10.left < xcoordinate) && (xcoordinate < object10.right)) && ((object10.top < ycoordinate) && (ycoordinate < object10.bottom))) {
return {
"name": object10.name,
"type": object10.type,
}
}
object8 = boundaryArr[slide]["F4I1"]
if (((object8.left < xcoordinate) && (xcoordinate < object8.right)) && ((object8.top < ycoordinate) && (ycoordinate < object8.bottom))) {
return {
"name": object8.name,
"type": object8.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide5
if (slide == "s5") {
object12 = boundaryArr[slide]["F5I2"]
if (((object12.left < xcoordinate) && (xcoordinate < object12.right)) && ((object12.top < ycoordinate) && (ycoordinate < object12.bottom))) {
return {
"name": object12.name,
"type": object12.type,
}
}
object13 = boundaryArr[slide]["F5I3"]
if (((object13.left < xcoordinate) && (xcoordinate < object13.right)) && ((object13.top < ycoordinate) && (ycoordinate < object13.bottom))) {
return {
"name": object13.name,
"type": object13.type,
}
}
object11 = boundaryArr[slide]["F5I1"]
if (((object11.left < xcoordinate) && (xcoordinate < object11.right)) && ((object11.top < ycoordinate) && (ycoordinate < object11.bottom))) {
return {
"name": object11.name,
"type": object11.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide6
if (slide == "s6") {
object14 = boundaryArr[slide]["F6I1"]
if (((object14.left < xcoordinate) && (xcoordinate < object14.right)) && ((object14.top < ycoordinate) && (ycoordinate < object14.bottom))) {
return {
"name": object14.name,
"type": object14.type,
}
}
object15 = boundaryArr[slide]["F6I2"]
if (((object15.left < xcoordinate) && (xcoordinate < object15.right)) && ((object15.top < ycoordinate) && (ycoordinate < object15.bottom))) {
return {
"name": object15.name,
"type": object15.type,
}
}
object16 = boundaryArr[slide]["F6I3"]
if (((object16.left < xcoordinate) && (xcoordinate < object16.right)) && ((object16.top < ycoordinate) && (ycoordinate < object16.bottom))) {
return {
"name": object16.name,
"type": object16.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide7
if (slide == "s7") {
object17 = boundaryArr[slide]["F7I1"]
if (((object17.left < xcoordinate) && (xcoordinate < object17.right)) && ((object17.top < ycoordinate) && (ycoordinate < object17.bottom))) {
return {
"name": object17.name,
"type": object17.type,
}
}
object18 = boundaryArr[slide]["F7I2"]
if (((object18.left < xcoordinate) && (xcoordinate < object18.right)) && ((object18.top < ycoordinate) && (ycoordinate < object18.bottom))) {
return {
"name": object18.name,
"type": object18.type,
}
}
object19 = boundaryArr[slide]["F7I3"]
if (((object19.left < xcoordinate) && (xcoordinate < object19.right)) && ((object19.top < ycoordinate) && (ycoordinate < object19.bottom))) {
return {
"name": object19.name,
"type": object19.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide8
if (slide == "s8") {
object20 = boundaryArr[slide]["F8I1"]
if (((object20.left < xcoordinate) && (xcoordinate < object20.right)) && ((object20.top < ycoordinate) && (ycoordinate < object20.bottom))) {
return {
"name": object20.name,
"type": object20.type,
}
}
object21 = boundaryArr[slide]["F8I2"]
if (((object21.left < xcoordinate) && (xcoordinate < object21.right)) && ((object21.top < ycoordinate) && (ycoordinate < object21.bottom))) {
return {
"name": object21.name,
"type": object21.type,
}
}
object22 = boundaryArr[slide]["F8I3"]
if (((object22.left < xcoordinate) && (xcoordinate < object22.right)) && ((object22.top < ycoordinate) && (ycoordinate < object22.bottom))) {
return {
"name": object22.name,
"type": object22.type,
}
}
object23 = boundaryArr[slide]["F8I4"]
if (((object23.left < xcoordinate) && (xcoordinate < object23.right)) && ((object23.top < ycoordinate) && (ycoordinate < object23.bottom))) {
return {
"name": object23.name,
"type": object23.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide9
if (slide == "s9") {
object24 = boundaryArr[slide]["F9I1"]
if (((object24.left < xcoordinate) && (xcoordinate < object24.right)) && ((object24.top < ycoordinate) && (ycoordinate < object24.bottom))) {
return {
"name": object24.name,
"type": object24.type,
}
}
object25 = boundaryArr[slide]["F9I2"]
if (((object25.left < xcoordinate) && (xcoordinate < object25.right)) && ((object25.top < ycoordinate) && (ycoordinate < object25.bottom))) {
return {
"name": object25.name,
"type": object25.type,
}
}
object26 = boundaryArr[slide]["F9I3"]
if (((object26.left < xcoordinate) && (xcoordinate < object26.right)) && ((object26.top < ycoordinate) && (ycoordinate < object26.bottom))) {
return {
"name": object26.name,
"type": object26.type,
}
}
object27 = boundaryArr[slide]["F9I4"]
if (((object27.left < xcoordinate) && (xcoordinate < object27.right)) && ((object27.top < ycoordinate) && (ycoordinate < object27.bottom))) {
return {
"name": object27.name,
"type": object27.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide10
if (slide == "s10") {
object28 = boundaryArr[slide]["F10I1"]
if (((object28.left < xcoordinate) && (xcoordinate < object28.right)) && ((object28.top < ycoordinate) && (ycoordinate < object28.bottom))) {
return {
"name": object28.name,
"type": object28.type,
}
}
object29 = boundaryArr[slide]["F10I2"]
if (((object29.left < xcoordinate) && (xcoordinate < object29.right)) && ((object29.top < ycoordinate) && (ycoordinate < object29.bottom))) {
return {
"name": object29.name,
"type": object29.type,
}
}
object30 = boundaryArr[slide]["F10I3"]
if (((object30.left < xcoordinate) && (xcoordinate < object30.right)) && ((object30.top < ycoordinate) && (ycoordinate < object30.bottom))) {
return {
"name": object30.name,
"type": object30.type,
}
}
object31 = boundaryArr[slide]["F10I4"]
if (((object31.left < xcoordinate) && (xcoordinate < object31.right)) && ((object31.top < ycoordinate) && (ycoordinate < object31.bottom))) {
return {
"name": object31.name,
"type": object31.type,
}
}
object32 = boundaryArr[slide]["F10I5"]
if (((object32.left < xcoordinate) && (xcoordinate < object32.right)) && ((object32.top < ycoordinate) && (ycoordinate < object32.bottom))) {
return {
"name": object32.name,
"type": object32.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide11
if (slide == "s11") {
object33 = boundaryArr[slide]["F11I1"]
if (((object33.left < xcoordinate) && (xcoordinate < object33.right)) && ((object33.top < ycoordinate) && (ycoordinate < object33.bottom))) {
return {
"name": object33.name,
"type": object33.type,
}
}
object34 = boundaryArr[slide]["F11I2"]
if (((object34.left < xcoordinate) && (xcoordinate < object34.right)) && ((object34.top < ycoordinate) && (ycoordinate < object34.bottom))) {
return {
"name": object34.name,
"type": object34.type,
}
}
object35 = boundaryArr[slide]["F11I3"]
if (((object35.left < xcoordinate) && (xcoordinate < object35.right)) && ((object35.top < ycoordinate) && (ycoordinate < object35.bottom))) {
return {
"name": object35.name,
"type": object35.type,
}
}
object36 = boundaryArr[slide]["F11I4"]
if (((object36.left < xcoordinate) && (xcoordinate < object36.right)) && ((object36.top < ycoordinate) && (ycoordinate < object36.bottom))) {
return {
"name": object36.name,
"type": object36.type,
}
}
object37 = boundaryArr[slide]["F11I5"]
if (((object37.left < xcoordinate) && (xcoordinate < object37.right)) && ((object37.top < ycoordinate) && (ycoordinate < object37.bottom))) {
return {
"name": object37.name,
"type": object37.type,
}
}
object38 = boundaryArr[slide]["F11I6"]
if (((object38.left < xcoordinate) && (xcoordinate < object38.right)) && ((object38.top < ycoordinate) && (ycoordinate < object38.bottom))) {
return {
"name": object38.name,
"type": object38.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide12
if (slide == "s12") {
object39 = boundaryArr[slide]["F12I1"]
if (((object39.left < xcoordinate) && (xcoordinate < object39.right)) && ((object39.top < ycoordinate) && (ycoordinate < object39.bottom))) {
return {
"name": object39.name,
"type": object39.type,
}
}
object40 = boundaryArr[slide]["F12I2"]
if (((object40.left < xcoordinate) && (xcoordinate < object40.right)) && ((object40.top < ycoordinate) && (ycoordinate < object40.bottom))) {
return {
"name": object40.name,
"type": object40.type,
}
}
object41 = boundaryArr[slide]["F12I3"]
if (((object41.left < xcoordinate) && (xcoordinate < object41.right)) && ((object41.top < ycoordinate) && (ycoordinate < object41.bottom))) {
return {
"name": object41.name,
"type": object41.type,
}
}
object42 = boundaryArr[slide]["F12I4"]
if (((object42.left < xcoordinate) && (xcoordinate < object42.right)) && ((object42.top < ycoordinate) && (ycoordinate < object42.bottom))) {
return {
"name": object42.name,
"type": object42.type,
}
}
object43 = boundaryArr[slide]["F12I5"]
if (((object43.left < xcoordinate) && (xcoordinate < object43.right)) && ((object43.top < ycoordinate) && (ycoordinate < object43.bottom))) {
return {
"name": object43.name,
"type": object43.type,
}
}
object44 = boundaryArr[slide]["F12I6"]
if (((object44.left < xcoordinate) && (xcoordinate < object44.right)) && ((object44.top < ycoordinate) && (ycoordinate < object44.bottom))) {
return {
"name": object44.name,
"type": object44.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide13
if (slide == "s13") {
object45 = boundaryArr[slide]["F13I1"]
if (((object45.left < xcoordinate) && (xcoordinate < object45.right)) && ((object45.top < ycoordinate) && (ycoordinate < object45.bottom))) {
return {
"name": object45.name,
"type": object45.type,
}
}
object46 = boundaryArr[slide]["F13I2"]
if (((object46.left < xcoordinate) && (xcoordinate < object46.right)) && ((object46.top < ycoordinate) && (ycoordinate < object46.bottom))) {
return {
"name": object46.name,
"type": object46.type,
}
}
object47 = boundaryArr[slide]["F13I3"]
if (((object47.left < xcoordinate) && (xcoordinate < object47.right)) && ((object47.top < ycoordinate) && (ycoordinate < object47.bottom))) {
return {
"name": object47.name,
"type": object47.type,
}
}
object48 = boundaryArr[slide]["F13I4"]
if (((object48.left < xcoordinate) && (xcoordinate < object48.right)) && ((object48.top < ycoordinate) && (ycoordinate < object48.bottom))) {
return {
"name": object48.name,
"type": object48.type,
}
}
object49 = boundaryArr[slide]["F13I5"]
if (((object49.left < xcoordinate) && (xcoordinate < object49.right)) && ((object49.top < ycoordinate) && (ycoordinate < object49.bottom))) {
return {
"name": object49.name,
"type": object49.type,
}
}
object50 = boundaryArr[slide]["F13I6"]
if (((object50.left < xcoordinate) && (xcoordinate < object50.right)) && ((object50.top < ycoordinate) && (ycoordinate < object50.bottom))) {
return {
"name": object50.name,
"type": object50.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide14
if (slide == "s14") {
object51 = boundaryArr[slide]["F14I1"]
if (((object51.left < xcoordinate) && (xcoordinate < object51.right)) && ((object51.top < ycoordinate) && (ycoordinate < object51.bottom))) {
return {
"name": object51.name,
"type": object51.type,
}
}
object52 = boundaryArr[slide]["F14I2"]
if (((object52.left < xcoordinate) && (xcoordinate < object52.right)) && ((object52.top < ycoordinate) && (ycoordinate < object52.bottom))) {
return {
"name": object52.name,
"type": object52.type,
}
}
object53 = boundaryArr[slide]["F14I3"]
if (((object53.left < xcoordinate) && (xcoordinate < object53.right)) && ((object53.top < ycoordinate) && (ycoordinate < object53.bottom))) {
return {
"name": object53.name,
"type": object53.type,
}
}
object54 = boundaryArr[slide]["F14I4"]
if (((object54.left < xcoordinate) && (xcoordinate < object54.right)) && ((object54.top < ycoordinate) && (ycoordinate < object54.bottom))) {
return {
"name": object54.name,
"type": object54.type,
}
}
object55 = boundaryArr[slide]["F14I5"]
if (((object55.left < xcoordinate) && (xcoordinate < object55.right)) && ((object55.top < ycoordinate) && (ycoordinate < object55.bottom))) {
return {
"name": object55.name,
"type": object55.type,
}
}
object56 = boundaryArr[slide]["F14I6"]
if (((object56.left < xcoordinate) && (xcoordinate < object56.right)) && ((object56.top < ycoordinate) && (ycoordinate < object56.bottom))) {
return {
"name": object56.name,
"type": object56.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide15
if (slide == "s15") {
object57 = boundaryArr[slide]["F15I1"]
if (((object57.left < xcoordinate) && (xcoordinate < object57.right)) && ((object57.top < ycoordinate) && (ycoordinate < object57.bottom))) {
return {
"name": object57.name,
"type": object57.type,
}
}
object58 = boundaryArr[slide]["F15I2"]
if (((object58.left < xcoordinate) && (xcoordinate < object58.right)) && ((object58.top < ycoordinate) && (ycoordinate < object58.bottom))) {
return {
"name": object58.name,
"type": object58.type,
}
}
object59 = boundaryArr[slide]["F15I3"]
if (((object59.left < xcoordinate) && (xcoordinate < object59.right)) && ((object59.top < ycoordinate) && (ycoordinate < object59.bottom))) {
return {
"name": object59.name,
"type": object59.type,
}
}
object60 = boundaryArr[slide]["F15I4"]
if (((object60.left < xcoordinate) && (xcoordinate < object60.right)) && ((object60.top < ycoordinate) && (ycoordinate < object60.bottom))) {
return {
"name": object60.name,
"type": object60.type,
}
}
object61 = boundaryArr[slide]["F15I5"]
if (((object61.left < xcoordinate) && (xcoordinate < object61.right)) && ((object61.top < ycoordinate) && (ycoordinate < object61.bottom))) {
return {
"name": object61.name,
"type": object61.type,
}
}
object62 = boundaryArr[slide]["F15I6"]
if (((object62.left < xcoordinate) && (xcoordinate < object62.right)) && ((object62.top < ycoordinate) && (ycoordinate < object62.bottom))) {
return {
"name": object62.name,
"type": object62.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide16
if (slide == "s16") {
object63 = boundaryArr[slide]["F16I1"]
if (((object63.left < xcoordinate) && (xcoordinate < object63.right)) && ((object63.top < ycoordinate) && (ycoordinate < object63.bottom))) {
return {
"name": object63.name,
"type": object63.type,
}
}
object64 = boundaryArr[slide]["F16I2"]
if (((object64.left < xcoordinate) && (xcoordinate < object64.right)) && ((object64.top < ycoordinate) && (ycoordinate < object64.bottom))) {
return {
"name": object64.name,
"type": object64.type,
}
}
object65 = boundaryArr[slide]["F16I3"]
if (((object65.left < xcoordinate) && (xcoordinate < object65.right)) && ((object65.top < ycoordinate) && (ycoordinate < object65.bottom))) {
return {
"name": object65.name,
"type": object65.type,
}
}
object66 = boundaryArr[slide]["F16I4"]
if (((object66.left < xcoordinate) && (xcoordinate < object66.right)) && ((object66.top < ycoordinate) && (ycoordinate < object66.bottom))) {
return {
"name": object66.name,
"type": object66.type,
}
}
object67 = boundaryArr[slide]["F16I5"]
if (((object67.left < xcoordinate) && (xcoordinate < object67.right)) && ((object67.top < ycoordinate) && (ycoordinate < object67.bottom))) {
return {
"name": object67.name,
"type": object67.type,
}
}
object68 = boundaryArr[slide]["F16I6"]
if (((object68.left < xcoordinate) && (xcoordinate < object68.right)) && ((object68.top < ycoordinate) && (ycoordinate < object68.bottom))) {
return {
"name": object68.name,
"type": object68.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide17
if (slide == "s17") {
object69 = boundaryArr[slide]["F17I1"]
if (((object69.left < xcoordinate) && (xcoordinate < object69.right)) && ((object69.top < ycoordinate) && (ycoordinate < object69.bottom))) {
return {
"name": object69.name,
"type": object69.type,
}
}
object70 = boundaryArr[slide]["F17I2"]
if (((object70.left < xcoordinate) && (xcoordinate < object70.right)) && ((object70.top < ycoordinate) && (ycoordinate < object70.bottom))) {
return {
"name": object70.name,
"type": object70.type,
}
}
object71 = boundaryArr[slide]["F17I3"]
if (((object71.left < xcoordinate) && (xcoordinate < object71.right)) && ((object71.top < ycoordinate) && (ycoordinate < object71.bottom))) {
return {
"name": object71.name,
"type": object71.type,
}
}
object72 = boundaryArr[slide]["F17I4"]
if (((object72.left < xcoordinate) && (xcoordinate < object72.right)) && ((object72.top < ycoordinate) && (ycoordinate < object72.bottom))) {
return {
"name": object72.name,
"type": object72.type,
}
}
object73 = boundaryArr[slide]["F17I5"]
if (((object73.left < xcoordinate) && (xcoordinate < object73.right)) && ((object73.top < ycoordinate) && (ycoordinate < object73.bottom))) {
return {
"name": object73.name,
"type": object73.type,
}
}
object74 = boundaryArr[slide]["F17I6"]
if (((object74.left < xcoordinate) && (xcoordinate < object74.right)) && ((object74.top < ycoordinate) && (ycoordinate < object74.bottom))) {
return {
"name": object74.name,
"type": object74.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide18
if (slide == "s18") {
object75 = boundaryArr[slide]["F18I1"]
if (((object75.left < xcoordinate) && (xcoordinate < object75.right)) && ((object75.top < ycoordinate) && (ycoordinate < object75.bottom))) {
return {
"name": object75.name,
"type": object75.type,
}
}
object76 = boundaryArr[slide]["F18I2"]
if (((object76.left < xcoordinate) && (xcoordinate < object76.right)) && ((object76.top < ycoordinate) && (ycoordinate < object76.bottom))) {
return {
"name": object76.name,
"type": object76.type,
}
}
object77 = boundaryArr[slide]["F18I3"]
if (((object77.left < xcoordinate) && (xcoordinate < object77.right)) && ((object77.top < ycoordinate) && (ycoordinate < object77.bottom))) {
return {
"name": object77.name,
"type": object77.type,
}
}
object78 = boundaryArr[slide]["F18I4"]
if (((object78.left < xcoordinate) && (xcoordinate < object78.right)) && ((object78.top < ycoordinate) && (ycoordinate < object78.bottom))) {
return {
"name": object78.name,
"type": object78.type,
}
}
object79 = boundaryArr[slide]["F18I5"]
if (((object79.left < xcoordinate) && (xcoordinate < object79.right)) && ((object79.top < ycoordinate) && (ycoordinate < object79.bottom))) {
return {
"name": object79.name,
"type": object79.type,
}
}
object80 = boundaryArr[slide]["F18I6"]
if (((object80.left < xcoordinate) && (xcoordinate < object80.right)) && ((object80.top < ycoordinate) && (ycoordinate < object80.bottom))) {
return {
"name": object80.name,
"type": object80.type,
}
}
return {
"name": "none",
"type": "none"
}
}
//slide19
if (slide == "s19") {
object81 = boundaryArr[slide]["F19I1"]
if (((object81.left < xcoordinate) && (xcoordinate < object81.right)) && ((object81.top < ycoordinate) && (ycoordinate < object81.bottom))) {
return {
"name": object81.name,
"type": object81.type,
}
}
object82 = boundaryArr[slide]["F19I2"]
if (((object82.left < xcoordinate) && (xcoordinate < object82.right)) && ((object82.top < ycoordinate) && (ycoordinate < object82.bottom))) {
return {
"name": object82.name,
"type": object82.type,
}
}
object83 = boundaryArr[slide]["F19I3"]
if (((object83.left < xcoordinate) && (xcoordinate < object83.right)) && ((object83.top < ycoordinate) && (ycoordinate < object83.bottom))) {
return {
"name": object83.name,
"type": object83.type,
}
}
object84 = boundaryArr[slide]["F19I4"]
if (((object84.left < xcoordinate) && (xcoordinate < object84.right)) && ((object84.top < ycoordinate) && (ycoordinate < object84.bottom))) {
return {
"name": object84.name,
"type": object84.type,
}
}
object85 = boundaryArr[slide]["F19I5"]
if (((object85.left < xcoordinate) && (xcoordinate < object85.right)) && ((object85.top < ycoordinate) && (ycoordinate < object85.bottom))) {
return {
"name": object85.name,
"type": object85.type,
}
}
object86 = boundaryArr[slide]["F19I6"]
if (((object86.left < xcoordinate) && (xcoordinate < object86.right)) && ((object86.top < ycoordinate) && (ycoordinate < object86.bottom))) {
return {
"name": object86.name,
"type": object86.type,
}
}
return {
"name": "none",
"type": "none"
}
}
}
// <!-- end webgazer -->
// var type = "s";
var increment = 1;
showSlide();
const taskLoop = setInterval(showSlide, 7000);
function showSlide() {
if (increment >= 20) {
$(".slide").hide();
$("#result").show();
slide = "result";
clearInterval(taskLoop);
$("#objectName").text("none")
webgazer.pause();
//calculate object percentages for each slide
for (let slide in arr) {
OList = arr[slide].map((x) => {
return x.bb
})
const count = {};
for (const element of OList) {
if (count[element]) {
count[element] += 1;
} else {
count[element] = 1;
}
}
var tot = OList.length
percentArr[slide] = {}
for (let name in count) {
percentArr[slide][name] = 100 * count[name] / tot
}
}
return;
}
$(".slide").hide();
slideID = "#s" + parseInt(increment);
$("#ch").show();
$("#objectName").text("none")
slide = "ch";
setTimeout(function () {
$("#ch").hide();
$(slideID).show();
slide = slideID.substr(1); //remove the # in the begining
console.log("slideID: " + slideID);
console.log("increment: " + increment);
}, 2000);
increment += 1;
}
</script>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment