PDA

View Full Version : gAjax RSS Feeds Displayer (hosted) ..WORD Filtration?



z2z
03-05-2009, 09:02 AM
1) Script Title: gAjax RSS Feeds Displayer (hosted)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

3) Describe problem: How to remove specific word(fwords) from description?

jscheuer1
03-05-2009, 02:48 PM
In the gfeedfetcher.js file, this line places the text to be displayed in the feed catcher on your page:


this.feedcontainer.innerHTML=rssoutput

If it's just one word you are concerned with, do:


this.feedcontainer.innerHTML=rssoutput.replace(/badword/gm, '****');

If you have a bunch of words in mind, make up a variable:


// -------------------------------------------------------------------
// gAjax RSS Feeds Displayer- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Created: July 17th, 2007 Updated: n/a
// -------------------------------------------------------------------

var badwords = new RegExp('(badword1)|(badword2)|(badword3)|(badword4)', 'gm');

var gfeedfetcher_loading_image="indicator.gif" //Full URL to "loading" image. No need to config after this line!!

Place it at the top of the gfeedfetcher.js file as shown.

Then make that other line we were talking about look like so:


this.feedcontainer.innerHTML=rssoutput.replace(badwords, '****');

Just make sure none of your bad words could legitimately be contained inside of other words especially HTML markup. If you have such a word in mind, we can deal with it easily enough, though I can't think of any 'bad' words off of the top of my head that would qualify for special treatment in that regard.

z2z
03-05-2009, 05:37 PM
thanks jscheuer1 :)

jscheuer1
03-05-2009, 05:48 PM
It just occurred to me, that sometimes a bad word might be capitalized, even perhaps in violation of the general rules of capitalizing words, so we should use the i (case insensitive) switch as well. If doing a single word:


this.feedcontainer.innerHTML=rssoutput.replace(/badword/gmi, '****');

If using the variable RegExp constructor:


var badwords = new RegExp('(badword1)|(badword2)|(badword3)|(badword4)', 'gmi');

z2z
03-13-2009, 06:45 AM
thanks mate :)

Is possible to add http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

like example 4 - 5 -6