Last active
September 16, 2019 17:22
-
-
Save hjwp/ea9f4ffc4eaf9d31c776 to your computer and use it in GitHub Desktop.
A No-UI TogetherJS integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(function() { | |
// normal application code goes here | |
// eg initialize Ace text editor | |
MyApp.do.myStuff("etc"); | |
// ... and then "reinitialize" togetherjs so that it finds all our dynamic ui stuff | |
TogetherJS.reinitialize(); | |
}); | |
</script> | |
<script type="text/javascript"> | |
// TogetherJS has a weird configuration model based on global variables | |
// which must be set before the togetherJS script gets loaded in its own script tag (!?!) | |
TogetherJSConfig_findRoom = window.location.href.replace(/[^a-zA-Z0-9]/g, ''); // "room" is unique based on URL | |
TogetherJSConfig_siteName = "My Super Site"; | |
TogetherJSConfig_dontShowClicks = true; | |
TogetherJSConfig_suppressJoinConfirmation = true; // UI still pops up if we don't hide it with CSS, but it seems to auto-accept. | |
TogetherJSConfig_suppressInvite = true; | |
TogetherJSConfig_autoStart = true; | |
TogetherJSConfig_getUserName = function () {return "{{ user.username }}";}; // not really needed since we hide all togetherjs stuff | |
</script> | |
<script src="https://togetherjs.com/togetherjs-min.js"></script> | |
<!-- then add some CSS to force-hide all togetherJS stuff --> | |
<style> | |
*.togetherjs { | |
display: none; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment