1 function scrapeNotices(user)
4 $(".notice").each(function(){
5 var notice = getNoticeFromElement($(this));
9 notice['user'] = getUserFromElement($(this));
20 var avatarURL = $(".entity_profile .entity_depiction img.avatar").attr('src');
21 var profileURL = $(".entity_profile .entity_nickname .url").attr('href');
22 var nickname = $(".entity_profile .entity_nickname .nickname").text();
25 'profile_image_url': avatarURL,
26 'profile_url': profileURL,
27 'screen_name': nickname
31 function getNoticeFromElement(noticeElement)
35 if(noticeElement.find(".geo").length) {
36 var latlon = noticeElement.find(".geo").attr('title').split(";");
37 notice['geo']={'coordinates': [
38 parseFloat(latlon[0]),
39 parseFloat(latlon[1])] };
42 notice['html'] = noticeElement.find(".e-content").html();
43 notice['url'] = noticeElement.find("a.timestamp").attr('href');
44 notice['created_at'] = noticeElement.find("abbr.published").text();
49 function getUserFromElement(noticeElement)
51 var avatarURL = noticeElement.find("img.avatar").attr('src');
52 var profileURL = noticeElement.find(".author a.url").attr('href');
53 var nickname = noticeElement.find(".author .nickname").text();
56 'profile_image_url': avatarURL,
57 'profile_url': profileURL,
58 'screen_name': nickname
62 function showMapstraction(element, notices) {
63 if(element instanceof jQuery) element = element[0];
64 if(! $.isArray(notices)) notices = [notices];
65 var mapstraction = new mxn.Mapstraction(element, _provider);
72 for (var i in notices)
76 var lat = n['geo']['coordinates'][0];
77 var lon = n['geo']['coordinates'][1];
95 pt = new mxn.LatLonPoint(lat, lon);
96 mkr = new mxn.Marker(pt);
98 mkr.setIcon(n['user']['profile_image_url'], [24, 24]);
99 mkr.setInfoBubble('<a href="'+ n['user']['profile_url'] + '">' + n['user']['screen_name'] + '</a>' + ' ' + n['html'] +
100 '<br/><a href="'+ n['url'] + '">'+ n['created_at'] + '</a>');
102 mapstraction.addMarker(mkr);
105 bounds = new mxn.BoundingBox(minLat, minLon, maxLat, maxLon);
107 mapstraction.setBounds(bounds);