Fix the 'Chat' link on user profiles

develop
knotteye 3 years ago
parent 9800012ba0
commit 791b96a476
  1. 7
      site/index.js
  2. 2
      templates/user.njk

@ -171,7 +171,7 @@ function handleLoad() {
function modifyLinks() {
for (var ls = document.links, numLinks = ls.length, i=0; i<numLinks; i++){
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1 && ls[i].href.match(new RegExp(/\/[A-Za-z0-9_\-~]+\.[A-Za-z0-9]+$/)) === null) {
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1 && ls[i].href.match(new RegExp(/\/[A-Za-z0-9_\-~]+\.[A-Za-z0-9]+$/)) === null && ls[i].href.match(new RegExp(/\/chat\?room=.+$/)) === null) {
//should be a regular link
ls[i].setAttribute('onclick', 'return internalLink(\"'+ls[i].href.substring((location.protocol+'//'+location.host).length)+'\")');
}
@ -245,3 +245,8 @@ function onError(error) {
// Log the error.
console.error('Error code', error.code, 'object', error);
}
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=700,width=450,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes')
}

@ -76,7 +76,7 @@ async function updateViewers(){
</br>
<span style="float: left;font-size: large;"><a href="/live/{{ username }}/index.mpd">{{ username }}</a> | {{ title | escape }}<span id="viewercount" onload="updateViewers">[Viewers: {{viewers}}]</span>
<script>updateViewers()</script>
</b></span><span style="float: right;font-size: large;"> Links | <a href="rtmp://{{ domain }}/live/{{ username }}" onclick="window.open('rtmp://{{ domain }}/live/{{ username }}').close(); return false;" ><!--If anyone is reading this I want you to know that that horrifying hack fixes a nasty bug that drove me temporarily insane. I'm not touching it.-->Watch</a> <a href="JavaScript:newPopup('/chat?room={{ username }}');">Chat</a> <a href="/vods/{{ username }}">VODs</a></span>
</b></span><span style="float: right;font-size: large;"> Links | <a href="rtmp://{{ domain }}/live/{{ username }}" onclick="window.open('rtmp://{{ domain }}/live/{{ username }}').close(); return false;" ><!--If anyone is reading this I want you to know that that horrifying hack fixes a nasty bug that drove me temporarily insane. I'm not touching it.-->Watch</a> <a href="/chat?room={{ username }}" onclick="newPopup('/chat?room={{ username }}'); return false;">Chat</a> <a href="/vods/{{ username }}">VODs</a></span>
<div id="jscontainer">
<div id="jschild" style="width: 70%;height: 100%;position: relative;">
<image id="playbtn" src="/play.svg" alt="Play Stream" style="width:100%;height:100%;height: 100%;position: absolute;" onclick="document.getElementById('video').paused ? document.getElementById('video').play() : document.getElementById('video') .pause();"></image>