Skip to content

Instantly share code, notes, and snippets.

@dennysfredericci
Created April 21, 2014 13:57
Show Gist options
  • Save dennysfredericci/11143515 to your computer and use it in GitHub Desktop.
Save dennysfredericci/11143515 to your computer and use it in GitHub Desktop.
A simple html page to read informations from facebook
<html>
<head>
<title>Fluid Canvas HTML Example </title>
</head>
<body>
<div id="allContent" class="span12">
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>
Toque de Especialista
</legend>
<!-- Text input-->
<div class="control-group">
<label class="control-label" for="nome">Indicação</label>
<div class="controls">
<input id="nome" name="nome" type="text" placeholder="" class="input-xlarge" required="">
</div>
</div>
<!-- Multiple Radios -->
<div class="control-group">
<label class="control-label" for="tipo_toque">Tipo de Toque</label>
<div class="controls">
<label class="radio" for="tipo_toque-0">
<input type="radio" name="tipo_toque" id="tipo_toque-0" value="Cozinha" checked="checked" required="required">
Cozinha </label>
<label class="radio" for="tipo_toque-1">
<input type="radio" name="tipo_toque" id="tipo_toque-1" value="Organização" required="required">
Organização </label>
<label class="radio" for="tipo_toque-2">
<input type="radio" name="tipo_toque" id="tipo_toque-2" value="Visual" required="required">
Visual </label>
</div>
</div>
<!-- Text input-->
<div class="control-group">
<label class="control-label" for="youtube">Link Youtube</label>
<div class="controls">
<input id="youtube" name="youtube" type="text" placeholder="" class="input-xlarge">
</div>
</div>
<!-- File Button -->
<div class="control-group">
<label class="control-label" for="foto">Selecionar Foto</label>
<div class="controls">
<input id="foto" name="foto" class="input-file" type="file">
</div>
</div>
<!-- Textarea -->
<div class="control-group">
<label class="control-label" for="historia">Sua História</label>
<div class="controls">
<textarea id="historia" class="span12" name="historia" rows="6"></textarea>
</div>
</div>
<!-- Button -->
<div class="control-group">
<label class="control-label" for="singlebutton"></label>
<div class="controls">
<button id="singlebutton" name="singlebutton" class="btn btn-primary">
Enviar
</button>
</div>
</div>
<input type="text" name="face_id" id="face_id" value="" />
<input type="text" name="name" id="name" value="" />
<input type="text" name="gender" id="gender" value="" />
<input type="text" name="link" id="link" value="" />
<input type="text" name="locale" id="locale" value="" />
<input type="text" name="username" id="username" value="" />
<input type="text" name="location" id="location" value="" />
</fieldset>
</form>
</div>
<div id="fb-root"></div>
<script src="https://connect.facebook.net/pt_BR/all.js"></script> <!-- location.name -->
<script type="text/javascript">
FB.init({
appId : '853237534692229'
});
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
$("#face_id").val(response.id)
$("#name").val(response.name)
$("#gender").val(response.gender)
$("#link").val(response.link)
$("#locale").val(response.locale)
$("#username").val(response.username)
$("#location").val(response.location.name)
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'basic_info,publish_actions'} );
$("#singlebutton").click(function(){
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
getAllProperties(response);
getAllProperties(response.error);
} else {
alert('Post ID: ' + response.id);
}
});
});
function getAllProperties(obj) {
   var properties = '';
for (property in obj) {
     properties += '\n' + property + " : " + obj[property];
   }
  alert('Properties of object:' + properties);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment