Skip to content
Extraits de code Groupes Projets
custom-mobile-scripting.js 1,23 ko
Newer Older
  • Learn to ignore specific revisions
  • danielgrippi's avatar
    danielgrippi a validé
    /*   Copyright (c) 2010-2011, Diaspora Inc.  This file is
    
    Sarah Mei's avatar
    Sarah Mei a validé
    *   licensed under the Affero General Public License version 3 or later.  See
    *   the COPYRIGHT file.
    */
    
    
    Laurent's avatar
    Laurent a validé
    $(document).bind("mobileinit", function() {
       $.extend($.mobile, {
    
    lfortin's avatar
    lfortin a validé
         ajaxLinksEnabled: false,
    
         ajaxEnabled: false,
    
    lfortin's avatar
    lfortin a validé
         ajaxFormsEnabled: false
    
    	$.mobile.selectmenu.prototype.options.nativeMenu = false;
    
    
    
    $(document).ready(function(){
      $(".like_action.inactive").bind('tap', function(evt){
        evt.preventDefault();
        var target = $(this),
            postId = target.data('post-id');
    
        $.ajax({
          url: '/posts/'+postId+'/likes.json',
          type: 'POST',
          complete: function(data){
            target.addClass('inactive')
                  .removeClass('active')
                  .data('post-id', postId);
          }
        });
      });
    
      $(".like_action.active").bind('tap', function(evt){
        evt.preventDefault();
        var target = $(this),
            postId = $(this).data('post-id'),
            likeId = $(this).data('like-id');
    
    
        $.ajax({
          url: '/posts/'+postId+'/likes/'+likeId+'.json',
          type: 'DELETE',
          complete: function(data){
            target.addClass('inactive')
                  .removeClass('active')
                  .data('like-id', '');
          }
        });
      });
    });