/**
 * Tatoeba Project, free collaborative creation of multilingual corpuses project
 * Copyright (C) 2009 Allan SIMON <allan.simon@supinfo.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


$(document).ready(function(){
    $(document).watch("addrule", function() {
        $(".add-to-corpus").click(function(){

            var sentenceId = $(this).attr("data-sentence-id");
            var correctness = $(this).attr("data-sentence-correctness");
            var addToCorpusOption = $(this);
            var action = "add";

            var requestUrl = "/collections";
            if ($(this).hasClass("selected")){
                requestUrl += "/delete_sentence/" + sentenceId + "/" + correctness;
            } else {
                requestUrl += "/add_sentence/" + sentenceId + "/" + correctness;
            }

            addToCorpusOptionParent = addToCorpusOption.parent();
            addToCorpusOption.html("<div class='loader-small loader'></div>");

            $.post(requestUrl, {}, function(data){
                addToCorpusOptionParent.replaceWith(data);
            });
        });
    });
});

@@ -1590,16 +1590,17 @@
 iv%3E%22);%0A%0A
+%0A
         
@@ -1682,16 +1682,23 @@
 nParent.
+watch(%22
 replaceW
@@ -1700,17 +1700,19 @@
 laceWith
-(
+%22, 
 data);%0A 

Fix rating buttons after pressing once