Template:Tag Friends Code

From OpenSocial Directory

Jump to: navigation, search
  <?xml version="1.0" encoding="UTF-8" ?> 
  <Module>
  <ModulePrefs title="Tag Friends" description="give tags to your friends - by Aakash Bapna" author="Aakash" author_email="aakash@live.com" author_location="Bangalore, India" height="200" scrolling="false" thumbnail="http://www.econtechnologies.com/site/Media/Downloads/widgetIcon.png">
  <Require feature="opensocial-0.5" /> 
  </ModulePrefs>
  <Content type="html">
  <![CDATA[ 
  
<script type="text/javascript">


var wait="<img src='http://enext.biz/aks/wait.gif' alt='loading image ' />working...";
  function getData() {
   document.getElementById("working").innerHTML=wait;
    var req = opensocial.newDataRequest();
    req.add(req.newFetchPersonRequest('OWNER'), 'owner');
    req.send(onLoadFriends);
  }


 	 var id=0;
  function onLoadFriends(dataResponse) {
    var owner = dataResponse.get('owner').getData();

    id= owner.getField(opensocial.Person.Field.PROFILE_URL) ;
	id= id.substring(18);
	//var html = 'Friends of ' +id;
   var html = 'Tags given to <b>' + owner.getDisplayName()+'</b>';
    document.getElementById("message").innerHTML = html;
	showData();
	
  };
  
  function addData(){
   var frm1 = document.forms["frm1"];
var tag=frm1.tag.value;var url="http://enext.biz/aks/tag.php?id="+id+"&tag="+tag;document.getElementById("working").innerHTML=wait;
_IG_FetchContent(url,_IG_Callback(showData),{refreshInterval: 0});
}

 function showData(response){ 
 if(response==null){var url="http://enext.biz/aks/tag.php?id="+id;document.getElementById("working").innerHTML=wait;
 _IG_FetchContent(url,_IG_Callback(showData),{refreshInterval: 30});} else{
 document.getElementById("working").innerHTML="";
 document.getElementById('server').innerHTML = response;
 var frm1 = document.forms["frm1"];
 frm1.tag.value=""; }
 }
  _IG_RegisterOnloadHandler(getData);

  </script>
  
  <span id="working"></span>
  <div style="margin-left:5px; font-family: sans-serif; width:400; ">
  <form id="frm1" name="form1" >
  <input type="text" name="tag" id="textfield" maxlength="30" size="30" style="font-weight:bold ;border: thin solid #2365C9 ;" />  <input type="button" name="button" id="button" value="Tag me!!" OnClick="javascript:addData()" />
</form></div>
<div id="message" style="font-family: sans-serif; width:300; margin-left:5px;"> </div></br><div id="server" style="font-family: sans-serif;color:#314973;width:300; margin-left:5px;" ></div>
  <p>Add this application to your profile from this url: </p><b><code style="border:thin solid #000000">http://enext.biz/aks/tags.xml</code></b>
  
  

  ]]> 
  </Content>
  </Module>
Personal tools
communication