Advertisement
Worked

score.html

Nov 9th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.64 KB | None | 0 0
  1. <!doctype html>
  2. <html xmlns:fb="http://www.facebook.com/2008/fbml">
  3. <head>
  4.   <meta charset="utf-8">
  5.   <title>Coru&#241;a Outlets Espa&#241;a</title>
  6.   <link rel="stylesheet" type="text/css" href="assets/css/reset.css" media="screen">
  7.   <link rel="stylesheet" type="text/css" href="assets/css/score.css" media="screen">
  8.   <script type="text/javascript" src="assets/scripts/jquery-1.8.1.js"></script>
  9.   <script type="text/javascript" src="assets/scripts/jquery.score-1.0.js"></script>
  10. <body>
  11.   <!-- Facebook need it to compatibility -->
  12.   <div id="fb-root"></div>
  13.   <script>
  14.  
  15.     // Iniciamos el SDK de JavaScript
  16.     window.fbAsyncInit = function() {
  17.       FB.init({
  18.         appId      : '{%app-id%}',
  19.         channelUrl : '{%app-facebook%}/channel.html',
  20.         status     : true,
  21.         cookie     : true
  22.         //oauth      : true
  23.       }); // Fin FB.init
  24.  
  25.       // Comprobamos los permisos
  26.       FB.getLoginStatus(function(response) {
  27.         if (response.status === 'not_authorized') {     // Not installed
  28.           $.get('{%app-hostname%}/trackback.php?action=report');
  29.           window.location.href = 'index.php'; }
  30.         else if (response.status === 'connected') {     // Installed, without perms?
  31.           authorizeApp(); }
  32.       }, true); // Fin FB.getLoginStatus
  33.  
  34.     }; // Fin de window.fbAsyncInit
  35.  
  36.     // Requerimos auths para poder usar la app
  37.     function authorizeApp() {
  38.       FB.login(function(response) {
  39.         if (response.authResponse) {
  40.           FB.api('/me/permissions', 'get', function(response) {
  41.             if ( (response.data[0]['email'] != 1) || (response.data[0]['user_likes'] != 1) || (response.data[0]['status_update'] != 1) || (response.data[0]['publish_stream'] != 1) ) {
  42.               $.get('{%app-hostname%}/trackback.php?action=report');
  43.               window.location.href = 'index.php'; }
  44.             });
  45.         }
  46.         else {
  47.           $.get('{%app-hostname%}/trackback.php?action=report');
  48.           window.location.href = "index.php"; }
  49.       }, {scope: 'email,publish_stream,user_likes'});
  50.     } // Fin authorizeApp
  51.  
  52.     // Publish on wall
  53.     function publish_on_wall() {
  54.       FB.ui({
  55.          method: 'feed',
  56.          name: 'Night Shoppings',
  57.          link: '{%app-facebook%}/?fwid={%userbook%}',
  58.          picture: '{%app-hostname%}/assets/portada.jpg',
  59.          caption: 'T&uacute; decides cuanto quieres ganar: Hay 5.000&euro; en juego',
  60.          description: 'Inscr&iacute;bete en la promoci&oacute;n, comp&aacute;rtela con tus amigos, suma puntos y consigue hasta 50&euro; para tus compras en la Night Shopping, que celebraremos el 8 de noviembre de 21.30 a 00.00h.',
  61.       }, function(response) {
  62.           if (!response || response.error) {
  63.             alert('Sentimos que no quieras publicarlo en tu muro.');
  64.           } else {
  65.             alert('Gracias por publicarlo.');
  66.             $.get('{%app-hostname%}/trackback.php?action=shared', function(data) {
  67.               if (data >= {%limit-publish%}) { $('#publish_on_wall').hide(); }
  68.             });
  69.           }
  70.       });
  71.     } // End function publish_on_wall() {
  72.  
  73.     // Funcion invite_friends()
  74.     function invite_friends() {
  75.       //var receiverUserIds =
  76.       FB.ui({
  77.          method : 'apprequests',
  78.          message: 'Participa, suma puntos y consigue 50E para tus compras en la Night Shopping. Entra en {%app-facebook%}/?fwid={%userbook%}',
  79.       }, function(receiverUserIds) {
  80.           for (i=0; i < receiverUserIds.to.length; i++) {
  81.            $.get('{%app-hostname%}/trackback.php?action=invite&facebook={%userbook%}%&request=' + receiverUserIds.request + '&user=' + receiverUserIds.to[i]);
  82.          }
  83.            // Actualizamos el usuario
  84.          $.get('{%app-hostname%}/trackback.php?action=status-invite', function(data) {
  85.            if (data >= {%limit-invite%}) { $('#invite_friends').hide(); }
  86.           }); // Fin del $.get()
  87.       });
  88.     } // Fin de invite_friends
  89.  
  90.     // Reload score window
  91.     function reload_score() {
  92.       window.location.href = 'puntuacion.php';
  93.     } // End $('a#reload_score').click(function(e) {
  94.  
  95.     // Cargamos el SDK Asynchronously
  96.     (function(d){
  97.       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  98.       if (d.getElementById(id)) { return; }
  99.       js = d.createElement('script'); js.id = id; js.async = true;
  100.        js.src = "//connect.facebook.net/es_ES/all.js";
  101.        ref.parentNode.insertBefore(js, ref);
  102.     }(document));
  103.   </script>
  104.  
  105.   <!-- Our code -->
  106.   <div id="approot">
  107.     <div class="wrapper first">
  108.       <h1>Tienes {%score-total%} puntos || Canjeables {%score-value%} &#8364;</h1>
  109.       <img src="{%user-picture%}" alt="{%user-name%}">
  110.       <fieldset>
  111.         <ul>
  112.           <li>1 has participado en el concurso ({%define-default%} punto)</li>
  113.           <li>{%score-publish%} publicaciones en el muro ({%define-publish%} punto)</li>
  114.           <li>{%score-incoming%} usuarios han visitado la promoci&#243;n por tus invitaciones o publicaciones en el muro ({%define-incoming%} punto)</li>
  115.           <li>{%score-joined%} amigos han participado por tus invitaciones o publicaciones en el muro ({%define-joined%} puntos)</li>
  116.         </ul>
  117.       </fieldset>
  118.       <br>
  119.       <hr>
  120.       <div class="buttons">
  121.         {%publish-button%}
  122.         {%invite-button%}
  123.         <a href="puntuacion.php">Recargar puntos</a>
  124.         {%top-ten-button%}
  125.       </div>
  126.     </div>
  127.     {%top-ten-start%}
  128.     <div class="wrapper">
  129.       <h1>Ranking de usuarios</h1>
  130.       {%top-ten%}
  131.       <div class="buttons">
  132.         <a href="#" class="cicle">Ver puntuaci&#243;n</a>
  133.       </div>
  134.     </div>
  135.     {%top-ten-ends%}
  136.   </div>
  137. </body>
  138. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement