function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steve BlackwellSteve Blackwell 

Console Marquee Component - how to exclude certain text and tags?

Working off of a tutorial I found in an older service cloud console cookbook, I've setup a scrolling marquee component at the bottom of our console. Not a coder by nature, I know my way around code well enough to troublehsoot and make basic modifications, but unfortunately the two changes I want to make to this code are a bit beyond me!

I'd like to:
  • Strip out HTML tags. It looks like the code does use .innerHTML to do this, but it doesn't work and posts in the Chatter group I'm pulling the text from are still showing <p> tags around my text in the marquee. I believe this cookbook was from pre-HTML posts in Chatter.
  • Set it to exclude posts with a certain #topic since the posts otherwise scroll forever, I want to be able to edit a Chatter post and add a #topic to it which will "shut it off" in the marquee.
Have spent quite a while on this and unfortunately I just haven't been able to figure it out with my novice level of coding!
 
<apex:page showHeader="false">

<meta http-equiv="refresh" content="60"/>

<style>
    body {
        padding: 10px;
        }
</style>

<!-- Start/Stop buttons - disabled for now
<div style="margin-left:auto; margin-right:auto;width:50%;">

    <apex:form>
        <apex:commandButton value="Start" id="startBtn" onclick="scrollButtonText();
        return false;" style="margin-left:10px"/>
        <apex:commandButton value="Stop" id="stopBtn" onclick="setButtonText();
        return false;" style="margin-left:10px"/>
    </apex:form>

</div>
-->

<apex:includeScript value="/support/console/36.0/integration.js"/>

<!-- Here’s the unique ID of a Chatter feed from the feed’s URL. -->
<chatter:feed entityId="0F9c0000000A0Xs" rendered="true"/>

<script>
function srcUp(url) {
    sforce.console.openPrimaryTab(null, url, true);
    }

setInterval(function(){window.location.href = window.location.href;},60000);

function getFeedItemBody() {
    var feeds = [];
    var elements = document.getElementsByClassName('feeditemtext');
    for (var i=0; i<elements.length; i++) {
        if (elements[i].innerHTML) feeds.push(elements[i].innerHTML);
        }
    return feeds.join(" | ");
    }

var feedItems = getFeedItemBody();

scrollButtonText();

function scrollButtonText() {
    if (! feedItems)
    setButtonText();
    else {
    sforce.console.setCustomConsoleComponentButtonText(feedItems, function() {
        sforce.console.scrollCustomConsoleComponentButtonText(150, 5,
        true, function(result){});
        });
    }
}

function setButtonText() {
    sforce.console.setCustomConsoleComponentButtonText('Alerts');
    }
</script>

</apex:page>

 
RickerRicker
Hi Steve I am having a similar issue with <p> tags around text were you able to remove the tags if so can you please suggest how it is done 
Chris WollastonChris Wollaston
I know this is old, but I thought you might like to know that I figured this one out. Replace the lines which contain elements[i].innerHTML with elements[i].innerText and voila, no <P> tags anymore!