More refactorings.

This commit is contained in:
Lars Jung 2012-10-06 20:08:59 +02:00
parent bd65025a4c
commit b8b6d32a33
7 changed files with 207 additions and 84 deletions

View file

@ -29,13 +29,14 @@ modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], functi
$.ajax({
url: resource.api(),
data: {
action: 'getchecks'
action: 'get',
checks: true
},
type: 'POST',
dataType: 'json',
success: function (json) {
callback(json);
callback(json.checks);
},
error: function () {
@ -44,19 +45,21 @@ modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], functi
});
},
getEntries = function (href, content, callback) {
getEntries = function (href, what, callback) {
$.ajax({
url: resource.api(),
data: {
action: 'getentries',
href: href,
content: content
action: 'get',
entries: true,
entriesHref: href,
entriesWhat: what
},
type: 'POST',
dataType: 'json',
success: function (json) {
callback(json);
callback(json.entries);
},
error: function () {
@ -154,6 +157,7 @@ modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], functi
$.ajax({
url: url,
type: 'POST',
dataType: 'html',
success: function (html) {

View file

@ -5,7 +5,7 @@ modulejs.define('core/refresh', ['_', 'core/mode', 'core/ajax', 'model/entry'],
var found = {};
_.each(json.entries, function (jsonEntry) {
_.each(json, function (jsonEntry) {
found[jsonEntry.absHref] = true;
Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content);