A free, self-hostable news aggregator…
JSON : utiliser application/json
Alexandre Alapetiteb646bd2f0844
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.phpindex b3ae40847..8ca730d0f 100755--- a/app/controllers/indexController.php+++ b/app/controllers/indexController.php@@ -260,6 +260,7 @@ class indexController extends ActionController {$res['reason'] = Translate::t ('invalid_login');}+ header('Content-Type: application/json; charset=UTF-8');$this->view->res = json_encode ($res);}diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtmlindex d175e10ed..1c8214bc4 100755--- a/app/views/entry/bookmark.phtml+++ b/app/views/entry/bookmark.phtml@@ -1,4 +1,5 @@<?php+header('Content-Type: application/json; charset=UTF-8');if (Request::param ('is_favorite')) {Request::_param ('is_favorite', 0);diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtmlindex e909d47f4..af360ed0c 100755--- a/app/views/entry/read.phtml+++ b/app/views/entry/read.phtml@@ -1,4 +1,5 @@<?php+header('Content-Type: application/json; charset=UTF-8');if (Request::param ('is_read')) {Request::_param ('is_read', 0);diff --git a/public/scripts/main.js b/public/scripts/main.jsindex 0c0e013e1..5cac3c561 100644--- a/public/scripts/main.js+++ b/public/scripts/main.js@@ -40,8 +40,7 @@ function mark_read(active, only_not_read) {url: url,data : { ajax: true }}).done(function (data) {- var res = $.parseJSON(data),- $r = active.find("a.read").attr("href", res.url),+ var $r = active.find("a.read").attr("href", data.url),inc = 0;if (active.hasClass("not_read")) {active.removeClass("not_read");@@ -50,7 +49,7 @@ function mark_read(active, only_not_read) {active.addClass("not_read");inc++;}- $r.find('.icon').replaceWith(res.icon);+ $r.find('.icon').replaceWith(data.icon);//Update unread: feedvar feed_url = active.find(".website>a").attr("href"),@@ -109,8 +108,7 @@ function mark_favorite(active) {url: url,data : { ajax: true }}).done(function (data) {- var res = $.parseJSON(data),- $b = active.find("a.bookmark").attr("href", res.url),+ var $b = active.find("a.bookmark").attr("href", data.url),inc = 0;if (active.hasClass("favorite")) {active.removeClass("favorite");@@ -119,7 +117,7 @@ function mark_favorite(active) {active.addClass("favorite").find('.bookmark');inc++;}- $b.find('.icon').replaceWith(res.icon);+ $b.find('.icon').replaceWith(data.icon);var favourites = $('.favorites>a').contents().last().get(0);if (favourites && favourites.textContent) {@@ -591,11 +589,9 @@ function init_persona() {url: url_login,data: {assertion: assertion},success: function(res, status, xhr) {- var res_obj = $.parseJSON(res);-- /*if (res_obj.status === 'failure') {+ /*if (res.status === 'failure') {alert (res_obj.reason);- } else*/ if (res_obj.status === 'okay') {+ } else*/ if (res.status === 'okay') {location.href = url_freshrss;}},