The place for more technical questions for those who want to create new pagetypes or bespoke functionality.

Embedding Yammer, creating Peerfeedback in Xerte

Plus d'informations
il y a 9 ans 2 mois #4520 par JaapJan
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;">&nbsp;
</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!

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 2 mois #4521 par JohnSmith
Réponse de JohnSmith sur le sujet Embedding Yammer, creating Peerfeedback in Xerte
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
Code:
<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
Code:
<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
Les utilisateur(s) suivant ont remercié: JaapJan

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: JohnSmith
Temps de génération de la page : 0.223 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo