RSS feed controlled by Javascript, if else statement confusion -
RSS feed controlled by Javascript, if else statement confusion -
so have rss feed displaying on multiple pages. on 1 page want events equal or beyond today's date display. on page want future events (like homepage) events of specific string title. of avoided if file read rss feed correctly feed doesn't have old dates on it. real core of problem.
as of set in place homepage. sees first x number of old entries , bypasses older ones not equal or greater today's date. works homepage.
(var = 0; < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; //regex queries 'match' method var filter_by_reg = regexp(filter_by, 'i'); var filter_by_2_reg = regexp(filter_by_2, 'i'); var cond1 = result.feed.entries[i].title.match(filter_by_reg); var cond2 = result.feed.entries[i].title.match(filter_by_2_reg); var today = new date; var pubdate = new date(entry.publisheddate); if (pubdate >= today) { //display items if(display_all == true){ cond1 = true; cond2 = true; } } //query entries matches , add together them "entry" array display if(cond1 || cond2 ){ var pubdate = new date(entry.publisheddate); var pubmonth = month_names[pubdate.getmonth()]; var pubdatenum = pubdate.getdate(); var href = 'http-link-here';//entry.link; var title = removedatetitle(entry.title); var location = entry.categories[0]; if(location != undefined){ location = location.replace(/[+]/g ," "); } var time = formattime( entry.publisheddate ); var desc = entry.content; desc = removedatedesc(desc); desc_short = desc.split(" ").splice(0, 25).join(" "); desc_short += "..."; // output html += '<div class="calentry' + ' tooltip_' + + '">' + '<div class="calcon">' + '<div class="caltop">' + pubmonth + '</div>' + '<div class="calbottom">' + pubdatenum + '</div>' + '</div>' + '<div class="description"><h3 class="calhead"><a href="' + href + '" target="_blank">' + title + '</a></h3>' + '<div class=callocation>' + time + ' in ' + location + '</div>' + '<p>' + desc_short + '<br />' + '</p></div><div class="clear"></div>' + '</div>'; //qtipcontent html += '<div style="display: none;">' + '<b>full description:</b><br />' + replaceurlwithhtmllinks(desc) + '<br />' + '<p><b>time: </b>' + time + '<br />' + '<b>location: </b>' + location + //throw new error(html); //update content content.innerhtml = html; } }//end loop //display message when no feed items found if(html == ''){ html += '<p class="cal_noevents">no events scheduled.</p>'; content.innerhtml = html; } //hide preloader $('#loading').fadeout('slow'); //animate loaded content $(content).wrapinner('<div class="calendarinner" />'); //wrap inner div var contentheight = $('.calendarinner').outerheight();// height of content div. contentheight = contentheight; $(content).animate({height:contentheight}, 1000); // animate height $('.calendarinner').css('width','100%'); //fix border line issue after animation //qtip var cal_items $('.calentry').each(function() { var thisentry = $(this); thisentry.qtip( { content: { text: thisentry.next('div:hidden'), title: { text: thisentry.find('h3').text(), button: true } }, position: { my: 'center', // ...at center of viewport at: 'center', target: $(window) }, show: { event: 'click', // show on click... solo: true, // ...and hide other tooltips... modal: true // ...and create modal }, hide: false, style: { classes: 'ui-tooltip-light ui-tooltip-rounded', width: 500 } }); }).bind('click', function(event){ event.preventdefault(); homecoming false; }); //end qtip } } function onload() { // create feed instance grab feed. var feed = new google.feeds.feed(feed_url); feed.setnumentries(count); // calling load sends request off. requires callback function. feed.load(feedloaded); } google.setonloadcallback(onload); } //end init }; $.fn.extend({ //pass options variable function fsucalendar: function(options) { //set default values, utilize comma separate settings, example: var defaults = { filter_by : false, filter_by_2 : false, count : 4, display_all : false, feed_url : 'nofeed', link_url : 'http://cal.aspx' } var options = $.extend(defaults, options); var o = options; //call init method (get ball rollin) -- passing options 'o' source.init(o); } }); })(jquery);
javascript rss
Comments
Post a Comment