-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
129 lines (93 loc) · 2.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html>
<head>
<title>
Aptitude Practice
</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" >
console.log('jquery loaded')
</script>
</head>
<body onload="myQuery(17)">
<button onclick="back()">back</button>
<button onclick="next()">next</button>
<button onclick="showAll()">show all</button>
<p id="myid">1</p>
<img src="" id='MAIN_IMAGE' alt="image not fetch" width="auto" height="auto">
<ul id="MAIN_IMAGE_2">
</ul>
</body>
</html>
<script type="text/javascript">
var limit;
var token;
var image_raw_url;
var image_code;
var url;
var img_cnt_field = $('#myid')
var img_field = document.getElementById('MAIN_IMAGE')
function myQuery(total_img_cnt) {
limit = total_img_cnt;
console.log('total image = '+limit)
token = "?token=AIBZX2JMTR7RNF6EZGJX3727QUQ4S"
image_raw_url = "https://raw.githubusercontent.com/dheerajpoonia29/aptitudeVerbalReasoning-brainwizCrt/master/percentage/"
image_code = "p"
console.log('loop end')
back()
}
function back() {
// body...
$(document).ready(()=>{
let n = Number(img_cnt_field.text());
n-=1;
img_cnt_field.text(n);
if(n>=0){
updateImageUrl(n)
img_field.src = url
}
else{
img_field.src = "";
}
})
}
function next() {
// body...
$(document).ready(()=>{
let n = Number(img_cnt_field.text());
n += 1
img_cnt_field.text(n);
if(n>=1){
updateImageUrl(n)
img_field.src = url
}
else{
img_field.src = "";
}
})
}
function showAll() {
// body...
updateImageUrl(0)
img_field.src = url
img_cnt_field.text(0);
for(let i=1; i<limit; i++){
// <img src="" id='MAIN_IMAGE_2' alt="image not fetch" width="auto" height="auto">
updateImageUrl(i)
$("#MAIN_IMAGE_2").append('<li>'+i+'<img src='+url+'></li>');
}
}
function updateImageUrl(n) {
// url = image_raw_url+image_code+String(n)+'.png'+token
/*
url = image_raw_url+image_code+String(n)+'.png'
*/
// url with 0 prefix
if(n>=0 && n<=9)
url = image_raw_url+image_code+'0'+String(n)+'.png'
else
url = image_raw_url+image_code+String(n)+'.png'
console.log('final url = ', url)
}
</script>