Skip to content

Commit

Permalink
Strip markup from feed posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
peroo committed Jul 9, 2012
1 parent 49b2cad commit 822fac4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
var cell = opera.contexts.speeddial;
cell.url = "http://portal.opera.com/portal/tabs/?tab_name=Opera%20Portal";

function parseData(text) {
var items = JSON.parse(text);
var fragment = document.createElement('div');
return items.map(function(item) {
fragment.innerHTML = item.post_content;
item.post_content = fragment.innerText;
return item;
});
}

function getSources() {
var xhr = new XMLHttpRequest();
xhr.open('GET', widget.preferences.baseURI + "?boxes=100&per_box=3", true);
xhr.onreadystatechange = function(event) {
if(xhr.readyState === 4) {
if(xhr.status === 200) {
data = JSON.parse(xhr.responseText);
data = parseData(xhr.responseText);
refresh();
}
else if(!widget.preferences.sources) {
Expand Down

0 comments on commit 822fac4

Please sign in to comment.