diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-29 00:05:41 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-29 00:05:41 +0200 |
commit | 1961a9776846d63fc5e71848552b338850225f35 (patch) | |
tree | c36f7acee972191531d0a95933c9831b17772f6d /pyaggr3g470r/templates/home.html | |
parent | Delete article from the Whoosh indew when article has been deleted via the RE... (diff) | |
download | newspipe-1961a9776846d63fc5e71848552b338850225f35.tar.gz newspipe-1961a9776846d63fc5e71848552b338850225f35.tar.bz2 newspipe-1961a9776846d63fc5e71848552b338850225f35.zip |
A little bit more JavaScript.
Diffstat (limited to 'pyaggr3g470r/templates/home.html')
-rw-r--r-- | pyaggr3g470r/templates/home.html | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html index 3db5eb87..95fa3b44 100644 --- a/pyaggr3g470r/templates/home.html +++ b/pyaggr3g470r/templates/home.html @@ -132,63 +132,4 @@ {% endif %} </div><!-- /.container --> {% endif %} - -<script type="text/javascript" class="source"> - -$(document).ready(function() { - // Like or unlike an article - $('.like').on('click', function() { - var article_id = $(this).parent().parent().parent().attr("data-article"); - - var data; - if ($(this).hasClass("glyphicon-star")) { - data = JSON.stringify({ - like: false - }) - $(this).removeClass('glyphicon-star').addClass('glyphicon-star-empty'); - } - else { - data = JSON.stringify({ - like: true - }) - $(this).removeClass('glyphicon-star-empty').addClass('glyphicon-star'); - } - - // sends the updates to the server - $.ajax({ - type: 'PUT', - // Provide correct Content-Type, so that Flask will know how to process it. - contentType: 'application/json', - // Encode your data as JSON. - data: data, - // This is the type of data you're expecting back from the server. - url: "/api/v1.0/articles/"+article_id, - success: function (result) { - //console.log(result); - }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); - } - }); // ajax closed - }); - - // Delete an article - $('.delete').on('click', function() { - var article_id = $(this).parent().parent().parent().attr("data-article"); - $(this).parent().parent().parent().remove(); - - // sends the updates to the server - $.ajax({ - type: 'DELETE', - url: "/api/v1.0/articles/"+article_id, - success: function (result) { - //console.log(result); - }, - error: function(XMLHttpRequest, textStatus, errorThrown){ - console.log(XMLHttpRequest.responseText); - } - }); // ajax closed - }); -}) -</script> -{% endblock %} +{% endblock %}
\ No newline at end of file |