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 getMicroformatValue(element)
33 if(element[0].tagName.toLowerCase() == 'abbr'){
34 return element.attr('title');
36 return element.text();
40 function getNoticeFromElement(noticeElement)
44 if(noticeElement.find(".geo").length) {
45 var latlon = noticeElement.find(".geo").attr('title').split(";");
46 notice['geo']={'coordinates': [
47 parseFloat(latlon[0]),
48 parseFloat(latlon[1])] };
51 notice['html'] = noticeElement.find(".entry-content").html();
52 notice['url'] = noticeElement.find("a.timestamp").attr('href');
53 notice['created_at'] = noticeElement.find("abbr.published").text();
58 function getUserFromElement(noticeElement)
60 var avatarURL = noticeElement.find("img.avatar").attr('src');
61 var profileURL = noticeElement.find(".author a.url").attr('href');
62 var nickname = noticeElement.find(".author .nickname").text();
65 'profile_image_url': avatarURL,
66 'profile_url': profileURL,
67 'screen_name': nickname
71 function showMapstraction(element, notices) {
72 if(element instanceof jQuery) element = element[0];
73 if(! $.isArray(notices)) notices = [notices];
74 var mapstraction = new mxn.Mapstraction(element, _provider);
81 for (var i in notices)
85 var lat = n['geo']['coordinates'][0];
86 var lon = n['geo']['coordinates'][1];
104 pt = new mxn.LatLonPoint(lat, lon);
105 mkr = new mxn.Marker(pt);
107 mkr.setIcon(n['user']['profile_image_url']);
108 mkr.setInfoBubble('<a href="'+ n['user']['profile_url'] + '">' + n['user']['screen_name'] + '</a>' + ' ' + n['html'] +
109 '<br/><a href="'+ n['url'] + '">'+ n['created_at'] + '</a>');
111 mapstraction.addMarker(mkr);
114 bounds = new mxn.BoundingBox(minLat, minLon, maxLat, maxLon);
116 mapstraction.setBounds(bounds);