Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
The place for more technical questions for those who want to create new pagetypes or bespoke functionality.
  • Page:
  • 1

TOPIC:

Embedding Yammer, creating Peerfeedback in Xerte 7 years 6 months ago #4520

  • JaapJan
  • JaapJan's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 115
  • Thank you received: 1
Hi,

I embedded Yammer into Xerte. A nice way to let people discuss with fellow students in the Xerte modules.

I use the following code from, grabbed from a developer Yammer-site:

<div id="embedded-feed" style="height:800px;width:800px;"> 
</div>
<script type="text/javascript" src="s0.assets-yammer.com/assets/platform_embed.js">
</script>
<script type="text/javascript">
yam.connect.embedFeed({
container: "#embedded-feed",
network: "deltion.nl",
feedType: "group",
feedId: "11767134"
});
</script>

The strange thing is now that the feed is not shown at the first visit of the page. When I go to the next page and then back, I can see and use the feed. Refreshing the page with F5 at first visit couses a empty screen.

The test module is here, the Yammer feed is on the second page.
xerte.deltion.nl/play.php?template_id=222

Anyone a idea to change the script so that the feed is seen inmediately?

JaapJan
Holy cow!

Please Inloggen or Create an account to join the conversation.

Embedding Yammer, creating Peerfeedback in Xerte 7 years 6 months ago #4521

  • JohnSmith
  • JohnSmith's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 397
  • Thank you received: 71
Hi JaapJan

The problem is that the script platform_embed.js is not loading fast enough - I don't use Yammer so can't test but you need some delay between loading it and executing the next code block, something like this code to replace the last code block above
<script type="text/javascript">
var yamcheck = function () {
  if (window.yam) {
    // ORIGINAL CODE BLOCK GIVEN
    yam.connect.embedFeed({
      container: "#embedded-feed",
      network: "deltion.nl",
      feedType: "group",
      feedId: "11767134"
    });
  }
  else {
    setTimeout(yamcheck, 1000);
  }
}
yamcheck();
</script>

It just checks if yam exists (since it's used in yam.connect.embedFeed) and if so executes the code block, else it delays for 1 second and repeats... indefinitely so you could add a counter to stop after 20 seconds... something like
<script type="text/javascript">
var yamcount = 0, yamcheck = function () {
  if (window.yam) {
    // ORIGINAL CODE BLOCK GIVEN
    yam.connect.embedFeed({
      container: "#embedded-feed",
      network: "deltion.nl",
      feedType: "group",
      feedId: "11767134"
    });
  }
  else if (yamcount++ < 20) {
    setTimeout(yamcheck, 1000);
  }
}
yamcheck();
</script>

John
The following user(s) said Thank You: JaapJan

Please Inloggen or Create an account to join the conversation.

  • Page:
  • 1
Moderators: JohnSmith
Time to create page: 0.049 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search