SlideShare una empresa de Scribd logo
1 de 45
hi5 OpenSocial Codelab
hi5 - Dominant Global Social Network
We are one of the largest web sites in the world (#8 on
  Alexa) and the most global of all the social networking
  sites.
 Over 70+ million registered members and ~40 million
  WW unique users
 Most popular Spanish-speaking social network in the
  world
Top 10 in Latin America
Mexico, Colombia, Bolivia, Guatemala, Peru, Costa Rica,
  Nicaragua, Honduras, Ecuador, El Salvador
Top 10 in Rest of the World
Portugal, Greece, Romania, Cyprus, Thailand, Jamaica, Sri
  Lanka, Kuwait, Jordan, Oman
Hi5’s Demographics
 Broad reach across major demos:

     18 to 34 primary

     Roughly 50%split male/female

     US traffic: significant percentage is Hispanic

 Diverse traffic from Europe (25%), North America (15%) and Central & South
America (31%), Asia (21%)
 Offered in 14 languages

 Grew big in most international countries with English first and then
translated
 Members use the site primarily to keep in touch with their friends. Users
have limited self-expression tools - skins, widgets, etc.
Getting Started
•  A text editor, or the hi5 Gadget Editor
•  Web hosting, or the built-in hosting in the
 hi5 Gadget Editor
• A hi5 account
• Access to the hi5 sandbox
Getting Started on sandbox.hi5.com
Two ways to get
your App going




                  Sample App lets
                     you Edit
Editing Console
Preview Mode
Integration Points

•   Preview Page
•   Profile Module
•   Canvas Page
•   Friend Updates
•   Notifications
•   App Invites
•   Emails
Hello World
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
 <ModulePrefs title="Hello World!” author_email=”lou@hi5.com”>
  <Require feature="opensocial-0.7" />
 </ModulePrefs>
 <Content type="html">
  <![CDATA[
   Hello, world!
  ]]>
 </Content>
</Module>
Hello World
• <Module> indicates that this XML file contains a gadget.
• <ModulePrefs> contains information about the gadget, and
  its author.
• author_email must match your hi5 account’s email in the
  hi5 container
• <Require feature="opensocial-0.7" /> denotes a required
  feature of the gadget — in this case, the OpenSocial API
  (v0.7).
• <Content type="html"> indicates that the gadget's content
  type is HTML.
• <![ CDATA[…]]> contains the bulk of the gadget, including
  all of the HTML, CSS, and JavaScript (or references to such
  files).
Initialization
gadgets.util.registerOnLoadHandler(init);

function init() {
  loadFriends();
}
Fetching Friends
function loadFriends() {
 var req = opensocial.newDataRequest();
 req.add(req.newFetchPersonRequest('VIEWER'),
  'viewer');

  req.add(req.newFetchPeopleRequest('VIEWER_F
  RIENDS'), 'viewerFriends');
req.send(onLoadFriends);
}
Handle the Response
Handle the Response
function onLoadFriends(data) {
 var viewer = data.get('viewer').getData();
 var viewerFriends = data.get('viewerFriends').getData();

    html = new Array();
    html.push('<ul>');
    viewerFriends.each(function(person) {
     html.push('<li>' + person.getDisplayName() + "</li>");
    });
    html.push('</ul>');
    document.getElementById('friends').innerHTML = html.join('');
}
Adding App Data
Adding App Data
Adding App Data
Adding App Data

var givenGifts = {};

function giveGift() {
 var nut = document.getElementById('nut').value;
 var friend = document.getElementById('person').value;

    givenGifts[friend] = nut;
    var json = gadgets.json.stringify(givenGifts);

    var req = opensocial.newDataRequest();

      req.add(req.newUpdatePersonAppDataRequest(opensocial.DataRequest.PersonId
      .VIEWER, 'gifts', json));
    req.send();
}
Displaying App Data
Displaying App Data
Displaying App Data
Displaying App Data
function updateGiftList(viewer, data, friends) {
 var json = data[viewer.getId()]['gifts'];

    if (!json) {
      givenGifts = {};
    }
    try {
      givenGifts = gadgets.json.parse(json);
    } catch (e) {
      givenGifts = {};
    }

    var options = ['a cashew nut', 'a peanut', 'a hazelnut', 'a red pistachio nut'];

    var html = new Array();
    html.push('You have given:');
    html.push('<ul>');
    for (i in givenGifts) {
      if (+(i) > 0) {
        html.push('<li>' + friends[i] + ' received ' + options[givenGifts[i]] + '</li>');
      }
    }
    html.push('</ul>');
    document.getElementById('given').innerHTML = html.join('');
}
Displaying App Data
Displaying App Data
Displaying App Data
Displaying App Data
Displaying App Data
function updateReceivedList(viewer, data, friends) {
 var viewerId = viewer.getId();
 var options = ['a cashew nut', 'a peanut', 'a hazelnut', 'a red pistachio nut'];

    var html = new Array();
    html.push('You have received:<ul>');
    friends.each(function(person) {
     var personData = data[person.getId()];
     if (personData) {
       var json = data[person.getId()]['gifts'];

      var gifts = {}
      if (!json) {
        gifts = {};
      }
      try {
        gifts = gadgets.json.parse(json);
      } catch (e) {
        gifts = {};
      }

      for (i in gifts) {
        if (+(i) > 0 && i == viewerId) {
          html.push('<li>' + options[gifts[i]] + ' from ' + person.getDisplayName() + '</li>');
        }
      }
     }
    });
    html.push('</ul>');
    document.getElementById('recieved').innerHTML = html.join('');
}
Displaying App Data
Resizing the Window
Resizing the Window
Creating Activity
function createActivity(title) {
  var opts = new Array();

    opts[opensocial.Activity.Field.TITLE] = title;
    opts[opensocial.Activity.Field.STREAM_FAVICON_URL] = 'http://images.hi5.com/images/icons/
      _/update_widget.png');

    var activity = opensocial.newActivity(opts);

    // Request the activity creation
    opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH);
}
Creating Activity
Sending Notifications
function sendNotifications(notification, toIds) {
  var params = new Object();
  params[opensocial.Message.Field.TYPE] =
  opensocial.Message.Type.NOTIFICATION;
  var message =
  opensocial.newMessage(notification, params);
  opensocial.requestSendMessage(toIds,
  message);
}
Sending Notifications
Making Content Requests
Making Content Requests

function getStatus() {
var authToken = this.sandbox.hi5Container.params['Hi5AuthToken'];
  gadgets.io.makeRequest('http://api.hi5.com/rest/status/getStatus?
    userId='+viewer.getField(opensocial.Person.Field.ID) +'&Hi5AuthToken='+authToken,
       function(response) {
          var data = response.data;
          console.debug(response.text);
          var content = data.getElementsByTagName('content');
          if(content.length == 1) {
            document.getElementById('status').innerHTML = "Your status: " +
    content.item(0).firstChild.nodeValue;
          }
       },
  {'METHOD' : 'GET', 'CONTENT_TYPE' : 'DOM'});
}
Working With Views
Working With Views
<Content type=“html” view=“profile”>
<![CDATA[
<script
   src="http://images.hi5.com/images/opensocial/gifts.js"></script>
    <script>
     gadgets.util.registerOnLoadHandler(initProfile);
    </script>
    <div id='main'>
     <div id='received’></div>
    </div>
 ]]>
</Content>
Navigating to a View
Navigating to a View

function navToCanvas() {
     var views = gadgets.views.getSupportedViews();
     gadgets.views.requestNavigateTo(views['canvas']);
}
Applying a Skin
Applying a Skin
Other Features

• requestShareApp
• requestSendMessage
  – EMAIL, PRIVATE_MESSAGE, PUBLIC_MESSAGE
• Person Field extensions
  – SMALL_IMG_URL, MEDIUM_IMG_URL,
    LARGE_IMG_URL
• Lifecycle Callbacks
• Activity Templates
hi5 Roadmap
March 15: Hackathon geared towards launch
 preparation. Apps will be considered for
 whitelisting from this date until launch.

March 31: Production launch

Más contenido relacionado

La actualidad más candente

jQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a TreejQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a Treeadamlogic
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created itPaul Bearne
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j queryMd. Ziaul Haq
 
Self join in active record association
Self join in active record associationSelf join in active record association
Self join in active record associationRORLAB
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do MoreRemy Sharp
 
Achilles presentation
Achilles presentationAchilles presentation
Achilles presentationDuyhai Doan
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web developmentJohannes Brodwall
 
Introduction to jQuery - The basics
Introduction to jQuery - The basicsIntroduction to jQuery - The basics
Introduction to jQuery - The basicsMaher Hossain
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersJonathan Sharp
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptDarren Mothersele
 
Ajax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsAjax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsTse-Ching Ho
 
Migration to jQuery 3.5.x
Migration to jQuery 3.5.xMigration to jQuery 3.5.x
Migration to jQuery 3.5.xStanislavIdolov
 
Magento Dependency Injection
Magento Dependency InjectionMagento Dependency Injection
Magento Dependency InjectionAnton Kril
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsFelix Arntz
 

La actualidad más candente (18)

jQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a TreejQuery and Rails, Sitting in a Tree
jQuery and Rails, Sitting in a Tree
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
Self join in active record association
Self join in active record associationSelf join in active record association
Self join in active record association
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
Achilles presentation
Achilles presentationAchilles presentation
Achilles presentation
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Introduction to jQuery - The basics
Introduction to jQuery - The basicsIntroduction to jQuery - The basics
Introduction to jQuery - The basics
 
jQuery quick tuts
jQuery quick tutsjQuery quick tuts
jQuery quick tuts
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for Developers
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
 
Ajax nested form and ajax upload in rails
Ajax nested form and ajax upload in railsAjax nested form and ajax upload in rails
Ajax nested form and ajax upload in rails
 
Migration to jQuery 3.5.x
Migration to jQuery 3.5.xMigration to jQuery 3.5.x
Migration to jQuery 3.5.x
 
Magento Dependency Injection
Magento Dependency InjectionMagento Dependency Injection
Magento Dependency Injection
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Jquery ui
Jquery uiJquery ui
Jquery ui
 
Bacbkone js
Bacbkone jsBacbkone js
Bacbkone js
 
Jquery 3
Jquery 3Jquery 3
Jquery 3
 

Destacado (6)

Xpi final presentation
Xpi final presentationXpi final presentation
Xpi final presentation
 
Social media lab
Social media labSocial media lab
Social media lab
 
Diapositivas
DiapositivasDiapositivas
Diapositivas
 
페이스북 캐리비안베이
페이스북 캐리비안베이페이스북 캐리비안베이
페이스북 캐리비안베이
 
Practica 1
Practica 1Practica 1
Practica 1
 
Morality of the profit
Morality of the profitMorality of the profit
Morality of the profit
 

Similar a Hi5 opensocial-code-lab-presentation-1203814696810018-3

Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon PresentationLou Moore
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegapyangdj
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaveryangdj
 
The Open & Social Web - Kings of Code 2009
The Open & Social Web - Kings of Code 2009The Open & Social Web - Kings of Code 2009
The Open & Social Web - Kings of Code 2009Chris Chabot
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.musart Park
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of usOSCON Byrum
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4Heather Rock
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4DEVCON
 
Pengenalan AngularJS
Pengenalan AngularJSPengenalan AngularJS
Pengenalan AngularJSEdi Santoso
 
Spiffy Applications With JavaScript
Spiffy Applications With JavaScriptSpiffy Applications With JavaScript
Spiffy Applications With JavaScriptMark Casias
 
Open Social Presentation - GSP West 2008
Open Social Presentation - GSP West 2008Open Social Presentation - GSP West 2008
Open Social Presentation - GSP West 2008Patrick Chanezon
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformanceJonas De Smet
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datosphilogb
 

Similar a Hi5 opensocial-code-lab-presentation-1203814696810018-3 (20)

Hi5 Hackathon Presentation
Hi5 Hackathon PresentationHi5 Hackathon Presentation
Hi5 Hackathon Presentation
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver
 
Client Web
Client WebClient Web
Client Web
 
The Open & Social Web - Kings of Code 2009
The Open & Social Web - Kings of Code 2009The Open & Social Web - Kings of Code 2009
The Open & Social Web - Kings of Code 2009
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.
 
Opensocial Codelab
Opensocial CodelabOpensocial Codelab
Opensocial Codelab
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Eu odeio OpenSocial
Eu odeio OpenSocialEu odeio OpenSocial
Eu odeio OpenSocial
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Pengenalan AngularJS
Pengenalan AngularJSPengenalan AngularJS
Pengenalan AngularJS
 
Spiffy Applications With JavaScript
Spiffy Applications With JavaScriptSpiffy Applications With JavaScript
Spiffy Applications With JavaScript
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
J query training
J query trainingJ query training
J query training
 
Open Social Presentation - GSP West 2008
Open Social Presentation - GSP West 2008Open Social Presentation - GSP West 2008
Open Social Presentation - GSP West 2008
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
jQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and PerformancejQuery: Tips, tricks and hints for better development and Performance
jQuery: Tips, tricks and hints for better development and Performance
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datos
 

Último

SSPL The Strand Abodes Kharadi Pune Brochure.pdf
SSPL The Strand Abodes Kharadi Pune Brochure.pdfSSPL The Strand Abodes Kharadi Pune Brochure.pdf
SSPL The Strand Abodes Kharadi Pune Brochure.pdfabbu831446
 
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhidollysharma2066
 
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdf
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdfSobha Aranya Sector 80 Gurgaon E- Brochure.pdf
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdffaheemali990101
 
8 Key Elements for Comfortable Farmland Living
8 Key Elements for Comfortable Farmland Living 8 Key Elements for Comfortable Farmland Living
8 Key Elements for Comfortable Farmland Living Farmland Bazaar
 
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdf
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdfMADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdf
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdfknoxdigital1
 
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Nanke Area Estate commercial ( Dir. Kat Kuo)
Nanke Area Estate commercial ( Dir. Kat Kuo)Nanke Area Estate commercial ( Dir. Kat Kuo)
Nanke Area Estate commercial ( Dir. Kat Kuo)jessica288382
 
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...AditiAlishetty
 
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCR
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCRCall Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCR
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCRasmaqueen5
 
SVN Live 4.22.24 Weekly Property Broadcast
SVN Live 4.22.24 Weekly Property BroadcastSVN Live 4.22.24 Weekly Property Broadcast
SVN Live 4.22.24 Weekly Property BroadcastSVN International Corp.
 
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhidelhimodel235
 
Ryan Mahoney - How Property Technology Is Altering the Real Estate Market
Ryan Mahoney - How Property Technology Is Altering the Real Estate MarketRyan Mahoney - How Property Technology Is Altering the Real Estate Market
Ryan Mahoney - How Property Technology Is Altering the Real Estate MarketRyan Mahoney
 
Call Girls in Khan Market 9654467111 ESCORTS SERVICE
Call Girls in Khan Market 9654467111 ESCORTS SERVICECall Girls in Khan Market 9654467111 ESCORTS SERVICE
Call Girls in Khan Market 9654467111 ESCORTS SERVICESapana Sha
 
Partner With the Golden Life Community for Single Women Over 55
Partner With the Golden Life Community for Single Women Over 55Partner With the Golden Life Community for Single Women Over 55
Partner With the Golden Life Community for Single Women Over 55Ron Surz
 
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...lizamodels9
 
Prestige Sector 94 at Noida E Brochure.pdf
Prestige Sector 94 at Noida E Brochure.pdfPrestige Sector 94 at Noida E Brochure.pdf
Prestige Sector 94 at Noida E Brochure.pdfsarak0han45400
 
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...lizamodels9
 

Último (20)

SSPL The Strand Abodes Kharadi Pune Brochure.pdf
SSPL The Strand Abodes Kharadi Pune Brochure.pdfSSPL The Strand Abodes Kharadi Pune Brochure.pdf
SSPL The Strand Abodes Kharadi Pune Brochure.pdf
 
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi
83770-87607 ۞Call Girls In Near The Park Hotel (Cp) Delhi
 
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdf
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdfSobha Aranya Sector 80 Gurgaon E- Brochure.pdf
Sobha Aranya Sector 80 Gurgaon E- Brochure.pdf
 
8 Key Elements for Comfortable Farmland Living
8 Key Elements for Comfortable Farmland Living 8 Key Elements for Comfortable Farmland Living
8 Key Elements for Comfortable Farmland Living
 
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdf
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdfMADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdf
MADHUGIRI FARM LAND BROCHURES (11)_compressed (1).pdf
 
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Pitampura Delhi 💯Call Us 🔝8264348440🔝
 
Nanke Area Estate commercial ( Dir. Kat Kuo)
Nanke Area Estate commercial ( Dir. Kat Kuo)Nanke Area Estate commercial ( Dir. Kat Kuo)
Nanke Area Estate commercial ( Dir. Kat Kuo)
 
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...
Affordable and Quality Construction SVTN's Signature Blend of Cost-Efficiency...
 
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Sarai Kale Khan Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCR
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCRCall Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCR
Call Girls In Peeragarhi, Delhi↫8447779280↬Call Girls in Peeragarhi Delhi NCR
 
SVN Live 4.22.24 Weekly Property Broadcast
SVN Live 4.22.24 Weekly Property BroadcastSVN Live 4.22.24 Weekly Property Broadcast
SVN Live 4.22.24 Weekly Property Broadcast
 
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 1 Noida (Call Girls) Delhi
 
Ryan Mahoney - How Property Technology Is Altering the Real Estate Market
Ryan Mahoney - How Property Technology Is Altering the Real Estate MarketRyan Mahoney - How Property Technology Is Altering the Real Estate Market
Ryan Mahoney - How Property Technology Is Altering the Real Estate Market
 
Call Girls in Mahavir Nagar whatsaap call US +919953056974
Call Girls in Mahavir Nagar  whatsaap call US  +919953056974Call Girls in Mahavir Nagar  whatsaap call US  +919953056974
Call Girls in Mahavir Nagar whatsaap call US +919953056974
 
Call Girls in Khan Market 9654467111 ESCORTS SERVICE
Call Girls in Khan Market 9654467111 ESCORTS SERVICECall Girls in Khan Market 9654467111 ESCORTS SERVICE
Call Girls in Khan Market 9654467111 ESCORTS SERVICE
 
Partner With the Golden Life Community for Single Women Over 55
Partner With the Golden Life Community for Single Women Over 55Partner With the Golden Life Community for Single Women Over 55
Partner With the Golden Life Community for Single Women Over 55
 
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...
Call Girls In Mayur Vihar-1 Delhi ❤️8860477959 Good Looking Escorts In 24/7 D...
 
Hot call girls in Moti Bagh🔝 9953056974 🔝 escort Service
Hot call girls in Moti Bagh🔝 9953056974 🔝 escort ServiceHot call girls in Moti Bagh🔝 9953056974 🔝 escort Service
Hot call girls in Moti Bagh🔝 9953056974 🔝 escort Service
 
Prestige Sector 94 at Noida E Brochure.pdf
Prestige Sector 94 at Noida E Brochure.pdfPrestige Sector 94 at Noida E Brochure.pdf
Prestige Sector 94 at Noida E Brochure.pdf
 
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...
Call Girls In Vasundhara Ghaziabad ❤️8860477959 Low Rate Escorts Service In 2...
 

Hi5 opensocial-code-lab-presentation-1203814696810018-3

  • 2. hi5 - Dominant Global Social Network We are one of the largest web sites in the world (#8 on Alexa) and the most global of all the social networking sites.  Over 70+ million registered members and ~40 million WW unique users  Most popular Spanish-speaking social network in the world Top 10 in Latin America Mexico, Colombia, Bolivia, Guatemala, Peru, Costa Rica, Nicaragua, Honduras, Ecuador, El Salvador Top 10 in Rest of the World Portugal, Greece, Romania, Cyprus, Thailand, Jamaica, Sri Lanka, Kuwait, Jordan, Oman
  • 3. Hi5’s Demographics  Broad reach across major demos:  18 to 34 primary  Roughly 50%split male/female  US traffic: significant percentage is Hispanic  Diverse traffic from Europe (25%), North America (15%) and Central & South America (31%), Asia (21%)  Offered in 14 languages  Grew big in most international countries with English first and then translated  Members use the site primarily to keep in touch with their friends. Users have limited self-expression tools - skins, widgets, etc.
  • 4. Getting Started • A text editor, or the hi5 Gadget Editor • Web hosting, or the built-in hosting in the hi5 Gadget Editor • A hi5 account • Access to the hi5 sandbox
  • 5. Getting Started on sandbox.hi5.com
  • 6. Two ways to get your App going Sample App lets you Edit
  • 9. Integration Points • Preview Page • Profile Module • Canvas Page • Friend Updates • Notifications • App Invites • Emails
  • 10. Hello World <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Hello World!” author_email=”lou@hi5.com”> <Require feature="opensocial-0.7" /> </ModulePrefs> <Content type="html"> <![CDATA[ Hello, world! ]]> </Content> </Module>
  • 11. Hello World • <Module> indicates that this XML file contains a gadget. • <ModulePrefs> contains information about the gadget, and its author. • author_email must match your hi5 account’s email in the hi5 container • <Require feature="opensocial-0.7" /> denotes a required feature of the gadget — in this case, the OpenSocial API (v0.7). • <Content type="html"> indicates that the gadget's content type is HTML. • <![ CDATA[…]]> contains the bulk of the gadget, including all of the HTML, CSS, and JavaScript (or references to such files).
  • 13. Fetching Friends function loadFriends() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest('VIEWER'), 'viewer'); req.add(req.newFetchPeopleRequest('VIEWER_F RIENDS'), 'viewerFriends'); req.send(onLoadFriends); }
  • 15. Handle the Response function onLoadFriends(data) { var viewer = data.get('viewer').getData(); var viewerFriends = data.get('viewerFriends').getData(); html = new Array(); html.push('<ul>'); viewerFriends.each(function(person) { html.push('<li>' + person.getDisplayName() + "</li>"); }); html.push('</ul>'); document.getElementById('friends').innerHTML = html.join(''); }
  • 19. Adding App Data var givenGifts = {}; function giveGift() { var nut = document.getElementById('nut').value; var friend = document.getElementById('person').value; givenGifts[friend] = nut; var json = gadgets.json.stringify(givenGifts); var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest(opensocial.DataRequest.PersonId .VIEWER, 'gifts', json)); req.send(); }
  • 23. Displaying App Data function updateGiftList(viewer, data, friends) { var json = data[viewer.getId()]['gifts']; if (!json) { givenGifts = {}; } try { givenGifts = gadgets.json.parse(json); } catch (e) { givenGifts = {}; } var options = ['a cashew nut', 'a peanut', 'a hazelnut', 'a red pistachio nut']; var html = new Array(); html.push('You have given:'); html.push('<ul>'); for (i in givenGifts) { if (+(i) > 0) { html.push('<li>' + friends[i] + ' received ' + options[givenGifts[i]] + '</li>'); } } html.push('</ul>'); document.getElementById('given').innerHTML = html.join(''); }
  • 28. Displaying App Data function updateReceivedList(viewer, data, friends) { var viewerId = viewer.getId(); var options = ['a cashew nut', 'a peanut', 'a hazelnut', 'a red pistachio nut']; var html = new Array(); html.push('You have received:<ul>'); friends.each(function(person) { var personData = data[person.getId()]; if (personData) { var json = data[person.getId()]['gifts']; var gifts = {} if (!json) { gifts = {}; } try { gifts = gadgets.json.parse(json); } catch (e) { gifts = {}; } for (i in gifts) { if (+(i) > 0 && i == viewerId) { html.push('<li>' + options[gifts[i]] + ' from ' + person.getDisplayName() + '</li>'); } } } }); html.push('</ul>'); document.getElementById('recieved').innerHTML = html.join(''); }
  • 32. Creating Activity function createActivity(title) { var opts = new Array(); opts[opensocial.Activity.Field.TITLE] = title; opts[opensocial.Activity.Field.STREAM_FAVICON_URL] = 'http://images.hi5.com/images/icons/ _/update_widget.png'); var activity = opensocial.newActivity(opts); // Request the activity creation opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH); }
  • 34. Sending Notifications function sendNotifications(notification, toIds) { var params = new Object(); params[opensocial.Message.Field.TYPE] = opensocial.Message.Type.NOTIFICATION; var message = opensocial.newMessage(notification, params); opensocial.requestSendMessage(toIds, message); }
  • 37. Making Content Requests function getStatus() { var authToken = this.sandbox.hi5Container.params['Hi5AuthToken']; gadgets.io.makeRequest('http://api.hi5.com/rest/status/getStatus? userId='+viewer.getField(opensocial.Person.Field.ID) +'&Hi5AuthToken='+authToken, function(response) { var data = response.data; console.debug(response.text); var content = data.getElementsByTagName('content'); if(content.length == 1) { document.getElementById('status').innerHTML = "Your status: " + content.item(0).firstChild.nodeValue; } }, {'METHOD' : 'GET', 'CONTENT_TYPE' : 'DOM'}); }
  • 39. Working With Views <Content type=“html” view=“profile”> <![CDATA[ <script src="http://images.hi5.com/images/opensocial/gifts.js"></script> <script> gadgets.util.registerOnLoadHandler(initProfile); </script> <div id='main'> <div id='received’></div> </div> ]]> </Content>
  • 41. Navigating to a View function navToCanvas() { var views = gadgets.views.getSupportedViews(); gadgets.views.requestNavigateTo(views['canvas']); }
  • 44. Other Features • requestShareApp • requestSendMessage – EMAIL, PRIVATE_MESSAGE, PUBLIC_MESSAGE • Person Field extensions – SMALL_IMG_URL, MEDIUM_IMG_URL, LARGE_IMG_URL • Lifecycle Callbacks • Activity Templates
  • 45. hi5 Roadmap March 15: Hackathon geared towards launch preparation. Apps will be considered for whitelisting from this date until launch. March 31: Production launch