-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.htm
More file actions
44 lines (40 loc) · 1.59 KB
/
index.htm
File metadata and controls
44 lines (40 loc) · 1.59 KB
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wikimedia API and GUI</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<link rel="stylesheet" media="screen" type="text/css" href="wiki-api-gui-styles.css" />
<script type="text/javascript" src="wikimedia-api-gui.js"></script>
<script>
$(document).ready(function() {
var myhandler = function(theimg,jqdata){
mydata = jqdata.attr('data-full');
console.log("img data:"+mydata);
try{
dataA =JSON.parse(mydata.replace(/'/g,'"'));
} catch (e) {
console.error("JSON parse error on:"+mydata);
};
$('#image-of-day').html('<img src="'+theimg+'" width="'+(dataA.width/4)+'" height="'+(dataA.height/4)+'"/>');
}
vpr={};
WikimediaApi = new WikimediaApiClass(vpr,$);
WikimediaApi.selfConstruct({initsearch:'landscape',
waiticon:'<span id="spinner" class="gnlv-blink">working!<span>',
thumbWidth:150,
containerDiv:'#gui-container',
clickHandler: myhandler
});
});
</script>
</head>
<body>
<h2>Image of The Day</h2>
<div id="image-of-day" style="width:50%;height:150px;border:thin dashed orange;padding:10px;font-face:Tahoma;overflow:scroll;">image will go here</div>
<h2>One DIV in your application holds the gui:</h2>
<div id="image-wrapper" style="width:50%;height:500px;border:thin dashed orange;padding:5px;">
<div id="gui-container" class="gnlv-wikidiv"></div>
</div>
</body>
</html>