Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

in my application I created a Javascript(posted below) to show and hide chatter feeds in the home page which was working fine till winter release.But post Spring '13 release the chatter toggle chatter.getFeed().toggle() is not working properly.The method is calling two parameters chatter.getFeed().toggle(param1, param2)!! No idea whats param 1 and param 2....and what should i pass to fix it.Anybody got any ideas what are the parameters??

The SCRIPT:

<iframe id="wayhomeFrame" height="700" src="/apex/Unilever_Way_Home" frameborder="0" width="100%"></iframe>
<script>
var p2 = document.getElementById("wayhomeFrame").parentNode.previousSibling;
p2.parentNode.removeChild(p2);
</script> &nbsp; 
<script>
var thehideLink = document.getElementById("hideFeedLink");
var attributeStyle=thehideLink.hasAttribute("style");
if(!attributeStyle){
  var newItem=document.createElement("script");
  newItem.innerHTML = "chatter.getFeed().toggle('',true);";
  thehideLink.insertBefore(newItem,thehideLink.childNodes[0]);
}
</script>
<script>
var ScriptDiv = document.getElementById("hideFeedLink");
var style = ScriptDiv.getAttribute("style");
if(style == null){
  var sHTML = ScriptDiv.innerHTML;
  var sScript="<script DEFER>";
  sScript = sScript + "chatter.getFeed().toggle('',true); ";
  sScript = sScript + "</script" + ">";
  ScriptDiv.innerHTML = sHTML + sScript;
}
</script>
share|improve this question

1 Answer 1

It does look like the chatter.getFeed().toggle() processing has changed to use an object parameter and a boolean parameter; however, this is 100% acceptable because that JavaScript is NOT a published Salesforce API and should not be used at all.

Take a look at the first 4 lines of the Chatter.js file:

 /*
 * This code is for Internal Salesforce use only, and subject to change without notice.
 * Customers shouldn't reference this file in any web pages.
 */

If you have a Visualforce page and you need to replicate that toggle behavior you could look at something like jQuery that has a toggle function or click function. You still might have maintainability issues if your selectors rely on internal SF code, though.

Another possibility would be to look at how the internal Salesforce JavaScript implementation of toggling of the element is done, and try to copy, paste, and modify it in a way that doesn't rely on any internal SF JavaScript or APIs.

Try to avoid any solution that relies on the internal Salesforce JavaScript.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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