0

i have a visualforce page that source code is

<apex:page sidebar="false" showHeader="false">
   <link type="text/css" href="//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.1/themes/smoothness/jquery-ui.min.css" rel="stylesheet" />

 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
 <script src="//cdn.jsdelivr.net/xdate/0.8/xdate.min.js"></script>

<script>
 $(function() {

    var clearChatter = function(){
        $('.feedcontainer .feeditem').each(function(idx, el){
            $(el).remove();
        });

    }
    //set date value to today
    var today = new XDate(), current = today.clone();
    $( "#slider" ).slider({
      value:30,
      min: 1,
      max: 30,
      step: 1,
      stop: function( event, ui ) {

        //calculate the date, subtract months
        current = today.clone().addDays(-30+ui.value);
        $( "#date" ).html(current.clone().addDays(-1).toString('dd MMMM yyyy'));

        //clean out all old chatter posts
        clearChatter();

        //start loading new chatter
        var dayStart = new XDate(current.getFullYear(), current.getMonth(), current.getDate());
        var dayEnd = dayStart.clone().addDays(1);
        //check on feed container
        //add her if she's not there
        if($('.cxshowmorefeeditemscontainer').length == 0){
            var container = '<div class="cxshowmorefeeditemscontainer showmorefeeditemscontainer"></div>';

            $('.feedcontainer').append(container);

        }

        chatter.getFeed().showMoreFeedItems(this, {paginationToken: dayStart.toISOString()});


      },
      orientation: 'vertical'
    });
    $( "#date" ).val( "$" + $( "#slider" ).slider( "value" ) );


  });
  </script>
  <div id="date" style="position:absolute; left:720px;">Today</div>
  <div style="height:300px; position:absolute; left:700px;" id="slider"></div>
  <chatter:newsfeed ></chatter:newsfeed>
</apex:page>

as i can see

chatter.getFeed().showMoreFeedItems(this, {paginationToken: dayStart.toISOString()});

without calling apex they are getting chatter.getFeed(). is there any link or documentation on chatter for getting feed using javascript with various filters please guideline.

1

I dont think this is documented anywhere and i suspect the author of the above code has used view page source in browser and used one of the internal java-script files for this hacking. If you inspect element the chatter.js file that you get on view page source on chatter page or any page with chatter component you will see this getfeed() function.

Please dont use this as these js files looks like for internal sfdc use and sfdc may change without any notice and that may break the functionality.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.