Skip to content

Instantly share code, notes, and snippets.

@shingonoide
Created December 30, 2011 02:41
Show Gist options
  • Save shingonoide/1537400 to your computer and use it in GitHub Desktop.
Save shingonoide/1537400 to your computer and use it in GitHub Desktop.
IFY
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Irritando Fernanda Young - Facebook Application </title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="pt-br" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<!-- <link rel="stylesheet" href="css/fcbk_style.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" /> -->
<link rel="stylesheet" href="js/TextboxList/TextboxList.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="js/TextboxList/TextboxList.Autocomplete.css" type="text/css" media="screen" charset="utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]>
<link href="css/ie6.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="js/ify.js" type="text/javascript" charset="utf-8"></script>
<script src="js/TextboxList/GrowingInput.js" type="text/javascript" charset="utf-8"></script>
<script src="js/TextboxList/TextboxList.js" type="text/javascript" charset="utf-8"></script>
<script src="js/TextboxList/TextboxList.Autocomplete.js" type="text/javascript" charset="utf-8"></script>
<script src="js/TextboxList/TextboxList.Autocomplete.Binary.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="fb-root">
<!--
<p id="verify-status" style='margin-left: 15px;'><b>Aguarde, Verificando configurações...</b></p>
-->
</div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '111216638924260',
session : {"session_key":"2.AQAc0pK3ti2hH4QF.3600.1325217600.0-681874477","uid":"681874477","expires":"1325217600","secret":"lK7BI9sochsehm4cta5fMA__","access_token":"AAABlJqRBleQBAOz8cvEkTZB5dkJdcZBuH6T4ZBncgVRViRJS0ky9FAOqnMLl7AWXTngxN0xg5eWhkopHHap7ZC91R5jgv9X0QNjn39Oc1QZDZD","sig":"f552aeeea306555043670a72227ecfe5"}, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
});
FB.Canvas.setAutoResize();
FB.getLoginStatus(handleSessionResponse);
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
/*
FB.login(function(response) {
if (response.session) {
if (response.perms) {
// user is logged in and granted some permissions.
// perms is a comma separated list of granted permissions
flash_message('Permissões: '+response.perms, 'info');
} else {
// user is logged in, but did not grant any permissions
flash_message('Sem permissao: '+response.perms, 'info');
}
} else {
// user is not logged in
flash_message('User not loggedin');
}
}, {perms:'publish_stream'});
*/
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/pt_BR/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
// handle a session response from any of the auth related calls
function handleSessionResponse(response) { return; }
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#show-ranking').click(function(){
showRanking()
});
$('#suggest-show-ranking').click(function(){
showRanking()
});
$('#show-sugerir').click(function(){
showSuggest()
});
$('#ranking-back').click(function(){
showQuadro()
});
$('#suggest-back').click(function(){
showQuadro()
});
$('p.BtTornarFa > a').click(function(){
$.ajax({
type: "POST",
url: "http://www.facebook.com/ajax/pages/fan_status.php?__a=1",
data: "fbpage_id=111216638924260&add=1&reload=0&preserve_tab=0&use_primer=0&post_form_id_source=AsyncRequest",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
// fbpage_id=111216638924260&add=1&reload=1&preserve_tab=1&use_primer=1&nctr[_mod]=pagelet_top_bar&post_form_id=10927192e4740074d0efe81645ac0803&fb_dtsg=7e0Qh&post_form_id_source=AsyncRequest
/*
FB.api('/111216638924260/likes', 'post',{
}, function(response){
});
*/
});
//end document.ready
});
function showQuadro(){
$('#ranking').fadeOut('fast');
$('#suggest').fadeOut('fast');
$('#quadro').fadeTo('normal', 1);
showBts();
}
function showRanking(){
$('#suggest').fadeOut('fast');
$('#quadro').fadeOut('fast');
$('#ranking').fadeTo('normal', 1);
hideBts();
}
function showSuggest(){
$('#quadro').fadeOut('fast');
$('#ranking').fadeOut('fast');
$('#suggest').fadeTo('normal', 1);
hideBts();
}
function showBts() {
$('#irritar-bts')[0].style.position = 'static';
$('#irritar-bts').stop().animate({opacity: 1}, 'normal');
}
function hideBts() {
$('#irritar-bts').stop().animate({opacity: 0}, 'normal', function () {
$('#irritar-bts')[0].style.position = 'relative';
$('#irritar-bts')[0].style.top = '-99999px';
});
}
</script>
<div id="BoxContainer">
<div id="flash-message" style="display: none;"></div>
<h1 class="replace"><a href="#"><strong>IFY</strong></a></h1>
<div id="quadro">
<div id="phrase" class="BoxVerOutro">
<div class="content">
<span class="my-quote">&ldquo;</span><span class="my-name"></span>
<h2>escreveu um email em comic sans para...<br/>
<p class="txt-help">Escolha abaixo o amigo que quer irritar</p>
</h2>
<p class="replace VerOutro"><a href="index.php"><strong>Ver outro</strong></a></p>
<p class="replace VerRanking"><a href="#" id="show-ranking"><strong>Ver ranking</strong></a></p>
</div>
</div><!-- .BoxVerOutro -->
</div><!-- #quadro -->
<div id="ranking">
<!-- Conteúdo do ranking -->
<p class="replace back"><a href="#" id="ranking-back" alt="Voltar">&nbsp;</a></p>
<div id="user-rank-1" style="color:#482F0E; font-family: Arial; font-size: 24px; font-weight: bold; position: absolute; left: 120px;">
<img src="http://profile.ak.fbcdn.net/hprofile-ak-ash2/372143_100000944744879_904907789_q.jpg" /><div style="position: relative; top: -30px; left: 60px; width: 200px">Priscila Dante</div>
</div>
<div id="user-rank-2" style="color:#482F0E; font-family: Arial; font-size: 18px; font-weight: bold; position: absolute; left: 180px; top: 185px;">
<img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/273311_100001043469300_1859372962_q.jpg" width="25" height="25" /><div style="position: relative; width: 200px;left:35px;top:-20px;">Rafael Bertozzo Duarte</div>
</div>
<div id="user-rank-3" style="color:#482F0E; font-family: Arial; font-size: 18px; font-weight: bold; position: absolute; top: 230px; left: 225px;">
<img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/202877_635504835_3410811_q.jpg" width="25" height="25" /><div style="position: relative; width: 200px;left:35px;top:-20px">Celia Saraceni</div>
</div>
</div>
<div id="suggest">
<!-- Conteúdo do ranking -->
<form action="blablabla">
<textarea class="text-area" id="user_suggest" name="user_suggest"></textarea>
<p class="replace submit-form">
<a href="#" id="send-form">&nbsp;</a>
</p>
</form>
<p class="replace back"><a href="#" id="suggest-back" alt="Voltar">&nbsp;</a></p>
<p class="replace ranking"><a href="#" id="suggest-show-ranking">&nbsp;</a></p>
</div>
<div id="irritador" class="BoxIrritar fix">
<div class="fix" id="irritar-bts">
<label>Selecionar amigo:</label>
<input type="text" name="friend_selector" id="friend-selector" />
<p class="replace BtIrritar"><a href="#" id="btnIrritar"><strong>Irritar</strong></a></p>
<script type="text/javascript" language="Javascript">
var exibindo = 0;
var listaDeMensagens = [];
function checkNext() {
if (exibindo || !listaDeMensagens.length) { return; }
var current = listaDeMensagens.shift();
message = current[0];
type = current[1];
exibindo = 1;
$('#flash-message')
.html('<span class="'+type+'">'+message+'</span')
.show('slow')
.delay(5555)
.hide('slow', function () { exibindo = 0; checkNext(); });
}
function flash_message(message,type) {
listaDeMensagens.push([message, type]);
checkNext();
}
$(document).ready(function(){
var friend_textbox = new $.TextboxList('#friend-selector', {
max: 1,
bitsOptions: {
editable: {
growing: false
}
},
plugins: {
autocomplete: {
placeholder: 'Digite o nome de um amigo',
onlyFromValues: true,
}
}
});
friend_textbox.addEvent('bitBoxAdd',function(widget) {
$('.textboxlist-bit-editable-input').hide();
$('.textboxlist-autocomplete').hide();
});
friend_textbox.addEvent('bitBoxRemove',function() {
$('.textboxlist-bit-editable-input').show();
$('.textboxlist-autocomplete').show();
});
$('#btnIrritar').click(function(btn){
var friend_selected = friend_textbox.getValues()[0];
var phrase_id = 4;
if (friend_selected != undefined ){
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'Irritando Fernanda Young',
caption: ' '+'escreveu um email em comic sans para'+"\n"+friend_selected[1],
href: 'http://apps.facebook.com/irritandofy?ref=wall',
media: [
{
'type':'image',
'src': 'http://186.202.16.46/ify/75x75_icone.jpg',
'href':'http://apps.facebook.com/irritandofy/'
}
]
},
user_message_prompt: 'Veja como vai ficar sua frase irritante para seu amigo',
target_id: friend_selected[0]/*,
display: 'popup'*/
},
function(response) {
if (response && response.post_id) {
// enviar informações para o servidor
//alert('Sua frase foi publicada com sucesso.');
$.ajax({
type: "POST",
url: "annoymizer.php",
data: 'sender_id=681874477&receiver_id='+friend_selected[0]+'&phrase_id=4',
success: function(msg){
flash_message('Sua frase foi publicada com sucesso.','info');
}
});
} else {
// frase não foi publicada
//alert('Sua frase não foi publicada.');
flash_message('Sua frase não foi publicada.', 'error');
}
}
);
/*
FB.api('/'+friend_selected[0]+'/feed', 'post', {
message: ' '+'escreveu um email em comic sans para '+friend_selected[1]
}, function(response) {
if (!response || response.error) {
//Ocorreu um erro
alert('Ocorreu um errooooooooooooooooooooo, oh oh!!! não se assuste, erro também é normal ;)');
} else {
//Mensagem enviada
// alert('Post ID: ' + response);
alert('Você enviou sua frase irritante ao seu amigo: '+friend_selected[1]);
if (console){
console.log('Post ID: ' +response);
}
}
});
*/
}else{
flash_message('Por favor, escolha um amigo primeiro na lista', 'info');
}
});
});
</script>
</div>
<div class="box fix">
<!-- <p class="replace BtPublicar"><a href="#"><strong>Publicar</strong></a></p> -->
<p class="replace BtSugerir"><a href="#" id="show-sugerir"><strong>Sugerir</strong></a></p>
<p class="replace BtAddFavoritos"><fb:bookmark><a href="#"><strong>Adicionar aos favoritos</strong></a></fb:bookmark></p>
<!--
<p class="replace BtTornarFa"><a href="#"><strong>Tornar-me fã</strong></a></p>
-->
</div>
</div><!-- .BoxIrritar -->
</div><!-- #BoxContainer-->
<div id="user-info">
&nbsp;
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment