Commit f8e8422e authored by Alexandra Rogova's avatar Alexandra Rogova

custom parser storage working

parent e9254adc
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
.declareMethod("read_file_new", function(link){ .declareMethod("read_file_new", function(link){
var gadget = this; var gadget = this;
return gadget.get_rss(link); return gadget.get_rss(link)
.push(function(result){ .push(function(result){
var rss, var rss,
title; title;
...@@ -77,8 +77,7 @@ ...@@ -77,8 +77,7 @@
}; };
xmlhttp.open("GET", link, true); xmlhttp.open("GET", link, true);
xmlhttp.send(); xmlhttp.send();
}); })
})
.declareMethod("parse", function(local_cur_text) { .declareMethod("parse", function(local_cur_text) {
var title_start = local_cur_text.indexOf("<title>") + 7, var title_start = local_cur_text.indexOf("<title>") + 7,
......
...@@ -26,11 +26,24 @@ ...@@ -26,11 +26,24 @@
if (xmlhttp.status == 200 && xmlhttp.readyState == 4){ if (xmlhttp.status == 200 && xmlhttp.readyState == 4){
return gadget.test_storage.putAttachment("doc_id", "att_id", new Blob([xmlhttp.responseText], {type: "text/xml"})) return gadget.test_storage.putAttachment("doc_id", "att_id", new Blob([xmlhttp.responseText], {type: "text/xml"}))
.push(function(){ .push(function(){
return gadget.test_storage.get("/0/1"); //return gadget.test_storage.get("/0/1");
console.log(gadget.test_storage);
return gadget.test_storage.allDocs();
}) })
.push(function(result){ .push(function(result){
console.log("get result : ");
console.log(result); console.log(result);
var promise_list = [],
i;
for (i=1; i<result.data.total_rows; i+=1){
promise_list.push(gadget.test_storage.get(result.data.rows[i].id));
}
return RSVP.all(promise_list);
})
.push(function (result){
var i;
for (i=0; i<result.length; i+=1){
if (result[i].title.match("la")) console.log(result[i]);
}
}); });
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment