feature - chat appended properly on page load
This commit is contained in:
parent
bbb8e0a24c
commit
a7d8a91457
14
index.php
14
index.php
@ -48,6 +48,20 @@
|
|||||||
></sib-chat>
|
></sib-chat>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// Move the chat singleton to the right view on "page load"
|
||||||
|
window.onload = function() {
|
||||||
|
if (window.location.pathname.indexOf("-chat") !== -1) {
|
||||||
|
var chatSingleton = document.querySelector("#chat-singleton");
|
||||||
|
var pathnameParts = window.location.pathname.split("/");
|
||||||
|
var viewName = pathnameParts[pathnameParts.length - 1];
|
||||||
|
var view = document.getElementById(viewName);
|
||||||
|
|
||||||
|
view.appendChild(chatSingleton);
|
||||||
|
chatSingleton.dataset.src = view.dataset.src;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the chat singleton to the right view on "navigate"
|
||||||
window.addEventListener('navigate', event => {
|
window.addEventListener('navigate', event => {
|
||||||
var chatSingleton = document.querySelector("#chat-singleton");
|
var chatSingleton = document.querySelector("#chat-singleton");
|
||||||
var view = document.getElementById(event.detail.route);
|
var view = document.getElementById(event.detail.route);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user