Hello community, I come to ask for an opinion on something I want to achieve.
I have this in my js code in index.html project RSS news ionic charge creates a div with a style, etc, etc
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("http://www.maratondesantiago.com/feed/");
var feeds = 5;
feed.setNumEntries(feeds);
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for(var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
console.log(entry.contentSnippet);
var textos = 0;
if($('.noti > p').length>feeds-1){
$(".noti p").each(function (index) {
if(entry.title != $(this).text()){
textos++;
}
})
}
if(textos<3){
var div = document.createElement("div");
var div_titulo = document.createElement("div");
var contenido_plano = entry.content.replace(/(<([^>]+)>)/ig,"");
var p = document.createElement("p");
var d = document.createElement("p");
var title = document.createTextNode(entry.title);
var descripcion = document.createTextNode(entry.contentSnippet);
var imagenes = entry.content.match(/http([^">]+)/g);
p.appendChild(title);
d.appendChild(descripcion);
d.style.color = "white";
d.style.fontSize = "12px";
p.style.marginBottom = "2px";
p.style.fontFamily = "Entel";
p.style.fontWeight = "bold";
p.style.fontSize = "20px";
p.style.color = "white";
p.style.marginTop = "7px";
div.style.width = "100%";
div.className = "noti"
div.style.height = "200px";
div.style.marginTop = "10px";
div.style.position = "relative";
div_titulo.style.background = "#000000";
div_titulo.style.width = "100%";
div_titulo.style.height = "90px";
div_titulo.style.opacity = 0.8;
div_titulo.style.position = "absolute";
div_titulo.style.bottom = "0px";
div_titulo.style.padding = "5px";
div_titulo.style.minHeight = "110px";
if(imagenes[i]!=null){
var str = imagenes[i];
div.style.backgroundImage = "url("+imagenes[i]+")";
div.style.backgroundRepeat="repeat-y";
div.style.backgroundSize="100% 200px";
}else{
div.style.background = "red";
}
div.style.color = "white";
div.style.border="thick solid #FFF";
div_titulo.appendChild(p);
div_titulo.appendChild(d);
div.appendChild(div_titulo);
container.appendChild(div);
}
}
var count = $("#feed .noti").children().length;
document.getElementById("noticias").innerHTML = count;
}
});
}
google.setOnLoadCallback(initialize);
</script>
What I want to do is open the application or any other application view that this burden of RSS run, they also want to display an icon of the “burden” when the user comes into sight and the news are loaded. I also thought of an algorithm (which I will do, I’m not asking) to upload news day “X” done in order to keep up. What I need from you and your opinions is if this code can be removed leaving the index.html in my js file and load the other drivers before ever explain.
Any advice, example, help, criticism is welcome.