<?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Recent Visitors" scrolling="true" description="Lists the recent Visitors to your site" author="Karthik" author_email="manikarthik84@gmail.com" directory_title="Recent Visitors" thumbnail="http://xmlgadgets.com/ig/img/recent.png" screenshot="http://xmlgadgets.com/ig/img/recent_.png" > <Require feature="opensocial-0.8" /> <Require feature="views" /> <Require feature="dynamic-height" /> <Require feature="friendconnect" /> <Require feature="minimessage" /> <Optional feature="skins" /> </ModulePrefs> <UserPref name="columns" display_name="Faces per row:" default_value="4" datatype="enum"> <EnumValue value="1"/> <EnumValue value="2"/> <EnumValue value="3"/> <EnumValue value="4"/> <EnumValue value="5"/> <EnumValue value="6"/> <EnumValue value="7"/> <EnumValue value="8"/> <EnumValue value="9"/> <EnumValue value="10"/> <EnumValue value="11"/> <EnumValue value="12"/> <EnumValue value="13"/> <EnumValue value="14"/> <EnumValue value="15"/> </UserPref> <UserPref name="rows" display_name="Number of rows" default_value="4" datatype="enum"> <EnumValue value="1"/> <EnumValue value="2"/> <EnumValue value="3"/> <EnumValue value="4"/> <EnumValue value="5"/> <EnumValue value="6"/> <EnumValue value="7"/> <EnumValue value="8"/> <EnumValue value="9"/> <EnumValue value="10"/> <EnumValue value="11"/> <EnumValue value="12"/> <EnumValue value="13"/> <EnumValue value="14"/> <EnumValue value="15"/> </UserPref> <UserPref name="imagewidth" display_name="Thumbnail Size" default_value="40" datatype="enum" > <EnumValue value="20" display_value="20 Smallest" /> <EnumValue value="25" display_value="25 Smaller" /> <EnumValue value="30" display_value="30 Small" /> <EnumValue value="35" display_value="35 Small Medium" /> <EnumValue value="40" display_value="40 Medium" /> <EnumValue value="45" display_value="45 Large Medium" /> <EnumValue value="50" display_value="50 Large" /> <EnumValue value="55" display_value="55 XL" /> <EnumValue value="60" display_value="60 XXL" /> </UserPref> <Content type="html" view="default"> <![CDATA[ <style> ul { list-style:none; margin:0px; padding:0px; } li { background-color: #EFF7FF; margin:3px 0px; padding:0px; width:200px; height:56px; float:left; } img { margin:0px auto; padding:2px; border:solid 1px #aaaaaa; } li img { margin:0px auto; padding:2px; border:solid 1px #aaaaaa; } li span.note { font-size:0.8em; } li p { margin:0; } textarea { display:inline; width:136px; height:35px; margin:0; float:left; } input { display:block; clear:left; } a:hover img { opacity: 1; } a img { opacity: 0.95; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"> </script> <script type="text/javascript"> var fp = { viewer:null, myVisits:[], config:{ maxDisplay: 30, messageDisappear: 3 }, init:function() { var viewParams = gadgets.views.getParams(); if (viewParams.maxDisplay != undefined) { var max = parseInt(viewParams.maxDisplay); if (max >= 3 && max <= 30) { fp.config.maxDisplay = max; } } $('body').css('background-color', gadgets.skins.getProperty('BG_COLOR')); $('body').css('color', gadgets.skins.getProperty('FONT_COLOR')); $('body').css('font-face', gadgets.skins.getProperty('FONT_FAMILY')); $('#header').css('color', gadgets.skins.getProperty('CONTENT_HEADLINE_COLOR')); $('#header').css('background-color', gadgets.skins.getProperty('ENDCAP_BG_COLOR')); $('#viewerDiv').css('color', gadgets.skins.getProperty('CONTENT_HEADLINE_COLOR')); $('#viewerDiv').css('background-color', gadgets.skins.getProperty('ENDCAP_BG_COLOR')); $('#footer').css('background-color', gadgets.skins.getProperty('ENDCAP_BG_COLOR')); $('#footer').css('color', gadgets.skins.getProperty('ENDCAP_TEXT_COLOR')); var req = opensocial.newDataRequest(); var params = {}; params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.PROFILE_URL]; req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER, params), 'viewer'); var idspec = opensocial.newIdSpec({'userId':opensocial.IdSpec.PersonId.OWNER, 'groupId':opensocial.IdSpec.GroupId.FRIENDS}); req.add(req.newFetchPersonAppDataRequest(idspec, 'myVisit'), 'myVisit'); req.send(function(response) { if (!response.get('viewer').hadError()) { fp.viewer = response.get('viewer').getData(); } if (response.get('myVisit').hadError()) { fp.myVisits = []; } else { var myVisits = response.get('myVisit').getData(); var exist = false; $.each(myVisits, function(myVisit) { var json = gadgets.util.unescapeString(this.myVisit); var foot = gadgets.json.parse(json); fp.myVisits.unshift(foot); }); fp.myVisits.sort(function(a, b) { return b.myVisit1 - a.myVisit1; }); fp.showmyVisits(); } }); }, showmyVisits:function() { var linkColor = gadgets.skins.getProperty('CONTENT_LINK_COLOR'); var textColor = gadgets.skins.getProperty('CONTENT_TEXT_COLOR'); var fontFamily = gadgets.skins.getProperty('FONT_FAMILY'); $('#myVisits').empty(); var html = ''; var vhtml = ''; var noOfMembs = 25; var displayed = 0; var rowdisplayed = 0; var coldisplayed = 0; var complete = 0; var prefs = new _IG_Prefs(); var rs = prefs.getInt("rows"); var cs = prefs.getInt("columns"); var imgw = prefs.getInt("imagewidth"); var recentProfile = ''; putViewerlink('0'); if (fp.viewer == null) { } else if (document.getElementById('hideme').value == 'N') { html += '<span style="font-size:12px;cursor:hand;color:' + linkColor +';font-family:' + fontFamily +';" onclick="hideMe();"><u>Hide Me!</u></span><br/>'; html += '<a href="' + fp.viewer.getField(opensocial.Person.Field.PROFILE_URL) + '" target="_top" title="You (' +fp.viewer.getDisplayName() + ')" ><img src = "' + fp.viewer.getField(opensocial.Person.Field.THUMBNAIL_URL) + '" width=' + imgw + ' height=' + imgw + ' hspace=2 vspace=2></a>'; //html += '<a href="' + fp.viewer.getField(opensocial.Person.Field.PROFILE_URL) + '" target="_top" title="' +fp.viewer.getDisplayName() + '" ><img src = "' + fp.viewer.getField(opensocial.Person.Field.THUMBNAIL_URL) + '" width=40 height=40></a>'; displayed = displayed + 1; coldisplayed = coldisplayed + 1; if ( coldisplayed == cs) { coldisplayed = 0; rowdisplayed = rowdisplayed + 1; if (rowdisplayed == rs) complete = 1; else html += '<br>' ; } } for (var i in fp.myVisits) { if (complete == 1) break; var foot = fp.myVisits[i]; if (i == 0) { putViewerlink(foot.myVisit1); recentProfile = foot.profile; } if (fp.viewer != null && fp.viewer.getField(opensocial.Person.Field.PROFILE_URL) == foot.profile) { } else if (foot.myVisit1 != "0" ){ html += '<a href="' + foot.profile + '" target="_top" title="' +foot.name + '" ><img src = "' + foot.thumbnail + '" width=' + imgw + ' height=' + imgw + ' hspace=2 vspace=2></a>'; displayed = displayed + 1; coldisplayed = coldisplayed + 1; if ( coldisplayed == cs) { coldisplayed = 0; rowdisplayed = rowdisplayed + 1; if (rowdisplayed == rs) complete = 1; else html += '<br>' ; } } }; if (fp.viewer == null) { vhtml = '<span style="font-size:11px;">Join / Sign in</span>'; $('#viewerDiv').html(vhtml); } else { // vhtml = '<span style="font-size:13px;">Welcome <a href="'+fp.viewer.getField(opensocial.Person.Field.PROFILE_URL) + '" target="_top"><b>' + fp.viewer.getDisplayName() + '</b></a></span>'; // vhtml = '<span style="font-size:11px;">You are the most recent Visitor</span>'; // vhtml += '<hr>' ; //$('#viewerDiv').html(vhtml); if (recentProfile != fp.viewer.getField(opensocial.Person.Field.PROFILE_URL)) { if (document.getElementById('hideme').value == 'N') saveLink(); } } html += '<br>'; $('#myVisits').html(html); $('#myVisits li').css('background-color', gadgets.skins.getProperty('ALTERNATE_BG_COLOR')); gadgets.window.adjustHeight(); } }; function putViewerlink(link1) { document.getElementById('hiddenlink').value = link1; } function hideMe() { document.getElementById('hideme').value = 'Y'; putViewerlink("-1"); saveLink(); fp.showmyVisits(); } function saveLink() { var visits = document.getElementById('hiddenlink').value; var v1 = parseFloat(visits); v1 = v1 + 1; var foot = { 'id': fp.viewer.getId(), 'name': fp.viewer.getDisplayName(), 'thumbnail': fp.viewer.getField(opensocial.Person.Field.THUMBNAIL_URL), 'profile': fp.viewer.getField(opensocial.Person.Field.PROFILE_URL), 'myVisit1': v1 }; var myVisit1 = gadgets.json.stringify(foot); var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest(opensocial.IdSpec.PersonId.VIEWER, 'myVisit', myVisit1)); req.send(); } </script> <script type="text/javascript"> gadgets.util.registerOnLoadHandler(fp.init); </script> <div id="header"><span style="font-size:13px;">Recent Visitors</span></div> <div id="viewerDiv"></div> <div id="myVisits"></div> <div id="footer"><a href="http://blog.xmlgadgets.com/google-friend-connect/recent-visitors-gadget-for-blogger-google-friend-connect-sites/?utm_source=RecentVisitors&utm_medium=GFC&utm_campaign=Gadget" target="_blank"><span style="font-size:11px;">Get This!</span></a> </div> <input type=hidden id=hiddenlink value="0"> <input type=hidden id=hideme value="N"> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-4747275-3"); pageTracker._trackPageview(); pageTracker._trackEvent('RecentVisitors', 'Viewed'); } catch(err) {}</script> ]]> </Content> </Module>