-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmgram-paso9.html
148 lines (128 loc) · 4.48 KB
/
mgram-paso9.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="ui/jquery.ui.map.js"></script>
<script type="text/javascript" src="ui/jquery.ui.map.services.js"></script>
<script type="text/javascript" src="ui/jquery.ui.map.extensions.js"></script>
<script type="text/javascript">
var instagram_client_id = "fc8041d4af1544a2939c3f5a9a1ef8cf";
function getPhotos() {
var tag = $("#list .tag").val();
if (tag == "") {
tag = "instafood";
}
tag = tag.replace(/(#| )/g,"");
$(".search-button").addClass('ui-disabled');
$(".result-count").html("cargando...");
$("#element_list").empty();
var url = "https://api.instagram.com/v1/tags/" + tag + "/media/recent?client_id=" + instagram_client_id + "&callback=?";
$.getJSON(url, function(data){
var data_elements = data["data"];
var showing = 0;
$.each(data_elements, function(index, current_element) {
showing++;
var thumbnail = current_element["images"]["thumbnail"]["url"];
var caption = "ver imagen";
if (current_element["caption"] != null) {
caption = current_element["caption"]["text"];
}
var link = current_element["link"];
$("#element_list").append(
$('<li>').append(
$('<a>').attr('href',link).append(
$('<img>').attr('src',thumbnail)).append(caption))
);
});
$("#element_list").listview("refresh");
$(".search-button").removeClass('ui-disabled');
$(".result-count").html("Mostrando " + showing + " resultados para #" + tag);
});
}
$("#map").live("pagecreate", function() {
$('#map_canvas').gmap({'zoom': 2});
});
$("#list").live("pageshow", function() {
getPhotos();
});
$(document).on('click', '[data-role="navbar"] a', function () {
$.mobile.changePage($(this).attr("data-href"), {
transition: "none",
changeHash: false
});
return false;
});
</script>
</head>
<body>
<div id="map" data-role="page">
<div data-role="header">
<h1>Mejorando.la-gram</h1>
</div>
<div data-role="navbar">
<ul>
<li><a href="#" data-href="#map" class="ui-btn-active">Mapa</a></li>
<li><a href="#" data-href="#list">Listado</a></li>
<li><a href="#" data-href="#upload">Mis fotos</a></li>
</ul>
</div>
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<input type="text" class="tag" name="tag"/>
</div>
<div class="ui-block-b">
<a href="javascript:getPhotos();" data-role="button"
data-icon="check" data-inline="true" class="search-button">Buscar</a>
</div>
</fieldset>
<div class="result-count"></div>
<br/>
<div class="ui-bar-c ui-corner-all ui-shadow" style="padding:1em;">
<div id="map_canvas" style="height:350px"></div>
</div>
</div>
<div id="list" data-role="page">
<div data-role="header">
<h1>Mejorando.la-gram</h1>
</div>
<div data-role="navbar">
<ul>
<li><a href="#" data-href="#map">Mapa</a></li>
<li><a href="#" data-href="#list" class="ui-btn-active">Listado</a></li>
<li><a href="#" data-href="#upload">Mis fotos</a></li>
</ul>
</div>
<div data-role="content">
<fieldset class="ui-grid-a">
<div class="ui-block-a">
<input type="text" class="tag" name="tag"/>
</div>
<div class="ui-block-b">
<a href="javascript:getPhotos();" data-role="button"
data-icon="check" data-inline="true" class="search-button">Buscar</a>
</div>
</fieldset>
<div class="result-count"></div>
<br/>
<ul data-role="listview" id="element_list"></ul>
</div>
</div>
<div id="upload" data-role="page">
<div data-role="header">
<h1>Mejorando.la-gram</h1>
</div>
<div data-role="navbar">
<ul>
<li><a href="#" data-href="#map">Mapa</a></li>
<li><a href="#" data-href="#list">Listado</a></li>
<li><a href="#" data-href="#upload" class="ui-btn-active">Mis fotos</a></li>
</ul>
</div>
Mis fotos
</div>
</body>
</html>