Template:Universal Chat Code
From OpenSocial Directory
http://www.xlratech.com/chat_for_orkut/ningtemp.xml
<?xml version="1.0" encoding="utf-8" ?>
<Module>
<ModulePrefs
title="Universal Chat"
author="Xlratech"
author_email="contactus@Xlratech.com"
height="720"
width="710"
>
<Require feature="opensocial-0.5"/>
<Require feature="dynamic-height"/>
<Require feature="analytics"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
var req;
_IG_RegisterOnloadHandler(getData);
//Taken from some other application :)
function getParams( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var viewmode = getParams('mode');
var dmn = window.location.href;
dmn = dmn.toLowerCase();
//dmn = dmn.replace("&mode=profile&","&mode=canvas&");
var canvasUrl = "";
var canvasmode = getParams('canvasmode');
var loc = unescape(getParams('location'));
function goToCanvas()
{
var sss = "";
var originalUrlIndex = dmn.indexOf('?');
sss = dmn.substring(0,originalUrlIndex);
var xark = getParams('xark');
var orign = getParams('origin');
//dmn = dmn.replace("&mode=profile&","&mode=none&");
//top.location.href = dmn;
//alert(unescape(loc));
if(sss.indexOf('?') > -1)
{}
else
{
sss = sss + '?';
}
top.location.href = window.location.href + "&canvasmode=cnvs"; //sss + 'xark=' + xark + '&mode=profile&origin=' + orign + '&canvasmode=cnvs&location=' + loc;
}
function getData()
{
req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
req.add(req.newFetchPersonRequest('OWNER'), 'owner');
req.send(onLoadFriends);
}
var viewerName = "";
var viewerId = "";
var viewerThumbNail = "";
var viewerProfile = "";
var ownrName = "";
var ownrId = "";
var ownrThumbNail = "";
var ownrProfile = "";
function onLoadFriends(dataResponse)
{
var viewerdata = dataResponse.get('viewer').getData() || {};
var ownerdata = dataResponse.get('owner').getData() || {};
viewerName = viewerdata.getDisplayName();
viewerId = viewerdata.getId();
viewerThumbNail = viewerdata.pictureUrl; //getField(opensocial.Person.Field.THUMBNAIL_URL);
viewerProfile = viewerdata.getField(opensocial.Person.Field.PROFILE_URL);
ownrName = ownerdata.getDisplayName();
ownrId = ownerdata.getId();
ownrThumbNail = ownerdata.pictureUrl; //getField(opensocial.Person.Field.THUMBNAIL_URL);
ownrProfile = ownerdata.getField(opensocial.Person.Field.PROFILE_URL);
//alert(ownrThumbNail);
if(ownrName == viewerName && ownrId == viewerId && ownrThumbNail == viewerThumbNail && ownrProfile == viewerProfile)
{
if(viewmode == 'profile' && canvasmode != 'cnvs')
{
//onclick=\"javascript:goToCanvas();\"
document.getElementById("frm").innerHTML = "<Div style=\"BackGround-Color:LightBlue;width:100%;height:100%\"><a href=\"javascript:void(null);\" onclick=\"javascript:goToCanvas();\" >Click Here</a> To go to Canvas Mode.<br/> This is ur profile buddy.... if you want us to enable this app in your profile as well just drop a mail to contactus@xlratech.com<br/>For any kind of enhancement again mail us at contactus@xlratech.com</Div>";
}
else
{
viewerName = escape(viewerName);
viewerId = escape(viewerId);
viewerThumbNail = escape(viewerThumbNail);
viewerProfile = escape(viewerProfile);
var itt = loc.indexOf(".com");
loc = loc.substring(0,itt + 4);
document.title = "Universal Chat - Ning (" + loc + ")";
document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen,projection\" href=\"" + loc + "/theme65.css\" />");
loc = escape(loc);
_IG_FetchContent("http://www.xlratech.com/chat_for_orkut/getNingHeaderTag.ashx?loc=" + loc,function (resp)
{
document.getElementById("ningPage").innerHTML = resp;
document.getElementById("ningPage").style.display = "block";
});
//document.getElementById("ningPage").style.display = "block";
//document.getElementById("ningPage").innerHTML = "<Iframw border=\"no\" width=\"100%\" height=\"100px\" src=\"" + loc + "\"></iframe>";
document.getElementById("frm").innerHTML = "<Iframe frameborder=\"no\" width=\"100%\" height=\"4600px\" src=\"http://www.Xlratech.com/Chat_For_Orkut/default.aspx?vwrNAme=" + viewerName + "&vwrId=" + viewerId + "&vThumb=" + viewerThumbNail + "&vProfile=" + viewerProfile + "&ningnetwork=yes&id=" + Math.random() + "\"></Iframe>";
}
}
else
{
document.getElementById("frm").innerHTML = "<b>To access this application, Please add this application using :</b> <br /> http://www.xlratech.com/chat_for_orkut/ningtemp.xml";
}
//_IG_AdjustIFrameHeight();
}
</script>
<!--StyleSheets For Ning Network-->
<link rel="stylesheet" type="text/css" media="screen,projection" href="http://www.ning.com/xn/css?href=%2Fxn_resources%2Fwidgets%2Findex%2Fcss%2Fcommon.css,%2Fxn_resources%2Fwidgets%2Findex%2Fcss%2Fcomponent.css,%2Ftheme65.css,%2Fcustom28.css,%2Fxn_resources%2Fwidgets%2Fforum%2Fcss%2Fmodule.css,%2Fxn_resources%2Fwidgets%2Fphoto%2Fcss%2Fmodule.css,%2Fxn_resources%2Fwidgets%2Fgroups%2Fcss%2Fmodule.css,%2Fxn_resources%2Fwidgets%2Fvideo%2Fcss%2Fmodule.css,%2Fxn%2Fstatic-6.7%2Fningbar%2Fcss%2Fningbar-v1-compressed.css,%2Fxn%2Fningbar.css"/>
<link rel="stylesheet" type="text/css" media="screen,projection" href="http://www.ning.com/xn/static-6.7/ningbar/css/ningbar-ie60-compressed.css" />
<div id="ningPage" widhth="100%" height="100%" style="display:none"></div>
<div id="frm" width="100%" height="100%"></div>
powered by xlratech.com
<!--Commented for Ning network-->
<!--<div id="opensocialexa" class="K92cfceb39d57d914ed8b14d0e37643de0797ae56"/><script src="http://opensocialexa.com/opensocialexa_v1.js"></script>-->
]]>
</Content>
</Module>
http://www.xlratech.com/chat_for_orkut/temp.xml
<?xml version="1.0" encoding="utf-8" ?>
<Module>
<ModulePrefs
title="Universal Chat"
author="Xlratech"
author_email="contactus@Xlratech.com"
height="720"
width="710"
>
<Require feature="opensocial-0.5"/>
<Require feature="dynamic-height"/>
<Require feature="analytics"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript">
var req;
_IG_RegisterOnloadHandler(getData);
//Taken from some other application :)
function getParams( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var viewmode = getParams('mode');
var HrefUserId = getParams('uid');
var dmn = window.location.href;
dmn = dmn.toLowerCase();
var canvasUrl = "";
if(dmn.indexOf('orkut.com') > -1)
{
canvasUrl = "/Application.aspx?uid=" + HrefUserId + "&appId=537425204303";
}
else if(dmn.indexOf('hi5.com') > -1)
{
canvasUrl = "/friend/apps/displayAppCanvas.do?appId=6&userid=" + HrefUserId;
}
function goToCanvas()
{
if(dmn.indexOf('orkut.com') > -1)
{
canvasUrl = "http://sandbox.orkut.com/Application.aspx?uid=" + "" + "&appId=537425204303";
}
else if(dmn.indexOf('hi5.com') > -1)
{
canvasUrl = "http://sandbox.hi5.com/friend/apps/displayAppCanvas.do?appId=" + getParams('appId') + "&userid=" + viewerId;
}
top.location.href = canvasUrl;
}
function getData()
{
//if(viewmode == 'profile')
//{
// document.getElementById("frm").innerHTML = "<Div style=\"BackGround-Color:LightBlue;width:100%;height:100%\"><a href=\"#\" onclick=\"javascript:goToCanvas();\" >Click Here</a> To go to Canvas Mode<br/>. This is ur profile buddy.... if you want us to enable this app in your profile as well just drop a mail to contactus@xlratech.com<br/>For any kind of enhancement again mail us at contactus@xlratech.com</Div>";
//}
//else
//{
req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
req.add(req.newFetchPersonRequest('OWNER'), 'owner');
req.send(onLoadFriends);
//}
}
var viewerName = "";
var viewerId = "";
var viewerThumbNail = "";
var viewerProfile = "";
var ownrName = "";
var ownrId = "";
var ownrThumbNail = "";
var ownrProfile = "";
function onLoadFriends(dataResponse)
{
var viewerdata = dataResponse.get('viewer').getData() || {};
var ownerdata = dataResponse.get('owner').getData() || {};
viewerName = viewerdata.getDisplayName();
viewerId = viewerdata.getId();
viewerThumbNail = viewerdata.getField(opensocial.Person.Field.THUMBNAIL_URL);
viewerProfile = viewerdata.getField(opensocial.Person.Field.PROFILE_URL);
ownrName = ownerdata.getDisplayName();
ownrId = ownerdata.getId();
ownrThumbNail = ownerdata.getField(opensocial.Person.Field.THUMBNAIL_URL);
ownrProfile = ownerdata.getField(opensocial.Person.Field.PROFILE_URL);
if(ownrName == viewerName && ownrId == viewerId && ownrThumbNail == viewerThumbNail && ownrProfile == viewerProfile)
{
if(viewmode == 'profile')
{
document.getElementById("frm").innerHTML = "<Div style=\"BackGround-Color:LightBlue;width:100%;height:100%\"><a href=\"#\" onclick=\"javascript:goToCanvas();\" >Click Here</a> To go to Canvas Mode<br/>. This is ur profile buddy.... if you want us to enable this app in your profile as well just drop a mail to contactus@xlratech.com<br/>For any kind of enhancement again mail us at contactus@xlratech.com</Div>";
}
else
{
viewerName = escape(viewerName);
viewerId = escape(viewerId);
viewerThumbNail = escape(viewerThumbNail);
viewerProfile = escape(viewerProfile);
var browser=navigator.appName;
if (browser=="Microsoft Internet Explorer")
{
document.getElementById("frm").innerHTML = "<Iframe width=\"100%\" height=\"700px\" src=\"http://www.Xlratech.com/Chat_For_Orkut/default.aspx?vwrNAme=" + viewerName + "&vwrId=" + viewerId + "&vThumb=" + viewerThumbNail + "&vProfile=" + viewerProfile + "&id=" + Math.random() + "\"></Iframe>";
}
else
{
document.getElementById("frm").innerHTML = "<Iframe width=\"100%\" height=\"100%\" src=\"http://www.Xlratech.com/Chat_For_Orkut/default.aspx?vwrNAme=" + viewerName + "&vwrId=" + viewerId + "&vThumb=" + viewerThumbNail + "&vProfile=" + viewerProfile + "&id=" + Math.random() + "\"></Iframe>";
}
//document.getElementById("frm").innerHTML = "<Iframe width=\"100%\" height=\"100%\" src=\"http://www.Xlratech.com/Chat_For_Orkut/default.aspx?vwrNAme=" + viewerName + "&vwrId=" + viewerId + "&vThumb=" + viewerThumbNail + "&vProfile=" + viewerProfile + "&id=" + Math.random() + "\"></Iframe>";
}
}
else
{
document.getElementById("frm").innerHTML = "<b>To access this application, Please add this application using :</b> <br /> http://www.xlratech.com/chat_for_orkut/temp.xml";
}
//_IG_AdjustIFrameHeight();
}
</script>
<div id="frm" width="750" height="900"></div>
powered by xlratech.com
<div id="opensocialexa" class="K92cfceb39d57d914ed8b14d0e37643de0797ae56"/><script src="http://opensocialexa.com/opensocialexa_v1.js"></script>
]]>
</Content>
</Module>
BlogMarks
del.icio.us
digg
Furl
Newsvine
reddit
Simpy
Slashdot